Skip to content

GetFunctionPointerForDelegateTests tests fail with Specified cast is not valid on Browser #39187

@mdh1418

Description

@mdh1418

When running System.Runtime.InteropServices library tests on Browser wasm, two functions fail with Specified cast is not valid:

  • GetFunctionPointerForDelegate_MarshalledDelegateNonGeneric_ReturnsExpected
  • GetFunctionPointerForDelegate_MarshalledDelegateGeneric_ReturnsExpected

Note

When the tests are not ordered, the suite sometimes fails with the two tests above

[FAIL] System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests.GetFunctionPointerForDelegate_MarshalledDelegateNonGeneric_ReturnsExpected
System.InvalidCastException : Specified cast is not valid.
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[FAIL] System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests.GetFunctionPointerForDelegate_MarshalledDelegateGeneric_ReturnsExpected
System.InvalidCastException : Specified cast is not valid.
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

And other times, it fails with the six tests from GetDelegateForFunctionPointerTests.cs

[FAIL] System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests.GetDelegateForFunctionPointer_NonGeneric_ReturnsExpected(t: typeof(System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+NonGenericDelegate))
Assert.IsType() Failure
Expected: System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+NonGenericDelegate
Actual: System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests+NonGenericDelegate
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[FAIL] System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests.GetDelegateForFunctionPointer_NonGeneric_ReturnsExpected(t: typeof(System.MulticastDelegate))
Assert.IsType() Failure
Expected: System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+NonGenericDelegate
Actual: System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests+NonGenericDelegate
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[FAIL] System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests.GetDelegateForFunctionPointer_NonGeneric_ReturnsExpected(t: typeof(System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+OtherNonGenericDelegate))
Assert.IsType() Failure
Expected: System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+NonGenericDelegate
Actual: System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests+NonGenericDelegate
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[FAIL] System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests.GetDelegateForFunctionPointer_GenericInvalidType_ReturnsExpected
Assert.IsType() Failure
Expected: System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+NonGenericDelegate
Actual: System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests+NonGenericDelegate
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[FAIL] System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests.GetDelegateForFunctionPointer_CollectibleType_ReturnsExpected
Assert.IsType() Failure
Expected: System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests+NonGenericDelegate
Actual: System.Runtime.InteropServices.Tests.GetFunctionPointerForDelegateTests+NonGenericDelegate
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[FAIL] System.Runtime.InteropServices.Tests.GetDelegateForFunctionPointerTests.GetDelegateForFunctionPointer_Generic_ReturnsExpected
System.InvalidCastException : Specified cast is not valid.
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions