Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: netcoredbg exception breakpoints are not working #830

Open
mikeboiko opened this issue Jan 19, 2024 · 1 comment
Open

[Bug]: netcoredbg exception breakpoints are not working #830

mikeboiko opened this issue Jan 19, 2024 · 1 comment
Labels
bug Something isn't working Severity 2 The plugin or a workflow is inconvenient or occasionally broken

Comments

@mikeboiko
Copy link

Is your feature request related to a problem? Please describe.
I can't get exception breakpoints to work with C# netcoredbg.
Regular breakpoints are working just fine.

Describe the solution you'd like
When an exception occurs, I would like vimspector to break on the offending line.

Describe alternatives you've considered

Additional context
This is my .vimspector.json config file:

{
  "configurations": {
    "local-test": {
      "adapter": "netcoredbg",
      "variables": {
        "PID": {
          "shell": "bash -c 'pgrep dotnet | tail -n 1'"
        }
      },
      "default": true,
      "configuration": {
        "request": "attach",
        "processId": "${PID}"
      },
      "breakpoints": {
        "exception": {
          "user-unhandled": "Y"
        }
      }
    }
  }
}

When I run :VimspectorDebugInfo, I get:

--------------------------------------------------------------------------------
Server Capabilities: 
--------------------------------------------------------------------------------
{
  "exceptionBreakpointFilters": [
    {
      "filter": "user-unhandled",
      "label": "user-unhandled"
    },
    {
      "filter": "all",
      "label": "all"
    }
  ],
  "supportTerminateDebuggee": true,
  "supportsCancelRequest": true,
  "supportsConditionalBreakpoints": true,
  "supportsConfigurationDoneRequest": true,
  "supportsExceptionFilterOptions": true,
  "supportsExceptionInfoRequest": true,
  "supportsExceptionOptions": false,
  "supportsFunctionBreakpoints": true,
  "supportsSetExpression": true,
  "supportsSetVariable": true,
  "supportsTerminateRequest": true
}
--------------------------------------------------------------------------------
Line Breakpoints: 
--------------------------------------------------------------------------------
{}
--------------------------------------------------------------------------------
Func Breakpoints: 
--------------------------------------------------------------------------------
[]
--------------------------------------------------------------------------------
Ex Breakpoints: 
--------------------------------------------------------------------------------
{
  "filters": []
}
--------------------------------------------------------------------------------
@puremourning
Copy link
Owner

steps to repro:

  1. open support/test/csharp/Program.cs
  2. edit
    void PrintToast( int r ) {
      int this_round = ( max_bread - bread - r);
      if (this_round % 3 == 0) {
        throw new Exception( "No moar bread!" );
      }
      Console.WriteLine( this.toaster + ": " + this_round );
    }
  1. edit support/test/csharp/.vimspector.json and remove all breakpoints blocks
  2. F5

expect: you are asked to set breakpoint options "user-unhandled" and "all"

actual: nothin. the adapter breaks on exception, but you didn't get to control the behaviour.

Explanation:

  • netcoredbg seems to return the 'initialized' event prior to responding to the 'initialize' request. The result is that we try to send exception breakpoints before we got the server capabilities. We need to defer the initialised event handling until after we get the capabilities. fun.

@puremourning puremourning added bug Something isn't working Severity 2 The plugin or a workflow is inconvenient or occasionally broken labels Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Severity 2 The plugin or a workflow is inconvenient or occasionally broken
Projects
None yet
Development

No branches or pull requests

2 participants