Skip to content

Break on exceptions behaves inconsistently on Blazor WASM apps #42326

@captainsafia

Description

@captainsafia

Break on exceptions behaves unreliably in a Blazor WASM application. I was able to get it working by doing a combination of setting breakpoints before the exception is thrown and pausing on caught exceptions. Of course, I wasn't able to reproduce the exact state I was in when I managed to get it working when drafting the repro notes here.

Configuration

Operating System and Browser
Google Chrome 85.0.4183.102
macOS 10.15.16
Note: Similar behavior was reproduced on Windows and Chromium Edge.

.NET SDK (reflecting any global.json):
Version: 5.0.100-rc.2.20459.6
Commit: 4e6d364bbb

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/5.0.100-rc.2.20459.6/

Host (useful for support):
Version: 5.0.0-rc.2.20458.14
Commit: 482494f

Reproduction Steps

  1. Create a new Blazor WASM project using dotnet new blazorwasm -o Testing.

  2. Open Pages/Counter.razor and add throw new Exception("foo") inside the IncrementCount method.

  3. Run dotnet run and navigate to the Blazor app. Press Alt+Shift+D to open the debugging experience. You'll be directed to relaunch a Chrome session with remote debugging enabled.

  4. Enable "Pause on Exceptions" in the debugger.

  5. Navigate to the counter page and click the increment button.

  6. Observe that the JS exception is thrown in the UI (by Blazor) but not paused on.
    Screen Shot 2020-09-16 at 9 48 23 AM

  7. Enable "Pause on caught exceptions".

  8. Refresh the counter page and click the button again.

  9. Observe that the debugger pauses on every exception but the one thrown.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions