Blazor Wasm PWA with AOT, publish build is not working after upgrade to .NET 9

Aperta
#111,663 9 commenti 1 reazione 1 assegnatario Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

arch-wasm area-Build-mono os-browser
Is there an existing issue for this?
  • I have searched the existing issues
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:

MONO interpreter: NIY encountered in method Blazored.LocalStorage.ServiceCollectionExtensions:AddBlazoredLocalStorage (Microsoft.Extensions.DependencyInjection.IServiceCollection)

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 modified the code,
  • Blazored.LocalStorage is not ready for .NET 9 and
  • I changed with/without AOT

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

  • without changes, without AOT, without Blazored.LocalStorage
  • with changes, without AOT, without Blazored.LocalStorage

Okay, it only works without Blazored.LocalStorage. That's why I first thought, this package causes the error. But it also does not work

  • without changes, with AOT, without Blazored.LocalStorage

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

Lingua principale
C#
Stelle
18.3k
Fork
5.6k
Merge medio
2g 19h
PR unite (30g)
589

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/runtime

Tutte le issue di dotnet/runtime

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.