Keep blittable layout class In/Out by default#50655
Merged
elinor-fung merged 2 commits intodotnet:mainfrom Apr 2, 2021
Merged
Conversation
jkoritzinsky
reviewed
Apr 2, 2021
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) |
Member
There was a problem hiding this comment.
I think this should only be for non-byref cases.
jkoritzinsky
approved these changes
Apr 2, 2021
AaronRobinsonMSFT
approved these changes
Apr 2, 2021
Member
Author
|
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 |
Anipik
pushed a commit
that referenced
this pull request
Apr 6, 2021
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc @jkoritzinsky @AaronRobinsonMSFT
Fixes #50410