Debugging CoreCLR applications in WinDBG
One of the nicest tools that you have as a developer is the ability to debug. WinDBG isn’t what I call the best debugger in the world, but it is certainly among the most powerful. This post is meant just to walk you through setting up WinDBG with a CoreCLR application.
In particular, this is important when you are getting a crash dump from somewhere. In order to actually debug things properly, you need to load the crash dump into WinDBG and then run the following commands:
- .sympath srv*c:\Symbols*https://msdl.microsoft.com/download/symbols
- .load C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.0\sos.dll .
- .reload
The first step is to setup the symbols, so you can see method names, instead of addresses. The second will use the CoreCLR SOS dll (note, if you have different versions, you might need to get the sos.dll from the machine that the user is running along with the dump). And finally you are reloading the symbols (this will be slow on the first time).
That is it, now you can start working with WinDBG relatively normally, although I did notice some some of the commands have better UI. Looks like SOS and SOSEX had a meeting .
Comments
Definitely a life saver sometimes for those "whats going on!?" production issues.
I've collected a few commands/tips that are useful too:
A shorter version for step 2 would be: ".loadby sos coreclr", it means load the extension from the directory of the "coreclr" dll.
Comment preview