Support stateful linear collection marshalling (#71788)
authorElinor Fung <elfung@microsoft.com>
Fri, 8 Jul 2022 03:06:11 +0000 (20:06 -0700)
committerGitHub <noreply@github.com>
Fri, 8 Jul 2022 03:06:11 +0000 (20:06 -0700)
commit05473449c1db9edbbbc565b39d73a59bf517de96
tree7ac6cf944b6d76d43a97f8475f721836ba0cd077
parent6ebcb3d67279554e1262b0b0abea16bd18c469af
Support stateful linear collection marshalling (#71788)

- Find shape data for stateful collection marshallers
- Add marshalling strategy implementations for stateful collection marshalling of blittable elements and non-blittable elements
- Refactor non-blittable element handling into a base class for shared functionality between stateless and stateful
  - Probably can share more for blittable element handling too, but I'll plan to do that in a follow-up after getting general support in.
- Tests for stateful marshallers for `List<T>` and arrays
13 files changed:
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/ManualTypeMarshallingHelper.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallerShape.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/AttributedMarshallingModelGeneratorFactory.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/MarshallerHelpers.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/NonBlittableElementsMarshalling.cs [new file with mode: 0644]
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/StatefulMarshallingStrategy.cs
src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/Marshalling/StatelessMarshallingStrategy.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/ArrayTests.Custom.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CollectionTests.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/SpanTests.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/CodeSnippets.cs
src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/Compiles.cs
src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/NonBlittable.cs