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