.netlinuxdebugging.net-core

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?


Solution

  • 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.