locked
VS2010RC - Framework Source Stepping (Cannot find or open the PDB file)

    Question

  • I have a fresh VS2010RC Ultimate install and am trying to get .Net Framework Source Stepping to work. In the Options dialog I enabled 'Enable .NET Framework source stepping', and turned on the Microsoft Symbol Servers setting, even emptied my symbol cache.

    If I then debug a simple Winforms app, right click on system.windows.forms.dll in the Modules window and try to step into a call to set the window Text, it does not step into Framework source.

    Looking at the Modules window I see that System.Windows.Forms.dll shows a Symbol Status of 'Cannot find or open the PDB file.'

    Any idea what is up? I had exactly the same experience with VS2010 Beta 2, so this is getting a bit frustrating that it's not working. Am I doing something wrong?

    Tuesday, February 09, 2010 9:05 PM

Answers

  • FYI I just found this site that I didn't know existed: http://referencesource.microsoft.com/netframework.aspx  Not sure how up to date they keep it but it does have the v4 B2 framework.  I doubt it'll work with the RC though because I assume they've updated the framework since then.

    Michael Taylor - 2/15/2010
    http://msmvps.com/blogs/p3net
    Monday, February 15, 2010 3:49 PM

All replies

  • I remembered I saw the same problem a few days ago. Let me do some more tests and investigations in my side to see if the source debugging works in VS2010. I will report back.


    Regards,
    Ji Zhou
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, February 10, 2010 10:14 AM
  • 2010 RC was just released yesterday.  I don't think the symbol servers have been updated to allow us access to the source yet.  Even for the standard PDBs only a couple of the assemblies are currently published.  There's also the issue that the symbols have to come from the reference server first rather than the public symbol server (I hope that's what the new Microsoft Symbol Server entry does??) otherwise you'll get the PDB that you can't step into.

    Michael Taylor - 2/10/2010
    http://msmvps.com/blogs/p3net
    Wednesday, February 10, 2010 3:09 PM
  • Hmm, that certainly could be it but how do we know when the symbol servers have been updated?
    Thursday, February 11, 2010 8:45 PM
  • Somebody from MS will hopefully let us know but I doubt we'll see the reference servers updated until the final release. 

    Michael Taylor - 2/11/2010
    http://msmvps.com/blogs/p3net
    Friday, February 12, 2010 1:57 AM
  • FYI I just found this site that I didn't know existed: http://referencesource.microsoft.com/netframework.aspx  Not sure how up to date they keep it but it does have the v4 B2 framework.  I doubt it'll work with the RC though because I assume they've updated the framework since then.

    Michael Taylor - 2/15/2010
    http://msmvps.com/blogs/p3net
    Monday, February 15, 2010 3:49 PM
  • Taylor,
      Just chiming in here.  I likewise have just loaded the freshest version of Visual Studio 2010: brand spanking new as of Feb. 23, 2010.  I've come to rely heavily on stepping through the .NET Framework libraries (documentation is good, but the behaviour of some WPF things just aren't covered).  At the moment I'm stuck.  I've tried setting the project to use both the 3.5 and 4.0 version of the Framework but I just can't seem to step into the code.  I saw the site reference above but can't make heads or tails over what to do with it.  Please let me know if there is any more help available on the subject.  Thanks.

    Donald Roy Airey
    Wednesday, February 24, 2010 5:16 PM
  • v4 does not yet appear to be fully supported so you probably can't debug into that.  However the v2.0 and v3.x source is available.  It works under either version of VS.

    My luck with the source stepping is hit and miss.  The entire process isn't, IMHO, well implemented because it really shouldn't be as difficult as it seems to be.  At any rate here are the steps that I take to get things to work (note that this is just to get the source downloaded, once that happens it shouldn't be a big deal thereafter).

    1) Configure the symbol settings
           a) Tools\Options -> Debugging\Symbols
           b) I've had no luck with Microsoft Symbol Servers ever working correctly so I disable this option
           c) For symbol locations I use the following:
                   i. <MySymbolsPath>\Windows - I keep the OS symbols separate from the others
                   ii. http://referencesource.microsoft.com/symbols 
                   iii. http://msdl.microsoft.com/download/symbols - I tend to keep this unchecked unless I need it although I don't know that it matters.
           d) Cache symbols at: <MySymbolsPath>\VisualStudio - I use a subdirectory because occassionally I need to empty the symbol cache and I only want it to blow away the VS files.
           e) Only specified modules - Otherwise VS likes to continually download files and (more importantly) might download the non-source version.
    2) Start up a basic .NET app
            static void Main ( string[] args )
            {
            BP -> DateTime dt = DateTime.Parse("1/1/1980");
            }
    3) Download the source
            a) Start the debugger
            b) When it hits the line switch to the Callstack window
            c) Right-click on any of the mscorlib functions and select Load Symbols From -> Microsoft Symbol Servers
            d) If it works you should be able to right click and Go To Source Code
            e) Now F11 to step into the Parse method and you should be sitting at the source code.

    Ideally it should be easier than this and MS should document what MS Symbols Servers do and how to get this stuff working.  My original thought was that MS SS was their way of adding the 2 http:// entries for us but it doesn't work for me.  It will download the source but when attempting to step into something like Parse it makes me go browse for the source (which is downloaded under a really, really long file path).

    It is my honest opinion that .NET source stepping is a hacked process that needs some real development time and thought to make it part of the core VS tool rather than the flaky behavior we see now.  I hope MS will put more effort into it in the next release.

    Michael Taylor - 2/24/2010
    http://msmvps.com/blogs/p3net

    Wednesday, February 24, 2010 9:40 PM
  • Michael,
      I think I see the issue here.  I have a REALLY squeeky clean environment.  I've got a fresh version of Windows 7 and a fresh copy of Visual Studio 2010.  I don't seem to have any of the .NET Framework 3.5 assemblies around, just 4.0.  Anyone know if it's possible to debug the framework with just 4.0 on their machine?

    Sincerely,

    Donald Roy Airey
    Thursday, February 25, 2010 12:11 AM
  • No it is not possible.  v4 is a completely new runtime with all new core assemblies.  You'll need to install the v3.5 framework before you can even develop apps targeting it.  VS 2010 only ships with the v4 framework.

    Michael Taylor - 2/25/2010
    http://msmvps.com/blogs/p3net
    Thursday, February 25, 2010 2:58 PM
  • Michael,
       Thanks so much for the info.  That's what I suspected and you've saved me a lot of time.  I was able to use Reflector to get what I wanted, but it's not the same as stepping through the code: much more labor involved.

    Ji Zhou,
       You mentioned a while ago that you were going to see about posting the symbols.  Would you please let us know the status?

    Best regards,

    Donald Roy Airey
    Thursday, February 25, 2010 4:32 PM
  • Hello Donald,

    I meant that I saw the same issue that I cannot debug into .NET 4.0 source codes. Michael has provided the answers. The reason is .NET 4.0 is still not released, so the symbols and sources are not available now.


    Regards,
    Ji Zhou



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, March 01, 2010 3:13 AM
  • Ji,

         I now have the production version of Visual Studio 2010.  I have turned on the Microsoft Symbol Server and enabled Enable .NET Framework source stepping.  This feature is still brain damaged.  Please help as stepping through the .NET Framework is essential for people trying to develop WPF on the front-lines.

    Sincerely,

    Donald Roy Airey

    Thursday, April 22, 2010 1:57 PM
  • The reference servers are down.  There is a discussion about getting the mass downloader working with v4 here: http://social.msdn.microsoft.com/Forums/en/refsourceserver/thread/592d23bc-4469-4bfc-a440-605ffe8d75b2

    Michael Taylor - 5/1/2010
    http://msmvps.com/blogs/p3net

     

    Saturday, May 01, 2010 11:34 PM
  • What good is the 'Mass Downloader' if the source file isn't available?

    If you have an inside resourse on the .NET team, would you please ask when we'll have the .NET Framework 4.0 source available?

    Monday, May 03, 2010 2:14 PM
  • We've made some progress. I tried to configure the Source Code Stepping today and it hung the Visual Studio 2010 while downloading the source module.
    Monday, May 17, 2010 9:33 PM
  • UPDATE: The reference source for v4 is available either at the reference source site (given above) or via VS 2010 now.  To get VS2010 to use the source you'll probably need to clear your symbol cache.  Also note that the Microsoft Symbol Server option doesn't seem to use the reference server (at least for me) so you'll probably want to set up the reference server path first followed by the standard MS symbol server.  I have verified that source stepping is working in v4.  Note however that not all assemblies are necessarily published as source.

    Michael Taylor - 6/18/2010
    http://msmvps.com/blogs/p3net

    Friday, June 18, 2010 2:14 PM
  • I still can't get this to work. I just went back into VS2010 and Emptied my Symbol Cache and tried to debug a simple line of code using DateTime.Parse() and it asks me for DateTime.cs (it shows an original location of: f:\dd\ndp\clr\src\BCL\System\DateTime.cs).

     

    Why is this so hard to setup? Or rather, the steps seem simple so why doesn't it 'just work' after I set them?

     

    Any advice?

    Wednesday, June 23, 2010 9:44 PM
  • Frustrating?  Most definitely.  This is made worse by the fact that there is no easy way of knowing what source was or wasn't downloaded and VS will happily download the PDBs in lieu of source if there is a problem.  Once it does that then you won't get source stepping anymore.

    I posted the steps I use and it works every time for me.  You can tell when the source is being downloaded because you'll see a src directory show up.  Most importantly though VS can't find any PDBs for the assembly in question otherwise it will happily load the PDBs instead.  Clearing the symbol cache should have gotten them.

    1. Verify your symbol search path has the reference server first and then the public symbol server (don't use Microsoft Symbol Servers). 
    2. Verify you've enabled source stepping in the debugger options.
    3. Set a BP on the Parse line.
    4. When the BP is hit right-click mscorlib in Call Stack and select Load Symbols\Symbol Path
    5. Once the symbols are loaded you should have the option in the context menu (in the Call Stack) to Go to Source.  If you don't then it didn't work.
    6. Worse comes to worse you can download the entire source tree from the link I gave earlier but the installer wants a path and I'm personally not sure how to go about installing it such that it won't: a) conflict with existing symbols, b) allow me to clear the VS symbol cache periodically, and c) not cause problems when the assemblies get patched.

    Michael Taylor - 6/24/2010
    http://msmvps.com/blogs/p3net

    Thursday, June 24, 2010 1:26 PM
  • Thanks for the detailed steps Michael, but I am still unable to make it work.

     

    I unchecked the Microsoft Symbol Servers option and added:

    http://referencesource.microsoft.com/symbols

    and

    http://msdl.microsoft.com/download/symbols

     

    Verified I had .Net Source Stepping on and restarted VS2010. The only step above I wasn't clear on is #4. When I right click on mscorlib in the call stack the Load Symbols option is greyed. However if I choose "Symbol Load Information" it shows a dialog that shows two paths it couldn't find the pdb in then a path it did and says it loaded it. This seems good, but when I try to step into DateTime.Parse() I get a Find Source dialog asking for the location of DateTime.cs.

    Not sure where to go from here.

    Thursday, June 24, 2010 9:07 PM
  • That means VS has already found the symbols and therefore will not download them again.  Did you follow step 1.e where you disable the auto loading of symbols?  VS does not prioritized PDBs so the first one it finds it'll use.

    The important part to verify is that the path is found the symbols in is in the VS cache.  If it isn't then the symbols got on your machine some other way and that is going to cause confusion.  The path should be something like: %cache%\mscorlib.pdb\<guid>.  More importantly the source directory should be created as well.  The unfortunate side (and the side that seems to cause us the most problem) is that the PDB you need for source stepping resides in the same place as where the downloaded non-source PDB resides.  They might be the same file with a flag set or something.  I don't really know.  Nevertheless once you've download the wrong PDB the only way to recover is to delete the PDB directory and try again.  I really wish MS would make this a smoother process.

    Michael Taylor - 6/25/2010
    http:/msmvps.com/blogs/p3net

    Friday, June 25, 2010 1:08 PM
  • v4 does not yet appear to be fully supported so you probably can't debug into that.  However the v2.0 and v3.x source is available.  It works under either version of VS.

    My luck with the source stepping is hit and miss.  The entire process isn't, IMHO, well implemented because it really shouldn't be as difficult as it seems to be.  At any rate here are the steps that I take to get things to work (note that this is just to get the source downloaded, once that happens it shouldn't be a big deal thereafter).

    1) Configure the symbol settings
           a) Tools\Options -> Debugging\Symbols
           b) I've had no luck with Microsoft Symbol Servers ever working correctly so I disable this option
           c) For symbol locations I use the following:
                   i. \Windows - I keep the OS symbols separate from the others
                   ii. http://referencesource.microsoft.com/symbols 
                   iii. http://msdl.microsoft.com/download/symbols - I tend to keep this unchecked unless I need it although I don't know that it matters.
           d) Cache symbols at: \VisualStudio - I use a subdirectory because occassionally I need to empty the symbol cache and I only want it to blow away the VS files.
           e) Only specified modules - Otherwise VS likes to continually download files and (more importantly) might download the non-source version.
    2) Start up a basic .NET app
            static void Main ( string[] args )
            {
            BP -> DateTime dt = DateTime.Parse("1/1/1980");
            }
    3) Download the source
            a) Start the debugger
            b) When it hits the line switch to the Callstack window
            c) Right-click on any of the mscorlib functions and select Load Symbols From -> Microsoft Symbol Servers
            d) If it works you should be able to right click and Go To Source Code
            e) Now F11 to step into the Parse method and you should be sitting at the source code.

    Ideally it should be easier than this and MS should document what MS Symbols Servers do and how to get this stuff working.  My original thought was that MS SS was their way of adding the 2 http:// entries for us but it doesn't work for me.  It will download the source but when attempting to step into something like Parse it makes me go browse for the source (which is downloaded under a really, really long file path).

    It is my honest opinion that .NET source stepping is a hacked process that needs some real development time and thought to make it part of the core VS tool rather than the flaky behavior we see now.  I hope MS will put more effort into it in the next release.

    Michael Taylor - 2/24/2010
    http://msmvps.com/blogs/p3net


    Thanks for your analysis! I understand this part.
    Saturday, December 18, 2010 7:00 AM
  • In my opinion this is just shambolic really. In essence it makes implementing anything based on internal code virtually impossible as you can't see a lot of the behaviour in action... Can the team responsible for this balls up please:

    a) produce tested guide

    b) sort out the symbol code so it actually works as described

    And... while I'm having a rant. STOP MARKING CLASSES\METHODS INTERNAL WHERE PEOPLE MAY WANT TO JUST EXTEND/MODIFY...


    Paul Sullivan
    Friday, June 17, 2011 8:45 PM
  •  

    Is there any way to force a 'new' PDB?

    I (in DLL hell) deleted out my PDB file from the Bin directory (as it wasn't being found)- thinking a new one would be made- but no- there is nothing around.

    I have set the paths as specified above, but seem to get irregular responses- on one debug, will get say 70 dlls recognised, 15 not, then on another 65 not recognised...

    In my 'default.aspx.c' file if I set a breakpoint, all is well. However in another page, breakpoints are disabled with ' the breakpoint will not be hit.. no sysmbols have been loaded for this document' even though I have right clicked & re loaded all the items in the call stack.

    Seems a little strange to waste 2 days just trying to get a breakpoint to fire on a line of code...

     

    Any help most gratefully received! Regards, J.

     

    Friday, July 01, 2011 11:13 AM
  • I don't see what your PDBs in the bin directory have to do with this topic.  If you are having problems with your personal symbol files then please post a new thread.  This thread is about the .NET framework binaries.

    By default VS won't load symbols for all loaded assemblies.  That would be wasteful.  You can use the Symbols settings to alter this behavior and configure the modules to load.  However you likely have 2 sets of symbol files on your machine.  This is the general cause of issues.  The first set contains only the public symbols (what you normally generate from a release build).  You can set breakpoints on the IL but that is about it.  The second set is the one downloaded from the reference server.  This PDB will contain the source code as well and is what this thread is all about.  However (as the thread has already mentioned) the SP versions of the framework aren't posted so you can't download the second set.  The best you'll get is the first set.  But again that is a different topic tahn source stepping which is what this thread is about.  If you're having problems getting the PDBs for the v4 SP1 framework to load then please create a new thread as it is independent of source stepping.

    Michael Taylor - 7/2/2011
    http://msmvps.com/blogs/p3net

    Friday, July 01, 2011 1:22 PM