react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

'System.AccessViolationException' in Facebook.Yoga.dll

Open vince-rowe opened this issue 9 years ago • 34 comments

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

vince-rowe avatar Feb 21 '17 17:02 vince-rowe

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 avatar Feb 24 '17 11:02 andrewwebber

@andrewwebber I think the AccessViolationException and DllNotFoundException are two unrelated issues. Can you confirm if you revert back to [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 avatar Feb 24 '17 15:02 rozele

@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.

andrewwebber avatar Feb 24 '17 16:02 andrewwebber

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

rmarinho avatar Feb 27 '17 16:02 rmarinho

@rmarinho any luck finding an ARM device :)

andrewwebber avatar Feb 28 '17 01:02 andrewwebber

@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.

rozele avatar Mar 02 '17 17:03 rozele

@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.

rozele avatar Mar 02 '17 18:03 rozele

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.

rozele avatar Mar 02 '17 21:03 rozele

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 avatar Mar 03 '17 16:03 rozele

@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 avatar Mar 06 '17 12:03 andrewwebber

@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 avatar Mar 06 '17 14:03 rozele

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

image

andrewwebber avatar Mar 07 '17 10:03 andrewwebber

@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

andrewwebber avatar Mar 07 '17 11:03 andrewwebber

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!

andrewwebber avatar Mar 07 '17 12:03 andrewwebber