Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ public static void TestUnmanagedCallersOnlyWithGeneric()

Assert.Equal(0, ((delegate* unmanaged<MaybeBlittable<nint>, int>)&MaybeBlittableGenericStruct)(new MaybeBlittable<nint>()));

Assert.Throws<InvalidProgramException> (() => ((delegate* unmanaged<NotBlittable<int>, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)(new NotBlittable<int>()));
Assert.Throws<MarshalDirectiveException> (() => ((delegate* unmanaged<NotBlittable<int>, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)(new NotBlittable<int>()));
Comment thread
jtschuster marked this conversation as resolved.
Outdated

Assert.Throws<InvalidProgramException> (() => ((delegate* unmanaged<MaybeBlittable<object>, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)(new MaybeBlittable<object>()));
Assert.Throws<MarshalDirectiveException> (() => ((delegate* unmanaged<MaybeBlittable<object>, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)(new MaybeBlittable<object>()));
}

internal struct Blittable<T> where T : unmanaged
Expand Down