Samsung / netcoredbg

NetCoreDbg is a managed code debugger with MI interface for CoreCLR.
MIT License
825 stars 104 forks source link

netcoredbg exits on macOS after upgrading to netcoredbg 1.2.0-767 #57

Closed puremourning closed 3 years ago

puremourning commented 3 years ago

Hi, after upgrading the version of netcoredbg in Vimspector to 1.2.0-767, netcoredbg exits after the initialize exchange. this does not happen with the previous version (netcoredbg 1.2.0-635).

Here is the log including the full message trace:

2021-04-11 16:44:07,573 - INFO - **** INITIALISING NEW VIMSPECTOR SESSION ****
2021-04-11 16:44:07,573 - INFO - API is: 
2021-04-11 16:44:07,574 - INFO - VIMSPECTOR_HOME = /Users/ben/.vim/vimspector-conf
2021-04-11 16:44:07,574 - INFO - gadgetDir = /Users/ben/.vim/vimspector-conf/gadgets/macos
2021-04-11 16:44:07,574 - INFO - User requested start debug session with {}
2021-04-11 16:44:07,575 - DEBUG - Reading configurations from: None
2021-04-11 16:44:07,575 - DEBUG - Reading configurations from: /Users/ben/.vim/bundle/vimspector/support/test/csharp/.vimspector.json
2021-04-11 16:44:07,576 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.json
2021-04-11 16:44:07,635 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/lldb-vscode.json
2021-04-11 16:44:07,636 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/mono.json
2021-04-11 16:44:07,637 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/netcoredbg.json
2021-04-11 16:44:07,637 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vim-debug-adapter.json
2021-04-11 16:44:07,637 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-cpptools.json
2021-04-11 16:44:07,638 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-javac.json
2021-04-11 16:44:07,638 - DEBUG - Reading gadget config: None
2021-04-11 16:44:11,168 - INFO - User requested start debug session with {}
2021-04-11 16:44:11,169 - DEBUG - Reading configurations from: None
2021-04-11 16:44:11,169 - DEBUG - Reading configurations from: /Users/ben/.vim/bundle/vimspector/support/test/csharp/.vimspector.json
2021-04-11 16:44:11,171 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.json
2021-04-11 16:44:11,227 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/lldb-vscode.json
2021-04-11 16:44:11,228 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/mono.json
2021-04-11 16:44:11,228 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/netcoredbg.json
2021-04-11 16:44:11,229 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vim-debug-adapter.json
2021-04-11 16:44:11,229 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-cpptools.json
2021-04-11 16:44:11,229 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-javac.json
2021-04-11 16:44:11,230 - DEBUG - Reading gadget config: None
2021-04-11 16:44:12,292 - INFO - Configuration: {"adapter": "netcoredbg", "configuration": {"request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true}}
2021-04-11 16:44:12,292 - INFO - Adapter: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "configuration": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp"}, "name": "netcoredbg"}
2021-04-11 16:44:12,293 - DEBUG - min_width/height: 149/55, actual: 272/68 - result: horizontal
2021-04-11 16:44:12,392 - DEBUG - LAUNCH!
2021-04-11 16:44:12,393 - INFO - Starting debug adapter with: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "configuration": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp"}, "name": "netcoredbg"}
2021-04-11 16:44:12,394 - DEBUG - Connection Type: job
2021-04-11 16:44:12,402 - INFO - Debug Adapter Started
2021-04-11 16:44:12,402 - DEBUG - Sending Message: {"command": "initialize", "arguments": {"adapterID": "netcoredbg", "clientID": "vimspector", "clientName": "vimspector", "linesStartAt1": true, "columnsStartAt1": true, "locale": "en_GB", "pathFormat": "path", "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true}, "seq": 0, "type": "request"}
2021-04-11 16:44:12,425 - DEBUG - Message received: {'seq': 1, 'body': {'capabilities': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True, 'supportsSetVariable': True}}, 'event': 'capabilities', 'type': 'event'}
2021-04-11 16:44:12,426 - DEBUG - Message received: {'seq': 2, 'body': {}, 'event': 'initialized', 'type': 'event'}
2021-04-11 16:44:12,426 - DEBUG - Sending Message: {"command": "setBreakpoints", "arguments": {"source": {"name": "Program.cs", "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"}, "breakpoints": [{"line": 31}]}, "sourceModified": false, "seq": 1, "type": "request"}
2021-04-11 16:44:12,426 - DEBUG - Sending Message: {"command": "setExceptionBreakpoints", "arguments": {"filters": []}, "seq": 2, "type": "request"}
2021-04-11 16:44:12,426 - DEBUG - Message received: {'seq': 3, 'body': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True, 'supportsSetVariable': True}, 'command': 'initialize', 'request_seq': 0, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,426 - DEBUG - Sending Message: {"command": "launch", "arguments": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp", "request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true, "name": "test"}, "seq": 3, "type": "request"}
2021-04-11 16:44:12,440 - DEBUG - Message received: {'seq': 4, 'body': {'breakpoints': [{'id': 1, 'line': 31, 'message': 'The breakpoint is pending and will be resolved when debugging starts.', 'verified': False}]}, 'command': 'setBreakpoints', 'request_seq': 1, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,440 - DEBUG - Breakpoints at this point: {
  "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs": [
    {
      "id": 1,
      "line": 31,
      "message": "The breakpoint is pending and will be resolved when debugging starts.",
      "verified": false,
      "source": {
        "name": "Program.cs",
        "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"
      }
    }
  ]
}
2021-04-11 16:44:12,440 - DEBUG - Message received: {'seq': 5, 'body': {'supportsExceptionOptions': False}, 'command': 'setExceptionBreakpoints', 'request_seq': 2, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,440 - DEBUG - Sending Message: {"command": "configurationDone", "seq": 4, "type": "request"}
2021-04-11 16:44:12,440 - DEBUG - Message received: {'seq': 6, 'body': {}, 'command': 'launch', 'request_seq': 3, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,444 - INFO - The server has terminated with status -1

As you can see, the netcoredbg ("server") exits with status -1 immediately after sending the response to the launch request.

With the previous version, this is the (working) log:

2021-04-11 16:44:07,573 - INFO - **** INITIALISING NEW VIMSPECTOR SESSION ****
2021-04-11 16:44:07,573 - INFO - API is: 
2021-04-11 16:44:07,574 - INFO - VIMSPECTOR_HOME = /Users/ben/.vim/vimspector-conf
2021-04-11 16:44:07,574 - INFO - gadgetDir = /Users/ben/.vim/vimspector-conf/gadgets/macos
2021-04-11 16:44:07,574 - INFO - User requested start debug session with {}
2021-04-11 16:44:07,575 - DEBUG - Reading configurations from: None
2021-04-11 16:44:07,575 - DEBUG - Reading configurations from: /Users/ben/.vim/bundle/vimspector/support/test/csharp/.vimspector.json
2021-04-11 16:44:07,576 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.json
2021-04-11 16:44:07,635 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/lldb-vscode.json
2021-04-11 16:44:07,636 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/mono.json
2021-04-11 16:44:07,637 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/netcoredbg.json
2021-04-11 16:44:07,637 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vim-debug-adapter.json
2021-04-11 16:44:07,637 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-cpptools.json
2021-04-11 16:44:07,638 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-javac.json
2021-04-11 16:44:07,638 - DEBUG - Reading gadget config: None
2021-04-11 16:44:11,168 - INFO - User requested start debug session with {}
2021-04-11 16:44:11,169 - DEBUG - Reading configurations from: None
2021-04-11 16:44:11,169 - DEBUG - Reading configurations from: /Users/ben/.vim/bundle/vimspector/support/test/csharp/.vimspector.json
2021-04-11 16:44:11,171 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.json
2021-04-11 16:44:11,227 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/lldb-vscode.json
2021-04-11 16:44:11,228 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/mono.json
2021-04-11 16:44:11,228 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/netcoredbg.json
2021-04-11 16:44:11,229 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vim-debug-adapter.json
2021-04-11 16:44:11,229 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-cpptools.json
2021-04-11 16:44:11,229 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-javac.json
2021-04-11 16:44:11,230 - DEBUG - Reading gadget config: None
2021-04-11 16:44:12,292 - INFO - Configuration: {"adapter": "netcoredbg", "configuration": {"request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true}}
2021-04-11 16:44:12,292 - INFO - Adapter: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "configuration": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp"}, "name": "netcoredbg"}
2021-04-11 16:44:12,293 - DEBUG - min_width/height: 149/55, actual: 272/68 - result: horizontal
2021-04-11 16:44:12,392 - DEBUG - LAUNCH!
2021-04-11 16:44:12,393 - INFO - Starting debug adapter with: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "configuration": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp"}, "name": "netcoredbg"}
2021-04-11 16:44:12,394 - DEBUG - Connection Type: job
2021-04-11 16:44:12,402 - INFO - Debug Adapter Started
2021-04-11 16:44:12,402 - DEBUG - Sending Message: {"command": "initialize", "arguments": {"adapterID": "netcoredbg", "clientID": "vimspector", "clientName": "vimspector", "linesStartAt1": true, "columnsStartAt1": true, "locale": "en_GB", "pathFormat": "path", "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true}, "seq": 0, "type": "request"}
2021-04-11 16:44:12,425 - DEBUG - Message received: {'seq': 1, 'body': {'capabilities': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True, 'supportsSetVariable': True}}, 'event': 'capabilities', 'type': 'event'}
2021-04-11 16:44:12,426 - DEBUG - Message received: {'seq': 2, 'body': {}, 'event': 'initialized', 'type': 'event'}
2021-04-11 16:44:12,426 - DEBUG - Sending Message: {"command": "setBreakpoints", "arguments": {"source": {"name": "Program.cs", "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"}, "breakpoints": [{"line": 31}]}, "sourceModified": false, "seq": 1, "type": "request"}
2021-04-11 16:44:12,426 - DEBUG - Sending Message: {"command": "setExceptionBreakpoints", "arguments": {"filters": []}, "seq": 2, "type": "request"}
2021-04-11 16:44:12,426 - DEBUG - Message received: {'seq': 3, 'body': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True, 'supportsSetVariable': True}, 'command': 'initialize', 'request_seq': 0, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,426 - DEBUG - Sending Message: {"command": "launch", "arguments": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp", "request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true, "name": "test"}, "seq": 3, "type": "request"}
2021-04-11 16:44:12,440 - DEBUG - Message received: {'seq': 4, 'body': {'breakpoints': [{'id': 1, 'line': 31, 'message': 'The breakpoint is pending and will be resolved when debugging starts.', 'verified': False}]}, 'command': 'setBreakpoints', 'request_seq': 1, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,440 - DEBUG - Breakpoints at this point: {
  "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs": [
    {
      "id": 1,
      "line": 31,
      "message": "The breakpoint is pending and will be resolved when debugging starts.",
      "verified": false,
      "source": {
        "name": "Program.cs",
        "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"
      }
    }
  ]
}
2021-04-11 16:44:12,440 - DEBUG - Message received: {'seq': 5, 'body': {'supportsExceptionOptions': False}, 'command': 'setExceptionBreakpoints', 'request_seq': 2, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,440 - DEBUG - Sending Message: {"command": "configurationDone", "seq": 4, "type": "request"}
2021-04-11 16:44:12,440 - DEBUG - Message received: {'seq': 6, 'body': {}, 'command': 'launch', 'request_seq': 3, 'success': True, 'type': 'response'}
2021-04-11 16:44:12,444 - INFO - The server has terminated with status -1
2021-04-11 16:44:12,446 - DEBUG - Closing down: Aborting request {'command': 'configurationDone', 'seq': 4, 'type': 'request'}
2021-04-11 16:44:12,446 - INFO - User Msg: Request for configurationDone aborted: Closing down
2021-04-11 16:44:12,449 - DEBUG - No server exit handler
2021-04-11 16:45:10,780 - INFO - Debugging complete.
2021-04-11 16:45:10,781 - DEBUG - Clearing down UI
2021-04-11 16:45:13,052 - INFO - User Msg: Vimspector gadget installation complete!
2021-04-11 16:45:14,329 - INFO - User requested start debug session with {}
2021-04-11 16:45:14,329 - DEBUG - Reading configurations from: None
2021-04-11 16:45:14,330 - DEBUG - Reading configurations from: /Users/ben/.vim/bundle/vimspector/support/test/csharp/.vimspector.json
2021-04-11 16:45:14,331 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.json
2021-04-11 16:45:14,388 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/lldb-vscode.json
2021-04-11 16:45:14,389 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/mono.json
2021-04-11 16:45:14,389 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/netcoredbg.json
2021-04-11 16:45:14,390 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vim-debug-adapter.json
2021-04-11 16:45:14,390 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-cpptools.json
2021-04-11 16:45:14,390 - DEBUG - Reading gadget config: /Users/ben/.vim/vimspector-conf/gadgets/macos/.gadgets.d/vscode-javac.json
2021-04-11 16:45:14,391 - DEBUG - Reading gadget config: None
2021-04-11 16:45:15,678 - INFO - Configuration: {"adapter": "netcoredbg", "configuration": {"request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true}}
2021-04-11 16:45:15,678 - INFO - Adapter: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "configuration": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp"}, "name": "netcoredbg"}
2021-04-11 16:45:15,679 - DEBUG - min_width/height: 149/55, actual: 272/68 - result: horizontal
2021-04-11 16:45:15,802 - DEBUG - LAUNCH!
2021-04-11 16:45:15,803 - INFO - Starting debug adapter with: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "configuration": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp"}, "name": "netcoredbg"}
2021-04-11 16:45:15,803 - DEBUG - Connection Type: job
2021-04-11 16:45:15,812 - INFO - Debug Adapter Started
2021-04-11 16:45:15,812 - DEBUG - Sending Message: {"command": "initialize", "arguments": {"adapterID": "netcoredbg", "clientID": "vimspector", "clientName": "vimspector", "linesStartAt1": true, "columnsStartAt1": true, "locale": "en_GB", "pathFormat": "path", "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true}, "seq": 0, "type": "request"}
2021-04-11 16:45:16,047 - DEBUG - Message received: {'seq': 1, 'body': {'capabilities': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True}}, 'event': 'capabilities', 'type': 'event'}
2021-04-11 16:45:16,047 - DEBUG - Message received: {'seq': 2, 'body': {}, 'event': 'initialized', 'type': 'event'}
2021-04-11 16:45:16,048 - DEBUG - Sending Message: {"command": "setBreakpoints", "arguments": {"source": {"name": "Program.cs", "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"}, "breakpoints": [{"line": 31}]}, "sourceModified": false, "seq": 1, "type": "request"}
2021-04-11 16:45:16,048 - DEBUG - Sending Message: {"command": "setExceptionBreakpoints", "arguments": {"filters": []}, "seq": 2, "type": "request"}
2021-04-11 16:45:16,048 - DEBUG - Message received: {'seq': 3, 'body': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True}, 'command': 'initialize', 'request_seq': 0, 'success': True, 'type': 'response'}
2021-04-11 16:45:16,048 - DEBUG - Sending Message: {"command": "launch", "arguments": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp", "request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true, "name": "test"}, "seq": 3, "type": "request"}
2021-04-11 16:45:16,064 - DEBUG - Message received: {'seq': 4, 'body': {'breakpoints': [{'id': 1, 'line': 31, 'message': 'The breakpoint is pending and will be resolved when debugging starts.', 'verified': False}]}, 'command': 'setBreakpoints', 'request_seq': 1, 'success': True, 'type': 'response'}
2021-04-11 16:45:16,065 - DEBUG - Breakpoints at this point: {
  "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs": [
    {
      "id": 1,
      "line": 31,
      "message": "The breakpoint is pending and will be resolved when debugging starts.",
      "verified": false,
      "source": {
        "name": "Program.cs",
        "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"
      }
    }
  ]
}
2021-04-11 16:45:16,066 - DEBUG - Message received: {'seq': 5, 'body': {'supportsExceptionOptions': False}, 'command': 'setExceptionBreakpoints', 'request_seq': 2, 'success': True, 'type': 'response'}
2021-04-11 16:45:16,066 - DEBUG - Sending Message: {"command": "configurationDone", "seq": 4, "type": "request"}
2021-04-11 16:45:16,066 - DEBUG - Message received: {'seq': 6, 'body': {}, 'command': 'launch', 'request_seq': 3, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,362 - DEBUG - Message received: {'seq': 7, 'body': {}, 'command': 'configurationDone', 'request_seq': 4, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,362 - DEBUG - Sending Message: {"command": "threads", "seq": 5, "type": "request"}
2021-04-11 16:45:17,375 - DEBUG - Message received: {'seq': 8, 'body': {'threads': []}, 'command': 'threads', 'request_seq': 5, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,376 - INFO - User Msg: Protocol error: Server returned no threads
2021-04-11 16:45:17,478 - DEBUG - Message received: {'seq': 9, 'body': {'module': {'id': 'cbf09656-4141-4643-9b7d-f785b9d4a77e', 'name': 'System.Private.CoreLib.dll', 'path': '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.7/System.Private.CoreLib.dll', 'symbolStatus': 'Symbols not found.'}, 'reason': 'new'}, 'event': 'module', 'type': 'event'}
2021-04-11 16:45:17,480 - DEBUG - Message received: {'seq': 10, 'body': {'reason': 'started', 'threadId': 4654089}, 'event': 'thread', 'type': 'event'}
2021-04-11 16:45:17,481 - DEBUG - Sending Message: {"command": "threads", "seq": 6, "type": "request"}
2021-04-11 16:45:17,484 - DEBUG - Message received: {'seq': 11, 'body': {'threads': [{'id': 4654146, 'name': '<No name>'}, {'id': 4654089, 'name': '<No name>'}]}, 'command': 'threads', 'request_seq': 6, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,543 - DEBUG - Message received: {'seq': 12, 'body': {'module': {'id': 'cfef6d56-aea1-4bff-961f-218e6cf66267', 'name': 'csharp.dll', 'path': '/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll', 'symbolStatus': 'Symbols loaded.'}, 'reason': 'new'}, 'event': 'module', 'type': 'event'}
2021-04-11 16:45:17,553 - DEBUG - Message received: {'seq': 13, 'body': {'breakpoint': {'endLine': 31, 'id': 1, 'line': 31, 'message': '', 'source': {'name': 'Program.cs', 'path': '/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs'}, 'verified': True}, 'reason': 'changed'}, 'event': 'breakpoint', 'type': 'event'}
2021-04-11 16:45:17,561 - DEBUG - Message received: {'seq': 14, 'body': {'module': {'id': '7e13846a-8909-4655-a2a4-d40c671844a6', 'name': 'System.Runtime.dll', 'path': '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.7/System.Runtime.dll', 'symbolStatus': 'Symbols not found.'}, 'reason': 'new'}, 'event': 'module', 'type': 'event'}
2021-04-11 16:45:17,601 - DEBUG - Message received: {'seq': 15, 'body': {'allThreadsStopped': True, 'description': '', 'reason': 'entry', 'text': '', 'threadId': 4654089}, 'event': 'stopped', 'type': 'event'}
2021-04-11 16:45:17,602 - WARNING - User Msg: Paused in thread 4654089 due to entry
2021-04-11 16:45:17,609 - DEBUG - Sending Message: {"command": "threads", "seq": 7, "type": "request"}
2021-04-11 16:45:17,622 - DEBUG - Message received: {'seq': 16, 'body': {'threads': [{'id': 4654146, 'name': '<No name>'}, {'id': 4654162, 'name': '<No name>'}, {'id': 4654089, 'name': '<No name>'}]}, 'command': 'threads', 'request_seq': 7, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,622 - DEBUG - Sending Message: {"command": "stackTrace", "arguments": {"threadId": 4654089}, "seq": 8, "type": "request"}
2021-04-11 16:45:17,636 - DEBUG - Message received: {'seq': 17, 'body': {'stackFrames': [{'column': 5, 'endColumn': 6, 'endLine': 30, 'id': 19989160047673344, 'line': 30, 'moduleId': 'cfef6d56-aea1-4bff-961f-218e6cf66267', 'name': 'csharp.Program.Main()', 'source': {'name': 'Program.cs', 'path': '/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs'}}], 'totalFrames': 1}, 'command': 'stackTrace', 'request_seq': 8, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,654 - DEBUG - Sending Message: {"command": "scopes", "arguments": {"frameId": 19989160047673344}, "seq": 9, "type": "request"}
2021-04-11 16:45:17,658 - DEBUG - Message received: {'seq': 18, 'body': {'scopes': [{'name': 'Locals', 'namedVariables': 2, 'variablesReference': 1}]}, 'command': 'scopes', 'request_seq': 9, 'success': True, 'type': 'response'}
2021-04-11 16:45:17,658 - DEBUG - Sending Message: {"command": "variables", "arguments": {"variablesReference": 1}, "seq": 10, "type": "request"}
2021-04-11 16:45:17,672 - DEBUG - Message received: {'seq': 19, 'body': {'variables': [{'evaluateName': 'args', 'name': 'args', 'type': 'string[]', 'value': '{string[0]}', 'variablesReference': 0}, {'evaluateName': 'p', 'name': 'p', 'namedVariables': 1, 'type': 'csharp.Program', 'value': 'null', 'variablesReference': 2}]}, 'command': 'variables', 'request_seq': 10, 'success': True, 'type': 'response'}

After enabling logging in netcoredbg (with --log) I would that it's throwing an exception and exiting.

2417944.303 I/NETCOREDBG(P22162, T4294967295): main.cpp: main(345) > Netcoredbg started
2417944.303 I/NETCOREDBG(P22162, T4294967295): main.cpp: instantiate_protocol(109) > Creating protocol VSCodeProtocol
2417944.303 I/NETCOREDBG(P22162, T4294967295): ioredirect.cpp: worker(145) > worker started
2417944.303 I/NETCOREDBG(P22162, T4294967295): main.cpp: main(372) > pidDebugee 0
2417944.322 I/NETCOREDBG(P22162, T4294967295): vscodeprotocol.cpp: operator(490) > exception '[json.exception.out_of_range.403] key 'env' not found'

It seems that the env key is now mandatory. this happened before with the cwd key. Can we make it not mandatory?

puremourning commented 3 years ago

Hmm it seems that adding the env key doesn't resolve it. In fact, debugging netcoredbg I find that it's crashing in ManagedDebugger::RunProcess:

- Thread 4708883: 1: tid=4708883 (paused)
  1001: 0@@0..0:3
  1006: netcoredbg::ManagedDebugger::RunProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_1::operator()() const@manageddebugger.cpp:1185
  1007: std::__1::result_of<netcoredbg::ManagedDebugger::RunProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_1 ()>::type netcoredbg::IORedirectHelper::exec<netcoredbg::ManagedDebugger::RunProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_1>(netcoredbg::ManagedDebugger::RunProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_1)@ioredirect.h:93
  1008: netcoredbg::ManagedDebugger::RunProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)@manageddebugger.cpp:1184
  1009: netcoredbg::ManagedDebugger::RunIfReady()@manageddebugger.cpp:542
  1010: netcoredbg::ManagedDebugger::ConfigurationDone()@manageddebugger.cpp:582
  1011: netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2::operator()(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&) const@vscodeprotocol.cpp:451
  1012: decltype(std::__1::forward<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2&>(fp)(std::__1::forward<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&>(fp0), std::__1::forward<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&>(fp0))) std::__1::__invoke<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&>(netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)@type_traits:3545
  1013: int std::__1::__invoke_void_return_wrapper<int>::__call<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&>(netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)@__functional_base:317
  1014: std::__1::__function::__alloc_func<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2, std::__1::allocator<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2>, int (nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)>::operator()(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)@functional:1546
  1015: std::__1::__function::__func<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2, std::__1::allocator<netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)::$_2>, int (nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)>::operator()(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)@functional:1720
  1016: std::__1::__function::__value_func<int (nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)>::operator()(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&) const@functional:1873
  1017: std::__1::function<int (nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)>::operator()(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&) const@functional:2548
  1018: netcoredbg::VSCodeProtocol::HandleCommand(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer> const&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer>&)@vscodeprotocol.cpp:708
  1039: netcoredbg::VSCodeProtocol::CommandLoop()@vscodeprotocol.cpp:816
  1044: main@main.cpp:421
  1045: start@@start:4
+ Thread 4708921: 2: tid=4708921 (paused)

This, while handling the configurationDone:

Screenshot 2021-04-11 at 18 32 55

Raw messages which trigger this:

Content-Length: 340\r\n
\r\n
{"command": "initialize", "arguments": {"adapterID": "netcoredbg", "clientID": "vimspector", "clientName": "vimspector", "linesStartAt1": true, "columnsStartAt1": true, "locale": "en_GB", "pathFormat": "path", "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true}, "seq": 0, "type": "request"}Content-Length: 239\r\n
\r\n
{"command": "setBreakpoints", "arguments": {"source": {"name": "Program.cs", "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"}, "breakpoints": [{"line": 31}]}, "sourceModified": false, "seq": 1, "type": "request"}Content-Length: 313\r\n
\r\n
{"command": "launch", "arguments": {"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp", "request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/bin/Debug/netcoreapp2.2/csharp.dll", "args": [], "stopAtEntry": true, "env": {}, "name": "test"}, "seq": 3, "type": "request"}Content-Length: 61\r\n
\r\n
{"command": "configurationDone", "seq": 4, "type": "request"}
puremourning commented 3 years ago

OK so the problem there is simple: the values in g_dbgshim are all NULL:

Screenshot 2021-04-11 at 18 54 49

That may be just the way I'm running it. I'll investigate

puremourning commented 3 years ago

OK well the problem is that _NSGetExecutablePath doesn't work the way it's being used:

Form the help:

/ _NSGetExecutablePath() copies the path of the main executable into the buffer buf. The bufsize parameter should initially be the size of the buffer. This function returns 0 if the path was successfully copied. It returns -1 if the buffer is not large enough, and * bufsize is set to the size required. Note that _NSGetExecutablePath() will return "a path" to the executable not a "real path" to the executable. That is, the path may be a symbolic link and not the real file. With deep directories the total bufsize needed could be more than MAXPATHLEN.

But we're using it like this:

    static span<char> get_exe_path(span<char> buffer)
    {
        uint32_t real_len;
        if (_NSGetExecutablePath(buffer.data(), &real_len) < 0)
            return {};

        if (real_len >= buffer.size())
            return {};

        buffer[real_len] = 0;
        return buffer.subspan(0, real_len);
    }

So:

Also, while this function can return {} for multiple reasons, netcoredebug does not handle that, and just eventually crashes.

This patch fixes it:

diff --git a/src/unix/filesystem_unix.cpp b/src/unix/filesystem_unix.cpp
index ebc0c7e..fbbd78e 100644
--- a/src/unix/filesystem_unix.cpp
+++ b/src/unix/filesystem_unix.cpp
@@ -42,14 +42,11 @@ namespace
 #elif defined(__APPLE__)
     static span<char> get_exe_path(span<char> buffer)
     {
-        uint32_t real_len;
+        uint32_t real_len = buffer.size();
         if (_NSGetExecutablePath(buffer.data(), &real_len) < 0)
             return {};

-        if (real_len >= buffer.size())
-            return {};
-
-        buffer[real_len] = 0;
+        real_len = strlen(buffer.data());
         return buffer.subspan(0, real_len);
     }
 #endif
viewizard commented 3 years ago

Hello, @puremourning this looks also wrong fix for me, we need detect size and allocate buffer in this case. As I see, previously code was:

#if defined(__APPLE__)  
    // On Mac, we ask the OS for the absolute path to the entrypoint executable 
    uint32_t lenActualPath = 0; 
    if (_NSGetExecutablePath(nullptr, &lenActualPath) == -1)    
    {   
        // OSX has placed the actual path length in lenActualPath,  
        // so re-attempt the operation  
        std::string resizedPath(lenActualPath, '\0');   
        char *pResizedPath = const_cast<char *>(resizedPath.data());    
        if (_NSGetExecutablePath(pResizedPath, &lenActualPath) == 0)    
        {   
            return pResizedPath;    
        }   
    }   
    return std::string();   
#else

this looks like proper logic for me. IMO, we need revert this changes.

puremourning commented 3 years ago

Agree 100%

0xfk0 commented 3 years ago

As apple documentation (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dyld.3.html) says: "The bufsize parameter should initially be the size of the buffer". So the real source of the problem, is that real_len isn't assigned initially. I think, @puremourning patch is right.

viewizard commented 3 years ago

I also see in apple documentation: "With deep directories the total bufsize needed could be more than MAXPATHLEN.". In case of changes proposed by @puremourning we will fail in this case.

puremourning commented 3 years ago

Agree with @viewizard - My patch is broken in the case where the returned path > MAXPATHLEN and the code pasted above is not.

viewizard commented 3 years ago

@puremourning this issue should be fixed in upstream now. Could you please check it on macOS?

puremourning commented 3 years ago

I just updated to netcoredbg 1.2.0-782 and get the following:

2021-04-15 17:06:39,835 - DEBUG - Message received: {'seq': 5, 'body': {'supportsExceptionOptions': False}, 'command': 'setExceptionBreakpoints', 'request_seq': 2, 'success': True, 'type': 'response'}
2021-04-15 17:06:39,835 - DEBUG - Sending Message: {"command": "configurationDone", "seq": 4, "type": "request"}
2021-04-15 17:06:39,835 - DEBUG - Message received: {'seq': 6, 'body': {}, 'command': 'launch', 'request_seq': 3, 'success': True, 'type': 'response'}
2021-04-15 17:06:39,849 - DEBUG - Message received: {'seq': 7, 'command': 'configurationDone', 'message': "Failed command 'configurationDone' : 0x80070002", 'request_seq': 4, 'success': False, 'type': 'response'}
2021-04-15 17:06:39,849 - ERROR - Request failed: Failed command 'configurationDone' : 0x80070002

Log:

4978.084 I/NETCOREDBG(P1678, T4294967295): main.cpp: main(346) > Netcoredbg started
4978.085 I/NETCOREDBG(P1678, T4294967295): main.cpp: instantiate_protocol(110) > Creating protocol VSCodeProtocol
4978.085 I/NETCOREDBG(P1678, T4294967295): main.cpp: main(383) > pidDebugee 0
4978.085 I/NETCOREDBG(P1678, T4294967295): ioredirect.cpp: worker(163) > worker started
4978.086 I/NETCOREDBG(P1678, T4294967295): vscodeprotocol.cpp: operator(495) > exception '[json.exception.out_of_range.403] key 'env' not found'
4978.100 E/NETCOREDBG(P1678, T4294967295): manageddebugger.cpp: operator(1228) > g_dbgshim.CreateProcessForLaunch(reinterpret_cast<LPWSTR>(const_cast<WCHAR*>(to_utf16(ss.str()).c_str())), TRUE, outEnv.empty() ? NULL : &outEnv[0], m_cwd.empty() ? NULL : reinterpret_cast<LPCWSTR>(to_utf16(m_cwd).c_str()), &m_processId, &resumeHandle) : 0x80070002
4978.101 E/NETCOREDBG(P1678, T4294967295): ioredirect.cpp: worker(325) > child process stdout/stderr reading error
4978.101 I/NETCOREDBG(P1678, T4294967295): ioredirect.cpp: operator(153) > IORedirectHelper::worker: terminated
viewizard commented 3 years ago

g_dbgshim.CreateProcessForLaunch return 0x80070002 ( IDS_EE_FILE_NOT_FOUND) Is the any chance you could check m_cwd right before g_dbgshim.CreateProcessForLaunch() call? I believe its empty, cleared by this code:

    if (!m_cwd.empty())
        if (!IsDirExists(m_cwd.c_str()) || !SetWorkDir(m_cwd))
            m_cwd.clear();

since SetWorkDir() return false on macOS.

puremourning commented 3 years ago

Err, you know what, this could be 100% me being a complete fool...

(let me just quickly make sure I actually built the app before trying to debug it :/)

puremourning commented 3 years ago

Success!

I had the wrong framework version on this Mac it turned out. Fixed, and now working! Thanks!

Screenshot 2021-04-15 at 18 00 10
viewizard commented 3 years ago

Nice =) But I also found issue in SetWorkDir, that should be fixed now (limited path to MAX_PATH size).

viewizard commented 3 years ago

Fixed in upstream.