-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Hermes bytecode compilation fails in release mode when app is included in a separate wapproj project #12708
Comments
Can I back up one step and ask why you're adding an additional packaging project when the new project template started you out with a UWP app that's already packaged? I'm not understanding the scenario. Would it be possible to add your background task to the UWP project created for you? Thanks for sharing the steps. Can you share a min repo of the steps you executed so we can get detail on these steps in particular:
Hermes in particular has a different version for UWP apps vs. Win32 apps, and if we end up with the wrong version it could cause problems (maybe like what you're seeing here). |
In the new, packaging project, I can add my .NET Framework background process under "Dependencies" just fine, and have UWP run via full trust. If I try to add that same project under "References" in the uwp app it says it's unable to (am I supposed to add it a different way?)
https://github.com/WilliamWelsh/react-native-windows-hermes-fail |
We have this kind of project and currently it works with Hermes on release on RNW 0.73.x I think that solution for you problem is add
|
There is our RNW 0.73 patch
|
After updating those four files, my packaged Hermes app runs in release now! Even from the Microsoft store as a flight |
I did previously issue about this but could not manage to find that anymore. Reason why we need that hack is our project structure - packaging project. |
I do not remember fully this now but it was related to somehow managed to copy Hermes compiled binary bundle. |
We have somehow NuGet restore issue with packaging project and RNW 0.73.x. I have to call If you use Here is some kind of packaging project example https://github.com/microsoft/react-native-windows-samples/tree/main/samples/AppServiceDemo I tested about year ago that when enabling Hermes in that example it failed into this same issue and i made issue for that microsoft/react-native-windows-samples#776 |
So how do we move forward with getting this to work in future versions without having to manually patch? |
Does adding "ContinueOnError" mean you're not actually using hermes bytecode? It sounds like the hermes compiler is complaining about your bundle, so my guess would be it "works" now, but with a regular JS bundle. |
Hermes bytecode is in use, see more from here microsoft/react-native-windows-samples#776 (comment) |
As far as this patch: #12708 (comment) If there are JS compilation errors, those will need to be fixed instead of setting |
Closing because workaround exists and this is a nonstandard configuration. For reducing need for patches, we can look at PRs on this. But original issue has been unblocked. |
In example package project is Hermes bundle build 2 times like i wrote in the example's issue
thats why "continue on error" hack is only workaround that i found for this. |
Are there any PRs fixing this issue? |
No, I have to manually patch for every update |
I run this powershell script in my CI to auto-fix the problem during every build:
FWIW - @chrisglein , yes the project structure is non standard, but if you want to access any OS internals via full trust you have to do this non-standard structure. The UWP "happy path" is very narrow and if you want to do anything outside that, you have to bundle UWP+fullTrust inside a WAP, which leads to this error. |
Exactly ! This is why I think we need an official patch for this, I think this error is going to occur more and more as rnw gets more adopted |
Problem Description
Continued from #12258
I made this into a new issue since my old one started out with a different issue.
I have a packaged solution, where my React Native Windows app is the startup, with a .NET Framework background process that is run via full trust. I've boiled it down to just setting up a packaged project causes the error.
If I make a new project, Hermes in release runs fine. Once I add to a packaged project, it fails to run.
If UseHermes is disabled, it runs fine.
When searching for similar error messages (on other react native projects), they all fixed it by doing something regarding ram bundle
Here is the output below from doing the steps under "Steps To Reproduce"
Steps To Reproduce
Initialize RN project
Initialize RN Windows
2. cd test
3. npx react-native-windows-init --overwrite --language cs
Get it running
4. npx react-native run-windows
Try out Release mode
5. npx react-native run-windows --release
Running in x64 release runs perfectly. UseHermes is true by default now.
Set up packaged project
6. Open solution in Visual Studio
7. Add a new project - Windows Application Packaging Project (C# UWP)
8. Add the test project as a reference in the new packaging project
9. Try to run in release (setting packaged app to startup project and clicking play)
10. Fail
Expected Results
The app should run.
CLI version
12.3.2
Environment
Target Platform Version
None
Target Device(s)
Desktop
Visual Studio Version
Visual Studio 2022
Build Configuration
ReleaseBundle
Snack, code example, screenshot, or link to a repository
https://github.com/WilliamWelsh/react-native-windows-hermes-fail
The text was updated successfully, but these errors were encountered: