1 write to CollectionSource
Microsoft.Interop.SourceGeneration (1)
Marshalling\ElementsMarshalling.cs (1)
32CollectionSource = collectionSource;
53 references to CollectionSource
Microsoft.Interop.SourceGeneration (53)
Marshalling\ElementsMarshalling.cs (53)
37writer.WriteLine($"{CollectionSource.GetUnmanagedValuesDestination(context)}.Clear();"); 42writer.WriteLine($"{CollectionSource.GetManagedValuesDestination(context)}.Clear();"); 104string source = CollectionSource.GetUnmanagedValuesSource(context); 106writer.WriteLine($"{CollectionSource.GetManagedValuesDestination(context)}.CopyTo({destination});"); 111string destination = CastToManagedIfNecessary(CollectionSource.GetUnmanagedValuesDestination(context)); 112writer.WriteLine($"{CollectionSource.GetManagedValuesSource(context)}.CopyTo({destination});"); 117string source = CastToManagedIfNecessary(CollectionSource.GetUnmanagedValuesDestination(context)); 118string managedSource = CollectionSource.GetManagedValuesSource(context); 125string source = CastToManagedIfNecessary(CollectionSource.GetUnmanagedValuesSource(context)); 126writer.WriteLine($"{source}.CopyTo({CollectionSource.GetManagedValuesDestination(context)});"); 155string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 156string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 160writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesSource(context)};"); 161writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesDestination(context)};"); 164if (ShouldCleanUpAllElements(CollectionSource.TypeInfo, CollectionSource.CodeContext)) 175string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 176string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 180writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesSource(context)};"); 181writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesDestination(context)};"); 190string numElementsIdentifier = MarshallerHelpers.GetNumElementsIdentifier(CollectionSource.TypeInfo, context); 191string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 192string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 196CollectionSource.GenerateNumElementsAssignmentFromManagedValuesSource(writer, CollectionSource.TypeInfo, context); 197writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {MemoryMarshalType}.CreateSpan(ref {UnsafeType}.AsRef(in {CollectionSource.GetManagedValuesSource(context)}.GetPinnableReference()), {numElementsIdentifier});"); 198writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesDestination(context)};"); 206string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 207bool usesLastIndexMarshalled = UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext); 209? MarshallerHelpers.GetLastIndexMarshalledIdentifier(CollectionSource.TypeInfo, context) 225string source = MarshallerHelpers.GetMarshalDirection(CollectionSource.TypeInfo, CollectionSource.CodeContext) == MarshalDirection.ManagedToUnmanaged 226? CollectionSource.GetUnmanagedValuesDestination(context) 227: CollectionSource.GetUnmanagedValuesSource(context); 236string numElementsIdentifier = MarshallerHelpers.GetNumElementsIdentifier(CollectionSource.TypeInfo, context); 237string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 238string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 242if (CollectionSource.CodeContext.Direction is MarshalDirection.UnmanagedToManaged && CollectionSource.TypeInfo.ByValueContentsMarshalKind is ByValueContentsMarshalKind.Out) 253CollectionSource.GenerateNumElementsAssignmentFromManagedValuesDestination(writer, CollectionSource.TypeInfo, context); 254writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {MemoryMarshalType}.CreateSpan(ref {UnsafeType}.AsRef(in {CollectionSource.GetUnmanagedValuesSource(context)}.GetPinnableReference()), {numElementsIdentifier});"); 255writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesDestination(context)};"); 268string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 269string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 270StubCodeContext elementCodeContext = StubCodeContext.CreateElementMarshallingContext(CollectionSource.CodeContext); 335if (UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext) 338incrementors += $", ++{MarshallerHelpers.GetLastIndexMarshalledIdentifier(CollectionSource.TypeInfo, context)}"; 362if (UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext)) 364writer.WriteLine($"int {MarshallerHelpers.GetLastIndexMarshalledIdentifier(CollectionSource.TypeInfo, context)} = 0;");