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

Open
#111,663 9 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

Assessment

This issue has not been assessed yet.

Description

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

Dominant language
C#
Stars
18.3k
Forks
5.6k
Avg merge
2d 19h
Merged PRs (30d)
589

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.