Skip to content

Conversation

@vmoroz
Copy link
Member

@vmoroz vmoroz commented Apr 23, 2020

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

@vmoroz vmoroz requested a review from a team as a code owner April 23, 2020 18:42
@vmoroz vmoroz added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Apr 23, 2020
@ghost
Copy link

ghost commented Apr 23, 2020

Hello @vmoroz!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.


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.
Copy link

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did. No response.


In reply to: 414051939 [](ancestors = 414051939)

Copy link
Member

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

Copy link

@NikoAri NikoAri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

: Default(typeof(void))))));
}
var fields =
from field in classType.GetFields(BindingFlags.Public | BindingFlags.Instance)
Copy link
Member

@dannyvv dannyvv Apr 23, 2020

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

Suggested change
from field in classType.GetFields(BindingFlags.Public | BindingFlags.Instance)
from field in classType.GetFields(BindingFlags.Public | BindingFlags.Instance)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed.


In reply to: 414053528 [](ancestors = 414053528)

@vmoroz vmoroz removed the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Apr 23, 2020
@vmoroz vmoroz added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Apr 23, 2020
@ghost ghost merged commit a09efe2 into microsoft:master Apr 23, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SampleAppCS in Release throws exception when clicking "Call SampleModuleCS!"

5 participants