Skip to content

Fix WASM EXIT message duplication causing GENERAL_FAILURE exit code#1578

Merged
kotlarmilos merged 1 commit intodotnet:mainfrom
kotlarmilos:fix/wasm-exit-message-parsing
Mar 30, 2026
Merged

Fix WASM EXIT message duplication causing GENERAL_FAILURE exit code#1578
kotlarmilos merged 1 commit intodotnet:mainfrom
kotlarmilos:fix/wasm-exit-message-parsing

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

@kotlarmilos kotlarmilos commented Mar 27, 2026

Problem

The JSON message processor in WasmTestMessagesProcessor.ProcessMessage concatenates payload and arguments fields:

line = logMessage.payload + " " + string.Join(" ", logMessage.arguments ?? ...);

For simple console.log() calls, both payload and arguments[0] contain the same text. This produces duplicated output:

info: WASM EXIT 0 WASM EXIT 0
crit: System.AggregateException: (The input string '0 WASM EXIT 0' was not in a correct format.)
      at WasmTestMessagesProcessor.ProcessMessage(...):line 235
XHarness exit code: 71 (GENERAL_FAILURE)

This manifests on runtime release/8.0-staging (PR #124544) where the older JavaScript console bridge sends WebSocket messages as JSON with both payload and arguments fields.

cc @pavelsavara

The JSON message processor concatenated payload and arguments fields
(payload + " " + arguments), but for simple console.log() calls both
contain the same text. This produced duplicated output like
'WASM EXIT 0 WASM EXIT 0', and int.Parse on the substring threw
FormatException, crashing the message processor with exit code 71.

Use payload alone (fall back to arguments only when payload is null),
and switch to int.TryParse for robustness.

Fixes: dotnet/runtime#124544 (comment)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos kotlarmilos merged commit 28f5ed3 into dotnet:main Mar 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants