84

I have Visual Studio 2005 set up to use Microsoft's symbol servers. I also have UltraMon installed, which injects a hook DLL into every process. Whenever I start debugging my MFC application, Visual Studio says:

"Loading symbols for C:\Program Files\UltraMon\RTSUltraMonHookX32.dll..."

for anything from the blink of an eye to several tens of seconds. It's never going to find those symbols... Can I tell it not to bother looking?

(I tried creating an empty RTSUltraMonHookX32.pdb file, but Visual Studio sees that it's not good and carries on looking.)

ZachB
  • 13,051
  • 4
  • 61
  • 89
RichieHindle
  • 272,464
  • 47
  • 358
  • 399

10 Answers10

141

You can't do this in a very fine grained fashion but you can disable automatic symbol loading and then manually choose the symbols to load via the Modules window (Debug -> Windows -> Modules).

To Disable Automatic Symbol loading

  • Tools -> Options -> Debugging -> Symbols
  • Check "Search the above locations only when symbols are loaded manually"
JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
29

Also check that you have no "_NT_SYMBOL_PATH" environment variable. If you have this var symbols will load regardless of VS settings.

Denis Bakharev
  • 959
  • 1
  • 9
  • 7
28

From Visual Studio 2010 onwards, you can go to:

Tools -> Options -> Debugging -> Symbols -> Specify excluded modules

and enter the list of the dlls which take too long to load. I use the full path, given by the Output Window; maybe it accepts wildcards or simple file names.

Smashery
  • 57,848
  • 30
  • 97
  • 128
Calvin1602
  • 9,413
  • 2
  • 44
  • 55
  • 2
    This is sadly not available in Visual Studio 2005, but it's nice to know it's there in a later version. – RichieHindle Jan 30 '13 at 09:15
  • 1
    @RichieHindle Indeed; but IIRC, JaredPar's method work in VC2005, though. – Calvin1602 Jan 30 '13 at 10:17
  • It's possible to use wildcards indeed. Microsoft provided a really confusing UI, not a single note about possible wildcards. for example I could disable DevExpress symbol loading by adding "DevExpress*" in the list. – Zoltán Tamási Jan 28 '15 at 15:09
  • Wow, great! Crazy! Before this I had 4 seconds start time, and it said already "loading disabled by include/exclude settings". But after I added all of them (20) it went down to 2 seconds (Visual Studio 2017). Must be a bug in the loading system of symbols that this can cut down 50% even that VS pretends not to load the symbole before this (I don't have _NT_SYMBOL_PATH in my set). – AndresRohrAtlasInformatik Jan 14 '19 at 10:36
  • I get confirmation from the Output window that the symbol is excluded (oleaut32.dll), but then it tries loading the symbols for that library anyway. – A. Niese Oct 14 '20 at 20:07
23

In my case it was because I had set "Enable .Net Source Stepping" to true in

Tools > Options > Debugging > General. 

Rather than setting it to false, I set "Enable Just My Code" to true which automatically set "Enable .Net Source Stepping" to false. It gave me a warning before doing so:

Enabling Just my code automatically disabled .Net framework source stepping

Which suggests Just My Code and .Net source stepping are mutually exclusive.

I hope this helps someone.

Hugo Nava Kopp
  • 2,906
  • 2
  • 23
  • 41
  • 2
    OMG! Actually setting this to Enable .Net Source Stepping to true and disabling Just My Code made the error go away. It was the opposite of what you said, but it did the trick. Thanks so much! – SmoveBB Jun 05 '19 at 19:24
2

If you go to Debug Options -> Symbols and then check "load only specified symbols" , it won't load symbols automatically and the debugger works without problem.

Nyx
  • 21
  • 2
1

You can also set up symbol server exclusions which will not be attempted to download in HKEY_CURRENT_USER\Software\Microsoft\Symbol Server\Exclusions or possibly also HKEY_LOCAL_MACHINE\Software\Microsoft\Symbol Server\Exclusions or via a .ini file at %WINDIR%\system32\inetsrv\Symsrv.ini (use the header [exclusions] and put each exclusion on its own line). The exclusions are simple pattern matches, so use msxml5.* for example.

adzm
  • 4,148
  • 1
  • 27
  • 21
  • This sounds perfect, but it doesn't work for me. I've added entries to the registry, and created a symsrv.ini with the correct entries in it, and rebooted my machine just in case, but still Visual Studio tries to load the symbols. Any ideas? – RichieHindle Aug 06 '10 at 08:58
  • Doesn't work for me either. But as far as I understand, this list is for PDBs only, not DLLs. – Calvin1602 May 25 '12 at 08:32
1

Not only the _NT_SYMBOL_PATH can cause this behavior, but for me it was the _NT_ALT_SYMBOL_PATH environment variable that was causing the delays.

(I believe I added this variable when experimenting with WinDbg)

Raf
  • 663
  • 1
  • 8
  • 21
0

In Visual Studio 2013 Pro, if the Microsoft Symbol Server is checked, VS will attempt to load all symbols on their server, causing a lot of extra time.

Jim Davis
  • 11
  • 1
0
  • Load all symbol packages from MS website manually, put them on a SSD drive for speed :-)
  • If you have a "_NT_SYMBOL_PATH" environment variable, remove the part "http://msdl.microsoft.com/download/symbols" from "SRVe:\symbols*http://msdl.microsoft.com/download/symbols", so you have only the symbol path where your symbols live preciously downloaded.
  • Now you have support for symbols but they wont be downloaded from MS, but loaded from drive
Martin.Martinsson
  • 1,894
  • 21
  • 25
  • People usually asks this question because they don't need symbols at all, not because they don't want to download through internet and don't know how to use it locally. They just want to turn it off whatsoever and forever. – user5280911 Mar 05 '19 at 02:39
  • @user5280911 Well, the main motivation to turn it off is probably the performance impact when loading the symbols. If the loading is fast the main reason to not want it goes away. – Peter - Reinstate Monica Jan 15 '20 at 19:36
0

VS 2022: Have a look at Tools -> Options -> Debugging -> Output Window -> General Output Settings. Offers granular Control over the emitted nessages. Did the trick for my project, and is even respected when debugging from VS in Docker.

Recurs1on
  • 39
  • 1
  • 5