Repository navigation
Blazor Wasm PWA with AOT, publish build is not working after upgrade to .NET 9 #111663
Description
Activity
Hey @PhilippJR, could you provide a minimal repository that shows the problem? This might help find the reason for your problem faster.
Thanks @KristofferStrube.
I spent the whole day with creating the minimal repo. I created a new branch to do so and deleted everything that is not necessary. Then, I tested the four cases (still in the original repo)- with Blazored.LocalStorage, with AOT
- with Blazored.LocalStorage, without AOT
- without Blazored.LocalStorage, with AOT
- without Blazored.LocalStorage, withoutAOT
I always published the build and it is reproducible that only combination 4 can be loaded. The error messages are
Combination 1
dotnet.runtime.rubq0v1yiy.js:3 [MONO] /__w/1/s/src/mono/mono/mini/aot-runtime.c:2139 Error at Fc (https://[...]/_framework/dotnet.runtime.rubq0v1yiy.js:3:168644) at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[74571]:0x1418633 at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67085]:0x124cdb5 at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67008]:0x124aced at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67010]:0x124adba at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67011]:0x124adf0 at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[69276]:0x12ea025 at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67527]:0x126bb9b at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67532]:0x126c597 at https://[...]/_framework/dotnet.native.w8nw0z0o5n.wasm:wasm-function[67524]:0x126b886 dotnet.runtime.rubq0v1yiy.js:3 MONO_WASM: mono_wasm_load_runtime () failed [object Object] dotnet.runtime.rubq0v1yiy.js:3 Uncaught (in promise) ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1, silent: true} dotnet.runtime.rubq0v1yiy.js:3 Uncaught (in promise) ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1, silent: true} blazor.webassembly.js:1 Uncaught (in promise) Error: Failed to start platform. Reason: [object Object] at qt (blazor.webassembly.js:1:55616)Combination 2
dotnet.runtime.rubq0v1yiy.js:3 [MONO] * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/interp/interp.c:3965 Error at Fc ([...]/_framework/dotnet.runtime.rubq0v1yiy.js:3:168644) at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[8297]:0x1faf19 at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[792]:0x3e9a4 at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[713]:0x3ca47 at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[717]:0x3cb68 at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[720]:0x3cbd1 at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[93]:0x7e84 at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[130]:0x16b8a at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[2899]:0xcfd9b at https://[...]/_framework/dotnet.native.1odv868sed.wasm:wasm-function[2266]:0xa6af0 blazor.webassembly.js:1 ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1}Combination 3
dotnet.runtime.rubq0v1yiy.js:3 [MONO] /__w/1/s/src/mono/mono/mini/aot-runtime.c:2139 Error at Fc ([...]/_framework/dotnet.runtime.rubq0v1yiy.js:3:168644) at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[74212]:0x1401d38 at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[66726]:0x12364c6 at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[66649]:0x12343fe at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[66651]:0x12344cb at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[66652]:0x1234501 at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[68917]:0x12d3736 at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[67168]:0x12552ac at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[67173]:0x1255ca8 at https://[...]/_framework/dotnet.native.hsxvpdpqyt.wasm:wasm-function[67165]:0x1254f97 dotnet.runtime.rubq0v1yiy.js:3 MONO_WASM: mono_wasm_load_runtime () failed [object Object] dotnet.runtime.rubq0v1yiy.js:3 Uncaught (in promise) ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1, silent: true} dotnet.runtime.rubq0v1yiy.js:3 Uncaught (in promise) ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1, silent: true} blazor.webassembly.js:1 Uncaught (in promise) Error: Failed to start platform. Reason: [object Object] at qt (blazor.webassembly.js:1:55616)Next, I created a new public repo, cloned it and copied alle the files from my original project into it. That's what you asked for, but when I tested the published versions of this minimal example repo, all four combinations worked well.
Here's the link to the minimal repo anyway, although I do not think that it will help.
I think, that anything else is wrong with my original repo. Any ideas?Thanks again!
Philipp
I made it :-)
I still do not know, what exactly caused this issue, but in case anyone faces the same problem, here are my steps. If the solution comprises several projects, like in my case, do the following steps in each project folder. It is probably smart to create a backup first. Also, please note, that e. g. the publish profile will be deleted.- Open the Developer PowerShell. Open it in Windows not in Visual Studio as later some files must be deleted, what is not possible when Visual Studio is running.
- Navigate to the folder(s) with the solution file(s) (.sln).
- Run "dotnet clean".
- Again in all folders run "dotnet restore --no-cache".
- Run "git clean -xdf" in all folders.
- In the folder with the main solution run "dotnet restore" and "dotnet build".
After these steps, I was finally able to create executable publish builds for above mentioned combinations 1 and 2. (3 and 4 are not really relevant, so I did not test them.)
Reacted by digitaldirk, sangeun jo, vellad001, Serge Nalishiwa and devmasonzReacted by Kristoffer Strube, e0548965 and vellad001Reacted by vellad001- addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Jan 21, 2025 @PhilippJR I was encountering the same error only when my Blazor wasm project was published. It was a brand new .net 9 wasm standalone project with a few additions, after I followed your steps and restarting my pc/visual studio the publish worked.
Thanks!
Reacted by PhilippJRdotnet-policy-service commented
on Feb 20, 2025 ContributorMore actionsTagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.- added and removeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Feb 20, 2025 Thanks @PhilippJR really helped me
Reacted by PhilippJR@PhilippJR! Experienced the same issue today and was able to solve the issue using your solution. Thanks!
Reacted by PhilippJRThe root cause is that our MSBuild scripts are not smart enough to understand when to do full clean of
binandobjfolder. Sorry about that.The "solution" is to do full clean yourself, any time you upgrade SDK or any time you make changes to project (MSBuild) properties.
Reacted by ZzZombo- addedos-browserBrowser variant of arch-wasmBrowser variant of arch-wasmand removed
on Apr 1, 2025 This was the only thing that saved me from basically scrapping the whole thing and looking for an alternative. I was ready to even consider forgoing .NET completely.
Is there an existing issue for this?
Describe the bug
Last week, I upgraded my Blazor Wasm PWA from .NET 7 to .NET 9. I tested everything, created a publish build and published it. It works without any problems.
So, I continued the work on the app and wanted to test something today. To do so, I created a publish build with
<RunAOTCompilation>false</RunAOTCompilation>, simply because compilation is faster without AOT. The build was successful but the app cannot be loaded in the browser. One error message says, that Blazored.LocalStorage throws a Not Implemented Yet exception:So, I already started a bug report at the Blazored.LocalStorage github repo, but then found out that this package cannot be the (only) reason for the error. Let me explain:
In this case, 3 things can make the app crash:
I tested all 8 combinations (with/without code changes, with/without Blazored.LocalStorage, with/without AOT). The only 2 cases, I can make the app run, are
Okay, it only works without Blazored.LocalStorage. That's why I first thought, this package causes the error. But it also does not work
So, I tried to go back to .NET 7, but without success. I cannot make the app run. That's a severe problem, because I cannot publish updates currently.
Here are some error messages
MONO interpreter: NIY encountered in method Blazored.LocalStorage.ServiceCollectionExtensions:AddBlazoredLocalStorage (Microsoft.Extensions.DependencyInjection.IServiceCollection) dotnet.runtime.o8gq1i8bk6.js:3 [MONO] * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/interp/interp.c:3965
Error
at Fc (https://[...].netlify.app/_framework/dotnet.runtime.o8gq1i8bk6.js:3:168644)
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[8300]:0x1faf36
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[792]:0x3e9ad
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[713]:0x3ca50
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[717]:0x3cb71
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[720]:0x3cbda
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[93]:0x7e8d
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[130]:0x16b93
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[2902]:0xcfdb8
at https://[...].netlify.app/_framework/dotnet.native.8uqnh0fgel.wasm:wasm-function[2266]:0xa6af7
Fc @ dotnet.runtime.o8gq1i8bk6.js:3
blazor.webassembly.js:1
ExitStatusmessage: "Program terminated with exit(1)"name: "ExitStatus"status: 1[[Prototype]]: Object
dotnet.runtime.o8gq1i8bk6.js:3 [MONO] /__w/1/s/src/mono/mono/mini/aot-runtime.c:2139 Error at Fc (https://neon-rabanadas-970146.netlify.app/_framework/dotnet.runtime.o8gq1i8bk6.js:3:168644) at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[77113]:0x1589a96 at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[69624]:0x13be1ea at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[69547]:0x13bc122 at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[69549]:0x13bc1ef at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[69550]:0x13bc225 at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[71818]:0x145b471 at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[70066]:0x13dcfd0 at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[70071]:0x13dd9cc at https://neon-rabanadas-970146.netlify.app/_framework/dotnet.native.xw1lrtwtqd.wasm:wasm-function[70063]:0x13dccbb Fc @ dotnet.runtime.o8gq1i8bk6.js:3 dotnet.runtime.o8gq1i8bk6.js:3 MONO_WASM: mono_wasm_load_runtime () failed [object Object] Pe @ dotnet.runtime.o8gq1i8bk6.js:3 dotnet.runtime.o8gq1i8bk6.js:3 Uncaught (in promise) ExitStatus dotnet.runtime.o8gq1i8bk6.js:3 Uncaught (in promise) ExitStatus blazor.webassembly.js:1 Uncaught (in promise) Error: Failed to start platform. Reason: [object Object] at qt (blazor.webassembly.js:1:55616)
There is a bug report, that is similar to mine, but no solution is provided.
Any help is highly appreciated, because I cannot continue working.
Please let me know, if you need any information.
Many thanks
Philipp
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9
Anything else?
No response