-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Regression] Invalid program when marhsalling delegate with both value type return and parameter #45637
Comments
This doesn't crash on .NET 5, but does exhibit some unusual behavior. Once we fully root cause this we can make a servicing decision. |
Actually this is fine in .NET 5 - GA. In our main branch there is an issue due to some refactoring, but will be fixed by @jkoritzinsky's PR #46238. I have been able to reproduce this locally on .NET Core 3.1 and I think (thanks @jkoritzinsky for helping root cause) this may be fixed by #35026. I will verify this locally. |
Thanks @jkoritzinsky for the stellar memory! This was found and fixed in .NET 5, but never back ported. |
@ceztko Thank you for reporting this. Given this is for 3.1 we need a strong customer case. Are you completely blocked by this issue? Is it possible to upgrade to and run on .NET 5.0? |
Thank you very much for taking care of this issue! Fortunately for me, I have no imminent use case. I stumbled in this issue in a big testing advanced interop strategies for strings and thought it was important to report. Feel free to stand by with the back port until an user with relevant use case replies here (if ever). |
@ceztko Thanks for the reply. Since this isn't blocking anyone at the moment I will close this issue. The issue will be searchable and since we now know the fix will be easy to apply if it becomes a blocking high priority concern. |
Description
I'm receiving an
System.InvalidProgramException
with message "Common Language Runtime detected an invalid program" when trying to marshal anUnmanagedFunctionPointer
delegate that has both return and parameters that are value types. This happens only on x86 build with .NET core runtime. It works with x64 build or using .NET Framework runtime.The minimal program to reproduce is with the following on the C# side:
and this on C++ side:
The program is also attached with a full standalone solution. Running it with x86 platform ( (Debug or Release is the same) fails with "TestDelegateValueTypeReturnInteropCore" and and works "TestDelegateValueTypeReturnInteropNet452" projects. On x64 platform the program works on both runtimes.
TestDelegateValueTypeReturnInterop.zip
Configuration
Regression?
The problem is a regression, the same program works on .NET Framework both on x86 and x64. Testing with 4.8 (release 528372).
The text was updated successfully, but these errors were encountered: