Debug .NET Source Code
Scott Guthrie announced some weeks ago that Microsoft will offer the source code of the .NET framework. The source code will be released under the Microsoft Reference License (MS-RL) and includes all comments which is very useful.
The last days I had a more deeper look inside. First I tried to create a small ConsoleApplication1 and debug the Console class:
Well, pressing F5 will stop at the breakpoint, but F11 doesn't open the Console.cs which contains the source code of the Console class. To get the .NET source code for System.Console you need to load the symbols for the mscorlib.dll by right-clicking on the Call Stack and select Load Symbols.
The Call Stack will then change from gray line for mscorlib.dll to black:
After loading the symbols for mscorlib.dll you are able to press F11 do step into the Console class. First Visual Studio will display some license dialogs that you have to accept... and the you will see the Console.cs and are able to debug each line.
Upps, I modified the Console.cs (I see the yellow indicator on the left side), but you are not able to compile a new .NET version, of course.
While extending the very simple debug test I tried to debug the XmlDocument class. I added some lines to load an XML fragment:
I started the debugger by pressing F5 and stopped at the breakpoint. Having a look at the call stack I couldn't find the System.Xml.dll, of course. But how can I debug the XmlDocument class now?
What you have to do is loading the symbols for System.Xml.dll. This can be done by opening the Modules window (Debug -> Windows -> Modules or by pressing Ctrl+D, M). In the Modules window you will find the System.Xml.dll, right-click on it and select Load Symbols.
Now you are able to debug the XmlDocument by pressing F11 while in debug mode:
7 Comments
Comments have been disabled for this content.
alerch said
Why do you torture us? What's the URL for the symbol/source server? :)
Michael Schwarz said
Well, because it is not available for public yet. I think end of this year Microsoft will publish the URL for the symbol and source server. I will then write a short post here at my blog with further details, sorry. Michael
Bart P said
Michael I cannot wait for this cool future. Bart
Alex Dresko said
This information doesn't do us much good if we mere mortals can't download the symbols.
Mel Grubb said
Stop rubbing it in, already!
Chinh Do said
End of the year? Ok... I can wait 11 more days :-)
Jake said
Well, the end of the year has come and gone... Any update? Hmm? Please..