Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid interop compatibility #168

Open
MichalStrehovsky opened this issue Oct 9, 2020 · 4 comments
Open

Invalid interop compatibility #168

MichalStrehovsky opened this issue Oct 9, 2020 · 4 comments
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation bug Something isn't working

Comments

@MichalStrehovsky
Copy link
Member

MichalStrehovsky commented Oct 9, 2020

Interop/PInvoke/Array/MarshalArrayAsField/AsLPArray/AsLPArrayTest

Test FAIL: TestLibrary.AssertTestException: Assert.Fail: Expected 'System.TypeLoadException' to be thrown, however 'System.Exception' was thrown. TakeIntArraySeqStructByVal
   at TestLibrary.Assert.HandleFail(String, String) + 0x5a
   at TestLibrary.Assert.Fail(String, Object[]) + 0x64
   at TestLibrary.Assert.Throws[T](Action, String, AssertThrowsOptions) + 0x1e1
   at Test.RunTest1(String) + 0xd4
   at Test.Main(String[]) + 0x29

Interop/PInvoke/Miscellaneous/HandleRef/HandleRefTest

InvalidMarshalPointer_Return
Test Failure: TestLibrary.AssertTestException: Assert.Fail: Expected 'System.Runtime.InteropServices.MarshalDirectiveException' to be thrown, however 'System.Exception' was thrown.
   at TestLibrary.Assert.HandleFail(String, String) + 0x5a
   at TestLibrary.Assert.Fail(String, Object[]) + 0x64
   at TestLibrary.Assert.Throws[T](Action, String, AssertThrowsOptions) + 0x1e1
   at HandleRefTest.Main(String[]) + 0x4e4
@MichalStrehovsky MichalStrehovsky added bug Something isn't working area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation labels Oct 9, 2020
@kant2002
Copy link
Contributor

kant2002 commented May 6, 2021

What should be done here for HandleRef support? Usual stuff for Marshallers? Or any caveats?

@MichalStrehovsky
Copy link
Member Author

Yeah, I think HandleRef is the usual stuff. I think we already support it. Maybe not fully?

This issue specifically tracks that if the HandleRef is invalid, we don't throw a descriptive exception. ("Expected 'System.Runtime.InteropServices.MarshalDirectiveException' to be thrown, however 'System.Exception' was thrown.").

@MichalStrehovsky
Copy link
Member Author

(I think the issue you're seeing with CreateStdAccessibleObject is caused by the object parameter. We don't have handling for other NativeType than AsAny - we need this to take the COM marshaller. Hopefully a single-line fix:

https://github.com/dotnet/runtime/blob/01b7e73cd378145264a7cb7a09365b41ed42b240/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs#L556-L559

@kant2002
Copy link
Contributor

kant2002 commented May 6, 2021

Thanks for clarification. If one liner fix issues thats would be quite good.

kant2002 added a commit to kant2002/runtimelab that referenced this issue May 9, 2021
kant2002 added a commit to kant2002/runtimelab that referenced this issue May 20, 2021
kant2002 added a commit to kant2002/runtimelab that referenced this issue May 25, 2021
kant2002 added a commit to kant2002/runtimelab that referenced this issue May 25, 2021
jkotas pushed a commit that referenced this issue May 26, 2021
kant2002 added a commit to kant2002/runtime that referenced this issue Jan 26, 2022
This is marshaller used when there incorrect configuration of marshaller applied to fields mostly

Closes dotnet/runtimelab#168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants