Problems running sos-commands

Yesterday I tried opening up a standard dump file from a 64-bit Windows 2008 Server. It opened up just fine in windbg, but when I tried executing a command I got the following:

 0:000> !dumpheap -stat
The garbage collector data structures are not in a valid state for traversal.
It is either in the "plan phase," where objects are being moved around, or
we are at the initialization or shutdown of the gc heap. Commands related to 
displaying, finding or traversing objects as well as gc heap segments may not 
work properly. !dumpheap and !verifyheap may incorrectly complain of heap 
consistency errors.
Error requesting GC Heap data
Unable to build snapshot of the garbage collector state

This can happen if both the .NET 4.0 and the .NET 2.0 runtime are loaded in the same process. I actually tried using .loadby on both Framework versions and neither of them returned with an error

 0:000> .loadby sos mscorwks
0:000> .loadby sos clr

The easiest way to resolve this is to run the following command:

 0:000> .cordll -I mscorwks.dll -N -ve

After that, simply reload the extensions you want to use and you should be fine.

Comments

  • Anonymous
    March 22, 2011
    Thanks for sharing this. This is exactly what I'm running into right now. You just saved me a few days of slapping foreheads (mine and coworkers passing by). Oh, the ingenious ways in which WinDBG manages to outsmart me. They never ceize to amaze me ;-) -- Henkk

  • Anonymous
    September 02, 2013
    Thanks for this post.. Helped me a lot.....