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][MT] Runtime Aborts after executing Program::Main() #100597

Closed
glutio opened this issue Apr 3, 2024 · 2 comments · Fixed by #100629
Closed

[browser][MT] Runtime Aborts after executing Program::Main() #100597

glutio opened this issue Apr 3, 2024 · 2 comments · Fixed by #100629
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm
Milestone

Comments

@glutio
Copy link

glutio commented Apr 3, 2024

Description

The multithreading browser runtime crashes in await runMain() after executing Program::Main().

Reproduction Steps

.csproj

<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <WasmEnableThreads>true</WasmEnableThreads>
  </PropertyGroup>
</Project>

.js

import { dotnet } from './_framework/dotnet.js'
const { runMain } = await dotnet.create();
await runMain();

.cs

using System;
Console.WriteLine("Hello, Browser!");

Expected behavior

Prints message and does not crash

Actual behavior

Prints message and crashes

worker.onerror		@	dotnet.native.9.0.0-…8.5.kpnkj0mqsi.js:8
error (async)		
(anonymous)		@	dotnet.native.9.0.0-…8.5.kpnkj0mqsi.js:8
loadWasmModuleToWorker	@	dotnet.native.9.0.0-…8.5.kpnkj0mqsi.js:8
e.loadWasmModuleToWorker@	ui-thread.ts:243
Bn			@	ui-thread.ts:359
(anonymous)		@	ui-thread.ts:169
(anonymous)		@	startup.ts:247
dotnet.native.wasm:1  Uncaught (in promise) RuntimeError: unreachable
    at __trap (dotnet.native.wasm)
    at ___trap (dotnet.native.9.0.0-preview.4.24202.8.804phjyibc.js:7325:45)
    at abort (dotnet.native.9.0.0-preview.4.24202.8.804phjyibc.js:727:3)
    at _abort (dotnet.native.9.0.0-preview.4.24202.8.804phjyibc.js:5423:2)
    at ves_icall_System_Environment_FailFast (dotnet.native.wasm)
    at ves_icall_System_Environment_FailFast_raw (dotnet.native.wasm)
    at do_icall (dotnet.native.wasm)
    at do_icall_wrapper (dotnet.native.wasm)
    at mono_interp_exec_method (dotnet.native.wasm)
    at interp_runtime_invoke (dotnet.native.wasm)

Regression?

Works in .net8

Known Workarounds

No response

Configuration

version 9.0.x-preview.x

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 Apr 3, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 3, 2024
@glutio glutio changed the title [browser][MT] Runtime Aborts after executing Main() [browser][MT] Runtime Aborts after executing Program::Main() Apr 3, 2024
@maraf maraf added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Apr 4, 2024
@maraf maraf added this to the 9.0.0 milestone Apr 4, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Apr 4, 2024
@maraf
Copy link
Member

maraf commented Apr 4, 2024

cc @pavelsavara

@pavelsavara pavelsavara self-assigned this Apr 4, 2024
@pavelsavara pavelsavara removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 4, 2024
@pavelsavara
Copy link
Member

The real error is Marshalling null return Task to JS is not supported in MT because the void Main() doesn't create any task.

@github-actions github-actions bot locked and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants