84 references to Stage
Microsoft.Interop.ComInterfaceGenerator (7)
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (1)
42
if (context.CurrentStage != StubIdentifierContext.
Stage
.Unmarshal)
Marshallers\KeepAliveThisMarshaller.cs (1)
20
if (context.CurrentStage != StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke)
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (2)
42
if (context.CurrentStage != StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke)
70
if (context.CurrentStage != StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke)
Marshallers\ObjectUnwrapperResolver.cs (1)
38
if (context.CurrentStage != StubIdentifierContext.
Stage
.Unmarshal)
Marshallers\StructAsHResultMarshallerFactory.cs (2)
38
case StubIdentifierContext.
Stage
.Marshal:
56
case StubIdentifierContext.
Stage
.Unmarshal:
Microsoft.Interop.JavaScript.JSImportGenerator (13)
Marshaling\BaseJSGenerator.cs (1)
48
if (context.CurrentStage == StubIdentifierContext.
Stage
.Setup)
Marshaling\FuncJSGenerator.cs (4)
48
if (context.CurrentStage == StubIdentifierContext.
Stage
.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition)
53
if (context.CurrentStage == StubIdentifierContext.
Stage
.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition)
63
if (context.CurrentStage == StubIdentifierContext.
Stage
.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition)
68
if (context.CurrentStage == StubIdentifierContext.
Stage
.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition)
Marshaling\PrimitiveJSGenerator.cs (4)
36
if (context.CurrentStage == StubIdentifierContext.
Stage
.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition)
41
if (context.CurrentStage == StubIdentifierContext.
Stage
.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition)
51
if (context.CurrentStage == StubIdentifierContext.
Stage
.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition)
56
if (context.CurrentStage == StubIdentifierContext.
Stage
.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition)
Marshaling\TaskJSGenerator.cs (4)
49
if (context.CurrentStage == StubIdentifierContext.
Stage
.UnmarshalCapture && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && TypeInfo.IsManagedReturnPosition)
56
if (context.CurrentStage == StubIdentifierContext.
Stage
.Marshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && TypeInfo.IsManagedReturnPosition)
68
if (context.CurrentStage == StubIdentifierContext.
Stage
.PinnedMarshal && CodeContext.Direction == MarshalDirection.ManagedToUnmanaged && !TypeInfo.IsManagedReturnPosition)
75
if (context.CurrentStage == StubIdentifierContext.
Stage
.Unmarshal && CodeContext.Direction == MarshalDirection.UnmanagedToManaged && !TypeInfo.IsManagedReturnPosition)
Microsoft.Interop.SourceGeneration (64)
GeneratedStatements.cs (28)
33
Setup = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.Setup }),
34
Marshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.Marshal }),
35
Pin = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.Pin }).Cast<FixedStatementSyntax>().ToImmutableArray(),
36
PinnedMarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.PinnedMarshal }),
38
Unmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.UnmarshalCapture })
39
.AddRange(GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.Unmarshal })),
40
NotifyForSuccessfulInvoke = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke }),
41
GuaranteedUnmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.GuaranteedUnmarshal }),
42
CleanupCallerAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.CleanupCallerAllocated }),
43
CleanupCalleeAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.CleanupCalleeAllocated }),
56
InvokeStatement = GenerateStatementForNativeInvoke(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.Invoke }, expressionToInvoke)
63
InvokeStatement = GenerateStatementForManagedInvoke(marshallers, context with { CurrentStage = StubIdentifierContext.
Stage
.Invoke }, expressionToInvoke)
93
if (context.CurrentStage != StubIdentifierContext.
Stage
.Invoke)
127
if (context.CurrentStage != StubIdentifierContext.
Stage
.Invoke)
165
managedExceptionMarshaller.Generate(context with { CurrentStage = StubIdentifierContext.
Stage
.Marshal }));
167
managedExceptionMarshaller.Generate(context with { CurrentStage = StubIdentifierContext.
Stage
.PinnedMarshal }));
175
private static SyntaxTriviaList GenerateStageTrivia(StubIdentifierContext.
Stage
stage)
179
StubIdentifierContext.
Stage
.Setup => "Perform required setup.",
180
StubIdentifierContext.
Stage
.Marshal => "Convert managed data to native data.",
181
StubIdentifierContext.
Stage
.Pin => "Pin data in preparation for calling the P/Invoke.",
182
StubIdentifierContext.
Stage
.PinnedMarshal => "Convert managed data to native data that requires the managed data to be pinned.",
183
StubIdentifierContext.
Stage
.Invoke => "Call the P/Invoke.",
184
StubIdentifierContext.
Stage
.UnmarshalCapture => "Capture the native data into marshaller instances in case conversion to managed data throws an exception.",
185
StubIdentifierContext.
Stage
.Unmarshal => "Convert native data to managed data.",
186
StubIdentifierContext.
Stage
.CleanupCallerAllocated => "Perform cleanup of caller allocated resources.",
187
StubIdentifierContext.
Stage
.CleanupCalleeAllocated => "Perform cleanup of callee allocated resources.",
188
StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke => "Keep alive any managed objects that need to stay alive across the call.",
189
StubIdentifierContext.
Stage
.GuaranteedUnmarshal => "Convert native data to managed data even in the case of an exception during the non-cleanup phases.",
Marshalling\BlittableMarshaller.cs (4)
46
if (context.CurrentStage == StubIdentifierContext.
Stage
.Pin)
69
case StubIdentifierContext.
Stage
.Setup:
71
case StubIdentifierContext.
Stage
.Marshal:
82
case StubIdentifierContext.
Stage
.Unmarshal:
Marshalling\BoolMarshaller.cs (3)
56
case StubIdentifierContext.
Stage
.Setup:
58
case StubIdentifierContext.
Stage
.Marshal:
75
case StubIdentifierContext.
Stage
.Unmarshal:
Marshalling\CharMarshaller.cs (4)
53
if (context.CurrentStage == StubIdentifierContext.
Stage
.Pin)
86
case StubIdentifierContext.
Stage
.Setup:
88
case StubIdentifierContext.
Stage
.Marshal:
104
case StubIdentifierContext.
Stage
.Unmarshal:
Marshalling\CustomTypeMarshallingGenerator.cs (10)
33
case StubIdentifierContext.
Stage
.Setup:
35
case StubIdentifierContext.
Stage
.Marshal:
42
case StubIdentifierContext.
Stage
.Pin:
48
case StubIdentifierContext.
Stage
.PinnedMarshal:
54
case StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke:
60
case StubIdentifierContext.
Stage
.UnmarshalCapture:
66
case StubIdentifierContext.
Stage
.Unmarshal:
73
case StubIdentifierContext.
Stage
.GuaranteedUnmarshal:
80
case StubIdentifierContext.
Stage
.CleanupCallerAllocated:
82
case StubIdentifierContext.
Stage
.CleanupCalleeAllocated:
Marshalling\DelegateMarshaller.cs (4)
36
case StubIdentifierContext.
Stage
.Setup:
38
case StubIdentifierContext.
Stage
.Marshal:
57
case StubIdentifierContext.
Stage
.Unmarshal:
79
case StubIdentifierContext.
Stage
.NotifyForSuccessfulInvoke:
Marshalling\MarshallerHelpers.cs (5)
353
public static StubIdentifierContext.
Stage
GetCleanupStage(TypePositionInfo info, StubCodeContext context)
359
return StubIdentifierContext.
Stage
.CleanupCallerAllocated;
363
MarshalDirection.UnmanagedToManaged => StubIdentifierContext.
Stage
.CleanupCalleeAllocated,
364
MarshalDirection.ManagedToUnmanaged => StubIdentifierContext.
Stage
.CleanupCallerAllocated,
365
MarshalDirection.Bidirectional => StubIdentifierContext.
Stage
.CleanupCallerAllocated,
Marshalling\MarshallingGenerator.cs (1)
120
/// For <see cref="StubIdentifierContext.
Stage
.Pin"/>, any statements not of type
Marshalling\StatefulMarshallingStrategy.cs (2)
27
if (MarshallerHelpers.GetCleanupStage(info, stubContext) is not StubIdentifierContext.
Stage
.CleanupCallerAllocated)
41
if (MarshallerHelpers.GetCleanupStage(info, stubContext) is not StubIdentifierContext.
Stage
.CleanupCalleeAllocated)
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
74
if (context.CurrentStage == StubIdentifierContext.
Stage
.Pin)
StubIdentifierContext.cs (2)
86
public
Stage
CurrentStage { get; init; } =
Stage
.Invalid;