123 references to Stage
Microsoft.Interop.ComInterfaceGenerator (7)
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (1)
42if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\KeepAliveThisMarshaller.cs (1)
20if (context.CurrentStage != StubIdentifierContext.Stage.NotifyForSuccessfulInvoke)
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (2)
43if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal) 77if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\ObjectUnwrapperResolver.cs (1)
38if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\StructAsHResultMarshallerFactory.cs (2)
38case StubIdentifierContext.Stage.Marshal: 56case StubIdentifierContext.Stage.Unmarshal:
Microsoft.Interop.JavaScript.JSImportGenerator (12)
Marshaling\BaseJSGenerator.cs (1)
40if (context.CurrentStage == StubIdentifierContext.Stage.Setup
Marshaling\FuncJSGenerator.cs (4)
30if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition) 35if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition) 40if (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition) 45if (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition)
Marshaling\ImplicitArgumentGenerator.cs (1)
19if (context.CurrentStage == StubIdentifierContext.Stage.Setup)
Marshaling\PrimitiveJSGenerator.cs (2)
26if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && marshalDirection is MarshalDirection.UnmanagedToManaged or MarshalDirection.Bidirectional) 31if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && marshalDirection is MarshalDirection.ManagedToUnmanaged or MarshalDirection.Bidirectional)
Marshaling\TaskJSGenerator.cs (4)
25if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition) 32if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition) 39if (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition) 46if (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition)
Microsoft.Interop.SourceGeneration (104)
GeneratedStatements.cs (36)
36Setup = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Setup }), 37Marshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Marshal }), 38Pin = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Pin }).Cast<FixedStatementSyntax>().ToImmutableArray(), 39PinnedMarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.PinnedMarshal }), 41ErrorUnmarshalCapture = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.UnmarshalCapture }, errorHandlingOnly: true), 42ErrorUnmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Unmarshal }, errorHandlingOnly: true), 43Unmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.UnmarshalCapture }) 44.AddRange(GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Unmarshal })), 45NotifyForSuccessfulInvoke = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.NotifyForSuccessfulInvoke }), 46GuaranteedUnmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.GuaranteedUnmarshal }), 47ErrorCleanupCalleeAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.CleanupCalleeAllocated }, errorHandlingOnly: true), 48CleanupCallerAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.CleanupCallerAllocated }), 49CleanupCalleeAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.CleanupCalleeAllocated }), 62InvokeStatement = GenerateStatementForNativeInvoke(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Invoke }, expressionToInvoke) 69InvokeStatement = GenerateStatementForManagedInvoke(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Invoke }, expressionToInvoke) 95InvokeStatement = GenerateStatementForProperty(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Invoke }, propertyAccess, isSetter) 108StubIdentifierContext.Stage.UnmarshalCapture 109or StubIdentifierContext.Stage.Unmarshal 110or StubIdentifierContext.Stage.CleanupCalleeAllocated 132if (context.CurrentStage != StubIdentifierContext.Stage.Invoke) 166if (context.CurrentStage != StubIdentifierContext.Stage.Invoke) 193if (context.CurrentStage != StubIdentifierContext.Stage.Invoke) 237managedExceptionMarshaller.Generate(context with { CurrentStage = StubIdentifierContext.Stage.Marshal })); 239managedExceptionMarshaller.Generate(context with { CurrentStage = StubIdentifierContext.Stage.PinnedMarshal })); 247private static SyntaxTriviaList GenerateStageTrivia(StubIdentifierContext.Stage stage) 251StubIdentifierContext.Stage.Setup => "Perform required setup.", 252StubIdentifierContext.Stage.Marshal => "Convert managed data to native data.", 253StubIdentifierContext.Stage.Pin => "Pin data in preparation for calling the P/Invoke.", 254StubIdentifierContext.Stage.PinnedMarshal => "Convert managed data to native data that requires the managed data to be pinned.", 255StubIdentifierContext.Stage.Invoke => "Call the P/Invoke.", 256StubIdentifierContext.Stage.UnmarshalCapture => "Capture the native data into marshaller instances in case conversion to managed data throws an exception.", 257StubIdentifierContext.Stage.Unmarshal => "Convert native data to managed data.", 258StubIdentifierContext.Stage.CleanupCallerAllocated => "Perform cleanup of caller allocated resources.", 259StubIdentifierContext.Stage.CleanupCalleeAllocated => "Perform cleanup of callee allocated resources.", 260StubIdentifierContext.Stage.NotifyForSuccessfulInvoke => "Keep alive any managed objects that need to stay alive across the call.", 261StubIdentifierContext.Stage.GuaranteedUnmarshal => "Convert native data to managed data even in the case of an exception during the non-cleanup phases.",
Marshalling\BlittableMarshaller.cs (4)
46if (context.CurrentStage == StubIdentifierContext.Stage.Pin) 69case StubIdentifierContext.Stage.Setup: 71case StubIdentifierContext.Stage.Marshal: 82case StubIdentifierContext.Stage.Unmarshal:
Marshalling\BoolMarshaller.cs (3)
56case StubIdentifierContext.Stage.Setup: 58case StubIdentifierContext.Stage.Marshal: 75case StubIdentifierContext.Stage.Unmarshal:
Marshalling\CharMarshaller.cs (4)
53if (context.CurrentStage == StubIdentifierContext.Stage.Pin) 86case StubIdentifierContext.Stage.Setup: 88case StubIdentifierContext.Stage.Marshal: 104case StubIdentifierContext.Stage.Unmarshal:
Marshalling\CustomTypeMarshallingGenerator.cs (10)
33case StubIdentifierContext.Stage.Setup: 35case StubIdentifierContext.Stage.Marshal: 42case StubIdentifierContext.Stage.Pin: 48case StubIdentifierContext.Stage.PinnedMarshal: 54case StubIdentifierContext.Stage.NotifyForSuccessfulInvoke: 60case StubIdentifierContext.Stage.UnmarshalCapture: 66case StubIdentifierContext.Stage.Unmarshal: 73case StubIdentifierContext.Stage.GuaranteedUnmarshal: 80case StubIdentifierContext.Stage.CleanupCallerAllocated: 82case StubIdentifierContext.Stage.CleanupCalleeAllocated:
Marshalling\DelegateMarshaller.cs (4)
36case StubIdentifierContext.Stage.Setup: 38case StubIdentifierContext.Stage.Marshal: 57case StubIdentifierContext.Stage.Unmarshal: 79case StubIdentifierContext.Stage.NotifyForSuccessfulInvoke:
Marshalling\ElementsMarshalling.cs (20)
289StubIdentifierContext.Stage.Marshal)); 316StubIdentifierContext.Stage.UnmarshalCapture, StubIdentifierContext.Stage.Unmarshal)); 363StubIdentifierContext.Stage.UnmarshalCapture, StubIdentifierContext.Stage.Unmarshal)); 447StubIdentifierContext.Stage[] stagesToGenerate; 452stagesToGenerate = [StubIdentifierContext.Stage.Marshal, StubIdentifierContext.Stage.PinnedMarshal]; 456stagesToGenerate = [StubIdentifierContext.Stage.Marshal, StubIdentifierContext.Stage.PinnedMarshal, StubIdentifierContext.Stage.CleanupCallerAllocated, StubIdentifierContext.Stage.CleanupCalleeAllocated]; 476params StubIdentifierContext.Stage[] stagesToGeneratePerElement) 488CurrentStage = StubIdentifierContext.Stage.Setup, 505foreach (StubIdentifierContext.Stage stage in stagesToGeneratePerElement) 517elementStatements.InsertRange(0, elementMarshaller.Generate(identifierContext with { CurrentStage = StubIdentifierContext.Stage.Setup })); 540if (stagesToGeneratePerElement.Any(stage => stage is StubIdentifierContext.Stage.Marshal or StubIdentifierContext.Stage.PinnedMarshal)) 566params StubIdentifierContext.Stage[] stagesToGeneratePerElement) 578if (UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext) && stagesToGeneratePerElement.Contains(StubIdentifierContext.Stage.Marshal))
Marshalling\IidParameterIndexMarshallerResolver.cs (1)
41if (context.CurrentStage != StubIdentifierContext.Stage.Marshal)
Marshalling\MarshallerHelpers.cs (5)
333public static StubIdentifierContext.Stage GetCleanupStage(TypePositionInfo info, StubCodeContext context) 339return StubIdentifierContext.Stage.CleanupCallerAllocated; 343MarshalDirection.UnmanagedToManaged => StubIdentifierContext.Stage.CleanupCalleeAllocated, 344MarshalDirection.ManagedToUnmanaged => StubIdentifierContext.Stage.CleanupCallerAllocated, 345MarshalDirection.Bidirectional => StubIdentifierContext.Stage.CleanupCallerAllocated,
Marshalling\StatefulMarshallingStrategy.cs (4)
27if (MarshallerHelpers.GetCleanupStage(info, stubContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 41if (MarshallerHelpers.GetCleanupStage(info, stubContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 481if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 498if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated)
Marshalling\StatelessMarshallingStrategy.cs (6)
259if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 278if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 319if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 337if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 607if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated) 640if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated)
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
74if (context.CurrentStage == StubIdentifierContext.Stage.Pin)
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (4)
94if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 107if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 151if (context.CurrentStage == StubIdentifierContext.Stage.Setup) 156if (context.CurrentStage == StubIdentifierContext.Stage.CleanupCallerAllocated)
StubIdentifierContext.cs (2)
86public Stage CurrentStage { get; init; } = Stage.Invalid;