Skip to content

Break on exceptions behaves inconsistently on Blazor WASM apps #42326

Closed

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.

Activity

  1. Dotnet-GitSync-Bot commented on Sep 16, 2020

    @Dotnet-GitSync-Bot
    Collaborator

    I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

  2. danroth27 commented on Sep 16, 2020

    @danroth27
    Member
  3. lewing commented on Sep 16, 2020

    @lewing
    Member

    It looks like we're not doing sufficient tracking of the state here. If you change the state of "Pause on exceptions" after navigating to the counter page does it work as expected?

  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 16, 2020
  5. captainsafia commented on Sep 16, 2020

    @captainsafia
    Author

    If you change the state of "Pause on exceptions" after navigating to the counter page does it work as expected?

    Yep. Loading the app, then navigating to the counter page, then Enable exceptions (and set pause on caught exceptions), then hitting the button works as expected.

  6. lewing commented on Sep 16, 2020

    @lewing
    Member

    Ok good. I think we can fix this by tracking the state in the proxy by session, then forcing the runtime to match on load or exception.

  7. thaystg commented on Sep 17, 2020

    @thaystg
    Member

    Working on it...

  8. added this to the 5.0.0 milestone on Sep 18, 2020
  9. assigned and unassigned on Sep 21, 2020
  10. lewing commented on Sep 28, 2020

    @lewing
    Member

    Just to update the status here, we've dug into the issue and it seems that the state of this setting is preserved and communicated to the ui outside of the Debugger protocol and we don't currently have a path to retrieve it so we're it isn't clear how this can be properly fixed. We can track the state better once it has changed so we'll start there.

  11. modified the milestones: 5.0.0, 6.0.0 on Oct 5, 2020
  12. thaystg commented on May 13, 2021

    @thaystg
    Member

    @lewing suggestion: "inject a caught exception and see if we get a pause", I agree that this is possible. Let's try.

  13. lewing commented on Jul 31, 2021

    @lewing
    Member

    @thaystg reopen if this isn't actually fixed.

  14. ghost locked as resolved and limited conversation to collaborators on Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions