Sei sulla pagina 1di 11

http://software.intel.

com/en-us/blogs/2009/09/07/visual-studio-2008-sp1-net-framework-source-
debugging/

Intel® Software Network


Connect with developers and Intel engineers

 Communities
 Downloads
 Tools
 Forums/Blogs
 Resources
 Software Support

English | 中文 | Русский | Français

Login

true

Login ID:

Password:

Remember Me?

Login

New Registration?
Forgot Login ID?
Forgot Password?

2,789 Posts served

8,560 Conversations started

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

 Update on the 915 Graphics WDDM Vista Driver Issue


 Intel Releases Preproduction Windows 7 Graphics Driver
 The C# Programming Language Version 4.0
 Video: Why Intel 915 graphics don't have a WDDM driver for Vista
 ASF and Intel AMT - Spot the differences (part 1)

Blog Roll

 Association for Computing Machinery TechNews (ACM)


 Go Parallel! (Dr. Dobbs)
 HPCwire (Tabor Communications, Inc.)
 insideHPC (John West)
 Joe Duffy's Weblog (Microsoft)
 Microsoft Parallel Programming Development Center (Microsoft Germany)
 MultiCoreInfo.com
 scalability.org (Scalable Informatics)
 Software Dev Blog (Intel Germany)
 Soft Talk Blog (Intel United Kingdom)
 The Moth (Microsoft)

Home › Software Blogs ›

Visual Studio 2008 SP1 .NET Framework


Source Debugging
By Doug Holland (Intel) (242 posts) on September 7, 2009 at 10:51 pm

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.

Here is where the magic begins...

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.

Have fun debugging!!!

Categories: Parallel Programming, Software Engineering

Comments (8)

September 15, 2009 wow i love this


1:15 AM PDT

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

September 15, 2009 Hey Peter,


4:49 PM PDT
I'm glad you liked it :)
404332
Doug
- Doug
Holland (Intel)

Total
Points:
13,505
Status
Points:
13,505

Black Belt

September 15, 2009 Hey Kerem,


4:51 PM PDT
You're right the .net mass downloader does allow you to download the available source code
404332 although, like the source available with the source debugging, it isn't a complete set as some
Doug
assemblies are excluded.
Holland (Intel)

Total Regards,
Points:
13,505 Doug
Status
Points:
13,505
Black Belt

September 15, 2009 Hey Brian,


5:03 PM PDT
As long as you are using the RTM build of Windows 7 or Windows Server 2008 R2 the source
404332 debugging will work for .NET 3.5.
Doug
Holland (Intel)
While I was using earlier builds of Windows 7 and Windows Server 2008 R2 the corresponding
Total PDB's were not uploaded to the public symbol servers. Within the PDB's are references to the
Points: source that allows the debugger to open the appropriate source file for the given .net type
13,505 you're debugging.
Status
Points: In the future when you might be running Windows 7 SP1 or even an early public build of
13,505
Windows 8, neither of which exist today, you will find that the appropriate PDB's are unlikely to
be available on the symbol server. With Windows 7 SP1, they should be available shortly after
the service pack is released to manufacturing although with a pre-release build of Windows the
Black Belt PDB's are unlikely to be uploaded at all.

Regards,

Doug

October 28, 2009 8:05 Doug,


AM PDT
I've been trying to get this working and still no luck. Every time I try to step into the .NET
framework source I get the dialog box asking where the source file is. From a couple of other
blog posts it looks like the source isn't available for the version of the .NET framework on my
box, even though the pdbs are downloaded fine.
Kyle Finley
From the modules window the source version is 2.0.50727.4927. I was curious if this matches
what you have. I'm running Windows 7 Pro build 7600. Not sure what the issue is here but it's
getting frustrating. Any help would be appreciated.

Cheers,
Kyle

November 12, 2009 Hey Kyle,


11:41 PM PST
I'll definitely do what I am able to help you resolve this issue although the source debugging
404332 should work on the Windows 7 final build which you appear to be running.
Doug
Holland (Intel)
Are you attempting to step into classes from the core .net framework, such as the
System.Console class? Beyond the System.dll and mscorlib.dll assemblies there are some
Total other .net framework assemblies for which source isn't available at the present time.
Points:
13,505 Within the modules Window I also have the source version as being 2.0.50727.4927.
Status
Points:
13,505 If you're still unable to get this working then feel free to e-mail me at doug DOT holland AT intel
DOT com and I'll see if we can resolve this for you. I'll be attending PDC next week and so there
may be a delay in the response however...

Black Belt
Regards,

Doug

Trackbacks (3)

 Dew Drop – September 8, 2009 | Alvin Ashcraft's Morning Dew


September 8, 2009 6:31 AM PDT
 Intel Software Network Blogs » Adventures with Typemock Isolator and Mock Objects
December 11, 2009 12:25 PM PST
 Adventures with Typemock Isolator and Mock Objects
December 11, 2009 1:24 PM PST

Leave a comment  

To obtain technical support, please go to Software Support.

Name (required)*

Email (required; will not be displayed on this page)*

Your URL (optional)

Potrebbero piacerti anche