Debug .NET Source Code

Posted by: Ajax.NET Professional, on 19 Dec 2007 | View original | Bookmarked: 0 time(s)

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:

image 

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:

call stack before loading symbols

call stack after loading symbols 

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.

image 

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:

image

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.

image 

Now you are able to debug the XmlDocument by pressing F11 while in debug mode:

image

Advertisement
Category: .NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1081 | Hits: 51

Similar Posts

  • VS 2010 and .NET 4.0 Beta 2 more
  • New article: How to detect and avoid memory and resources leaks in .NET applications more
  • Important releases from Microsoft you may have missed more
  • New Entity Framework Feature CTP for VS2010 Beta 2 more
  • Mark Miller Will Beat You With a Guitar! more
  • Video: CodeRush Metric Shader Plugin more
  • MPI Project Template for VS2010 more
  • Searching and Navigating Code in VS 2010 (VS 2010 and .NET 4.0 Series) more
  • VS2010 Beta 2 : Pin to Source for debugging COOL! But with a caveat more
  • Customizing MaskedInput Transforms more

News Categories

.NET | ADO.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Community Server | dasBlog | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD