121 references to Stage
Microsoft.Interop.ComInterfaceGenerator (7)
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (1)
36if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\KeepAliveThisMarshaller.cs (1)
13if (context.CurrentStage != StubIdentifierContext.Stage.NotifyForSuccessfulInvoke)
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (2)
37if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal) 62if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\ObjectUnwrapperResolver.cs (1)
33if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\StructAsHResultMarshallerFactory.cs (2)
33case StubIdentifierContext.Stage.Marshal: 39case StubIdentifierContext.Stage.Unmarshal:
Microsoft.Interop.JavaScript.JSImportGenerator (12)
Marshaling\BaseJSGenerator.cs (1)
33if (context.CurrentStage == StubIdentifierContext.Stage.Setup
Marshaling\FuncJSGenerator.cs (4)
18&& ((context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged) 19|| (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged))) 25&& ((context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged) 26|| (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged)))
Marshaling\ImplicitArgumentGenerator.cs (1)
10if (context.CurrentStage == StubIdentifierContext.Stage.Setup)
Marshaling\PrimitiveJSGenerator.cs (2)
19if (context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && marshalDirection is MarshalDirection.UnmanagedToManaged or MarshalDirection.Bidirectional) 24if (context.CurrentStage == StubIdentifierContext.Stage.Marshal && marshalDirection is MarshalDirection.ManagedToUnmanaged or MarshalDirection.Bidirectional)
Marshaling\TaskJSGenerator.cs (4)
17&& ((context.CurrentStage == StubIdentifierContext.Stage.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged) 18|| (context.CurrentStage == StubIdentifierContext.Stage.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged))) 24&& ((context.CurrentStage == StubIdentifierContext.Stage.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged) 25|| (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged)))
Microsoft.Interop.SourceGeneration (102)
GeneratedStatements.cs (33)
33Setup = GenerateStage(StubIdentifierContext.Stage.Setup), 34Marshal = GenerateStage(StubIdentifierContext.Stage.Marshal), 35Pin = GenerateStage(StubIdentifierContext.Stage.Pin), 36PinnedMarshal = GenerateStage(StubIdentifierContext.Stage.PinnedMarshal), 38ErrorUnmarshalCapture = GenerateStage(StubIdentifierContext.Stage.UnmarshalCapture, errorHandlingOnly: true), 39ErrorUnmarshal = GenerateStage(StubIdentifierContext.Stage.Unmarshal, errorHandlingOnly: true), 40Unmarshal = GenerateStage(StubIdentifierContext.Stage.UnmarshalCapture) + GenerateStage(StubIdentifierContext.Stage.Unmarshal), 41NotifyForSuccessfulInvoke = GenerateStage(StubIdentifierContext.Stage.NotifyForSuccessfulInvoke), 42GuaranteedUnmarshal = GenerateStage(StubIdentifierContext.Stage.GuaranteedUnmarshal), 43ErrorCleanupCalleeAllocated = GenerateStage(StubIdentifierContext.Stage.CleanupCalleeAllocated, errorHandlingOnly: true), 44CleanupCallerAllocated = GenerateStage(StubIdentifierContext.Stage.CleanupCallerAllocated), 45CleanupCalleeAllocated = GenerateStage(StubIdentifierContext.Stage.CleanupCalleeAllocated), 49string GenerateStage(StubIdentifierContext.Stage stage, bool errorHandlingOnly = false) 55if (stage is StubIdentifierContext.Stage.UnmarshalCapture 56or StubIdentifierContext.Stage.Unmarshal 57or StubIdentifierContext.Stage.CleanupCalleeAllocated 73StubIdentifierContext invokeContext = context with { CurrentStage = StubIdentifierContext.Stage.Invoke }; 92StubIdentifierContext invokeContext = context with { CurrentStage = StubIdentifierContext.Stage.Invoke }; 148marshaller.Generate(writer, context with { CurrentStage = StubIdentifierContext.Stage.Marshal }); 149marshaller.Generate(writer, context with { CurrentStage = StubIdentifierContext.Stage.PinnedMarshal }); 154private static string GetStageDescription(StubIdentifierContext.Stage stage) 158StubIdentifierContext.Stage.Setup => "Perform required setup.", 159StubIdentifierContext.Stage.Marshal => "Convert managed data to native data.", 160StubIdentifierContext.Stage.Pin => "Pin data in preparation for calling the P/Invoke.", 161StubIdentifierContext.Stage.PinnedMarshal => "Convert managed data to native data that requires the managed data to be pinned.", 162StubIdentifierContext.Stage.Invoke => "Call the P/Invoke.", 163StubIdentifierContext.Stage.UnmarshalCapture => "Capture the native data into marshaller instances in case conversion to managed data throws an exception.", 164StubIdentifierContext.Stage.Unmarshal => "Convert native data to managed data.", 165StubIdentifierContext.Stage.CleanupCallerAllocated => "Perform cleanup of caller allocated resources.", 166StubIdentifierContext.Stage.CleanupCalleeAllocated => "Perform cleanup of callee allocated resources.", 167StubIdentifierContext.Stage.NotifyForSuccessfulInvoke => "Keep alive any managed objects that need to stay alive across the call.", 168StubIdentifierContext.Stage.GuaranteedUnmarshal => "Convert native data to managed data even in the case of an exception during the non-cleanup phases.",
Marshalling\BlittableMarshaller.cs (4)
40if (context.CurrentStage == StubIdentifierContext.Stage.Pin) 51case StubIdentifierContext.Stage.Setup: 53case StubIdentifierContext.Stage.Marshal: 60case StubIdentifierContext.Stage.Unmarshal:
Marshalling\BoolMarshaller.cs (3)
51case StubIdentifierContext.Stage.Setup: 53case StubIdentifierContext.Stage.Marshal: 61case StubIdentifierContext.Stage.Unmarshal:
Marshalling\CharMarshaller.cs (5)
48if (context.CurrentStage == StubIdentifierContext.Stage.Pin) 52else if (context.CurrentStage == StubIdentifierContext.Stage.PinnedMarshal) 65case StubIdentifierContext.Stage.Setup: 67case StubIdentifierContext.Stage.Marshal: 79case StubIdentifierContext.Stage.Unmarshal:
Marshalling\CustomTypeMarshallingGenerator.cs (10)
29case StubIdentifierContext.Stage.Setup: 32case StubIdentifierContext.Stage.Marshal: 39case StubIdentifierContext.Stage.Pin: 45case StubIdentifierContext.Stage.PinnedMarshal: 51case StubIdentifierContext.Stage.NotifyForSuccessfulInvoke: 57case StubIdentifierContext.Stage.UnmarshalCapture: 63case StubIdentifierContext.Stage.Unmarshal: 70case StubIdentifierContext.Stage.GuaranteedUnmarshal: 77case StubIdentifierContext.Stage.CleanupCallerAllocated: 80case StubIdentifierContext.Stage.CleanupCalleeAllocated:
Marshalling\DelegateMarshaller.cs (4)
29case StubIdentifierContext.Stage.Setup: 31case StubIdentifierContext.Stage.Marshal: 38case StubIdentifierContext.Stage.Unmarshal: 45case StubIdentifierContext.Stage.NotifyForSuccessfulInvoke:
Marshalling\ElementsMarshalling.cs (20)
168GenerateContentsMarshallingStatement(writer, context, $"{managedSpanIdentifier}.Length", elementMarshaller, StubIdentifierContext.Stage.Marshal); 182StubIdentifierContext.Stage.UnmarshalCapture, StubIdentifierContext.Stage.Unmarshal); 199StubIdentifierContext.Stage.UnmarshalCapture, StubIdentifierContext.Stage.Unmarshal); 239StubIdentifierContext.Stage[] stagesToGenerate; 243stagesToGenerate = [StubIdentifierContext.Stage.Marshal, StubIdentifierContext.Stage.PinnedMarshal]; 247stagesToGenerate = [StubIdentifierContext.Stage.Marshal, StubIdentifierContext.Stage.PinnedMarshal, StubIdentifierContext.Stage.CleanupCallerAllocated, StubIdentifierContext.Stage.CleanupCalleeAllocated]; 265params StubIdentifierContext.Stage[] stagesToGeneratePerElement) 277CurrentStage = StubIdentifierContext.Stage.Setup, 292foreach (StubIdentifierContext.Stage stage in stagesToGeneratePerElement) 309elementMarshaller.Generate(writer, identifierContext with { CurrentStage = StubIdentifierContext.Stage.Setup }); 313&& stagesToGeneratePerElement.Any(stage => stage is StubIdentifierContext.Stage.Marshal or StubIdentifierContext.Stage.PinnedMarshal)) 324params StubIdentifierContext.Stage[] stagesToGeneratePerElement) 335&& stagesToGeneratePerElement.Contains(StubIdentifierContext.Stage.Marshal))
Marshalling\IidParameterIndexMarshallerResolver.cs (1)
35if (context.CurrentStage != StubIdentifierContext.Stage.Marshal)
Marshalling\MarshallerHelpers.cs (5)
312public static StubIdentifierContext.Stage GetCleanupStage(TypePositionInfo info, StubCodeContext context) 318return StubIdentifierContext.Stage.CleanupCallerAllocated; 322MarshalDirection.UnmanagedToManaged => StubIdentifierContext.Stage.CleanupCalleeAllocated, 323MarshalDirection.ManagedToUnmanaged => StubIdentifierContext.Stage.CleanupCallerAllocated, 324MarshalDirection.Bidirectional => StubIdentifierContext.Stage.CleanupCallerAllocated,
Marshalling\StatefulMarshallingStrategy.cs (4)
17if (MarshallerHelpers.GetCleanupStage(info, stubContext) is StubIdentifierContext.Stage.CleanupCallerAllocated 26if (MarshallerHelpers.GetCleanupStage(info, stubContext) is StubIdentifierContext.Stage.CleanupCalleeAllocated 289if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated) 298if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCalleeAllocated)
Marshalling\StatelessMarshallingStrategy.cs (6)
139if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 150if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 181if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated 191if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCalleeAllocated 346if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated) 371if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated)
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
66if (context.CurrentStage == StubIdentifierContext.Stage.Pin)
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (4)
55if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 69if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 105if (context.CurrentStage == StubIdentifierContext.Stage.Setup) 112inner.Generate(writer, context.CurrentStage == StubIdentifierContext.Stage.CleanupCallerAllocated
StubIdentifierContext.cs (2)
86public Stage CurrentStage { get; init; } = Stage.Invalid;