4 types derived from StubIdentifierContext
Microsoft.Interop.SourceGeneration (4)
DefaultIdentifierContext.cs (1)
8public sealed record DefaultIdentifierContext : StubIdentifierContext
LinearCollectionElementIdentifierContext.cs (1)
9internal sealed record LinearCollectionElementIdentifierContext : StubIdentifierContext
Marshalling\GenericFriendlyPointerIdentifierContext.cs (1)
11internal sealed record GenericFriendlyPointerIdentifierContext : StubIdentifierContext
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (1)
181file sealed record OwnedValueCodeContext : StubIdentifierContext
340 references to StubIdentifierContext
Microsoft.Interop.ComInterfaceGenerator (13)
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (2)
40public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 42if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\KeepAliveThisMarshaller.cs (2)
18public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 20if (context.CurrentStage != StubIdentifierContext.Stage.NotifyForSuccessfulInvoke)
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (4)
38public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 42if (context.CurrentStage != StubIdentifierContext.Stage.NotifyForSuccessfulInvoke) 66public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 70if (context.CurrentStage != StubIdentifierContext.Stage.NotifyForSuccessfulInvoke)
Marshallers\ObjectUnwrapperResolver.cs (2)
34public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 38if (context.CurrentStage != StubIdentifierContext.Stage.Unmarshal)
Marshallers\StructAsHResultMarshallerFactory.cs (3)
32public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 38case StubIdentifierContext.Stage.Marshal: 56case StubIdentifierContext.Stage.Unmarshal:
Microsoft.Interop.JavaScript.JSImportGenerator (17)
Marshaling\BaseJSGenerator.cs (2)
37public virtual IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 40if (context.CurrentStage == StubIdentifierContext.Stage.Setup
Marshaling\FuncJSGenerator.cs (5)
16public override IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 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 (2)
17public override IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 19if (context.CurrentStage == StubIdentifierContext.Stage.Setup)
Marshaling\PrimitiveJSGenerator.cs (3)
15public override IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 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 (5)
14public override IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 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 (310)
BoundGenerators.cs (1)
205public (ParameterListSyntax ParameterList, TypeSyntax ReturnType, AttributeListSyntax? ReturnTypeAttributes) GenerateTargetMethodSignatureData(StubIdentifierContext context)
GeneratedStatements.cs (34)
29public static GeneratedStatements Create(BoundGenerators marshallers, StubIdentifierContext context) 33Setup = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Setup }), 34Marshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Marshal }), 35Pin = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Pin }).Cast<FixedStatementSyntax>().ToImmutableArray(), 36PinnedMarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.PinnedMarshal }), 38Unmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.UnmarshalCapture }) 39.AddRange(GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Unmarshal })), 40NotifyForSuccessfulInvoke = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.NotifyForSuccessfulInvoke }), 41GuaranteedUnmarshal = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.GuaranteedUnmarshal }), 42CleanupCallerAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.CleanupCallerAllocated }), 43CleanupCalleeAllocated = GenerateStatementsForStubContext(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.CleanupCalleeAllocated }), 48public static GeneratedStatements Create(BoundGenerators marshallers, StubCodeContext codeContext, StubIdentifierContext context, ExpressionSyntax expressionToInvoke) 56InvokeStatement = GenerateStatementForNativeInvoke(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Invoke }, expressionToInvoke) 63InvokeStatement = GenerateStatementForManagedInvoke(marshallers, context with { CurrentStage = StubIdentifierContext.Stage.Invoke }, expressionToInvoke) 72private static ImmutableArray<StatementSyntax> GenerateStatementsForStubContext(BoundGenerators marshallers, StubIdentifierContext context) 91private static ExpressionStatementSyntax GenerateStatementForNativeInvoke(BoundGenerators marshallers, StubIdentifierContext context, ExpressionSyntax expressionToInvoke) 93if (context.CurrentStage != StubIdentifierContext.Stage.Invoke) 125private static ExpressionStatementSyntax GenerateStatementForManagedInvoke(BoundGenerators marshallers, StubIdentifierContext context, ExpressionSyntax expressionToInvoke) 127if (context.CurrentStage != StubIdentifierContext.Stage.Invoke) 152private static ImmutableArray<CatchClauseSyntax> GenerateCatchClauseForManagedException(BoundGenerators marshallers, StubIdentifierContext context) 165managedExceptionMarshaller.Generate(context with { CurrentStage = StubIdentifierContext.Stage.Marshal })); 167managedExceptionMarshaller.Generate(context with { CurrentStage = StubIdentifierContext.Stage.PinnedMarshal })); 175private static SyntaxTriviaList GenerateStageTrivia(StubIdentifierContext.Stage stage) 179StubIdentifierContext.Stage.Setup => "Perform required setup.", 180StubIdentifierContext.Stage.Marshal => "Convert managed data to native data.", 181StubIdentifierContext.Stage.Pin => "Pin data in preparation for calling the P/Invoke.", 182StubIdentifierContext.Stage.PinnedMarshal => "Convert managed data to native data that requires the managed data to be pinned.", 183StubIdentifierContext.Stage.Invoke => "Call the P/Invoke.", 184StubIdentifierContext.Stage.UnmarshalCapture => "Capture the native data into marshaller instances in case conversion to managed data throws an exception.", 185StubIdentifierContext.Stage.Unmarshal => "Convert native data to managed data.", 186StubIdentifierContext.Stage.CleanupCallerAllocated => "Perform cleanup of caller allocated resources.", 187StubIdentifierContext.Stage.CleanupCalleeAllocated => "Perform cleanup of callee allocated resources.", 188StubIdentifierContext.Stage.NotifyForSuccessfulInvoke => "Keep alive any managed objects that need to stay alive across the call.", 189StubIdentifierContext.Stage.GuaranteedUnmarshal => "Convert native data to managed data even in the case of an exception during the non-cleanup phases.",
LinearCollectionElementIdentifierContext.cs (3)
11private readonly StubIdentifierContext _globalContext; 20/// Create a <see cref="StubIdentifierContext"/> for marshalling elements of an collection. 28StubIdentifierContext globalContext,
ManagedToNativeStubGenerator.cs (1)
66_context = new DefaultIdentifierContext(ReturnIdentifier, $"{ReturnIdentifier}{StubIdentifierContext.GeneratedNativeIdentifierSuffix}", MarshalDirection.ManagedToUnmanaged)
Marshalling\BlittableMarshaller.cs (5)
37public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 46if (context.CurrentStage == StubIdentifierContext.Stage.Pin) 69case StubIdentifierContext.Stage.Setup: 71case StubIdentifierContext.Stage.Marshal: 82case StubIdentifierContext.Stage.Unmarshal:
Marshalling\BoolMarshaller.cs (4)
50public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 56case StubIdentifierContext.Stage.Setup: 58case StubIdentifierContext.Stage.Marshal: 75case StubIdentifierContext.Stage.Unmarshal:
Marshalling\CharMarshaller.cs (5)
47public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 53if (context.CurrentStage == StubIdentifierContext.Stage.Pin) 86case StubIdentifierContext.Stage.Setup: 88case StubIdentifierContext.Stage.Marshal: 104case StubIdentifierContext.Stage.Unmarshal:
Marshalling\CustomTypeMarshallingGenerator.cs (11)
26public IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 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 (5)
30public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 36case StubIdentifierContext.Stage.Setup: 38case StubIdentifierContext.Stage.Marshal: 57case StubIdentifierContext.Stage.Unmarshal: 79case StubIdentifierContext.Stage.NotifyForSuccessfulInvoke:
Marshalling\ElementsMarshalling.cs (51)
21InvocationExpressionSyntax GetUnmanagedValuesDestination(StubIdentifierContext context); 22InvocationExpressionSyntax GetManagedValuesSource(StubIdentifierContext context); 23InvocationExpressionSyntax GetUnmanagedValuesSource(StubIdentifierContext context); 24InvocationExpressionSyntax GetManagedValuesDestination(StubIdentifierContext context); 41public StatementSyntax GenerateClearUnmanagedDestination(StubIdentifierContext context) 54public StatementSyntax GenerateClearManagedValuesDestination(StubIdentifierContext context) 62public static ExpressionSyntax GenerateNumElementsExpression(CountInfo count, bool countInfoRequiresCast, StubCodeContext codeContext, StubIdentifierContext context) 102public abstract StatementSyntax GenerateSetupStatement(StubIdentifierContext context); 103public abstract StatementSyntax GenerateUnmanagedToManagedByValueOutMarshalStatement(StubIdentifierContext context); 104public abstract StatementSyntax GenerateMarshalStatement(StubIdentifierContext context); 105public abstract StatementSyntax GenerateManagedToUnmanagedByValueOutUnmarshalStatement(StubIdentifierContext context); 107public abstract StatementSyntax GenerateUnmarshalStatement(StubIdentifierContext context); 108public abstract StatementSyntax GenerateElementCleanupStatement(StubIdentifierContext context); 113public static StatementSyntax GetNumElementsAssignmentFromManagedValuesSource(this IElementsMarshallingCollectionSource source, TypePositionInfo info, StubIdentifierContext context) 127public static StatementSyntax GetNumElementsAssignmentFromManagedValuesDestination(this IElementsMarshallingCollectionSource source, TypePositionInfo info, StubIdentifierContext context) 150public override StatementSyntax GenerateUnmanagedToManagedByValueOutMarshalStatement(StubIdentifierContext context) 174public override StatementSyntax GenerateMarshalStatement(StubIdentifierContext context) 185public override StatementSyntax GenerateManagedToUnmanagedByValueOutUnmarshalStatement(StubIdentifierContext context) 214public override StatementSyntax GenerateUnmarshalStatement(StubIdentifierContext context) 244public override StatementSyntax GenerateElementCleanupStatement(StubIdentifierContext context) => EmptyStatement(); 245public override StatementSyntax GenerateSetupStatement(StubIdentifierContext context) => EmptyStatement(); 256public override StatementSyntax GenerateMarshalStatement(StubIdentifierContext context) 290StubIdentifierContext.Stage.Marshal)); 294public override StatementSyntax GenerateUnmarshalStatement(StubIdentifierContext context) 316StubIdentifierContext.Stage.UnmarshalCapture, StubIdentifierContext.Stage.Unmarshal)); 319public override StatementSyntax GenerateManagedToUnmanagedByValueOutUnmarshalStatement(StubIdentifierContext context) 361StubIdentifierContext.Stage.UnmarshalCapture, StubIdentifierContext.Stage.Unmarshal)); 364public override StatementSyntax GenerateElementCleanupStatement(StubIdentifierContext context) 405public override StatementSyntax GenerateUnmanagedToManagedByValueOutMarshalStatement(StubIdentifierContext context) 445StubIdentifierContext.Stage[] stagesToGenerate; 450stagesToGenerate = [StubIdentifierContext.Stage.Marshal, StubIdentifierContext.Stage.PinnedMarshal]; 454stagesToGenerate = [StubIdentifierContext.Stage.Marshal, StubIdentifierContext.Stage.PinnedMarshal, StubIdentifierContext.Stage.CleanupCallerAllocated, StubIdentifierContext.Stage.CleanupCalleeAllocated]; 469StubIdentifierContext context, 472params StubIdentifierContext.Stage[] stagesToGeneratePerElement) 484CurrentStage = StubIdentifierContext.Stage.Setup, 490StubIdentifierContext identifierContext = elementSetupSubContext; 501foreach (StubIdentifierContext.Stage stage in stagesToGeneratePerElement) 503var elementIdentifierContext = identifierContext with { CurrentStage = stage }; 513elementStatements.InsertRange(0, elementMarshaller.Generate(identifierContext with { CurrentStage = StubIdentifierContext.Stage.Setup })); 536if (stagesToGeneratePerElement.Any(stage => stage is StubIdentifierContext.Stage.Marshal or StubIdentifierContext.Stage.PinnedMarshal)) 559StubIdentifierContext context, 562params StubIdentifierContext.Stage[] stagesToGeneratePerElement) 574if (UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext) && stagesToGeneratePerElement.Contains(StubIdentifierContext.Stage.Marshal)) 608public override StatementSyntax GenerateSetupStatement(StubIdentifierContext context)
Marshalling\Forwarder.cs (1)
27public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context)
Marshalling\GenericFriendlyPointerIdentifierContext.cs (2)
13private readonly StubIdentifierContext _innerContext; 17public GenericFriendlyPointerIdentifierContext(StubIdentifierContext inner, TypePositionInfo adaptedInfo, string baseIdentifier)
Marshalling\ICustomTypeMarshallingStrategy.cs (10)
20IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context); 22IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context); 24IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context); 26IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context); 28IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context); 30IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context); 32IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context); 34IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context); 36IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context); 38IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context);
Marshalling\MarshallerHelpers.cs (13)
64public static string GetMarshallerIdentifier(TypePositionInfo info, StubIdentifierContext context) 69public static string GetManagedSpanIdentifier(TypePositionInfo info, StubIdentifierContext context) 74public static string GetNativeSpanIdentifier(TypePositionInfo info, StubIdentifierContext context) 79public static string GetNumElementsIdentifier(TypePositionInfo info, StubIdentifierContext context) 84public static string GetLastIndexMarshalledIdentifier(TypePositionInfo info, StubIdentifierContext context) 94public static ExpressionSyntax GetIndexedManagedElementExpression(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 233public static StatementSyntax SkipInitOrDefaultInit(TypePositionInfo info, StubIdentifierContext context) 255public static StatementSyntax DefaultInit(TypePositionInfo info, StubIdentifierContext context) 326public static StubIdentifierContext.Stage GetCleanupStage(TypePositionInfo info, StubCodeContext context) 332return StubIdentifierContext.Stage.CleanupCallerAllocated; 336MarshalDirection.UnmanagedToManaged => StubIdentifierContext.Stage.CleanupCalleeAllocated, 337MarshalDirection.ManagedToUnmanaged => StubIdentifierContext.Stage.CleanupCallerAllocated, 338MarshalDirection.Bidirectional => StubIdentifierContext.Stage.CleanupCallerAllocated,
Marshalling\MarshallingGenerator.cs (11)
42/// The native identifier provided by <see cref="StubIdentifierContext.GetIdentifiers(TypePositionInfo)"/> should be passed by value. 47/// The address of the native identifier provided by <see cref="StubIdentifierContext.GetIdentifiers(TypePositionInfo)"/> should be passed by value. 52/// The native identifier provided by <see cref="StubIdentifierContext.GetIdentifiers(TypePositionInfo)"/> should be cast to the native type. 119/// <see cref="StubIdentifierContext.CurrentStage" /> of <paramref name="context"/>. 120/// For <see cref="StubIdentifierContext.Stage.Pin"/>, any statements not of type 123IEnumerable<StatementSyntax> Generate(StubIdentifierContext context); 132/// <see cref="StubIdentifierContext.CurrentStage" /> of <paramref name="context"/> may not be valid. 170public IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) => unbound.Generate(TypeInfo, CodeContext, context); 228/// <see cref="StubIdentifierContext.CurrentStage" /> of <paramref name="context"/>. 229/// For <see cref="StubIdentifierContext.Stage.Pin"/>, any statements not of type 232IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context);
Marshalling\MarshallingGeneratorExtensions.cs (4)
59public static ParameterSyntax AsParameter(this IBoundMarshallingGenerator generator, StubIdentifierContext context) 139public static ArgumentSyntax AsArgument(this IBoundMarshallingGenerator generator, StubIdentifierContext context) 154public static ArgumentSyntax AsManagedArgument(this IBoundMarshallingGenerator generator, StubIdentifierContext context) 165public static ExpressionSyntax GenerateNativeByRefInitialization(this IBoundMarshallingGenerator generator, StubIdentifierContext context)
Marshalling\StatefulMarshallingStrategy.cs (49)
25public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 27if (MarshallerHelpers.GetCleanupStage(info, stubContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 39public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 41if (MarshallerHelpers.GetCleanupStage(info, stubContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 53public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) 68public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 82public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) 97public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) 112public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) 126public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 148public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) 164public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) 175public static string GetMarshallerIdentifier(TypePositionInfo info, StubIdentifierContext context) 188public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 193public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 198public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 226public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) 231public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) 236public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 241public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) 246public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) 257public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 258public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 267public InvocationExpressionSyntax GetUnmanagedValuesDestination(StubIdentifierContext context) 277public InvocationExpressionSyntax GetManagedValuesSource(StubIdentifierContext context) 287public InvocationExpressionSyntax GetUnmanagedValuesSource(StubIdentifierContext context) 299public InvocationExpressionSyntax GetManagedValuesDestination(StubIdentifierContext context) 325public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 339public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 353public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 355public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 384public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 385public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinnedMarshalStatements(context); 386public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinStatements(context); 387public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 422public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) 458public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalCaptureStatements(context); 474public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 481if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 491public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 498if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 508public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 510public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateMarshalStatements(context); 512public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 513public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinnedMarshalStatements(context); 514public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinStatements(context); 515public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) => innerMarshaller.GenerateSetupStatements(context); 517public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalStatements(context); 519public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalCaptureStatements(context);
Marshalling\StatelessMarshallingStrategy.cs (60)
27public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 29public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 31public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) 51public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 98public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) 103public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) 123public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) 128public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 133public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) 138public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) 152public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) => innerMarshaller.GenerateCleanupCallerAllocatedResourcesStatements(context); 153public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) => innerMarshaller.GenerateCleanupCalleeAllocatedResourcesStatements(context); 154public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 156public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 237public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinnedMarshalStatements(context); 238public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinStatements(context); 239public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) => innerMarshaller.GenerateSetupStatements(context); 240public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalCaptureStatements(context); 241public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalStatements(context); 244public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 257public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 259if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 276public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 278if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 295public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 296public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateMarshalStatements(context); 297public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 298public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinnedMarshalStatements(context); 299public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinStatements(context); 300public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) => innerMarshaller.GenerateSetupStatements(context); 301public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalCaptureStatements(context); 302public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalStatements(context); 316public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 319if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 335public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 337if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 355public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) 385public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 415public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 416public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 417public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 418public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 436public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 438public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) 482public InvocationExpressionSyntax GetUnmanagedValuesDestination(StubIdentifierContext context) 500public InvocationExpressionSyntax GetManagedValuesSource(StubIdentifierContext context) 513public InvocationExpressionSyntax GetUnmanagedValuesSource(StubIdentifierContext context) 531public InvocationExpressionSyntax GetManagedValuesDestination(StubIdentifierContext context) 565public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 607if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated) 616public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 640if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is StubIdentifierContext.Stage.CleanupCallerAllocated) 649public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => spaceMarshallingStrategy.GenerateGuaranteedUnmarshalStatements(context); 651public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 681public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => spaceMarshallingStrategy.GenerateNotifyForSuccessfulInvokeStatements(context); 682public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => spaceMarshallingStrategy.GeneratePinnedMarshalStatements(context); 683public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => spaceMarshallingStrategy.GeneratePinStatements(context); 685public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 696public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => Array.Empty<StatementSyntax>(); 698public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context)
Marshalling\StaticPinnableManagedValueMarshaller.cs (3)
44public IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 72private IEnumerable<StatementSyntax> GeneratePinningPath(StubIdentifierContext context) 74if (context.CurrentStage == StubIdentifierContext.Stage.Pin)
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (31)
27public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) => innerMarshaller.GenerateCleanupCallerAllocatedResourcesStatements(context); 28public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) => innerMarshaller.GenerateCleanupCalleeAllocatedResourcesStatements(context); 30public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 31public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) 48public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 49public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinnedMarshalStatements(context); 51public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinStatements(context); 52public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) 73public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalCaptureStatements(context); 75public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalStatements(context); 80/// in the <see cref="StubIdentifierContext.Stage.CleanupCallerAllocated"/> stage. 92public IEnumerable<StatementSyntax> GenerateCleanupCallerAllocatedResourcesStatements(StubIdentifierContext context) 94if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCallerAllocated) 105public IEnumerable<StatementSyntax> GenerateCleanupCalleeAllocatedResourcesStatements(StubIdentifierContext context) 107if (MarshallerHelpers.GetCleanupStage(TypeInfo, CodeContext) is not StubIdentifierContext.Stage.CleanupCalleeAllocated) 118public IEnumerable<StatementSyntax> GenerateGuaranteedUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateGuaranteedUnmarshalStatements(context); 119public IEnumerable<StatementSyntax> GenerateMarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateMarshalStatements(context); 121public IEnumerable<StatementSyntax> GenerateNotifyForSuccessfulInvokeStatements(StubIdentifierContext context) => innerMarshaller.GenerateNotifyForSuccessfulInvokeStatements(context); 122public IEnumerable<StatementSyntax> GeneratePinnedMarshalStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinnedMarshalStatements(context); 124public IEnumerable<StatementSyntax> GeneratePinStatements(StubIdentifierContext context) => innerMarshaller.GeneratePinStatements(context); 125public IEnumerable<StatementSyntax> GenerateSetupStatements(StubIdentifierContext context) => innerMarshaller.GenerateSetupStatements(context); 127public IEnumerable<StatementSyntax> GenerateUnmarshalCaptureStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalCaptureStatements(context); 129public IEnumerable<StatementSyntax> GenerateUnmarshalStatements(StubIdentifierContext context) => innerMarshaller.GenerateUnmarshalStatements(context); 134/// Useful in scenarios where the value is always owned in all code-paths that reach the <see cref="StubIdentifierContext.Stage.CleanupCallerAllocated"/> stage, so additional ownership tracking is extraneous. 149public IEnumerable<StatementSyntax> Generate(StubIdentifierContext context) 151if (context.CurrentStage == StubIdentifierContext.Stage.Setup) 156if (context.CurrentStage == StubIdentifierContext.Stage.CleanupCallerAllocated) 171IEnumerable<StatementSyntax> GenerateStatementsFromInner(StubIdentifierContext contextForStage) 183private readonly StubIdentifierContext _innerContext; 185public OwnedValueCodeContext(StubIdentifierContext innerContext) 205public static StatementSyntax DeclareOriginalValueIdentifier(TypePositionInfo info, StubIdentifierContext context, ManagedTypeInfo nativeType)
UnmanagedToManagedStubGenerator.cs (2)
20private readonly StubIdentifierContext _context; 34_context = new DefaultIdentifierContext(ReturnIdentifier, $"{ReturnIdentifier}{StubIdentifierContext.GeneratedNativeIdentifierSuffix}", MarshalDirection.UnmanagedToManaged);
VariableDeclarations.cs (4)
16public static VariableDeclarations GenerateDeclarationsForManagedToUnmanaged(BoundGenerators marshallers, StubIdentifierContext context, bool initializeDeclarations) 55static void AppendVariableDeclarations(ImmutableArray<LocalDeclarationStatementSyntax>.Builder statementsToUpdate, IBoundMarshallingGenerator marshaller, StubIdentifierContext context, bool initializeToDefault) 79public static VariableDeclarations GenerateDeclarationsForUnmanagedToManaged(BoundGenerators marshallers, StubIdentifierContext context, bool initializeDeclarations) 112static void AppendVariableDeclarations(ImmutableArray<LocalDeclarationStatementSyntax>.Builder statementsToUpdate, IBoundMarshallingGenerator marshaller, StubIdentifierContext context, bool initializeToDefault)