Sunday, February 28, 2010

Exploring undocumented SOS function in Windbg – .NET 4.0

With the new Microsoft .NET Framework 4.0 ,comes a new sos , which adds bunch of features. In this post I will be exploring one of the undocumented function , which is !HandleCLRN. Brian has also mentioned about these undocumented functions.

I guessed it by the name ,it would have to be something about clr notification exception. I knew these exceptions are raised when there is an assembly load.  Here is the simple console application that I am going to be using for exploring this.

01 using System;
02 using System.Collections.Generic;
03 using System.Linq;
04
05 namespace ConsoleApplication1 {
06 class Program {
07 static void Main(string[] args) {
08 Console.WriteLine("Debugging");
09 Console.Read();
10 }
11 }
12 }

Started the exe within windbg. Issued the command

  sxe ld:clrjit

To load the sos after clr is loaded. Then loaded sos by
 
  .loadby sos clr

Note  there is change in the syntax for loading sos in .NET 4.0. Prior to this, clr was part of mscorwks.dll and now it is clr.dll.

Read more: Naveen's Blog

Posted via email from jasper22's posterous