Open puremourning opened 3 years ago
Program.cs
:
using System;
namespace csharp
{
class Program
{
string toaster = "Making round of toast";
static int max_bread = 100;
int bread = max_bread;
void PrintToast( int r ) {
int this_round = ( max_bread - bread - r);
Console.WriteLine( this.toaster + ": " + this_round );
}
void MakeToast( int rounds ) {
if (this.bread - rounds < 0) {
throw new Exception( "No moar bread!" );
}
this.bread -= rounds;
for (int r = 0; r < rounds; ++r) {
this.PrintToast( r );
}
Console.WriteLine( "Got only " + this.bread + " left" );
}
static void Main(string[] args)
{
Program p = new Program();
for (int x = 1; x < 10; ++ x) {
p.MakeToast( x );
}
}
}
}
compiled with csc -debug Program.cs
OS: macOS Big Sur
ben@BenMBP csharp % csc -version
3.6.0-4.20224.5 (ec77c100)
ben@BenMBP csharp % mono --version
Mono JIT compiler version 6.12.0.90 (tarball Sun Oct 18 19:07:15 BST 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
Suspend: hybrid
GC: sgen (concurrent by default)
with --log-file
and --trace=response
, this is the log:
21:43:05 waiting for debug protocol on stdin/stdout
21:43:06 C initialize: {
"adapterID": "mono-debug",
"clientID": "vimspector",
"clientName": "vimspector",
"linesStartAt1": true,
"columnsStartAt1": true,
"locale": "en_GB",
"pathFormat": "path",
"supportsVariableType": true,
"supportsVariablePaging": false,
"supportsRunInTerminalRequest": true
}
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 0,
"command": "initialize",
"body": {
"supportsConfigurationDoneRequest": false,
"supportsFunctionBreakpoints": false,
"supportsConditionalBreakpoints": false,
"supportsEvaluateForHovers": false,
"exceptionBreakpointFilters": []
},
"seq": 1,
"type": "response"
}
21:43:06 E initialized: null
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 0,
"command": "initialize",
"body": {
"supportsConfigurationDoneRequest": false,
"supportsFunctionBreakpoints": false,
"supportsConditionalBreakpoints": false,
"supportsEvaluateForHovers": false,
"exceptionBreakpointFilters": []
},
"seq": 1,
"type": "response"
}
21:43:06 C launch: {
"request": "launch",
"program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.exe",
"console": "integratedTerminal",
"cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp",
"args": [],
"env": {},
"name": "test"
}
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 1,
"command": "launch",
"body": null,
"seq": 4,
"type": "response"
}
21:43:06 C setBreakpoints: {
"source": {
"name": "Program.cs",
"path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"
},
"breakpoints": [
{
"line": 31
}
]
}
21:43:06 R: {
"success": false,
"message": "error while processing request 'setBreakpoints' (exception: Cannot perform runtime binding on a null reference)",
"request_seq": 2,
"command": "setBreakpoints",
"body": {
"error": {
"id": 1104,
"format": "error while processing request '{_request}' (exception: {_exception})",
"variables": {
"_request": "setBreakpoints",
"_exception": "Cannot perform runtime binding on a null reference"
},
"showUser": true,
"sendTelemetry": false
}
},
"seq": 5,
"type": "response"
}
21:43:06 R: {
"success": false,
"message": "error while processing request 'setBreakpoints' (exception: Cannot perform runtime binding on a null reference)",
"request_seq": 2,
"command": "setBreakpoints",
"body": {
"error": {
"id": 1104,
"format": "error while processing request '{_request}' (exception: {_exception})",
"variables": {
"_request": "setBreakpoints",
"_exception": "Cannot perform runtime binding on a null reference"
},
"showUser": true,
"sendTelemetry": false
}
},
"seq": 5,
"type": "response"
}
21:43:06 C setExceptionBreakpoints: {
"filters": []
}
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 3,
"command": "setExceptionBreakpoints",
"body": null,
"seq": 6,
"type": "response"
}
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 3,
"command": "setExceptionBreakpoints",
"body": null,
"seq": 6,
"type": "response"
}
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 1,
"command": "launch",
"body": null,
"seq": 4,
"type": "response"
}
21:43:06 C threads: null
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 5,
"command": "threads",
"body": {
"threads": []
},
"seq": 7,
"type": "response"
}
21:43:06 R: {
"success": true,
"message": null,
"request_seq": 5,
"command": "threads",
"body": {
"threads": []
},
"seq": 7,
"type": "response"
}
21:43:06 E terminated: null
21:43:09 C disconnect: {}
21:43:09 R: {
"success": true,
"message": null,
"request_seq": 6,
"command": "disconnect",
"body": null,
"seq": 9,
"type": "response"
}
21:43:09 R: {
"success": true,
"message": null,
"request_seq": 6,
"command": "disconnect",
"body": null,
"seq": 9,
"type": "response"
}
Setting breakpoints is failing using this test program and
vscode-mono-debug
v0.16.2 and a non-vscode client vimspectorThe failure response is:
To break down the flow:
mono Users/ben/.vim/vimspector-conf/gadgets/macos/vscode-mono-debug/bin/Release/mono-debug.exe
2020-11-16 21:20:27,565 - DEBUG - Sending Message: {"command": "initialize", "arguments": {"adapterID": "mono-debug", "clientID": "vimspector", "clientName": "vimspector", "linesStartAt1": true, "columnsStartAt1": true, "locale": "en_GB", "pathFormat": "path", "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true}, "seq": 0, "type": "request"}
2020-11-16 21:20:28,113 - DEBUG - Message received: {'success': True, 'message': None, 'request_seq': 0, 'command': 'initialize', 'body': {'supportsConfigurationDoneRequest': False, 'supportsFunctionBreakpoints': False, 'supportsConditionalBreakpoints': False, 'supportsEvaluateForHovers': False, 'exceptionBreakpointFilters': []}, 'seq': 1, 'type': 'response'}
So far so good.
2020-11-16 21:20:28,114 - DEBUG - Sending Message: {"command": "launch", "arguments": {"request": "launch", "program": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.exe", "console": "integratedTerminal", "cwd": "/Users/ben/.vim/bundle/vimspector/support/test/csharp", "args": [], "env": {}, "name": "test"}, "seq": 1, "type": "request"}
2020-11-16 21:20:28,118 - DEBUG - Message received: {'seq': 2, 'type': 'event', 'event': 'initialized', 'body': None}
2020-11-16 21:20:28,119 - 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": 2, "type": "request"}
2020-11-16 21:20:28,119 - DEBUG - Sending Message: {"command": "setExceptionBreakpoints", "arguments": {"filters": []}, "seq": 3, "type": "request"}
This is where it starts to go wrong.
First, we receive a duplicate response to the
initialize
request:This is bad, but the client just ignores it, so whatever.
We then get a runInTerminal request:
2020-11-16 21:20:28,296 - DEBUG - Message received: {'command': 'runInTerminal', 'arguments': {'kind': 'integrated', 'title': 'Node Debug Console', 'cwd': '/Users/ben/.vim/bundle/vimspector/support/test/csharp', 'args': ['mono', '--debug', '--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:57681', 'Program.exe'], 'env': None}, 'seq': 3, 'type': 'request'}
And send a response
2020-11-16 21:20:28,309 - DEBUG - Sending Message: {"seq": 4, "type": "response", "request_seq": 3, "command": "runInTerminal", "body": {"processId": 74070}, "success": true}
That's all fine, and we get a response to the
launch
request:2020-11-16 21:20:28,310 - DEBUG - Message received: {'success': True, 'message': None, 'request_seq': 1, 'command': 'launch', 'body': None, 'seq': 4, 'type': 'response'}
But then we get rejections for the breakpoints request from earlier:
2020-11-16 21:20:28,332 - DEBUG - Message received: {'success': False, 'message': "error while processing request 'setBreakpoints' (exception: Cannot perform runtime binding on a null reference)", 'request_seq': 2, 'command': 'setBreakpoints', 'body': {'error': {'id': 1104, 'format': "error while processing request '{_request}' (exception: {_exception})", 'variables': {'_request': 'setBreakpoints', '_exception': 'Cannot perform runtime binding on a null reference'}, 'showUser': True, 'sendTelemetry': False}}, 'seq': 5, 'type': 'response'}
But then we get a duplicate of that message:
And finally the exception breakpoints request is accepted:
2020-11-16 21:20:28,336 - DEBUG - Message received: {'success': True, 'message': None, 'request_seq': 3, 'command': 'setExceptionBreakpoints', 'body': None, 'seq': 6, 'type': 'response'}
Subsequently there are other problems like duplicate responses to the
threads
request and such, but the inability to set breakpoints seems the most severe.Full log including DAP trace: