vimspector icon indicating copy to clipboard operation
vimspector copied to clipboard

[Bug]: netcoredbg exception breakpoints are not working

Open mikeboiko opened this issue 7 months ago • 1 comments

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": []
}
--------------------------------------------------------------------------------

mikeboiko avatar Jan 19 '24 20:01 mikeboiko

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 avatar Jan 19 '24 21:01 puremourning