Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow symbol loading in an ASP.NET Project in VS2012

I'm having an issue with loading symbols on my ASP.NET MVC project. The first time I load visual studio and debug my project, symbols are loaded in roughly 2 seconds. I then end the debug session, make a code modification, and debug again, and the symbol load time is about a minute. Based on the research I have done, here are some applicable settings on my machine/VS:

In Options/Debugging/Symbols/Symbol file locations, "Microsoft Symbol Servers" is unchecked, and there are no additional locations.

Options/Debugging/Symbols/Cache symbols in this directory is "G:\Symbol Cache". I did click "Load all symbols" and I have inspected that directory and I see lots of symbols.

Just my code is enabled.

The _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH environment variables are not defined on my machine.

Options/Debugging/Symbols/Automatically load symbols for is set to "Only specified modules", with no modules specified.

I have tried both debug and release builds, with identical results. Ctrl + F5 loads the site almost immediately.

like image 724
Jason Fry Avatar asked Dec 11 '12 00:12

Jason Fry


2 Answers

I too had this problem, the cause was that I had accidently enabled the "Microsoft Symbol Server"

You can disable it by going to Tools > Options > Debugging > Symbols and uncheck the "Microsoft Symbol Server"

Now it loads just as fast as it used to.

like image 149
Peter Taylor Avatar answered Oct 01 '22 14:10

Peter Taylor


I too had this problem and noticed that it was mostly related to 3rd-party assemblies acquired via NuGet. In these cases, Visual Studio was trying to load PDBs from paths that apparently existed on the original author's machine (i.e. D:\OriginalAuthor\MyVisualStudioProjects\AwesomeNuGetPackage) but on my machine the same path referred to an optical drive. I then discovered via Command Prompt that if you tried to change directory to an optical drive that didn't have a disc in the tray, it took a very long time (~30 seconds) to fail. With this in mind, my solution was to simply place a DVD in the tray. At that point Visual Studio was able to very quickly determine that the path didn't exist, skip loading the PDB, and go straight into debug.

So, if Visual Studio is taking a long time to load symbols, watch the Output window for the paths it's trying to access and verify that you can quickly access (or quickly fail to access) those paths yourself via Command Prompt.

This brings up an interesting question about security/privacy--apparently Visual Studio is storing the absolute path of the original PBD within the assembly. I suppose this isn't a super critical issue, but from a privacy perspective I don't really want my absolute filesystem paths being exposed to the public without my knowledge.

like image 32
Mike Avatar answered Oct 01 '22 14:10

Mike