Yiru’s got a great piece up on using SOS to debug code that was emitted using Whidbey’s new Lightweight CodeGen feature. Debugging any code written at the IL level can be tricky for anyone who doesn’t have Partition III of ECMA committed to mind. LCG makes it even more fun since the code is generated dynamically, so there’s generally not any source to look at when figuring out the problem. Yiru shows how to use the the SOS commands !DumpMD, !DumpIL and friends to help figure out what is wrong with the emitted method.
As I’ve mentioned a few times before in this blog WinDBG is my debugger of choice, and working with managed code all the time means knowing SOS is a must. I’m always glad to learn a new trick or two about that particular extension.