React-native-windows: 'System.AccessViolationException' in Facebook.Yoga.dll

Created on 21 Feb 2017  路  34Comments  路  Source: microsoft/react-native-windows

The app is running fine in simulator by react-native run-windows, but it will not run on a device through Visual Studio 2015 DebugRelease ARM. I have run the packaging command as per the docs.

It seems an issue with Facebook Yoga, but I think this is the best place to report?

Running facebook.yoga version 1.1.0.18-pre on the ReactNative package (not the app package).

Exception thrown: 'System.AccessViolationException' in Facebook.Yoga.dll
The thread 0x92c has exited with code 0 (0x0).
The thread 0x11d4 has exited with code 0 (0x0).
The thread 0x10cc has exited with code 0 (0x0).
The program '[4644] Name.exe' has exited with code 0 (0x0).

Any thoughts?
Vince

Most helpful comment

Ok i forgot to bundle before building the debug offline version :( sorry

The "Welcome to React Native" example app now works again on ARM, thank you!

All 34 comments

Can confirm I get the same issue

'testapp.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\81e1c535-6804-4f0c-8a3b-041215426f68VS.DebugBundle_ARM.AWebber\Facebook.Yoga.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
[JS Info] Running application "testapp" with appParams: {"rootTag":1,"initialProps":null}. __DEV__ === true, development-level warning are ON, performance optimizations are OFFException thrown: 'System.AccessViolationException' in Facebook.Yoga.dll
The thread 0x5b0 has exited with code 0 (0x0).

yoga

Sounds like an issue with the ARM build for Facebook.Yoga. Any thoughts @rmarinho?

@rozele I feel so much confidence as soon as you reply to a thread. Stuff gets done :)
I am unfortunately blocked here upgrading my app

@rozele are you able to explain a little bit about the versioning here. Presumably ReactNative C# is maintained on this repro and a specific version of Facebook.Yoga is supported, as defined in the package.json. Assuming this issue is due to the PInvoke library being out of sync with the C# wrapper can we not pin the versions that are compatible? Or have I misunderstood

I don't think the P/Invoke library is out of sync. We actually don't touch P/Invoke code, that's all handled in the Facebook.Yoga package. There's a few new releases of Facebook.Yoga, let's try an upgrade and see if this is something that was already fixed.

Yo , can you try with our myget feed one of the last versions..

https://www.myget.org/F/yoga/api/v3/index.json

@rmarinho how can i take advantage of your last comment, what are the steps

@andrewwebber what IDE are you using ?

@andrewwebber @rmarinho, I posted a PR ^^, if you can pull in those changes, let me know if the issue is still there. Still working on getting an ARM device to test on.

@rmarinho atom.io + VSCommunity 2015

@rozele thanks, ill check it out...

@andrewwebber if you don't want to merge any changes, you should just be able to go to the NuGet Package Manager Console and upgrade all the projects to 1.1.0.23-pre.

@rozele @rmarinho I was able to successfully deploy the playground to my local machine but it fails on a windows phone.
"Facebook.Yoga": "1.1.0.23-pre",

 react-native bundle --platform windows --entry-file ReactWindows/Playground/index.windows.js --bundle-output ReactWindows/Playground/ReactAssets/index.windows.bundle --assets-dest ReactW    indows/Playground/ReactAssets

I already get access violations on many properites after the default constructor is called.

image

@rozele @rmarinho

After cloning and attaching the Yoga project I landed at the following exception. Again could poor configuration my side...

Is there any way to verify which DLLs are deployed to the phone

image

Is this related to #1032 ?

@andrewwebber can you check if you have yoga.dll on your bin/debug/arm ? is this UWP or Windows 8.1 ?

@rmarinho I am running UWP. I will check tomorrow as my company's Phone is in the office. I have the feeling that I cannot verify if yoga.dll is copied during the build. Is there a output windows to verify this? In the old days there was a property window field like "copy to output" :)

I just realized I can check this quickly without the device...

@rmarinho After building the stock template the following can be found in the ARM folder

image

I would assume if they are in the ARM folder they get deployed to the device...
image

Hum, yap it's there.. so it's UWP on a ARM device, wasn't this the fix you did recently @rozele that you tracked down with the UWP team ?

@rmarinho I had a slightly different issue. The UWP build was not targeted for the store, so it was linked against the incorrect VC runtime. I compiled today against the latest NuGet package and ran dumpbin /headers yoga.dll to confirm the DLL was ARM and had the correct dependencies. Everything looked good.

Is there a vendoring/versioning concept here? It is possible to rollback to an older working version and still use 0.41 for example?

@andrewwebber I think the AccessViolationException and DllNotFoundException are two unrelated issues. Can you confirm if you revert back to Facebook.[email protected] that you still get the AccessViolationException? I think this is a broader issue than just ARM, as #1032 references a similar issue.

@rmarinho Has there been any changes to the build between 1.1.0.18-pre to 1.1.0.23-pre that may explain why we were previously building a valid ARM binary and now not?

@rozele I am convinced that the DllNotFoundException is not the issue because I tried to setup a consolidate solution file with all the relevant projects in order to step into. I think my solution was not correct and did not copy the native DLL.

The first access violation is the real problem.

Yap, i m trying to get a hold of a device to test this..

@rmarinho any luck finding an ARM device :)

@andrewwebber sorry for the delay, I finally got an ARM device with the latest Windows 10 bits and have a repro. I think I understand the problem.

@andrewwebber I'm also getting the DllNotFoundException when adding a test Universal Windows app to the Facebook.Yoga project. Did you ever resolve the DllNotFoundException when the Facebook.Yoga dependency is consumed locally?

@rmarinho The repro for ARM is actually quite simple:

var node = new YogaNode();
var leftPadding = node.PaddingLeft.Value;

The expected value of leftPadding is NaN, but instead it results in an AccessViolationException.

An update: I've narrowed the problem down to P/Invoke calls that return the YogaValue struct on ARM. Doing further testing to figure out what kinds of structs fail.

Another update: only structs containing enum聽members produce the AccessViolationException, and only on ARM builds. I've hacked together a workaround and may post a聽NuGet package just to unblock the 0.40 and 0.41聽releases https://github.com/facebook/yoga/pull/459

@rozele where can i find the patched version of yoga or is this already updated when creating a new app and installing react-native-windows?

@andrewwebber I'll be publishing new versions of [email protected], 0.41, and 0.42 today, but in the meantime you can just upgrade your NuGet dependency to [email protected]

@rozele I get the following error on ARM after creating an empty app

image

@rozele after deleting and re-creating the app building I get:

The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.ni.dll

Ok i forgot to bundle before building the debug offline version :( sorry

The "Welcome to React Native" example app now works again on ARM, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fatfatson picture fatfatson  路  3Comments

KristijanZic picture KristijanZic  路  3Comments

josephan picture josephan  路  3Comments

datkinson picture datkinson  路  3Comments

qmatteoq picture qmatteoq  路  3Comments