Repository navigation
Remove --forward-console support from wasm/browser app host - #130819
Merged
pavelsavara merged 4 commits intoJul 16, 2026
Merged
Conversation
The app host's --forward-console flag set up a WebSocket /console endpoint that received browser console messages (forwarded over WebSocket by the JS runtime) and printed them to the host stdout. This was primarily a workaround for Firefox, since chromedriver/Playwright forward console output natively. Removes the host-side mechanism entirely: the --forward-console CLI option and ForwardConsoleOutput/forwardConsole plumbing, the OnConsoleConnected wiring, the /console endpoints in WebServer/DevServer, and the WasmTestMessagesProcessor/WasmLogMessage types. The JS side (config.forwardConsole) and the xharness side (its own /console handler) are kept in place. Rewires the only in-repo consumers (InterpPgoTests and WasmTemplateTests, both Chrome/Playwright) to capture browser console output into BrowserRunner.OutputLines via page.Console instead of relying on host forwarding.
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the --forward-console option and the host-side WebSocket /console forwarding plumbing from the wasm/browser app host, and updates wasm build tests to rely on Playwright’s native browser-console forwarding instead of the host flag.
Changes:
- Removed
/consoleWebSocket endpoint support from the app host’s web server + dev server startup paths and options wiring. - Stopped writing
forwardConsoleintorunArgs.jsonand removed the associated host-configuration parsing. - Updated Playwright-based wasm build tests to drop
--forward-consoleand capture browser console output viapage.Console.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs | Drops --forward-console from dotnet run invocations used by template tests. |
| src/mono/wasm/Wasm.Build.Tests/InterpPgoTests.cs | Drops --forward-console from dotnet run invocation used by interpreter PGO test. |
| src/mono/wasm/Wasm.Build.Tests/BrowserRunner.cs | Captures Playwright page.Console output into OutputLines to replace reliance on host forwarding. |
| src/mono/wasm/host/WebServerStartup.cs | Removes /console WebSocket route wiring from the legacy web server startup. |
| src/mono/wasm/host/WebServerOptions.cs | Removes the OnConsoleConnected callback from the web server options record. |
| src/mono/wasm/host/RunArgumentsJson.cs | Removes the forwardConsole field from serialized runArgs.json. |
| src/mono/wasm/host/DevServer/DevServerStartup.cs | Removes /console WebSocket interception from the dev server startup pipeline. |
| src/mono/wasm/host/DevServer/DevServerOptions.cs | Removes the OnConsoleConnected callback from the dev server options record. |
| src/mono/wasm/host/BrowserHost.cs | Removes console-forwarding wiring, related factories, and runArgs.json emission for forwardConsole. |
| src/mono/wasm/host/BrowserArguments.cs | Removes the --forward-console CLI option + JSON property parsing. |
| src/mono/wasm/host/WasmTestMessagesProcessor.cs | Deleted (host-side message processing for forwarded console WebSocket payloads). |
| src/mono/wasm/host/WasmLogMessage.cs | Deleted (data contract for forwarded console messages). |
pavelsavara
temporarily deployed
to
copilot-pat-pool
July 15, 2026 20:48 — with
GitHub Actions
Inactive
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
pavelsavara
temporarily deployed
to
copilot-pat-pool
July 15, 2026 20:48 — with
GitHub Actions
Inactive
pavelsavara
marked this pull request as ready for review
July 16, 2026 09:53
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
akoeplinger
approved these changes
Jul 16, 2026
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
maraf
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
--forward-consoleflag (and its supporting infrastructure) from the WebAssembly app host (src/mono/wasm/host/).The app host's
--forward-consoleflag set up a WebSocket/consoleendpoint that received browser console messages — forwarded over a WebSocket by the JS runtime (config.forwardConsole) — and printed them to the host stdout. This was primarily a workaround for Firefox, since chromedriver/Playwright forward browser console output natively.Changes
Host-side removal (full):
BrowserArguments.cs— removed the--forward-consoleCLI option,ForwardConsoleOutputproperty, and its JSON property parsing.RunArgumentsJson.cs— removed theforwardConsolefield (no longer written torunArgs.json).BrowserHost.cs— removed theonConsoleConnectedwiring, theRunConsoleMessagesPumpmethod, and theOnConsoleConnectedargs from the server-option factories.WebServerOptions.cs/DevServer/DevServerOptions.cs— dropped theOnConsoleConnectedmember.WebServerStartup.cs/DevServer/DevServerStartup.cs— removed the/consoleWebSocket endpoints.WasmTestMessagesProcessor.csand its only-consumerWasmLogMessage.cs.Kept in place (intentionally out of scope):
config.forwardConsolehandling in the browser runtime loader,test-main.mjs, etc./consolehandler and message processor.Impacted tests rewired:
InterpPgoTestsandWasmTemplateTestswere the only in-repo consumers ofdotnet run --forward-console. Both run in Chrome via Playwright and previously read the app's console output from the host stdout. They now capture browser console output intoBrowserRunner.OutputLinesviapage.Console(native chromedriver/Playwright forwarding), so they no longer depend on the host flag.Firefox scenarios
All Firefox-relevant console forwarding lives on the JS + xharness side, which is untouched. The commented-out Firefox run-only sample work items in
sendtohelix-browser.targetsand theWasmTestForwardConsolenote inBuildEnvironment.csreference the xharness/JS path, not the host CLI flag, so they are unaffected.Note
This PR description was generated with the assistance of GitHub Copilot.