John Robbins' Blog

Additional .NET Framework Source Code Debugging Tricks

With the big announcement today, everyone's looking at the Framework sources like mad. Make sure you read everything in Shawn Burke's blog entry before you start. I thought I'd mention a couple of additional hints to help you out.

  1. If you've been downloading your symbols with the Microsoft Symbol Server, make sure to delete your cache directory before you start downloading from the new symbol location.
  2. Shawn says you'll want to check the "Search the above locations only when symbols are loaded manually" in the Options dialog, Debugging, Symbols node. Personally, I think it's much better to leave that unchecked so that you get the symbols and source downloaded automatically. Yes, there will be some slowdowns on the download, but by getting the symbols and source every time you access the item, you'll fill up the cache quicker.
  3. If you're having some trouble getting everything to work, turn on the source server diagnostic messages in the Options dialog, Debugging, General node:

    Also, as you are loading downloading source files by double clicking on them in the call stack window, you can see the path reference location in the status bar.
  4. To get both the new Reference Symbol Server and Microsoft Symbol Server set in your _NT_SYMBOL_PATH environment variable to the following:
    SRV*c:\symbols\OSSymbols*http://referencesource.microsoft.com/symbols;SRV*c:\symbols\OSSymbols*http://msdl.microsoft.com/download/symbols;
  5. For you advanced hackers out there, I tried like crazy to get SYMCHK and PDBSTR to work for pre-downloading and bulk source extraction working, but with no luck at all. It appears that the WinDBG tools don't have support for source servers that use http downloads, but the QFE added that support to Visual Studio 2008. (See my article if you don't know what I'm talking about.)

Hope that helps you out!

[Edit 2/14/08 - Changed symbol path in Step 4 as I pasted it in wrong.]

On Jan 16 2008 6:16 PMBy jrobbins With 10 Comments

Comments (10)

  1. keremskusmezer@gmail.com

    Hi John,

    I developed a tool which allows the download of the framework source code without VS2008.
    It also enables me to debug the framework source code under VS2005.
    I want to release the source code and the tool himself under LGPL.

    What is the legal status on the Microsoft side for such a tool?
    As far as i see from the licence, there is no such a term that disallows this.

    I have succedded in mass downloading the source files.
    Contact me for details, so we can publish it together if you want.

    I am now in contact with Shawn Burke about the details.

  2. keremskusmezer@gmail.com

    I have the downloaded source code tool, i am just waiting approval for microsoft, please contact me so i can share the mass downloading details with you.

    I am a big fan of your book Debugging Microsoft® .NET 2.0 Applications, so i will for sure share the source code for mass download with you :)

  3. Hi John,

    when I try to use SRV*c:\symbols\OSSymbols*http://referencesource.microsoft.com/symbols*http://msdl.microsoft.com, Visual Studio does not download the symbols at all.

    Instead when I run WinDbg, I get this error for symbols loading:

    SYMSRV: http://referencesource.microsoft.com/symbols is followed by http://msdl.microsoft.com/download/symbols.
    SYMSRV: Any HTTP store must be the last store in the list.

    When I remove http://msdl.microsoft.com/download/symbols I am able to dowload .NET Framework source files, but then the rest of the symbols does not work.

    How can I enable both scenarios to work in Visual Studio 2008?

    How can one debug .NET source files in WinDbg?

    Thanks!
    Martin Kulov

  4. I think the syntax for your _NT_SYMBOL_PATH is incorrect:

    SRV*c:\symbols\OSSymbols*http://referencesource.microsoft.com/symbols*http://msdl.microsoft.com/download/symbols

    Should be

    SRV*c:\symbols\OSSymbols*http://referencesource.microsoft.com/symbols;SRV*C:\http://msdl.microsoft.com/download/symbols

  5. It is not working on my Vista developing machine: I can get the symbols and load them, but I cannot step into the source code (it keeps saying it's not available).
    It all works well on a WIndows XP machine.

  6. I'm having the same issue as Alessandro.
    It seems that, on my Vista machine, the (target)directory where the sources are being put, is not created if it does n't exist.
    on XP, there are no problems.
    It is impossible for me to create the target-directory myself in advance, because I do not know what the target-directory will be.

  7. All,

    Honestly, I've found the .NET Reference Source stepping to be kind of flaky. To me it feels like the servers hosting the source go up and down all the time.

    I've had some of the same problems you all are mentioning and I don't know how to fix them either. Actually, I do, I use .NET Reflector Pro and that gives me everything without a hassle. Of course, it's commercial so you have to pay for it, but it's worth it.

    - John Robbins

Leave a Comment

Archives

Tags