Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
com/en-us/blogs/2009/09/07/visual-studio-2008-sp1-net-framework-source-
debugging/
Communities
Downloads
Tools
Forums/Blogs
Resources
Software Support
Login
true
Login ID:
Password:
Remember Me?
Login
New Registration?
Forgot Login ID?
Forgot Password?
Navigation
Blog Categories
Meet The Bloggers
Archives
Posts By Category
Academic
Art, Music, & Animation
Bit Stories
Cool Software
Customer Support
Events
Financial Services Industry
Gaming
Intel SW Partner Program
Intel® Atom™ Developer Program
Intel® Software Network 2.0
Manageability
Media
Mobility
Open Source
Parallel Programming
Social Media & Virtual Worlds
Software Engineering
Threading Building Blocks
Virtualization
Visual Computing
What If Software
XML Software
Popular Posts
Blog Roll
One feature of the Visual Studio 2008 SP1 debugger that many .net developers are unaware of is
that it can be used to debug the .net framework source itself. Within the Visual Studio 2008
Options dialog are settings that allow you to use a reference source server provided by Microsoft
that provides access to the source code for the .net framework. In this blog post I'll walk you
through configuring the Visual Studio 2008 SP1 debugger such that you can step into the .net
framework itself.
Start Visual Studio 2008 SP1 and then go to the Tools menu and then select Options and locate
the the General Debugging section as shown here.
Initially we will unselect the Enable Just My Code (Managed only) option which is selected by
default.
Obviously we will want to select the Enable .NET Framework source stepping option.
Visual Studio 2008 SP1 needs to know where to access the framework source code and for this
reason we will select the Enable source server support option.
The Visual Studio 2008 SP1 debugger needs to now know which symbols to use when
debugging and so you'll want to set the Symbols settings as shown here. If you have Visual
Studio 2008 SP1 installed then the Options dialog will look like the following and the two
buttons at the bottom of the page are disabled.
If however you are still using the initial RTM build of Visual Studio 2008 then this Options page
will be somewhat different. In that version there are two check boxes following the text box
where you define the default location to save the symbol files. If you are using the RTM build
and have not applied the SP1 update then leave these check boxes unselected.
When you click OK you'll receive the following warning advising you to only use symbol files
that are from a known and trusted location. Click Yes to continue.
We will now define a new C# console application with which we can test the .NET Framework
source debugging. Call the new project SourceDebugging or some other name of your choice.
Within the Project class we'll add a single statement calling the Console.WriteLine method,
passing some suitable string. Press F9 on that line to create a debugger break point.
We'll now press F5 to begin debugging and you'll notice the debugger begins downloading the
required symbols.
Once the symbols have been successfully downloaded the debugger breaks on the break point as
expected.
Press F11 to step into the Console.WriteLine method and you'll find that Visual Studio 2008
loads the Console.cs source file into another editor Window and breaks within the
InitializeStdOutError method.
You'll notice that you have access to the source code for the Console class although you might
not have expected to have access to the comments within the source too.
Until recently framework source debugging was not working on the RTM builds of Windows 7
and Windows Server 2008 R2 because the required symbols for build 7600 were not available
from the public symbol servers.
If you are using either an earlier build of these operating systems then framework source
debugging is unlikely to work even if you have downloaded the symbols for the build of
Windows you are using. Once you have access to the RTM builds however you'll be debugging
the .NET framework source code without issue.
Comments (8)
peter
September 15, 2009 Check netmassdownloader to download whole source code at once :)
5:22 AM PDT
Kerem Kusmezer
September 15, 2009 Doug, great blog post. Where did you find your information about the issue with .Net source
12:33 PM PDT debugging with Windows 7? Have you heard any work-arounds or updates on when this will be
fixed? Thanks again.
Brian
Brian Ellis
Total
Points:
13,505
Status
Points:
13,505
Black Belt
Total Regards,
Points:
13,505 Doug
Status
Points:
13,505
Black Belt
Regards,
Doug
Cheers,
Kyle
Black Belt
Regards,
Doug
Trackbacks (3)
Leave a comment
Name (required)*