You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basic support for stateless linear collection marshalling (dotnet#71473)
Basic stateless linear collection marshalling for blittable elements
Not handled:
- caller-allocated buffer
- guaranteed unmarshal
- pinnable reference
- non-blittable element marshalling
- element scenarios on custom marshallers
+ /// <param name="elementMarshaller">Marshaller type to use for marshalling <paramref name="managedType"/>.</param>
196
196
+ public ElementMarshallerAttribute(Type managedType, Type elementMarshaller) { }
197
197
+ }
198
-
+
198
+
+
199
199
+ /// <summary>
200
200
+ /// Specifies that a particular generic parameter is the collection element's unmanaged type.
201
201
+ /// </summary>
@@ -470,10 +470,10 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
470
470
publicstaticclassManagedToNative
471
471
{
472
472
publicstaticTNativeAllocateContainerForUnmanagedElements(TCollectionmanaged, outintnumElements); // Can throw exceptions
473
-
473
+
474
474
publicstaticReadOnlySpan<TManagedElement> GetManagedValuesSource(TCollectionmanaged); // Can throw exceptions
475
475
476
-
publicstaticSpan<TUnmanagedElement> GetUnmanagedValuesDestination(TNativenativeValue, intnumElements); // Can throw exceptions
476
+
publicstaticSpan<TUnmanagedElement> GetUnmanagedValuesDestination(TNativeunmanaged, intnumElements); // Can throw exceptions
477
477
478
478
publicstaticrefTOtherGetPinnableReference(TManagedmanaged); // Optional. Can throw exceptions. Result pinnned and passed to Invoke.
479
479
@@ -495,10 +495,10 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
495
495
publicstaticclassManagedToNative
496
496
{
497
497
publicstaticTNativeAllocateContainerForUnmanagedElements(TCollectionmanaged, Span<TOther> buffer, outintnumElements); // Can throw exceptions
498
-
498
+
499
499
publicstaticReadOnlySpan<TManagedElement> GetManagedValuesSource(TCollectionmanaged); // Can throw exceptions
500
500
501
-
publicstaticSpan<TUnmanagedElement> GetUnmanagedValuesDestination(TNativenativeValue, intnumElements); // Can throw exceptions
501
+
publicstaticSpan<TUnmanagedElement> GetUnmanagedValuesDestination(TNativeunmanaged, intnumElements); // Can throw exceptions
502
502
503
503
publicstaticrefTOtherGetPinnableReference(TManagedmanaged); // Optional. Can throw exceptions. Result pinnned and passed to Invoke.
504
504
@@ -517,11 +517,11 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
517
517
{
518
518
publicstaticclassNativeToManaged
519
519
{
520
-
publicstaticTCollectionAllocateContainerForManagedElements(intlength); // Can throw exceptions
520
+
publicstaticTCollectionAllocateContainerForManagedElements(TNativeunmanaged, intlength); // Can throw exceptions
521
521
522
522
publicstaticSpan<TManagedElement> GetManagedValuesDestination(T[] managed) =>managed; // Can throw exceptions
523
523
524
-
publicstaticReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(TNativenativeValue, intnumElements); // Can throw exceptions
524
+
publicstaticReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(TNativeunmanaged, intnumElements); // Can throw exceptions
525
525
526
526
publicstaticvoidFree(TNativenative); // Optional. Should not throw exceptions.
527
527
}
@@ -540,11 +540,11 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
540
540
{
541
541
publicstaticclassNativeToManaged
542
542
{
543
-
publicstaticTCollectionAllocateContainerForManagedElementsGuaranteed(intlength); // Should not throw exceptions other than OutOfMemoryException.
543
+
publicstaticTCollectionAllocateContainerForManagedElementsGuaranteed(TNativeunmanaged, intlength); // Should not throw exceptions other than OutOfMemoryException.
544
544
545
545
publicstaticSpan<TManagedElement> GetManagedValuesDestination(T[] managed) =>managed; // Can throw exceptions
546
546
547
-
publicstaticReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(TNativenativeValue, intnumElements); // Can throw exceptions
547
+
publicstaticReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(TNativeunmanaged, intnumElements); // Can throw exceptions
548
548
549
549
publicstaticvoidFree(TNativenative); // Optional. Should not throw exceptions.
550
550
}
@@ -584,7 +584,7 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
584
584
585
585
publicReadOnlySpan<TManagedElement> GetManagedValuesSource(); // Can throw exceptions.
586
586
587
-
publicSpan<byte> GetNativeValuesDestination(); // Can throw exceptions.
587
+
publicSpan<byte> GetUnmanagedValuesDestination(); // Can throw exceptions.
588
588
589
589
publicrefTIgnoredGetPinnableReference(); // Optional. Can throw exceptions.
590
590
@@ -615,7 +615,7 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
615
615
616
616
publicReadOnlySpan<TManagedElement> GetManagedValuesSource(); // Can throw exceptions.
617
617
618
-
publicSpan<byte> GetNativeValuesDestination(); // Can throw exceptions.
618
+
publicSpan<byte> GetUnmanagedValuesDestination(); // Can throw exceptions.
619
619
620
620
publicrefTIgnoredGetPinnableReference(); // Optional. Can throw exceptions.
621
621
@@ -642,7 +642,7 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
642
642
643
643
publicvoidFromUnmanaged(TNativevalue); // Should not throw exceptions.
644
644
645
-
publicReadOnlySpan<TUnmanagedElement> GetNativeValuesSource(intlength); // Can throw exceptions.
645
+
publicReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(intlength); // Can throw exceptions.
646
646
647
647
publicSpan<TManagedElement> GetManagedValuesDestination(intlength); // Can throw exceptions.
648
648
@@ -667,7 +667,7 @@ static class TMarshaller<T, U, V..., [ElementUnmanagedType] TUnmanagedElement> w
667
667
668
668
publicvoidFromUnmanaged(TNativevalue); // Should not throw exceptions.
669
669
670
-
publicReadOnlySpan<TUnmanagedElement> GetNativeValuesSource(intlength); // Can throw exceptions.
670
+
publicReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(intlength); // Can throw exceptions.
671
671
672
672
publicSpan<TManagedElement> GetManagedValuesDestination(intlength); // Can throw exceptions.
0 commit comments