Code Monkey home page Code Monkey logo

netcoredbg's Introduction

Debugger for .NET Core runtime

The debugger provides GDB/MI and VSCode Debug Adapter Protocol and allows to debug .NET apps under .NET Core runtime. Also debugger allows debugging from command line (like as GDB).

Copyright

You can find licensing information in file LICENSE, in root directory of Netcoredbg sources.

Usage

More details about usage of NCDB you can find in CLI manual.

Building from source code

Currently Netcoredbg can be built on Linux, MacOS or Windows. Instructions for building Netcoredbg on each platform is shown below.

Unix

Building of Netcoredbg requires Microsoft's .NET, so currently you can build Netcoredbg only in Linux. Microsoft supports at least few distributions, see details here: https://docs.microsoft.com/en-us/dotnet/core/install/linux

Prerequisites

  1. You need to install cmake, and make or ninja.

  2. You need clang C++ compiler installed (Netcoredbg can't be built with gcc).

  3. Microsoft's .NET runtime should be installed, you can download it here: https://dotnet.microsoft.com/download

  4. May be you need to install some typical developers tools not mentioned here, like git, etc...

  5. It is expected, that Netcoredbg sources placed to some directory;

  6. Optional step: Netcoredbg requires CoreCLR runtime source code, which is typically downloaded automatically, but you can download it from here: https://github.com/dotnet/runtime

    For example, you can check out tag v8.x.

  7. Optional step: Netcoredbg requires .NET SDK, which can be downloaded automatically, but you can download it manually from here: https://dotnet.microsoft.com/download

Compiling

Configure build with the following commands:

user@netcoredbg$ mkdir build
user@netcoredbg$ cd build
user@build$ CC=clang CXX=clang++ cmake ..

For running tests after build has succeed you need to add option -DCMAKE_INSTALL_PREFIX=$PWD/../bin.

To enable the Source-based code coverage feature (https://clang.llvm.org/docs/SourceBasedCodeCoverage.html) add -DCLR_CMAKE_ENABLE_CODE_COVERAGE option.

If you have previously downloaded .NET SDK or CoreCLR sources, then you should modify command line and add following options: -DDOTNET_DIR=/path/to/sdk/dir -DCORECLR_DIR=/path/to/coreclr/sources

If cmake tries to download .NET SDK or CoreCLR sources and fails -- see bullets 6 and 7 above. You can download required files manually.

After configuration has finished, you can build Netcoredbg:

user@netcoredbg$ make
...
user@netcoredbg$ make install

To perform build from scratch (including configuration step) again you should delete artefacts with following commands:

user@build$ cd ..
user@netcoredbg$ rm -rf build src/debug/netcoredbg/bin bin

Directory bin contains "installed" Netcoredbg's binaries for tests. If you have installed Netcoredbg in other place, for example in /usr/local/bin, you should remove it manually: currently Netcoredbg's build system doesn't performs "uninstalling".

Prerequisites and compiling with interop mode support (Linux and Tizen OSes only)

Prerequisites and compiling process are the same as above with following changes:

  1. You need to install libunwind-dev or libunwind-devel package, depends on your distro.

  2. Configure build with the following commands:

user@build$ CC=clang CXX=clang++ cmake .. -DINTEROP_DEBUGGING=1

More details about usage of NCDB you can find in Interop mode.

MacOS

You need install homebrew from here: https://brew.sh/

After this, build instructions are same as for Unix (including prerequisites).

Note: MacOS arm64 build (M1) is community supported and may not work as expected, plus some tests might fail.

Windows

Prerequisites:

  1. Download and install CMake from here: https://cmake.org/download

  2. Download and install Microsoft's Visual Studio 2019 or newer: https://visualstudio.microsoft.com/downloads

    During installation of Visual Studio you should install all options required for C# and C++ development on windows.

  3. Download and install Git, you have few options here:

  1. Checkout Netcoredbg sources to some directory by using git.

  2. This step might be omitted, in this case cmake automatically downloads necessary files. But if it fails, you should then checkout CoreCLR sources to another directory from here: https://github.com/dotnet/runtime

    For example, you can use latest tag v8.x.

  3. This step might be omitted too, and cmake will automatically downloads that it needs. But in case of failure you need download and install .NET SDK from here: https://dotnet.microsoft.com/download

Compiling

Configure the build with the following commands given in Netcoredbg's source tree:

C:\Users\localuser\netcoredbg> md build
C:\Users\localuser\netcoredbg> cd build
C:\Users\localuser\netcoredbg\build> cmake .. -G "Visual Studio 16 2019"

You should run this command from cmd.exe, not from cygwin's shell.

Option -G specifies which instance of Visual Studio should build the project. Note, minimum requirements for netcoredbg build is Visual Studio 2019 version.

If you want to run tests after build succeed, you should add following option: -DCMAKE_INSTALL_PREFIX="%cd%\..\bin"

If you have downloaded .NET SDK or .NET Core sources manually, you should add following options: -DDOTNET_DIR="c:\Program Files\dotnet" -DCORECLR_DIR="path\to\coreclr"

To compile and install give command:

C:\Users\localuser\netcoredbg\build> cmake --build . --target install

To perform build from scratch (including configuration step) again you should delete artefacts with following commands:

C:\Users\localuser\netcoredbg\build>cd ..
C:\Users\localuser\netcoredbg>rmdir /s /q build src\debug\netcoredbg\bin bin

Directory bin contains "installed" Netcoredbg's binaries for tests. If you have installed Netcoredbg in other place, you should remove it manually: currently Netcoredbg's build system doesn't performs "uninstalling".

Running Netcoredbg

In instructions shown above netcoredbg binary and additional libraries will be installed in some directory. For developing purposes (for running tests, debugging, etc...) directory bin in Netcoredbg's source tree is typically used.

Now running the debugger with --help option should look like this:

$ ../bin/netcoredbg --help
.NET Core debugger

Options:
--buildinfo                           Print build info.
--attach <process-id>                 Attach the debugger to the specified process id.
--interpreter=cli                     Runs the debugger with Command Line Interface.
--interpreter=mi                      Puts the debugger into MI mode.
--interpreter=vscode                  Puts the debugger into VS Code Debugger mode.
--command=<file>                      Interpret commands file at the start.
-ex "<command>"                       Execute command at the start
--run                                 Run program without waiting commands
--engineLogging[=<path to log file>]  Enable logging to VsDbg-UI or file for the engine.
                                      Only supported by the VsCode interpreter.
--server[=port_num]                   Start the debugger listening for requests on the
                                      specified TCP/IP port instead of stdin/out. If port is not specified
                                      TCP 4711 will be used.
--log[=<type>]                        Enable logging. Supported logging to file and to dlog (only for Tizen)
                                      File log by default. File is created in 'current' folder.
--version                             Displays the current version.

Basically, to debug .NET code you should run Netcoredbg with the following command line:

$ /path/to/netcoredbg --interpreter=TYPE -- /path/to/dotnet /path/to/program.dll

Notes for developers

Running the tests

You can find detailed instruction how to run tests in test-suite directory, see test-suite/README.md. Basically you just need to build and install Netcoredbg into bin directory (in Netcoredbg source tree) and then change directory to test-suite and run script /run_tests.sh

If you wish to get "Source-based code coverage" report, you can add an -c or --coverage option to the command line, i.e.: ./run_tests.sh -c [[testname1][testname2]..] Note, for that case your build configuration should be done with -DCLR_CMAKE_ENABLE_CODE_COVERAGE option (see above). This feature is currently supported on Unix-like platforms only.

Building and running unit tests

To build unit tests you need to add following option to CMake: -DBUILD_TESTING=ON.

After the build, you can run unit tests by the command: make test.

See details in src/unittests/README.md.

Enabling logs

On Tizen platform Netcoredbg will send logs to the system logger. On other platforms you should specify the file to which logs will be written. This can be done by setting environment variable, example:

export  LOG_OUTPUT=/tmp/log.txt

Each line of the log lines has same format which is described below:

5280715.183 D/NETCOREDBG(P12036, T12036): cliprotocol.cpp: evalCommands(1309) > evaluating: 'source file.txt'
      ^     ^  ^          ^       ^        ^               ^            ^       ^
      |     |  |          |       |        |               |            |       `-- Message itself.
      |     |  |          |       |        |               |            |   
      |     |  |          |       |        |               |            `-- Source line number.
      |     |  |          |       |        |               |    
      |     |  |          |       |        |               `-- This is function name.
      |     |  |          |       |        |
      |     |  |          |       |        `-- This is file name in which logging is performed.
      |     |  |          |       |
      |     |  |          |       `-- This is thread ID.
      |     |  |          |      
      |     |  |          `-- This is process PID
      |     |  |         
      |     |  `-- This program name (always NETCOREDBG).
      |     |
      |     `-- This is log level: E is for error, W is for warnings, D is for debug...
      |
      `--- This is time in seconds from the boot time (might be wrapped around).

Selecting between Debug and Release builds

You can select build type by providing one of the following options for CMake:

  • -DCMAKE_BUILD_TYPE=Debug for debug build (no optimizations, suitable for debugging);

  • -DCMAKE_BUILD_TYPE=Release for release builds (optimized, hard to debug).

By default build system create release builds.

Using address sanitizer

Example:

CC=clang-10 CXX=clang++-10 cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../bin  -DCMAKE_BUILD_TYPE=Debug  -DCORECLR_DIR=/path/to/coreclr -DDOTNET_DIR=/usr/share/dotnet -DASAN=1

Using clang-tidy

Install clang-10. To use clang-tidy modify command used to configure the build:

CC=clang-10 CXX=clang++-10   cmake .. . -DCMAKE_CXX_CLANG_TIDY=clang-tidy-10 -DCMAKE_INSTALL_PREFIX=$PWD/../bin

Then just run make. All errors will be printed to stderr.

See details here: https://blog.kitware.com/static-checks-with-cmake-cdash-iwyu-clang-tidy-lwyu-cpplint-and-cppcheck/

Note: clang-analyzer (scan-build), cpplint, cppcheck, iwyu -- these tools currently will not work with Netcoredbg sources due to miscellaneous problems.

netcoredbg's People

Contributors

0xfk0 avatar ashaurtaev avatar ayuckhulk avatar codeprefect avatar gbalykov avatar github-jane-doe avatar hjleee avatar itn3000 avatar jamsilva avatar mickaelistria avatar o-lek avatar okodron avatar passeride avatar pavel-orekhov avatar randomnoise avatar thanikthedev avatar viewizard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netcoredbg's Issues

netcoredbg just exits after Launch request

Hi,
I just upgraded the version of netcoredbg in vimspector and now with the test application here, netcoredbg just exits after vimspector sends the launch request. Here's the message trace:

2020-11-07 18:23:47,463 - INFO - Starting debug adapter with: {"attach": {"pidProperty": "processId", "pidSelect": "ask"}, "command": ["/Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg", "--interpreter=vscode"], "name": "netcoredbg"}
2020-11-07 18:23:47,469 - INFO - Debug Adapter Started
2020-11-07 18:23:47,470 - 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"}
2020-11-07 18:23:47,474 - DEBUG - Message received: {'seq': 1, 'body': {'capabilities': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True}}, 'event': 'capabilities', 'type': 'event'}
2020-11-07 18:23:47,475 - DEBUG - Message received: {'seq': 2, 'body': {}, 'event': 'initialized', 'type': 'event'}
2020-11-07 18:23:47,475 - DEBUG - Sending Message: {"command": "setBreakpoints", "arguments": {"source": {"name": "Program.cs", "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"}, "breakpoints": [{"line": 9}]}, "sourceModified": false, "seq": 1, "type": "request"}
2020-11-07 18:23:47,475 - DEBUG - Sending Message: {"command": "setExceptionBreakpoints", "arguments": {"filters": []}, "seq": 2, "type": "request"}
2020-11-07 18:23:47,475 - 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'}
2020-11-07 18:23:47,475 - DEBUG - LAUNCH!
2020-11-07 18:23:47,475 - DEBUG - Sending Message: {"command": "launch", "arguments": {"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"}
2020-11-07 18:23:47,478 - INFO - The server has terminated with status -1

As you can see:

  • we start with /Users/ben/.vim/vimspector-conf/gadgets/macos/netcoredbg/netcoredbg --interpreter=vscode
  • Send Initialize: {"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"}
  • Receive capabilities: {'seq': 1, 'body': {'capabilities': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True}}, 'event': 'capabilities', 'type': 'event'}
  • Received initialised event: {'seq': 2, 'body': {}, 'event': 'initialized', 'type': 'event'}
  • Send breakpoints:
    • {"command": "setBreakpoints", "arguments": {"source": {"name": "Program.cs", "path": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/Program.cs"}, "breakpoints": [{"line": 9}]}, "sourceModified": false, "seq": 1, "type": "request"}
    • {"command": "setExceptionBreakpoints", "arguments": {"filters": []}, "seq": 2, "type": "request"}
  • Receive initialise response: {'seq': 3, 'body': {'supportTerminateDebuggee': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True}, 'command': 'initialize', 'request_seq': 0, 'success': True, 'type': 'response'}

All good so far. Then we send the launch request:

  • {"command": "launch", "arguments": {"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"}

But at this point, the netcoredbg process just exits: The server has terminated with status -1.

Do you have any idea what's wrong, or how to debug this?

This tested on macOS with netcoredbg 1.2.0-635 and dotnet 3.1.402. Haven't tried other Ones.

Thanks,
Ben

ref puremourning/vimspector#290

Package for conda-forge

I'd like to package this for conda-forge. Is there any chance you could create a release/tag that we could then distribute?

VSCode protocol configurationDone/launch order

According to official specifications (https://microsoft.github.io/debug-adapter-protocol/overview) debugger should accept first 'configurationDone' request and then 'launch' request.

From my tests seems that I need to send the 'launch' request before 'configurationDone' request to correctly start the debugger.

This is the sequence of configurationDone first and getting an error:

-> {"command":"initialize","seq":1,"type":"Request"}
<- {"body":{},"event":"initialized","seq":1,"type":"event"}
<- {"body":{"supportTerminateDebuggee":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true},"command":"initialize","request_seq":1,"seq":2,"success":true,"type":"response"}
-> {"command":"configurationDone","seq":2,"type":"Request"}
<- {"command":"configurationDone","message":"Failed command 'configurationDone' : 0x80004005","request_seq":2,"seq":3,"success":false,"type":"response"}
-> {"arguments":{},"command":"launch","seq":3,"type":"Request"}
<- {"body":{},"command":"launch","request_seq":3,"seq":4,"success":true,"type":"response"}

while sending 'launch' before 'configurationDone' works fine:

-> {"command":"initialize","seq":1,"type":"Request"}
<- {"body":{},"event":"initialized","seq":1,"type":"event"}
<- {"body":{"supportTerminateDebuggee":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true},"command":"initialize","request_seq":1,"seq":2,"success":true,"type":"response"} {"arguments":{},"command":"launch","seq":2,"type":"Request"}
<- {"body":{},"command":"launch","request_seq":2,"seq":3,"success":true,"type":"response"} {"command":"configurationDone","seq":3,"type":"Request"}
<- {"body":{},"command":"configurationDone","request_seq":3,"seq":4,"success":true,"type":"response"}
<- {"body":{"module":{"id":"341dfe22-562e-4db3-8729-b233a8cd1a5f","name":"System.Private.CoreLib.dll","path":"C:\\Program Files\\dotnet\\shared\\Microsoft.NETCore.App\\2.1.6\\System.Private.CoreLib.dll","symbolStatus":"Skipped loading symbols."},"reason":"new"},"event":"module","seq":5,"type":"event"}
....

Is there any error on my side?

netcoredbg exits on macOS after upgrading to netcoredbg 1.2.0-767

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?

Debugger unhandled exception occuring on non-English symbols

Hello, I'm getting this exception thrown by debugger when I'm trying to debug my 'vscode'-debuggable applications:
Console.WriteLine(<some non-English string>); (App or Debug Console) => Exception: -529697949
<set my cursor on non-English element> => Exception: -529697949
In eventvwr.msc I see... =>
Application: netcoredbg.exe CoreCLR Version: 4.6.27817.3 Description: The process was terminated due to an unhandled exception. Exception Info: exception code e06d7363, exception address 00007FFF873FA839 Stack:
In ProcessMonitor I see that these DLLs are missing =>
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.6\ru-RU\mscorrc.debug.dll C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.6\ru-RU\mscorrc.debug.dll.DLL C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.6\ru\mscorrc.debug.dll ...

line breakpoint did not work in vscode with netcoreapp3.0

Overview

I tried to use netcoredbg as vscode's debugger with dotnet sdk-3.0pre3.
I set breakpoint, but vscode did not stop at the breakpoint.

Environment

  • os: win8.1-x64
  • vscode: 1.32.1
  • csharp-extension: 1.17.1
  • omnisharp: 1.32.12-beta9
  • netcoredbg: download from release page
  • dotnetcore-sdk: 3.0.100-preview3-010431

Steps to reproduce

  1. creating new console project with dotnet new console
  2. ensure TargetFramework to netcoreapp3.0
  3. build program with dotnet build
  4. add following setting in launch.json to use netcoredbg
  5. set breakpoint at Console.WriteLine
  6. launch vscode's debug session

launch.json setting is following;

        {
            "name": ".NET Core Launch with netcoredbg",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/consolereadkeytest.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "console": "integratedTerminal",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart",
            "pipeTransport": {
                "pipeCwd": "${workspaceFolder}",
                "pipeProgram": "cmd",
                "pipeArgs": ["/c"],
                "debuggerPath": "g:/bin/netcoredbg/netcoredbg.exe"
            }
        }

(fix "program" to point "netcoreapp3.0" directory)

Expected Result

stop on Console.WriteLine and variables are displayed.

Actual Result

program exited with code 0.

Notes

  • I also tried at TargetFramwork == netcoreapp2.1 and netcoreapp2.2, breakpoint worked expectedly
  • stop at unhandled exception was worked
  • stop with pause button was worked

sending "next" on async/await function returns early

Additional info can be found at puremourning/vimspector#293

Using this minimal program:

using System;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            await DoSomeStuff();
        }

        public static async Task DoSomeStuff()
        {
            Console.WriteLine("Before");
            await Task.Delay(500);
            Console.WriteLine("After");
        }
    }
}

When sending the "next" request to step over the line await Task.Delay(500), the next stack trace response then points to the ending curly brace of the Program.DoSomeStuff function instead of the line Console.WriteLine("After")

Here is what it looks like graphically:
image
Sending "next" request

{"command": "next", "arguments": {"threadId": 119152}, "seq": 15, "type": "request"}

image
The next stack trace response now points the current line at the closing brace instead of the line after the awaited function:

{
    "body": {
        "stackFrames": [
            {
                "column": 9,
                "endColumn": 10,
                "endLine": 20,
                "id": 511753943252992,
                "line": 20,
                "moduleId": "963384f9-3e81-445e-9ecf-224b6b1946c5",
                "name": "test.Program.<DoSomeStuff>d__1.MoveNext()",
                "source": {
                    "name": "Program.cs",
                    "path": "/home/aqez/testyo/Program.cs"
                }
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943252993,
                "line": 0,
                "moduleId": "00e4cc82-435b-478c-b083-227a479f9d7b",
                "name": "System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.__Canon>()"
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943252994,
                "line": 0,
                "moduleId": "00e4cc82-435b-478c-b083-227a479f9d7b",
                "name": "System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<test.Program.<DoSomeStuff>d__1>()"
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943252995,
                "line": 0,
                "moduleId": "963384f9-3e81-445e-9ecf-224b6b1946c5",
                "name": "test.Program.DoSomeStuff()"
            },
            {
                "column": 13,
                "endColumn": 33,
                "endLine": 11,
                "id": 511753943252996,
                "line": 11,
                "moduleId": "963384f9-3e81-445e-9ecf-224b6b1946c5",
                "name": "test.Program.<Main>d__0.MoveNext()",
                "source": {
                    "name": "Program.cs",
                    "path": "/home/aqez/testyo/Program.cs"
                }
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943252997,
                "line": 0,
                "moduleId": "00e4cc82-435b-478c-b083-227a479f9d7b",
                "name": "System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<System.__Canon>()"
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943252998,
                "line": 0,
                "moduleId": "00e4cc82-435b-478c-b083-227a479f9d7b",
                "name": "System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<test.Program.<Main>d__0>()"
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943252999,
                "line": 0,
                "moduleId": "963384f9-3e81-445e-9ecf-224b6b1946c5",
                "name": "test.Program.Main()"
            },
            {
                "column": 0,
                "endColumn": 0,
                "endLine": 0,
                "id": 511753943253000,
                "line": 0,
                "moduleId": "963384f9-3e81-445e-9ecf-224b6b1946c5",
                "name": "test.Program.<Main>()"
            }
        ],
        "totalFrames": 9
    },
    "command": "stackTrace",
    "request_seq": 16,
    "seq": 36,
    "success": true,
    "type": "response"
}

VS Code - Watch - Error when calling methods of an object

Hi, I have the following problem:
when trying to call inside the watch of VS Code a method, for example a.GetHashCode(), I get a Microsoft.CodeAnalysis.Scripting.CompilationErrorException. See image below; I have made a series of toy examples to show you the problem. So the question is: does this happen to you as well? If not, how can I get rid of this error? On my windows 10 machine (on which I have running dotnet 2.1.401) I tried with both: the exe available in the releases link, and the exe generated by compiling netcoredbg on my machine..

a

For a complete error log for the first error in the watch see here below:

Microsoft.CodeAnalysis.Scripting.CompilationErrorException: (1,1): error CS0103: The name 'p' does not exist in the current context
   at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors(DiagnosticBag diagnostics, DiagnosticFormatter formatter)
   at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, Boolean emitDebugInformation, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.GetExecutor(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunAsync(Object globals, Func`2 catchException, CancellationToken cancellationToken)
   at SOS.SymbolReader.EvalExpression(String expr, IntPtr opaque, IntPtr& errorText, Int32& typeId, Int32& size, IntPtr& result)

Thanks in advance for the help.

Breakpoint hit but not highlight the code in .Net Core WebApi

I debug a .net core webapi application in code-server, set the breakpoint at Controller class. It paused at the breakpoint when i request from browser, but the code not highlight, the Call Stack not show the method either.

In the snapshot, breakpoint set at var rng = new Random();

20200720145119

From Debug Console log show setBreakpoints sucess

-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"WeatherForecastController.cs","path":"/home/coder/project/webapidemo/Controllers/WeatherForecastController.cs","checksums":[{"algorithm":"SHA1","checksum":"a5c682ac52a8031e8316527dead42a9d77a5b3ca"},{"algorithm":"SHA256","checksum":"3cd5fc7be889f7ed11dad4727291a7afcbfaf80a91eeea6385948ea044bd298d"},{"algorithm":"SHA1","checksum":"543ac7ce9f0c446b39cc842f78f758fdb9b8a1b9"},{"algorithm":"SHA256","checksum":"532d080bb6470ebe700e4d3ecdd3a33610355f6ebc263ea6e1b70963ecc69bda"}]},"lines":[29],"breakpoints":[{"line":29}],"sourceModified":false},"type":"request","seq":3}
<- (R) {"seq":5,"body":{"breakpoints":[{"id":1,"line":29,"message":"","verified":false}]},"command":"setBreakpoints","request_seq":3,"success":true,"type":"response"}
-> (C) {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
<- (R) {"seq":6,"body":{"breakpoints":[]},"command":"setFunctionBreakpoints","request_seq":4,"success":true,"type":"response"}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":["user-unhandled"]},"type":"request","seq":5}
<- (R) {"seq":7,"body":{"supportsExceptionOptions":false},"command":"setExceptionBreakpoints","request_seq":5,"success":true,"type":"response"}
<- (R) {"seq":8,"body":{},"command":"configurationDone","request_seq":6,"success":true,"type":"response"}

But the stackFrames not contains my code. see the "seq":139.

<- (E) {"seq":136,"body":{"allThreadsStopped":true,"description":"","reason":"breakpoint","text":"","threadId":17678},"event":"stopped","type":"event"}
-> (C) {"command":"threads","type":"request","seq":13}
<- (R) {"seq":137,"body":{"threads":[{"id":17651,"name":"<No name>"}]},"command":"threads","request_seq":13,"success":true,"type":"response"}
-> (C) {"command":"threads","type":"request","seq":14}
<- (R) {"seq":138,"body":{"threads":[{"id":17651,"name":"<No name>"}]},"command":"threads","request_seq":14,"success":true,"type":"response"}
-> (C) {"command":"stackTrace","arguments":{"threadId":17651,"startFrame":0,"levels":20},"type":"request","seq":15}
<- (R) {"seq":139,"body":{"stackFrames":[{"column":0,"endColumn":0,"endLine":0,"id":75810467741696,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Threading.ManualResetEventSlim.Wait()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741697,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Threading.Tasks.Task.SpinThenBlockingWait()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741698,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Threading.Tasks.Task.InternalWaitCore()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741699,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741700,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Runtime.CompilerServices.TaskAwaiter.GetResult()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741701,"line":0,"moduleId":"57b2a5cd-d468-4c19-ba79-131335305fac","name":"Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run()"},{"column":13,"endColumn":51,"endLine":16,"id":75810467741702,"line":16,"moduleId":"4be45882-5c99-4311-869c-538afae641e4","name":"webapidemo.Program.Main()","source":{"name":"Program.cs","path":"/home/coder/project/webapidemo/Program.cs"}}],"totalFrames":7},"command":"stackTrace","request_seq":15,"success":true,"type":"response"}
-> (C) {"command":"continue","arguments":{"threadId":17651},"type":"request","seq":16}
<- (E) {"seq":140,"body":{"allThreadsContinued":true,"threadId":17651},"event":"continued","type":"event"}
<- (R) {"seq":141,"body":{"allThreadsContinued":true,"threadId":17651},"command":"continue","request_seq":16,"success":true,"type":"response"}
<- (E) {"seq":142,"body":{"reason":"exited","threadId":17686},"event":"thread","type":"event"}

I check the log file, there are some Errors

20-07-20 06:48:35 DEBUG > HRESULT ManagedDebugger::GetStackTrace(ICorDebugThread *, int, int, std::vector<StackFrame> &, int &)
20-07-20 06:48:35 ERROR [modules.cpp:351] GetSequencePointByILOffset(info_pair->second.symbols.get(), methodToken, ilOffset, &sequencePoint) : 0x80004005
20-07-20 06:51:54 DEBUG < virtual HRESULT ManagedCallback::CreateThread(ICorDebugAppDomain *, ICorDebugThread *)
20-07-20 06:51:54 DEBUG > virtual HRESULT ManagedDebugger::GetThreads(std::vector<Thread> &)
20-07-20 06:51:54 ERROR [frames.cpp:46] pThread->GetUserState(&corUserState) : 0x80131302

When i create a simple console application, and It works well, so I think the problem only occur in System.Threading.Tasks.Task because it is Asynchronous, the CALL STACK

System.Threading.ManualResetEventSlim.Wait() (Unknown Source:0)
System.Threading.Tasks.Task.SpinThenBlockingWait() (Unknown Source:0)
System.Threading.Tasks.Task.InternalWaitCore() (Unknown Source:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification() (Unknown Source:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult() (Unknown Source:0)
Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run() (Unknown Source:0)
webapidemo.Program.Main() (\home\coder\project\webapidemo\Program.cs:16)

Environment
os: Debian GNU/Linux 10 (x86_64)
dotnetcore-sdk: 3.1.302
netcoredbg: latest releas

Reproduce the issue

  1. Run dotnet new webapi -n webapideom -o webapidemo in shell.
  2. Open vs code and Set breakpoint at the path `Controllers->WeatherForecastController->Get
  3. Debug and Open browser type 'http://localhost:5000/WeatherForecast'

Invalid control characters in JSON payload

I'm sorry I don't have any steps to reproduce this, but a vimspector user reported that there was a json parse error in a response from netcoredbg.

The python json package reports Invalid control character at line/column. It looks like netcoredbg is returning some unescaped shell sequences in the console output.

For example: https://files.gitter.im/5bfc5f15d73408ce4fb023af/dYVd/Screenshot-2021-04-13-at-14.08.57.png

2021-04-13 15:39:08,214 - DEBUG - Message received (raw): {"seq":177, "event":"output","type":"event","body":{"category":"stdout","output":"�[40m�[32minfo�[39m�[22m�[49m: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]\n      User profile is available. Using '/home/anvba/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.\n"}}
2021-04-13 15:39:08,215 - ERROR - Invalid message received: {"seq":177, "event":"output","type":"event","body":{"category":"stdout","output":"�[40m�[32minfo�[39m�[22m�[49m: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]\n      User profile is available. Using '/home/anvba/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.\n"}}
Traceback (most recent call last):
  File "/home/anvba/.vim/plugged/vimspector/python3/vimspector/debug_adapter_connection.py", line 231, in _ReadBody
    message = json.loads( payload )
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 83 (char 82)

Full log attached.

vim_sp_message_line.logs.txt

"Unverified breakpoints" in a docker setup

Hello, thank you for the great work first,

i've been having problems trying to make netcoredbg with VS Code in a docker setup with .NET Core 2.2
here is my launch.json config

 {
             "name": "APIGateway_Attach_Docker",
             "type": "coreclr",
             "request": "attach",
             "sourceFileMap": {
                 "/src": "${workspaceRoot}"
              },
             "processId": "${command:pickRemoteProcess}",
             "pipeTransport": {
                "debuggerPath": "/netcoredbg/netcoredbg",
                "pipeProgram": "docker",
                "pipeCwd": "${workspaceFolder}",
                "quoteArgs": false,
                "pipeArgs": [
                     "exec",
                     "-i",
                     "constellation_apigateway"
                 ]
             }
}

It seems like it correctly attach because if I hit pause here:
image
It will correctly pause the running process and break where it paused:
image
however when trying to attach a breakpoint I get an "unverified breakpoint"
image
Do you know if i'm doing anything wrong ?
I've been using my exact same setup that is working with vsdbg with a Microsoft Visual Studio code distrib

Build with not CoreCLR 3.1 sources are broken.

Note, that 57221dd broke netcoredbg build in case of not CoreCLR 3.1 sources usage. Only build with CoreCLR 3.1 sources are supported now.
Broken build looks like:
https://travis-ci.org/github/Samsung/netcoredbg/jobs/738317489

...
c:\users\travis\build\samsung\netcoredbg\src\debug\netcoredbg\cputil.cpp(116): error C2065: 'CTL_E_OVERFLOW': undeclared identifier [C:\Users\travis\build\Samsung\netcoredbg\build\src\debug\netcoredbg\netcoredbg.vcxproj]
...

We are working on fix at this moment.

What's the best way to debug unit tests?

Pretty much the title. I'd like to be able to step through our unit tests using netcoredbg if possible - what would the command line for that be like? Sorry if this has been asked or seems super basic - I couldn't find anything in issues.

Ship ready-to-use binary

To simplify adoption, it would be nice if netcoredbg could ship pre-built and ready-to-use tarballs or zips containing the binary.

String representation of variable

Hi all,

Having trouble recovering the string/friendly representation of a variable tried using CLI & MI modes.
For CLI:

print ObjectInstance.ToString() -- Not found!

print $"{ObjectInstance}"
^done,
$"{ObjectInstance}" = "NetCoreDbg.Evaluation+ContextVariable"

For MI mode using https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html#GDB_002fMI as source of debugging commands, tested different commands that could of done the trick but many of which are not available, like for example -var-evaluate-expression -data-evaluate-expression -interpreter-exec interpreter


Also it's not clear how does escaping characters works, for example

print dictionary["key"]
^done,
dictionary.key-- Not found!

print dictionary[\"key\"]
^done,
dictionary[\"key\"] -- Not found!

What am I missing? Any help appreciated, thanks!

Documentation

It would be great to have some documentation on each command. I managed to run a few things using the unit tests as an example, but that's less than ideal.

Doesn't need to be a full fledged manual, just a Wiki page can work.

Return capabilites as a result of `initialize`

I see that invocations of initialize will emit the capabilities event. However, the spec also allows to return the capabilities as a response (and even kind of recommends it as the capabilities event isn't at all involved in the sequence described in https://microsoft.github.io/debug-adapter-protocol/specification for "Initialized Event").
Not having capabilities at that time makes processing by clients more complex and error-prone.
Please make the the capabilities are also returned (and not only emitted) as a response to initialize.

Support VSCode's Debug Adapter Protocol

In order to make this debugger easily usable in VSCode and other IDEs (such as Eclipse IDE) supporting the VSCode Debug Adapter Protocol ( https://github.com/Microsoft/vscode-debugadapter-node/tree/master/protocol ), it would be nice to provide the option ot have netcoredbg read/write content conforming to this protocol.
For example, vsdbg has a vsdbg-ui executable which talks over the debug protocol instead of starting gdb console; and OmniSharp simply uses it as debugger in VSCode, which is then able to do most of the work: https://github.com/OmniSharp/omnisharp-vscode/blob/4dd381fa5e4b1e81266d4796d641d1bf2785d2c8/src/coreclr-debug/activate.ts#L155

Problem with debugging simple .Net mvc application

I'm trying to debug simple .Net mvc application which was generated by the command:
dotnet new mvc --no-https --auth None

When I run debug configuration in VS Code, it starts running the application and stops at entry but it freezes at

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
        }

As a result the application doesn't start fully and the debugger is frozen. Any idea what is wrong?

Netcoredbg Log file
https://gist.github.com/svor/13af827c7d00b2577aeb7038a70a6412

VS Code debug configuration

{
    "version": "0.2.0",
    "configurations": [
    
        {
             "name": ".NET Core Launch (console)",
             "type": "coreclr",
             "request": "launch",
             "program": "/home/vsvydenko/tmp/net-core-mvc/bin/Debug/netcoreapp3.0/net-core-mvc.dll",
             "args": [],
             "cwd": "${workspaceFolder}",
             "console": "internalConsole",
             "stopAtEntry": true,
             "internalConsoleOptions": "openOnSessionStart",
 
             "pipeTransport": {
                 "pipeCwd": "${workspaceFolder}",
                 "pipeProgram": "bash",
                 "pipeArgs": ["-c"],
                 "debuggerPath": "/home/vsvydenko/bin/netcoredbg/netcoredbg  --engineLogging=/tmp/a",
                 "quoteArgs": true
             }
         },
     ]
 }

Short video
https://youtu.be/beBx9X_bh6g

Environment
os: Linux Mint 19.3 (x86-64)
dotnetcore-sdk: 3.0.1
netcoredbg: latest releas

Build on Raspberry PI fails at Linking

I get this error when trying to build on Raspberry PI.

Any ideas?

[ 39%] Built target corguids
[ 42%] Linking CXX executable netcoredbg
CMakeFiles/netcoredbg.dir/manageddebugger.cpp.o: In function ManagedCallback::QueryInterface(_GUID const&, void**)': /home/pi/.vs/netcoredbg-master/9103d73c-20b3-4998-995b-f066353b263b/src/src/debug/netcoredbg/manageddebugger.cpp:312: undefined reference to IID_IUnknown'
/home/pi/.vs/netcoredbg-master/9103d73c-20b3-4998-995b-f066353b263b/src/src/debug/netcoredbg/manageddebugger.cpp:312: undefined reference to `IID_IUnknown'
collect2: error: ld returned 1 exit status
src/debug/netcoredbg/CMakeFiles/netcoredbg.dir/build.make:339: recipe for target 'src/debug/netcoredbg/netcoredbg' failed
make[2]: *** [src/debug/netcoredbg/netcoredbg] Error 1
CMakeFiles/Makefile2:124: recipe for target 'src/debug/netcoredbg/CMakeFiles/netcoredbg.dir/all' failed
Makefile:129: recipe for target 'all' failed
make[1]: *** [src/debug/netcoredbg/CMakeFiles/netcoredbg.dir/all] Error 2
make: *** [all] Error 2

No Breakpoints Hit on Simple .NET Core Apps

Environment:
Windows 10.0.19041
VSCodium 1.50
dotnet 3.1.402
netcoredbg latest win64 binary based on auto-release commit

Related Issues:
VSCodium/vscodium#82

Issue:
Attempting to debug a simple .NET Core console application leads to no breakpoints hit. Have reviewed the issue noted above and made changes to use debugger through pipeTransport. Only in the event of setting the stopOnEntry flag do I get a response from the debugger. Also does not work with netcore 2.2.

Using the following launch.json:

{
    "name": ".NET Core Launch (console)",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/sometest.dll",
    "args": [],
    "cwd": "${workspaceFolder}",
    "console": "internalConsole",
    "stopAtEntry": false,
    "logging": {
        "engineLogging": true
    },
    "pipeTransport": {
        "pipeCwd": "${workspaceFolder}",
        "pipeProgram": "cmd",
        "pipeArgs": ["/c"],
        "debuggerPath": "C:/bin/netcoredbg/netcoredbg.exe --engineLogging=C:\\Temp\\a"
    }
}

Logs

On latest Mac OS version, the above works without issue.

Any help would be appreciated as I am not looking to go back to regular vscode or Visual Studio.

path to libdbgshim.so is hardcoded on ARM/Tizen

The fact, that path is hardcoded prevents installing multiple different versions of netcoredbg on the computer (mobile phone, etc...) Especially it's impossible to install, for debugging purposes, particular versions of CoreCLR, CoreFX and netcoredbg in separate directory without touching phone's rootfs.

I think, that path to libdbgshim.so shouldn't be hardcoded, but should be determined by LD_LIBRARY_PATH environment variable, as for other libraries (typical behaviour). And only in case, when libdbgshim.so can't be found in places, where other libraries are searched, only in this case harcoded path should be tried as second option.

No binary generated compiling in MacOS Mojave

I have just tried to compile in MacOS, and it doesn't report any error, but doesn't create the bin folder.

I attach the output of cmake.

Versions: MacOS Mojave 10.14.6
XCode 10.3
cc -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

cmake_output.txt

Not compatible with .NET 5.0

These small patches were required to get it to compile with .NET 5.0:

diff --git a/src/debug/netcoredbg/CMakeLists.txt b/src/debug/netcoredbg/CMakeLists.txt
index 5b21494..4036361 100644
--- a/src/debug/netcoredbg/CMakeLists.txt
+++ b/src/debug/netcoredbg/CMakeLists.txt
@@ -27,6 +27,7 @@ include_directories(${CORECLR_DIR}/src/debug/inc)
 include_directories(${CORECLR_DIR}/src/debug/shim)
 include_directories(${CORECLR_DIR}/src/dlls/dbgshim)
 include_directories(${CORECLR_DIR}/src/coreclr/hosts/inc)
+include_directories(${CORECLR_DIR}/src/hosts/inc)
 
 # Build native part of the debugger
 
diff --git a/src/debug/netcoredbg/cputil.cpp b/src/debug/netcoredbg/cputil.cpp
index a51d448..eb5ca49 100644
--- a/src/debug/netcoredbg/cputil.cpp
+++ b/src/debug/netcoredbg/cputil.cpp
@@ -494,7 +494,6 @@ const char *errormessage(HRESULT hresult)
         CASE_OF(CORDBG_E_UNSUPPORTED_DELEGATE, "The delegate contains a delegate currently not supported by the API.");
         CASE_OF(PEFMT_E_64BIT, "File is PE32+.");
         CASE_OF(PEFMT_E_32BIT, "File is PE32");
-        CASE_OF(NGEN_E_SYS_ASM_NI_MISSING, "NGen cannot proceed because Mscorlib.dll does not have a native image");
         CASE_OF(CLDB_E_INTERNALERROR, "CLDB_E_INTERNALERROR");
         CASE_OF(CLR_E_BIND_ASSEMBLY_VERSION_TOO_LOW, "The bound assembly has a version that is lower than that of the request.");
         CASE_OF(CLR_E_BIND_ASSEMBLY_PUBLIC_KEY_MISMATCH, "The assembly version has a public key token that does not match that of the request.");

However, even with this, there are several linker errors:

ld: CMakeFiles/netcoredbg.dir/manageddebugger.cpp.o: in function `ManagedCallback::QueryInterface(_GUID const&, void**)':
manageddebugger.cpp:(.text._ZN15ManagedCallback14QueryInterfaceERK5_GUIDPPv[_ZN15ManagedCallback14QueryInterfaceERK5_GUIDPPv]+0x10d): undefined reference to `IID_IUnknown'
ld: CMakeFiles/netcoredbg.dir/valuewalk.cpp.o: in function `Evaluator::GetLiteralValue(ICorDebugThread*, ICorDebugType*, ICorDebugModule*, unsigned char const*, unsigned int, void const*, unsigned int, ICorDebugValue**)':
valuewalk.cpp:(.text+0xb243): undefined reference to `g_tkCorEncodeToken'
ld: valuewalk.cpp:(.text+0xb50c): undefined reference to `g_tkCorEncodeToken'
ld: CMakeFiles/netcoredbg.dir/typeprinter.cpp.o: in function `TypePrinter::NameForTypeSig(unsigned char const*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, IMetaDataImport*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
typeprinter.cpp:(.text+0x96f5): undefined reference to `g_tkCorEncodeToken'
ld: typeprinter.cpp:(.text+0xa159): undefined reference to `g_tkCorEncodeToken'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)

Can't change value of variable

I'm using Eclipse aCute which integrated netcoredbg as a debugger in a simple hello world project with a String variable:

using System;

namespace NewDotnetProject
{
    class Program
    {
        static void Main(string[] args)
        {
	    String name = "Alex";
            Console.WriteLine("Hello "+ name);
        }
    }
}

Putting breakpoint on Console.WriteLine value of variable name can not be changed. Is netcoredbg supporting it ? AFAIK Eclipse LSP4E project which provides the integration with DAP does.

Netcoredbg can't be compiled with CoreCLR 3.0

Currently Netcoredbg (from master branch) can't be compiled with CoreCLR 3.0 on Linux.
Steps to reproduce the issue are following (microsoft's dotnet should be installed in /usr/share):

  1. checkout microsoft's CoreCLR from https://github.com/dotnet/coreclr.git, tag v3.0.0-preview4-27612-72 or similar;
  2. build CoreCLR with the following command: ./build.sh -debug -verbose -clang6.0;
  3. checkout Netcoredbg to separate directory from https://github.com/dotnet/coreclr.git, master branch;
  4. change directory to place where Netcoredbg sources reside, make build director, change directory to build;
  5. in build directory run following command to configure Netcoredbg:
    CC=clang-6.0 CXX=clang++-6.0 cmake .. -DCMAKE_INSTALL_PREFIX=/some/path -DCORECLR_DIR=/home/sysop/coreclr.microsoft -DDOTNET_DIR=/usr/share/dotnet -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
  6. run make.

Compilation fails with messages showing, that some types or symbols are not defined.

The issues exists because of absence right #include directives in Netcoredbg's code. Previously required files was included by accident, because some vital include-files included via "assert.h" file, but now system-wide (but not microsoft's one) file is used.

Symbols not loaded for assemblies loaded at runtime from bytes

Hi,
I'm facing a strange issue: seems like that symbols are not loaded when I dynamically load an assembly with overload:
Assembly.Load(bytes[], bytes[])

while are correctly loaded if I use the overload that directly open the file:
Assembly.LoadFile()

(tested with .net core 3.0.100 under windows)

Do you have any hints? great work BTW

Debugger does not work if add a breakpoint

I tried to use netcoredbg with dotnet 2.2.104.
If I don't set breakpoints everything works fine, but if I add one or more breakpoint I'll get an error:

{ 
	command: 'threads',
  	message: 'Failed command \'threads\' : 0x80004005',
  	request_seq: 4,
  	seq: 6,
  	success: false,
  	type: 'response' 
}

Environment

  • os: Fedora 28 Twenty Eight (x86-64)
  • dotnetcore-sdk: 2.2.104
  • netcoredbg: latest releas

Logs

netcoredbg's log file is here: https://raw.githubusercontent.com/svor/files/master/netcodedbg-launch.log

Stepping wrapped debugger causes stdout/stderr reading error

Hi all! appreciate your work with this debugger 🙌

When

Launching the debugger through another C# processes and redirecting it's input/output, and trying to step I would get:

stopped, reason: end stepping range, thread id: 1081, stopped threads: all, frame={
    Main.cs:12  (col: 9 to line: 12 col: 10)
    clr-addr: {module-id {d90e33da-6e69-45f7-a539-d4b98ca3e560}, method-token: 0x06000001 il-offset: 54, native offset: 172}
    WhatEver.Pinocho(), addr: 0x00007f51176726f0
}
^exit
stopped, reason: exited, exit-code: 1
  • More Logs
6893984.915 E/NETCOREDBG(P   7, T   8): ioredirect.cpp: worker(307) > child process stdout/stderr reading error
6893984.915 I/NETCOREDBG(P   7, T   8): ioredirect.cpp: operator(135) > IORedirectHelper::worker: terminated
6893984.929 W/NETCOREDBG(P   7, T  16): waitpid.cpp: waitpid(84) > Process terminated without exiting; can't get exit code. Killed by signal 9. Assuming EXIT_FAILURE.

Reproduce:

  • OS Linux, tested using released package netcoredbg-linux-bionic-amd64_1.2.0-782 (tested older versions too)
  • interpreter=cli
  • Launching the debugger through another C# processes and redirecting it's input/output, example follows. The issue doesn't happen if I don't wrap the debugger with another process for some reason 🤔
  • Net5 debugged program and wrapper program

dotnet wrapper.dll /binaries/for/netcoredbg "--interpreter=cli -ex "run" -- /usr/bin/dotnet /program/to/debug.dll"

Wrapper program:

static void Main(string[] args)
{
    var netcoredbg = args[0];
    var arguments = args[1];

    var process = new Process
    {
        StartInfo = new ProcessStartInfo(netcoredbg, arguments)
        {
            RedirectStandardOutput = true,
            RedirectStandardInput = true,
            RedirectStandardError = true,
            UseShellExecute = false,
            WindowStyle = ProcessWindowStyle.Hidden,
            CreateNoWindow = true
        }
    };
    process.Start();
    process.BeginOutputReadLine();
    process.BeginErrorReadLine();

    process.OutputDataReceived += (sender, outputArgs) =>
    {
        var data = outputArgs.Data;
        if (string.IsNullOrEmpty(data)) return;
        Console.WriteLine($"UNDERLYING::: {data}");
    };
    process.ErrorDataReceived += (sender, outputArgs) =>
    {
        var data = outputArgs.Data;
        if (string.IsNullOrEmpty(data)) return;
        Console.WriteLine($"UNDERLYING::: {data}");
    };

    Task.Factory.StartNew(() =>
    {
            while (true)
            {
                var line = Console.ReadLine();
                process.StandardInput.WriteLine(line);
            }
    });
    process.WaitForExit();
}

Error: SysAllocStringLen not found

Hi and thanks a lot for netcoredbg!

When trying to run a small "Hello World" program FirstVSCode, I get this output in the debug console of VS Code:

Starting: "bash" -c "/usr/bin/netcoredbg --interpreter=vscode"
Error: SysAllocStringLen not found
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.ArgumentOutOfRangeException' in System.Private.CoreLib.dll
Exception thrown: 'System.ArgumentOutOfRangeException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.ArgumentOutOfRangeException' in System.Private.CoreLib.dll
The pipe program 'bash' exited unexpectedly with code 139.

This is my launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
        
            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/FirstVSCode.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "pipeTransport": {
                "pipeCwd": "${workspaceFolder}",
                "pipeProgram": "bash",
                "pipeArgs": ["-c"],
                "debuggerPath": "/usr/bin/netcoredbg"},
              
            "console": "internalConsole"
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

FirstVSCode.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

</Project>

dotnet --version: 3.0.100

code --version:

1.39.2
6ab598523be7a800d7f3eb4d92d7ab9a66069390
x64

I can run the program fine using dotnet run.

I installed netcoredbg from AUR.

I'm on Arch Linux 5.3.6.

Is this an issue with netcoredbg, VS Code, or something else?


For completeness, here's the program:

using System;

namespace FirstVSCode
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello VS Code World!");

            for(int i = 0; i < 10; i++){
                Console.WriteLine($"The count is {i}.");
            }
        }
    }
}

Windows package

We'd like to enable dotnet core debugging on Windows too.
Would it be possible to create a windows distribution just like there is for mac and linux.
(this is currently a low priority request as we have some more work to do on the Eclipse IDE side to enable debugging properly, but a PoC shows it can work well)

Exception specification in declaration does not match previous declaration

Kernel: 5.6.19-2-MANJARO

  1. I downloaded the package from AUR;

  2. I typed in terminal: makepkg -si

  3. And I got the error below:

7/44] Building CXX object src/debug/netcoredbg/CMakeFiles/netcoredbg.dir/manageddebugger.cpp.o

[...]

/home/douglas/Projects/netcoredbg/src/netcoredbg-latest/src/debug/netcoredbg/manageddebugger.cpp:115:7: error: exception specification in declaration does not match previous declaration
pid_t waitpid(pid_t pid, int *status, int options) noexcept
      ^
/usr/include/sys/wait.h:111:16: note: previous declaration is here
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
               ^
1 error generated.
[9/44] Building CXX object src/debug/netcoredbg/CMakeFiles/netcoredbg.dir/symbolreader.cpp.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

Someone can help me? I need to install that in order to use VSCode Debugger.

"Unverified Breakpoint"

Hello,

I am having this weird issue with vscodium where I get breakpoints to break because they are listed as "unverified". The debugger stops itself in a line where intentional exception is thrown. I can start debugging the application from this point on step by step, and as I move to new files, I can set valid breakpoints as long as the debugger is in the same file as the breakpoints. I wonder what is going on here?

Debug Console window cannot accept Console.ReadLine() input during debugging

I'm running code-server in Google Cloud Shell and since code-server cannot run the Microsoft's C# debugger, I'm running netcoredbg.

As mentioned here I updated my launch.json file by adding "console": "integratedTerminal". But I'm still not able to read the input from the debug console and send it to the Console.ReadLine(). The Debug Console prints the current value of the variable entered in the Debug Console.

image

Can someone help to sort out the issue so that I can give input to the Console.ReadLine() from VSCode itself?

Trying to use MI via Emacs, I get notes about unsupported commands?

This might be a problem with the module calling the debugger rather than netcoredbg, when running the debugger I get the following errors:

netcoredbg --interpreter=mi --attach 68528 where 68528 is the PID of my test app.

(gdb)
1^done
(gdb)
2^done
(gdb)
3^done
(gdb)
4^error,msg="Unknown command: enable-pretty-printing"
(gdb)
5^error,msg="Unknown command: file-list-exec-source-files"
(gdb)
6^error,msg="Unknown command: file-list-exec-source-file"
(gdb)
7^error,msg="Error: 0x80004005"
(gdb)
8^error,msg="Unknown command: stack-info-frame"
(gdb)
9^done,threads=[{id="85316",name="<No name>",state="running"},{id="84512",name="<No name>",state="running"}]
(gdb)
10^error,msg="Unknown command: break-list"
(gdb)
11^done,threads=[{id="85316",name="<No name>",state="running"},{id="84512",name="<No name>",state="running"}]
(gdb)
12^error,msg="Unknown command: break-list" 
(gdb)

Are these unsupported MI commands?
I'm also reaching to the debugging tool authors.

Thank you!

The "process" event is not raised

vsdbg raises a "process" event when it launches a new process,

{
    "seq":6,
    "type":"event",
    "event":"process",
    "body":
    {
        "name":"/Users/lextm/consoletest/bin/Debug/netcoreapp2.1/consoletest.dll",
        "systemProcessId":81517,
        "isLocalProcess":true,
        "startMethod":"launch"
    }
}

which allows the editor/IDE talks to vsdbg learning the process information and perform other initialization (such as setting break points).

However, this project does not raise the same event.

Can this be added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.