Skip to content

Fix WASM debugger breakpoints not hitting after Terser 5.39+.#123353

Merged
ilonatommy merged 1 commit intodotnet:mainfrom
ilonatommy:fix-debugger
Jan 19, 2026
Merged

Fix WASM debugger breakpoints not hitting after Terser 5.39+.#123353
ilonatommy merged 1 commit intodotnet:mainfrom
ilonatommy:fix-debugger

Conversation

@ilonatommy
Copy link
Member

@ilonatommy ilonatommy commented Jan 19, 2026

Terser 5.39 introduced an optimization that removes console.assert(true, ...) as "unnecessary" https://github.com/terser/terser/blob/master/CHANGELOG.md#v5390.

In runtime we are counting on the assert to keep base64String:

//keep this console.assert, otherwise optimization will remove the assignments

The assert removal caused the base64String to be optimized away, breaking the BrowserDebugProxy's ability to read debugger agent info from the paused scope.

image

This affects net11 debugging, net10 works correctly.

This PR replaces true with !!Date.now() which Terser cannot statically evaluate.

@ilonatommy ilonatommy added this to the 11.0.0 milestone Jan 19, 2026
@ilonatommy ilonatommy requested a review from thaystg January 19, 2026 15:40
@ilonatommy ilonatommy self-assigned this Jan 19, 2026
Copilot AI review requested due to automatic review settings January 19, 2026 15:40
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @thaystg, @dotnet/dotnet-diag
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

This PR fixes a critical bug where WASM debugger breakpoints stopped working after Terser 5.39+ was introduced. Terser 5.39 added an optimization that removes console.assert(true, ...) statements as "unnecessary", which broke the debugger proxy's ability to read variables from paused scopes. The fix replaces the static true value with !!Date.now(), which evaluates to true at runtime but cannot be statically analyzed by Terser.

Changes:

  • Updated two console.assert calls to use !!Date.now() instead of true to prevent Terser optimization
  • Added clear explanatory comments describing why the change was necessary and how the workaround works

@ilonatommy ilonatommy merged commit 5952bf2 into dotnet:main Jan 19, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants