-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixed .Net Native crash for custom struct deserialization #4696
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
Conversation
|
Hello @vmoroz! Because this pull request has the Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 60 minutes, a condition that will be fulfilled in about 44 minutes. No worries though, I will be back when the time is right! 😉 p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
|
||
| public static void ReadClass<TClass>(IJSValueReader reader, out TClass value) where TClass : new() | ||
| { | ||
| // .Net Native seems to have a bug that does not allow to have 'out' or 'ref' parameters. |
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.
bug [](start = 37, length = 3)
(nit) would be nice to contact .net team with this issue :)
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.
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.
@vmoroz could you file a bug in the dotnet runtime project?
https://github.com/dotnet/runtime
NikoAri
left a comment
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.
![]()
| : Default(typeof(void)))))); | ||
| } | ||
| var fields = | ||
| from field in classType.GetFields(BindingFlags.Public | BindingFlags.Instance) |
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.
nit: seems indention seems to have accidentally changed
| from field in classType.GetFields(BindingFlags.Public | BindingFlags.Instance) | |
| from field in classType.GetFields(BindingFlags.Public | BindingFlags.Instance) |
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.
The investigation has shown that the .Net Native does not allow to have a parameter passed as 'ref' in a dynamically generated lambda. It was causing a crash when we generate ReadValue lambda to read custom class or struct where we pass the type by 'ref'.
In this PR we work around this issue by having a different delegate signature used for generating custom class reader. It uses return value instead of 'ref' parameter.
This change only affect the internal implementation of the Microsoft.ReactNative.SharedManaged code. There are no changes in user code required.
Closes #3838
Microsoft Reviewers: Open in CodeFlow