•   Posted in:
  • .NET

When I am working with WinDbg and .NET I usually using following command to load .NET support Dll into WinDbg:
.cordll -ve -u -l

But in case of .NET Core it does not work. It took me quite some time to figure out what to do. Firstly, install dotnet-sos tool into dotnet:
dotnet tool install -g dotnet-sos

Then activate dotnet-sos tool by execution this command:
dotnet-sos install

And this will copy support dll to C:\Users\<username>\.dotnet\sos\sos.dll, where <username> is your username on this computer. These two commands you need to execute only once per .NET Core version or after tool is updated.

And lastly to load this dll into WinDbg, execute this

How to get to Exception object in .NET when native code calls it

Few day ago, I did investigate crash dump where .NET code raised some exception. Some .NET code called from native host using COM interface. .NET wraps such calls in try catch and return proper HRESULT to caller in native code in case of exception. In my case that .NET method failed and return failed HRESULT. Then due to unforeseen design issues, native code crashed and as result Windows created crash dump and terminated process.

Normally in most native languages when exception is raised, exception object of some kind is created and when exception handled somewhere, this object is destroyed and after that there is no way to