-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Keep blittable layout class In/Out by default #50655
Conversation
src/coreclr/vm/mlinfo.cpp
Outdated
// If neither IN nor OUT are true, this signals the URT to use the default | ||
// rules. | ||
if (!m_in && !m_out) | ||
if (alwaysInOut) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should only be for non-byref cases.
Bah, it looks like we have a bug and test gap with handling Before this and #50137, passing null to this p/invoke worked: [StructLayout(LayoutKind.Sequential)]
internal class TestClass
{
public int i;
}
[DllImport("NativeLib", CallingConvention = CallingConvention.Cdecl)]
public static extern void update_test_class([In][Out] TestClass c); Now, it fails with a null ref exception trying to call |
…ly marshalling the type if it doesn't match the static type in the signature. (#50138) * When marshalling a layout class, fall-back to dynamically marshalling the type if it doesn't match the static type in the signature. * Allocate the correct amount of space for the native data based on the runtime type. * Apply suggestions from code review * Keep blittable layout class In/Out by default (#50655) * Do the exact type check after the null check. Co-authored-by: Elinor Fung <[email protected]>
cc @jkoritzinsky @AaronRobinsonMSFT
Fixes #50410