Add CoreCLR on WebAssembly features documentation#124455
Add CoreCLR on WebAssembly features documentation#124455radekdoulik wants to merge 3 commits intodotnet:mainfrom
Conversation
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>
|
Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure |
There was a problem hiding this comment.
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.mdcovering 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>
|
|
||
| ### 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. |
There was a problem hiding this comment.
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.
| 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. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
||
| ### 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. |
There was a problem hiding this comment.
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.
| 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. |
| <WasmEnvironmentVariable Include="COMPlus_LogEnable" Value="1" /> | ||
| <WasmEnvironmentVariable Include="COMPlus_LogToConsole" Value="1" /> | ||
| <WasmEnvironmentVariable Include="COMPlus_LogLevel" Value="10" /> | ||
| <WasmEnvironmentVariable Include="COMPlus_LogFacility" Value="410" /> |
There was a problem hiding this comment.
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.
| <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" /> |
|
|
||
| ### CoreCLR runtime logging | ||
|
|
||
| ```xml |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Add a features document for CoreCLR WASM browser support at
docs/design/coreclr/browser-wasm-coreclr.md, structured similarly to the existingsrc/mono/wasm/features.md.Covers: