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

When marshalling a layout class, fall-back to dynamically marshalling the type if it doesn't match the static type in the signature. #50137

Merged
merged 3 commits into from
Mar 24, 2021

Conversation

jkoritzinsky
Copy link
Member

When we switched the struct marshalling system to be IL based, we accidentally stopped checking if the passed in object matched the type in the signature in the "layout class" case (where we have a sequential or explicit layout class type). This causes failures to marshal the derived types correctly since only the base type ends up being marshalled.

This PR fixes the regression by falling back to dynamically marshalling the object if the runtime type does not match the declared type.

Fixes #49857

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect PInvoke when parameter has base class with no members
2 participants