Skip to content
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

[browser] Enabling WasmStripILAfterAOT breaks app with 'NIY encountered' and results in larger build size #92238

Closed
elringus opened this issue Sep 18, 2023 · 17 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono
Milestone

Comments

@elringus
Copy link

elringus commented Sep 18, 2023

Description

I've tried enabling recently added <WasmStripILAfterAOT> (dotnet/core#8439 (comment)), but it breaks the application and results in slightly larger build size (5.05MB vs 5.06MB).

Reproduction Steps

  1. Clone https://github.com/Elringus/DotNetJS/tree/feat/revamp/Samples/App
  2. Under App directory run npm install
  3. Run dotnet publish backend
  4. Run npm run dev
  5. Open browser with the reported dev server address
  6. Observe the app is working and check binaries size under App/public/bin (5.05MB on my end)
  7. Add <WasmStripILAfterAOT>true</WasmStripILAfterAOT> to App/backend/Backend.WASM/Backend.WASM.csproj properties
  8. Run dotnet publish backend to re-build the solution
  9. Run dev server and check the app and binaries size again

Expected behavior

App works as before and binaries size is at least not larger than before.

Actual behavior

Binaries size is slightly larger (5.06MB on my end) and app crashes with the following log:

Browser console log
MONO interpreter: NIY encountered in method .ctor backend.js:21:18473
ht@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:13344
El<@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:177768
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14918]:0x338c58
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12244]:0x284015
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12168]:0x280bb2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12172]:0x280cd5
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12175]:0x280d3e
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x250ae1
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11664]:0x260823
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11669]:0x2609de
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[7663]:0x166705
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[242]:0x16789
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[241]:0x166c9
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[240]:0x1665a
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[128]:0x106a2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11156]:0x231c55
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11706]:0x2618bd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.Module:wasm-function[1]:0x56
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e3e4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13622]:0x2dedef
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13106]:0x2bc4b6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5387]:0xf5900
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5386]:0xf5885
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[6898]:0x13f939
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5395]:0xf6892
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5392]:0xf61bc
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5493]:0xfbbab
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5374]:0xf48d4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[7041]:0x1446ca
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11156]:0x231c55
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11706]:0x2618bd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.Module:wasm-function[1]:0x56
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e3e4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13629]:0x2df704
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13653]:0x2e1da6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14908]:0x33523a
createDotnetRuntime/Module._mono_wasm_invoke_method_bound@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:21:99186
Sr@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:36377
jl/e.onRuntimeInitialized/l$1.javaScriptExports.call_entry_point@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:210505
$c@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:138300
boot@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:234:51
async*bootBackend@http://localhost:5173/src/boot.ts?t=1695055130977:7:19
async*@http://localhost:5173/src/main.tsx?t=1695055130977:8:1
backend.js:3:177762
ht@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:13344
El<@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:177768
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14918]:0x338c58
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12244]:0x284015
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12168]:0x280bb2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12172]:0x280cd5
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12174]:0x280d18
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12173]:0x280ceb
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e669
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13622]:0x2dedef
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13106]:0x2bc4b6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5387]:0xf5900
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5386]:0xf5885
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[6898]:0x13f939
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5395]:0xf6892
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5392]:0xf61bc
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5493]:0xfbbab
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5374]:0xf48d4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[7041]:0x1446ca
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11156]:0x231c55
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11706]:0x2618bd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.Module:wasm-function[1]:0x56
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e3e4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13629]:0x2df704
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13653]:0x2e1da6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14908]:0x33523a
createDotnetRuntime/Module._mono_wasm_invoke_method_bound@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:21:99186
Sr@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:36377
jl/e.onRuntimeInitialized/l$1.javaScriptExports.call_entry_point@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:210505
$c@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:138300
boot@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:234:51
async*bootBackend@http://localhost:5173/src/boot.ts?t=1695055130977:7:19
async*@http://localhost:5173/src/main.tsx?t=1695055130977:8:1
backend.js:3:177762
ht@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:13344
El<@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:177768
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14918]:0x338c58
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12244]:0x284015
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12168]:0x280bb2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12172]:0x280cd5
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12174]:0x280d18
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12173]:0x280ceb
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e669
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13629]:0x2df704
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13653]:0x2e1da6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14908]:0x33523a
createDotnetRuntime/Module._mono_wasm_invoke_method_bound@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:21:99186
Sr@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:36377
jl/e.onRuntimeInitialized/l$1.javaScriptExports.call_entry_point@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:210505
$c@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:138300
boot@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:234:51
async*bootBackend@http://localhost:5173/src/boot.ts?t=1695055130977:7:19
async*@http://localhost:5173/src/main.tsx?t=1695055130977:8:1
backend.js:3:177762
Uncaught (in promise) 
Object { name: "ExitStatus", message: "Program terminated with exit(1)", status: 1 }

Regression?

No.

Known Workarounds

None.

Configuration

.NET 8 RC1
Windows 10 x64

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 18, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 18, 2023
@vcsjones vcsjones added area-Codegen-AOT-mono and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 18, 2023
@vargaz
Copy link
Contributor

vargaz commented Sep 18, 2023

@fanyang-mono

@radical radical added the arch-wasm WebAssembly architecture label Sep 18, 2023
@ghost
Copy link

ghost commented Sep 18, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I've tried enabling recently added <WasmStripILAfterAOT> (dotnet/core#8439 (comment)), but it breaks the application and results in slightly larger build size (5.05MB vs 5.06MB).

Reproduction Steps

  1. Clone https://github.com/Elringus/DotNetJS/tree/feat/revamp/Samples/App
  2. Under App directory run npm install
  3. Run dotnet publish backend
  4. Run npm run dev
  5. Open browser with the reported dev server address
  6. Observe the app is working and check binaries size under App/public/bin (5.05MB on my end)
  7. Add <WasmStripILAfterAOT>true</WasmStripILAfterAOT> to App/backend/Backend.WASM/Backend.WASM.csproj properties
  8. Run dotnet publish backend to re-build the solution
  9. Run dev server and check the app and binaries size again

Expected behavior

App works as before and binaries size is at least not larger than before.

Actual behavior

Binaries size is slightly larger (5.06MB on my end) and app crashes with the following log:

Browser console log
MONO interpreter: NIY encountered in method .ctor backend.js:21:18473
ht@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:13344
El<@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:177768
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14918]:0x338c58
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12244]:0x284015
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12168]:0x280bb2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12172]:0x280cd5
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12175]:0x280d3e
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x250ae1
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11664]:0x260823
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11669]:0x2609de
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[7663]:0x166705
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[242]:0x16789
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[241]:0x166c9
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[240]:0x1665a
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[128]:0x106a2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11156]:0x231c55
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11706]:0x2618bd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.Module:wasm-function[1]:0x56
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e3e4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13622]:0x2dedef
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13106]:0x2bc4b6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5387]:0xf5900
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5386]:0xf5885
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[6898]:0x13f939
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5395]:0xf6892
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5392]:0xf61bc
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5493]:0xfbbab
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5374]:0xf48d4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[7041]:0x1446ca
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11156]:0x231c55
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11706]:0x2618bd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.Module:wasm-function[1]:0x56
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e3e4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13629]:0x2df704
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13653]:0x2e1da6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14908]:0x33523a
createDotnetRuntime/Module._mono_wasm_invoke_method_bound@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:21:99186
Sr@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:36377
jl/e.onRuntimeInitialized/l$1.javaScriptExports.call_entry_point@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:210505
$c@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:138300
boot@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:234:51
async*bootBackend@http://localhost:5173/src/boot.ts?t=1695055130977:7:19
async*@http://localhost:5173/src/main.tsx?t=1695055130977:8:1
backend.js:3:177762
ht@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:13344
El<@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:177768
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14918]:0x338c58
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12244]:0x284015
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12168]:0x280bb2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12172]:0x280cd5
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12174]:0x280d18
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12173]:0x280ceb
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e669
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13622]:0x2dedef
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13106]:0x2bc4b6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5387]:0xf5900
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5386]:0xf5885
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[6898]:0x13f939
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5395]:0xf6892
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5392]:0xf61bc
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5493]:0xfbbab
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[5374]:0xf48d4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[7041]:0x1446ca
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11156]:0x231c55
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11706]:0x2618bd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.Module:wasm-function[1]:0x56
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e3e4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13629]:0x2df704
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13653]:0x2e1da6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14908]:0x33523a
createDotnetRuntime/Module._mono_wasm_invoke_method_bound@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:21:99186
Sr@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:36377
jl/e.onRuntimeInitialized/l$1.javaScriptExports.call_entry_point@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:210505
$c@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:138300
boot@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:234:51
async*bootBackend@http://localhost:5173/src/boot.ts?t=1695055130977:7:19
async*@http://localhost:5173/src/main.tsx?t=1695055130977:8:1
backend.js:3:177762
ht@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:13344
El<@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:177768
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14918]:0x338c58
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12244]:0x284015
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12168]:0x280bb2
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12172]:0x280cd5
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12174]:0x280d18
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[12173]:0x280ceb
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11604]:0x25e669
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11596]:0x251b4f
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[11630]:0x25f1dd
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14228]:0x3079a4
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13623]:0x2dee64
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13629]:0x2df704
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[13653]:0x2e1da6
@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977 line 3 > WebAssembly.instantiate:wasm-function[14908]:0x33523a
createDotnetRuntime/Module._mono_wasm_invoke_method_bound@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:21:99186
Sr@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:36377
jl/e.onRuntimeInitialized/l$1.javaScriptExports.call_entry_point@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:210505
$c@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:3:138300
boot@http://localhost:5173/backend/Backend.WASM/bin/backend/backend.js?t=1695055130977:234:51
async*bootBackend@http://localhost:5173/src/boot.ts?t=1695055130977:7:19
async*@http://localhost:5173/src/main.tsx?t=1695055130977:8:1
backend.js:3:177762
Uncaught (in promise) 
Object { name: "ExitStatus", message: "Program terminated with exit(1)", status: 1 }

Regression?

No.

Known Workarounds

None.

Configuration

.NET 8 RC1
Windows 10 x64

Other information

No response

Author: Elringus
Assignees: -
Labels:

arch-wasm, untriaged, area-Codegen-AOT-mono

Milestone: -

@fanyang-mono fanyang-mono self-assigned this Sep 18, 2023
@fanyang-mono fanyang-mono removed the untriaged New issue has not been triaged by the area owner label Sep 18, 2023
@fanyang-mono fanyang-mono added this to the 9.0.0 milestone Sep 18, 2023
@fanyang-mono
Copy link
Member

#90436 might fix this.

@legistek
Copy link

I'm having this issue in production .NET8, AOT WASM. Happens regardless whether WasmStripILAfterAOT is on or off. The console errors start:

MONO interpreter: NIY encountered in method .ctor

dotnet.runtime.8.0.0.14kkjimq5k.js:3 Error: [MONO] * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/interp/interp.c:3863

at ht (dotnet.runtime.8.0.0.14kkjimq5k.js:3:12765)
at Ul (dotnet.runtime.8.0.0.14kkjimq5k.js:3:175673)
at dotnet.native.wasm:0x22277b6
at dotnet.native.wasm:0x2069e6d
at dotnet.native.wasm:0x20668ce
at dotnet.native.wasm:0x20669fe
at dotnet.native.wasm:0x2066a6d
at dotnet.native.wasm:0x203562f
at dotnet.native.wasm:0x2045870
at dotnet.native.wasm:0x20465b8

Which repeats 4 times with other stack traces, and then ultimately:

ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1}
message
:
"Program terminated with exit(1)"
name
:
"ExitStatus"
status
:
1
[[Prototype]]
:
Object

Interpreted works fine. AOT also worked fine in .NET6.

@elringus
Copy link
Author

Can confirm the same issue is still reproducing in final .NET 8.0. Was the mentioned PR merged to 8.0 or it's postponed to 9.0? (the PR is missing milestone)

@fanyang-mono
Copy link
Member

The fix was merged recently. Unfortunately, it didn't make it to the .NET8 GA. It will for sure be in .NET9. It might be able to be released as part of .NET8 service1. But I can't guarantee that right now.

@fanyang-mono
Copy link
Member

I'm having this issue in production .NET8, AOT WASM. Happens regardless whether WasmStripILAfterAOT is on or off. The console errors start:

MONO interpreter: NIY encountered in method .ctor

dotnet.runtime.8.0.0.14kkjimq5k.js:3 Error: [MONO] * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/interp/interp.c:3863

at ht (dotnet.runtime.8.0.0.14kkjimq5k.js:3:12765)
at Ul (dotnet.runtime.8.0.0.14kkjimq5k.js:3:175673)
at dotnet.native.wasm:0x22277b6
at dotnet.native.wasm:0x2069e6d
at dotnet.native.wasm:0x20668ce
at dotnet.native.wasm:0x20669fe
at dotnet.native.wasm:0x2066a6d
at dotnet.native.wasm:0x203562f
at dotnet.native.wasm:0x2045870
at dotnet.native.wasm:0x20465b8

Which repeats 4 times with other stack traces, and then ultimately:

ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(1)', status: 1} message : "Program terminated with exit(1)" name : "ExitStatus" status : 1 [[Prototype]] : Object

Interpreted works fine. AOT also worked fine in .NET6.

Could you try to build your app after deleting all the build artifacts of your app and turning off WasmStripILAfterAOT?

@legistek
Copy link

legistek commented Nov 20, 2023

@fanyang-mono apologies, I stand corrected. It DOES work properly when WasmStripILAfterAOT is off. I had to more thoroughly clear the build artifacts. So it likely is the same issue. Thanks for the tip.

Do we know the qualitative cause and is it something we can try to avoid until the fix makes it into production? Or is WasmStripILAfterAOT just broken entirely?

@fanyang-mono
Copy link
Member

fanyang-mono commented Nov 20, 2023

@legistek Thanks for confirming and trying out this new feature. Unfortunately, the initial release of WasmStripILAfterAOT is only capable of handling simple apps. If your app ran into this issue, you would have to avoid using it, until we release the fix (#90436).

@legistek
Copy link

@fanyang-mono gotcha thank you. Stripping IL isn't critical now that I can get AOT working without it.

@sschoener
Copy link

@fanyang-mono I am hitting this error without stripping on a clean debug build. I have cleared out the bin and obj folders completely prior to making the build to rule out the case that legistek describes above. This is the entire log:

MONO interpreter: NIY encountered in method .cctor
Invalid UTF-8 leading byte 0x000000fe encountered when deserializing a UTF-8 string in wasm memory to a JS string!
Error: [MONO] * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/interp/interp.c:3863

    at ht (https://localhost:7253/_framework/dotnet.runtime.8.0.0.14kkjimq5k.js:3:12765)
    at Ul (https://localhost:7253/_framework/dotnet.runtime.8.0.0.14kkjimq5k.js:3:175673)
    at wasm_trace_logger (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[195125]:0xf16701c)
    at eglib_log_adapter (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[182445]:0xef06845)
    at monoeg_g_logv_nofree (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[182334]:0xef02238)
    at monoeg_assertion_message (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[182338]:0xef023d6)
    at mono_assertion_message_unreachable (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[182341]:0xef02477)
    at mono_interp_exec_method (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[181667]:0xeecae4d)
    at interp_runtime_invoke (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[181707]:0xeedaf7b)
    at mono_jit_runtime_invoke (https://localhost:7253/_framework/dotnet.native.wasm:wasm-function[186238]:0xefeff7c)
program exited (with status: 1), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)
Uncaught Error Error: Failed to start platform. Reason: [object Object]
    at hn (localhost꞉7253/_framework/blazor.webassembly.js:1:57366)
    --- await ---
    at mn (localhost꞉7253/_framework/blazor.webassembly.js:1:53888)
    at Cn (localhost꞉7253/_framework/blazor.webassembly.js:1:59815)
    at <anonymous> (localhost꞉7253/_framework/blazor.webassembly.js:1:59943)
    at <anonymous> (localhost꞉7253/_framework/blazor.webassembly.js:1:60010)

My build options are

    <RunAOTCompilation>true</RunAOTCompilation>
    <RunAOTCompilationAfterBuild>true</RunAOTCompilationAfterBuild>
    <WasmStripILAfterAOT>false</WasmStripILAfterAOT>
    <WasmEmitSymbolMap>true</WasmEmitSymbolMap>
    <WasmNativeStrip>false</WasmNativeStrip>

Please let me know if there is other information that you need to investigate this (or if I should move this to a separate issue entirely). Thank you!

@fanyang-mono
Copy link
Member

@sschoener Thanks for reporting this issue. This should not happen to a fresh build with WasmStripILAfterAOT setting to false. Could you please share a reproduction app?

@sschoener
Copy link

Please find the project here: BlazorLineFilter.zip

It is a tiny project created from the Blazor WebAssembly template. It consists of a single page with some JavaScript-interop to open/close files on the users file system. To reproduce, open the solution, build for Debug (Any CPU). Then start with https. Also note that on my machine this build frequently takes ~60min (System.Private.CoreLib.dll.bc by itself takes 10minutes, aot-instances.dll.bc takes 41 minutes -- likely because of the lack of stripping) and can lock up the entire system because clang++ happily takes so much memory that you are in memory hard fault hell, so you may have to give it some time :). -- Visual Studio version is 17.8.3, dotnet --version is 8.0.100.

Let me know if I can be of further assitance.

@iSeiryu
Copy link

iSeiryu commented Jan 23, 2024

> dotnet --info
.NET SDK:
 Version:           8.0.101
 Commit:            6eceda187b
 Workload version:  8.0.100-manifests.1c08acc9

My .csproj

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <Nullable>enable</Nullable>
  <ImplicitUsings>enable</ImplicitUsings>
  <InvariantGlobalization>true</InvariantGlobalization>
  <BlazorEnableTimeZoneSupport>false</BlazorEnableTimeZoneSupport>
  <BlazorWebAssemblyPreserveCollationData>false</BlazorWebAssemblyPreserveCollationData>
  <WasmExceptionHandling>true</WasmExceptionHandling>
  <WasmSIMD>false</WasmSIMD>
</PropertyGroup>

Publishing with WasmStripILAfterAOT=false works

dotnet publish UI.csproj -c Release -p:RunAOTCompilation=true -p:WasmStripILAfterAOT=false

But this crashes with MONO interpreter: NIY encountered in method .ctor

dotnet publish UI.csproj -c Release -p:RunAOTCompilation=true -p:WasmStripILAfterAOT=true

image

The latter does produce noticeably smaller files, which is nice, e.g. dotnet.native.wasm.gz went from 3.7MB to 2.5MB. Huge improvement!

@fanyang-mono you mentioned that it should be fixed in #90436. I see that PR is merged now. When is it going to be release? That size improvement would be great to have.

iSeiryu added a commit to iSeiryu/blazor-wasm-experiments that referenced this issue Jan 23, 2024
dimmik added a commit to dimmik/tourcalc that referenced this issue Jan 26, 2024
@Matheos96
Copy link

Matheos96 commented Feb 6, 2024

Just encountered this myself too. exactly the same issue as @iSeiryu describes above.

Looks like we have to wait for .NET 9 for the fix? No chance of getting it in a .NET 8 update??

UPDATE: Running AOT + WasmStripILAfterAOT publish of our Blazor WASM Standalone app AS ADMINISTRATOR seemingly broke my .NET install altogether... I cannot even start our ASP.NET app anymore (separate from WASM app) in debug mode. I get System.InvalidProgramException: Common Language Runtime detected an invalid program. at ... errors every time. I tried running .NET SDK repair but no luck. I will now try a full remove of .NET 8 using Visual Studio Installer and then reinstall it...
Amazing how this one option could mess up my whole environment!? The only reason I ran it as admin in the first place was because it was complaining about permission issues in the dotnet installation folder. It did sound very suspicious as it wanted to "move" something....

My Windows is completely messed up from this... I cannot get it fixed. Created issue #98041
EDIT2: After 5 hours I got it solved... This is a MAJOR issue if this is what caused it initially. Hope to see a fix asap! Please see my linked issue for details on my specific persistant problem and solution

@fanyang-mono
Copy link
Member

Sorry about the delay. The fix has been shipped as part of .NET9 Preview1. Please download the latest .NET from https://dotnet.microsoft.com/en-us/download/dotnet/9.0 to see if you issue has been resolved.

@fanyang-mono
Copy link
Member

Closing this now, as all the issues related to WasmStripILAfterAOT should have been fixed.

@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono
Projects
None yet
Development

No branches or pull requests

9 participants