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] WasmEnableThreads=true should fail without workload installed #98496

Closed
SteveSandersonMS opened this issue Feb 15, 2024 · 7 comments · Fixed by #98498
Closed

[browser][MT] WasmEnableThreads=true should fail without workload installed #98496

SteveSandersonMS opened this issue Feb 15, 2024 · 7 comments · Fixed by #98498
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm
Milestone

Comments

@SteveSandersonMS
Copy link
Member

Description

The wasm-tools workload is required to build a multithreading-enabled WebAssembly app.

By default, people do not have the wasm-tools workload installed. In this scenario, if they create a Blazor WebAssembly app and set <WasmEnableThreads>true</WasmEnableThreads>, then it will fail at runtime as follows:

image

This doesn't help the developer to understand the problem or how to fix it.

Reproduction Steps

Using an SDK without wasm-tools, create a .NET 9 Blazor WebAssembly Standalone app, set <WasmEnableThreads>true</WasmEnableThreads>, and dotnet run.

Expected behavior

Ideally it would fail at build time with a message like WasmEnableThreads is set to true, but the wasm-tools workload is not installed. To build this project, first run 'dotnet workload install wasm-tools'.

The second best behavior would be failing at runtime with a message like the above.

Actual behavior

Currently it fails saying "Can't find method ... InstallMainSynchronizationContext", giving no clue how to fix it.

Regression?

No

Known Workarounds

n/a

Configuration

.NET 9 + WebAssembly

Other information

No response

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Feb 15, 2024
@SteveSandersonMS
Copy link
Member Author

cc @lewing @pavelsavara

@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Feb 15, 2024
@ghost
Copy link

ghost commented Feb 15, 2024

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

Issue Details

Description

The wasm-tools workload is required to build a multithreading-enabled WebAssembly app.

By default, people do not have the wasm-tools workload installed. In this scenario, if they create a Blazor WebAssembly app and set <WasmEnableThreads>true</WasmEnableThreads>, then it will fail at runtime as follows:

image

This doesn't help the developer to understand the problem or how to fix it.

Reproduction Steps

Using an SDK without wasm-tools, create a .NET 9 Blazor WebAssembly Standalone app, set <WasmEnableThreads>true</WasmEnableThreads>, and dotnet run.

Expected behavior

Ideally it would fail at build time with a message like WasmEnableThreads is set to true, but the wasm-tools workload is not installed. To build this project, first run 'dotnet workload install wasm-tools'.

The second best behavior would be failing at runtime with a message like the above.

Actual behavior

Currently it fails saying "Can't find method ... InstallMainSynchronizationContext", giving no clue how to fix it.

Regression?

No

Known Workarounds

n/a

Configuration

.NET 9 + WebAssembly

Other information

No response

Author: SteveSandersonMS
Assignees: -
Labels:

arch-wasm, untriaged, area-Build-mono, os-browser

Milestone: -

@pavelsavara pavelsavara added this to the 9.0.0 milestone Feb 15, 2024
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Feb 15, 2024
@pavelsavara pavelsavara changed the title WebAssembly multithreading should give understandable error when built without wasm-tools [browser][MT] WasmEnableThreads=true should fail without workload installed Feb 15, 2024
@pavelsavara
Copy link
Member

I think this WasmEnableThreads needs to be added to _WasmNativeWorkloadNeeded.
Right @maraf ?

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 15, 2024
@lewing
Copy link
Member

lewing commented Feb 15, 2024

#98498

@ilonatommy
Copy link
Member

HostedBlazorWebassemblyApp sample app with threads on - installing workload does not help with the error, why do we link it with workloads?

.NET SDK:
 Version:           9.0.100-preview.2.24112.1
 Commit:            ab44b49a39
 Workload version:  9.0.100-manifests.18bf7498

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Users\..\aspnetcore\aspnetcore\.dotnet\sdk\9.0.100-preview.2.24112.1\

.NET workloads installed:
 [wasm-tools]
   Installation Source: SDK 9.0.100-preview.2
   Manifest Version:    9.0.0-preview.2.24115.1/9.0.100-preview.2
   Manifest Path:       C:\Users\..\aspnetcore\aspnetcore\.dotnet\sdk-manifests\9.0.100-preview.2\microsoft.net.workload.mono.toolchain.current\9.0.0-preview.2.24115.1\WorkloadManifest.json
   Install Type:        FileBased

@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 15, 2024
@lewing
Copy link
Member

lewing commented Feb 15, 2024

HostedBlazorWebassemblyApp sample app with threads on - installing workload does not help with the error, why do we link it with workloads?

.NET SDK:
 Version:           9.0.100-preview.2.24112.1
 Commit:            ab44b49a39
 Workload version:  9.0.100-manifests.18bf7498

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Users\..\aspnetcore\aspnetcore\.dotnet\sdk\9.0.100-preview.2.24112.1\

.NET workloads installed:
 [wasm-tools]
   Installation Source: SDK 9.0.100-preview.2
   Manifest Version:    9.0.0-preview.2.24115.1/9.0.100-preview.2
   Manifest Path:       C:\Users\..\aspnetcore\aspnetcore\.dotnet\sdk-manifests\9.0.100-preview.2\microsoft.net.workload.mono.toolchain.current\9.0.0-preview.2.24115.1\WorkloadManifest.json
   Install Type:        FileBased

Yeah, I'm not 100% sure this failure is related but making sure the workload is installed for mt will reduce configurations we're testing for MT immediately which will reduce the search space.

@maraf
Copy link
Member

maraf commented Mar 5, 2024

The reported error has the same cause as #98502. MT apps should be working without workload

@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 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.

5 participants