Prevent Visual Studio from trying to load symbols for a particular DLL
Asked Answered
C

10

89

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.)

Caa answered 15/5, 2009 at 14:53 Comment(0)
G
145

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"
Grateful answered 15/5, 2009 at 14:56 Comment(6)
Apparently this option is gone in Visual Studio 2019?Dunant
And Visual Studio 2022 apparently..Flightless
In Visual Studio 2019: Tools > Options > Debugging > Symbols, then untick the "Symbol file (.pdb) locations" for the slow servers e.g. "Microsoft Symbol Server"Allpowerful
Clicking the Empty Symbol Cache button there did the trick for me.Ghibelline
No luck with any of these options. It appears to just do it's thing with System.* and Microsoft.* no matter what options I add or ask it to ignore.Toilet
Emptying the symbol cache or unchecking the symbol servers will not cut it, you'll need to fully clear the "Cache symbols in this directory" setting too. See #39075144Fluidextract
L
29

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

Lucylud answered 4/7, 2010 at 22:12 Comment(0)
B
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.

Ballew answered 25/5, 2012 at 8:31 Comment(5)
This is sadly not available in Visual Studio 2005, but it's nice to know it's there in a later version.Caa
@Caa Indeed; but IIRC, JaredPar's method work in VC2005, though.Ballew
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.Pathoneurosis
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).Soapwort
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.Herbherbaceous
D
24

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.

Diophantus answered 2/3, 2017 at 11:48 Comment(1)
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!Jaunty
P
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.

Polarization answered 28/1, 2021 at 4:28 Comment(0)
V
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.

Velour answered 4/8, 2010 at 15:54 Comment(2)
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?Caa
Doesn't work for me either. But as far as I understand, this list is for PDBs only, not DLLs.Ballew
P
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)

Propensity answered 13/1, 2012 at 9:8 Comment(0)
G
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.

Gone answered 1/9, 2016 at 14:59 Comment(0)
N
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
Nice answered 6/9, 2016 at 23:11 Comment(2)
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.Rutger
@Rutger 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.Pun
C
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.

Croce answered 9/2, 2023 at 14:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.