Skip to content

Comments

Add CoreCLR on WebAssembly features documentation#124455

Draft
radekdoulik wants to merge 3 commits intodotnet:mainfrom
radekdoulik:coreclr-wasm-features-doc
Draft

Add CoreCLR on WebAssembly features documentation#124455
radekdoulik wants to merge 3 commits intodotnet:mainfrom
radekdoulik:coreclr-wasm-features-doc

Conversation

@radekdoulik
Copy link
Member

Add a features document for CoreCLR WASM browser support at docs/design/coreclr/browser-wasm-coreclr.md, structured similarly to the existing src/mono/wasm/features.md.

Covers:

  • Configuring browser features (execution model, SIMD, EH, BigInt, threading, HTTP, WebSocket, memory, GC, globalization, MSBuild properties)
  • JavaScript host API and interop
  • Project folder structure
  • Hosting the application (MIME types, CSP)
  • Resources consumed on the target device
  • Key differences from Mono WASM and known limitations
  • Developer tools (building, running, debugging, logging)

Add a features document for CoreCLR WASM browser support, structured
similarly to the existing src/mono/wasm/features.md. Covers configuring
browser features, JavaScript host API, project structure, hosting,
resource consumption, differences from Mono WASM, and developer tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 16, 2026 08:42
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 16, 2026
@radekdoulik radekdoulik added arch-wasm WebAssembly architecture and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 16, 2026
@radekdoulik radekdoulik added this to the Future milestone Feb 16, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial design/features document describing the current state and configuration surface of CoreCLR running in the browser via WebAssembly, intended to parallel existing Mono WASM documentation and point readers to relevant build/debug resources within the repo.

Changes:

  • Introduces docs/design/coreclr/browser-wasm-coreclr.md covering browser feature requirements, hosting concerns, tooling, and CoreCLR-vs-Mono differences.
  • Links to existing build/debug documentation (docs/workflow/building/coreclr/wasm.md) and loader API typings (src/native/corehost/browserhost/loader/dotnet.d.ts).
  • Documents runtime characteristics such as interpreter execution model, memory sizing, globalization/ICU, and known limitations.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


### WebSocket

Applications using the [WebSocketClient](https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocket) managed API require the browser to support the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) API.
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc refers to a "WebSocketClient" managed API, but the type at the linked URL is ClientWebSocket. Rename this to the correct API name to prevent confusion.

Suggested change
Applications using the [WebSocketClient](https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocket) managed API require the browser to support the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) API.
Applications using the [ClientWebSocket](https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocket) managed API require the browser to support the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) API.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 16, 2026 08:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


### WebSocket

Applications using the [WebSocketClient](https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocket) managed API require the browser to support the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) API.
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name should be ClientWebSocket, not WebSocketClient. The text refers to the System.Net.WebSockets.ClientWebSocket class but uses the wrong name in the prose.

Suggested change
Applications using the [WebSocketClient](https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocket) managed API require the browser to support the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) API.
Applications using the [ClientWebSocket](https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocket) managed API require the browser to support the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) API.

Copilot uses AI. Check for mistakes.
Comment on lines +261 to +264
<WasmEnvironmentVariable Include="COMPlus_LogEnable" Value="1" />
<WasmEnvironmentVariable Include="COMPlus_LogToConsole" Value="1" />
<WasmEnvironmentVariable Include="COMPlus_LogLevel" Value="10" />
<WasmEnvironmentVariable Include="COMPlus_LogFacility" Value="410" />
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoreCLR has migrated from the legacy COMPlus_ environment variable prefix to DOTNET_. These logging configuration examples should use the DOTNET_ prefix instead. For example, DOTNET_LogEnable instead of COMPlus_LogEnable, DOTNET_LogToConsole instead of COMPlus_LogToConsole, etc.

Suggested change
<WasmEnvironmentVariable Include="COMPlus_LogEnable" Value="1" />
<WasmEnvironmentVariable Include="COMPlus_LogToConsole" Value="1" />
<WasmEnvironmentVariable Include="COMPlus_LogLevel" Value="10" />
<WasmEnvironmentVariable Include="COMPlus_LogFacility" Value="410" />
<WasmEnvironmentVariable Include="DOTNET_LogEnable" Value="1" />
<WasmEnvironmentVariable Include="DOTNET_LogToConsole" Value="1" />
<WasmEnvironmentVariable Include="DOTNET_LogLevel" Value="10" />
<WasmEnvironmentVariable Include="DOTNET_LogFacility" Value="410" />

Copilot uses AI. Check for mistakes.

### CoreCLR runtime logging

```xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not expect that this is the one right setting for logging to use with wasm. You typically want to tailor it to what you are trying to diagnose.

https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/botr/logging.md is our doc for logging. Perhaps this should be adeed there?

- **GC/Finalizer issues** — Finalizer integration with the browser event loop has known issues ([#123712](https://github.com/dotnet/runtime/issues/123712)).
- **PAL limitations** — No process/signal/pipe support ([#122506](https://github.com/dotnet/runtime/issues/122506)).

## Developer tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be somewhere under docs\workflow . There is no "design" in how to build and debug.

|----------|---------|-------------|
| `RuntimeFlavor` | `Mono` | Set to `CoreCLR` to use CoreCLR runtime |
| `WasmEnableExceptionHandling` | `true` | Enable native WASM exception handling |
| `WasmEnableSIMD` | `true` | Enable WASM SIMD instructions |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier chapter says that WasmEnableSIMD must be enabled for CoreCLR. Why is this important?

| `RuntimeFlavor` | `Mono` | Set to `CoreCLR` to use CoreCLR runtime |
| `WasmEnableExceptionHandling` | `true` | Enable native WASM exception handling |
| `WasmEnableSIMD` | `true` | Enable WASM SIMD instructions |
| `InvariantGlobalization` | `false` | Disable ICU for smaller binary size |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here, duplicated with ICU above

| **Execution** | CoreCLR interpreter (+ RyuJIT AOT in progress) | Mono interpreter + JITerpreter + optional AOT |
| **GC** | CoreCLR workstation GC | Mono SGen GC |
| **Type system** | CoreCLR type system | Mono type system |
| **Assembly loading** | `AssemblyLoadContext` | Mono native loader |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean that AssemblyLoadContext is used for assembly loading? I would expect it to be CoreCLR native loader.

| **Workload** | Not yet available | `wasm-tools` / `wasm-experimental` |
| **Maturity** | Experimental | Production-supported |

### Known limitations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to list the limitations that we expect to stay and that are relevant from user point of view. Work in progress, etc. is not interesting for a design doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants