Lyze
Lyze

Reputation: 395

debug a dotnet core program in terminal

I’ve recently setup omnisharp with nvim and wanted to try to develope a dotnet core application without the help of VS/rider/vs code.

Now i tried to google around but couldn’t find any real way to debug dotnet core applications from terminal.

What’s the correct way to debug one?

Upvotes: 15

Views: 25292

Answers (2)

Ricardo Fontana
Ricardo Fontana

Reputation: 4813

You can use netcoredbg, a debugger released by the Samsung under the MIT license. The tool suports cli (command line), GDB/MI and VSCode Debug Adapterprotocol.

The sample usage are:

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

They released a guide with more information.

Upvotes: 3

omajid
omajid

Reputation: 15203

Unfortunately, this is going to be a very painful experience. There's no real command line debugger available for .NET Core.

However, CoreCLR developers use a plugin for lldb (on *nix) that teaches lldb about a number of commands that it can use to help debug .NET code.

Essentially:

lldb /path/to/dotnet/dotnet
plugin load /path/to/dotnet/shared/Microsoft.NETCore.App/*/libsosplugin.so
b SystemNative_ReceiveMessage
r run
clrstack

Further documentation:

If you start using it, you will quickly realize how painful this is. It's almost worth using VS/Rider/VSCode just for the debugger, sadly.

Upvotes: 14

Related Questions