Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

First time exception - System.pdb not loaded

I use VS2017 and I get the following when I hit F5

enter image description here

It happens for certain projects only, even if I disabled the Symbols support under VS options. Although in the past, for the same projects it used not to throw even with Symbol support enabled.

So, since I assumed this must be some kind of cached VS setting project specific, I deleted bin, obj, .vs , SymbolSource folders but the same.

If I enable Just My Code it does not throw, however this is not what I want since I cannot debug assemblies which I already have the symbols.

As far as I know even if Symbols Support is enabled it shouldn't throw if there isn't a related Symbol Server declared in VS Options.

This behavior is not specific only to System.dll but happens even if I attach to external processes which I do not have symbols, meaning that filtering with the Load Only Specified Module VS option again is not what I am looking for.

So, does anybody have an idea on how to avoid such annoying exceptions while allowing to utilize Symbol Support for other assemblies which I have configured.

like image 735
Apostolis Bekiaris Avatar asked Sep 13 '17 16:09

Apostolis Bekiaris


2 Answers

None of the above worked for me because I was using external dll which doesn't have the pdb fir with it ,i found that when i unchecked the breakpoints for all from

Debug => Windows then check 'Common Language Runtime Exceptions' or restore default

So when it throw exception and you don't see it it want to use the pdb file to store the stack trace but it couldn't find it

like image 181
Abdullah Tahan Avatar answered Oct 20 '22 00:10

Abdullah Tahan


It means that you want to step in to the .net Framework source code:

http://referencesource.microsoft.com/setup.html

http://referencesource.microsoft.com/indexedpdbs.txt

Actually we also reported this issue to product team for VS 2017 before:

Stepping into .NET Source Still Doesn't Work

If you really want to avoid it, I suggest you disable settings like "Enable .NET framework source stepping" under TOOLS->Options->Debugging.

To debug .NET framework source code,we need to:

Disable just my code

Disable step over properties and operators

Disable require source files to exactly match the original version

Enable .NET framework source stepping

Enable source server support

So just use the contrary settings as above options, debug it again.

In addition, please enable the symbols server under TOOLS->Options->Debugging->Symbols Server, and enable the exception settings window, view the detailed exception messages, maybe you have to resolve the Exception firstly or get any helpful information from it.

like image 36
Jack Zhai-MSFT Avatar answered Oct 20 '22 00:10

Jack Zhai-MSFT