WindDBG : load right extensions
In order to debug .NET applications, Microsoft provides a tool called WinDBG available in “Windows SDK”.
WinDBG is a native debugger and need additional extensions to work with .NET application. These extensions are different based on technology and .NET version (Silverlight / WPF / .NET 2.0 / .NET 4, etc.).
SOS
SOS.dll (Son Of Strike) is a DLL provided by .NET Framework and is available in folder :
C:\Windows\Microsoft.NET\Framework\
The DLL loading is slightly different if your application is a classic .NET 4 application or Silverlight application. Actually Silverlight uses only a subset of .NET Framework based on coreclr.dll and not clr.dll (mscorwks.dll for .NET 2.0). The extension module to load is not the same (clr for .NET 4 and coreclr for Silverlight).
.NET 4 application :
.loadby sos clr
Silverlight application :
.loadby sos coreclr
To get the full list of available commands in SOS, see the associated MSDN page. We’ll see some of these extensions in another article.
SOSEX
SOSEX.dll is an extension developed by Steve Johnson which bring 30 commands. It includes :
!mk
: display managed and non-managed stack!muf
: unassemble a function (IL et ASM)
Unfortunately, SOSEX is linked to clr.dll making its use impossible with Silverlight applications.
SOSEX is available here (x86/x64)
SOSEX loading :
.load sosex
To get the full list of available commands in SOSEX, execute the command :
!help
after loading the extension.
PSSCOR4
PSSCOR4 is a superset of SOS which add some commands. This extension seems to not work as expected in some scenarios as indicated in comments of the previous link.
Note : Thanks to Gaël Covain for his help.