Advert

Resolving Very Slow Symbol Loading with VS 2008 during debugging

Resolving Very Slow Symbol Loading with VS 2008 during debugging

  • Comments 15

Recently, I was encountering insanely slow project loading times during debugging in Visual Studio 2008. Interestingly, this only happened while loading the project only in debug mode. Also, during the slow symbol loading time, the status bar at Visual Studio 2008 always showed Loading Symbols For ____.Dll.

To track it down, I enabled logging for the VS 2008 IDE. This can be done by adding the following entries to its configuration file.

1) Navigate to: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE  in Windows Explorer

2) Load devenv.exe.config in text editor.

3) Add the following entries into it

  <system.diagnostics>
        <trace autoflush="true" indentsize="4">
            <listeners>
               <add name="myListener" 
type="System.Diagnostics.TextWriterTraceListener, System version=1.0.3300.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089" 
initializeData="c:\myListener.log" />
               <remove name="Default" />
            </listeners>
        </trace>
    </system.diagnostics>
As per this configuration, the trace log would be saved to C:\myListener.Log. Now I fired up VS 2008 and loaded to project in debug mode to reproduce the issues.
I also ran couple of unit test cases in debug mode which were also not able to load. I opened the trace log and found these exceptions:

[V, 5820, 7, 2008/07/04 14:00:33.412] devenv.exe: DIA thew in retrieving symbols: System.Runtime.InteropServices.COMException (0x806D0005): Exception from HRESULT: 0x806D0005

at Microsoft.VisualStudio.TestTools.Common.Dia2Lib.IDiaDataSource.loadDataForExe(String executable, String searchPath, Object pCallback)

at Microsoft.VisualStudio.TestTools.Common.DiaHelper.GetSymbolsFileName(String imagePath)

Confirmed with the issue was related to loading of Symbols. I realized that I had once set up a dedicated symbol directory on machine at C:\symbols to enable debugging with WinDbg.

I checked the Debugging Options in VS 2008 to see if its trying to load symbols from somewhere else.

Debug

 

Then suddenly, I was reminded that I had once set up a environment variable _NT_SYMBOL_PATH to an Internet location while debugging in WinDbg to enable automatic downloading of symbols.

I originally thought that this setting was only applicable to WinDbg. But I was mistaken. In fact, this setting will be used across by all debuggers (atleast Microsoft debuggers). This is documented here. I was pretty sure that VS 2008 was trying to load symbols from the Internet location and since many of the assemblies in my application didn't had symbols were them, it must have been failing.

To confirm, I fired My Computer -> Properties -> Advanced -> Environment Variables and cleared out the line

_NT_SYMBOL_PATH=srv*c:\mysymbols*http://msdl.microsoft.com/download/symbols;cache*c:\mysymbols

I reloaded the my project in VS 2008 in debug mode and Bingo, the problem was solved :)

While investigating this problem, I came across many other sources which could cause this issue , so I thought I can post it here for the benefit of community. The credit for these tips goes to Azeem Khan who is working with VSTS team at Microsoft.

  • Make sure that you don't have a symbol path specified in VS under Tools | Options | Debugging | Symbols and also, that you don't have the NT_SYMBOL_PATH environment variable set on your machine.
  • Verify that you haven't specified any network shares under the same setting to server that do not exist anymore. This will require timeouts.
  • Specify a local cache for symbols under the same setting. After you have downloaded symbols once from network shares you can disable those locations. Symbol loading will go a lot faster after the first attempt.
  • Do not specify any symbol lookup paths at all either in environment variable and specify paths in the options page but specify that they be used for manual loading. You can then manually load symbols for modules you care about either via the context menu in call stack or the modules window.
  • VS 2008 SP1 has made a few improvements in this area. It allows for canceling loading of symbols as it is happening. This will allow you to get to your debug session much faster. Note that this is currently in Beta.
  • Clearing the breakpoints also serve to solve this problem for some people.
Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post
  • PingBack from http://blog.a-foton.ru/2008/07/resolving-very-slow-symbol-loading-with-vs-2008-during-debugging/

  • Thank you thank you thank you.

    This was driving me around the bend!

  • Clearing the breakpoints made it for me.

    Thank you for this posting.

  • I also had exactly the same problem as yanbes.

    I've searched for problems with symbols, but when I saw yanbes answer to this post, just deleted something around 20 disabled breakpoints and the problem was gone :-)

    By the way your config is not working on my VS 2008 SP1.

    Thanks for posts both of you: Madhyr and yanbes. :-)

  • I started having this problem a couple days ago - symbol loading is taking over 1.5 minutes to load each time I debug my solution.  I checked environment variables, no _NT_SYMBOL_PATH variable defined.  I checked the VS 2008 debugging options and no path was specified for the Symbol file location.  I created a new breakpoint, then deleted all breakpoints.  I have VS SP1 installed.  I'm running Windows Vista SP1 and have all the latest updates installed.  On 10/15 about the time I started noticing the problem, I installed these updates:

    Update for Microsoft Office Outlook 2007 Junk Email Filter (KB957258)

    Cumulative Security Update for ActiveX Killbits for Windows Vista (KB956391)

    Cumulative Update for Media Center for Windows Vista (KB955519)

    Update for Windows Mail Junk E-mail Filter [October 2008] (KB905866)

    Update for Virtual Earth 3D (KB956034)

    Security Update for Windows Vista (KB954211)

    Windows Malicious Software Removal Tool - October 2008 (KB890830)

    Security Update for 2007 Microsoft Office System (KB955936)

    Security Update for Windows Vista (KB957095)

    Security Update for Microsoft Office Excel 2007 (KB955470)

    Security Update for Windows Vista (KB956841)

    Cumulative Security Update for Internet Explorer 7 in Windows Vista (KB956390)

    It's not obvious to me why any of these updates would cause a problem with VS 2008 debugging, but with security updates, I can't be sure it's not some security problem.

    As for an HTTP location for the symbols, I disabled my network connection and tried to debug again, but still the delay was there and the debugging worked once the symbol load was complete.

    So, I still have the slow symbol load problem.  I tried to enable the system diagnostics as described above, but did not see the log file appear in the specified location.

    Any help with this would be greatly appreciated.  If I don't resolve some other way soon, I will start uninstalling the updates (if possible) one at a time and if the problem does go away, I'll post the information here.

  • I had this problem (60-90 second symbol load times on every debug) and tried all of the recommendations, but could not get the symbols to load like they used to.  I finally figured out that I had a virtual drive mapped to an ISO of the Visual Studio 2008 DVD with DAEMON Tools.  I unmounted the drive and my symbols started loading in the typical 3-5 second time frame.  I definately did not map that virtual DVD drive recently, but the slow load times only started recently.  I'm not sure what triggered the slowness to begin.  Just for giggles, after I fixed the issue, I remapped the virtual DVD drive to the same ISO image, verified it was the same drive letter as before and was able to debug without the slow symbol load times.

  • Glad that finally the symbols are loading in 3-5 seconds timeframe. That's what matters :)

  • Thanks for the post.I have encouter exactly the same problem.And this post help me a lot.

  • Same problem here. Unfortunately, none of the tips I've found here (or in other threads, questions, forums, etc) helped me out so far; still suffering from extremely slow load times.

    Especially, I have

    - no _NT_SYMBOL_PATH set,

    - an 'empty' Tools>Options>Debugging>Symbols dialog,

    - even no breakpoints (yes, I also tried creating one and then deleting all).

    Any other hints? VS is slightly unusable ATM..

  • Thanks a lot, it is very useful to me.

  • Thank you for this. This was driving me insane...

  • Clearing breakpoints solved our headaches!

    Thanks a lot for this.

  • Bingo....clearing the environment variable has done the trick for me...

    Thanks a ton.

  • THanks a lot!! Cleared the Environmnet variable and now its loading faster than ever!!!!

  • Thanks a lot!

    Deleting the environment variable worked for me.. I've been frustrated with this issue for so long. Finally found a solution here! Thanks!

Page 1 of 1 (15 items)