dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.38k stars 192 forks source link

[NativeAOT LLVM, WASM] WebAssembly.instantiate(): unexpected section <Tag> #2437

Closed Kanawanagasaki closed 8 months ago

Kanawanagasaki commented 8 months ago

I have node v16.13.0 installed, I cannot upgrade to v17 or use --experimental-wasm-eh flag. When I compiled simple "Hello, world!" program and tried to run it I got following error:

failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): unexpected section <Tag> (enable with --experimental-wasm-eh) @+3543
Aborted(CompileError: WebAssembly.instantiate(): unexpected section <Tag> (enable with --experimental-wasm-eh) @+3543)
K:\Coding\DotnetLLVMTest\bin\Publish\DotnetLLVMTest.js:161
      throw ex;
      ^

RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): unexpected section <Tag> (enable with --experimental-wasm-eh) @+3543)
    at abort (K:\Coding\DotnetLLVMTest\bin\Publish\DotnetLLVMTest.js:967:11)
    at K:\Coding\DotnetLLVMTest\bin\Publish\DotnetLLVMTest.js:1132:7

Is there a way to disable generation of Tag section? Or maybe a way to prevent passing -fwasm-exceptions flag to emscripten?

SingleAccretion commented 8 months ago

Is there a way to disable generation of Tag section? Or maybe a way to prevent passing -fwasm-exceptions flag to emscripten?

Yes, we support the same option as upstream, documented here https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=windows#exception-handling:

<PropertyGroup>
  <WasmEnableExceptionHandling>false</WasmEnableExceptionHandling>
</PropertyGroup>

Note we do strongly recommend upgrading to hosts that support WASM EH as it is much more efficient.