Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vs2017 Source Not Available

I´m trying to debug a System.Net.Http.Formating.dll, by clicking at the stack trace:

System.Net.Http.Formatting.dll!System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStreamAsync.AnonymousMethod__c()

I´ve the "Just my code disabled" and I have the following symbols servers:

https://nuget.smbsrc.net
http://localhost:33417/ (dot peek)
Microsoft Symbol Server

I do have the pdb available, however I get the following error/image.

How to properly overcome it?

Why is it such a hassle to debug third party source code at Visual Studio?

enter image description here

like image 812
Luiz Henrique Martins Lins Rol Avatar asked Aug 08 '17 17:08

Luiz Henrique Martins Lins Rol


1 Answers

After following the link pointed by @Jack Zhai-MSFT I was finally able to understaand the reasons why the .net framework couldn´t be debugged.

It turned out that the symbols were being downloaded without their respective source, because I was pointing to Microsoft Symbol Server instead of http://referencesource.microsoft.com/symbols

Then, my following attempt was to uncheck the "Microsoft Symbols Server" or to change the order at the Symbols menu. To my surprise, I couldn´t delete it, nor change the order, and, even after it was disabled the symbols were still fetched from there.

Perhaps this is a VS2017 community bug.

What I did next, that actually solved it:

  1. Deleted my symbol cache that had misleading pdbs without source
  2. Enabled just my code flag, disabling “Enable .NET Framework source stepping” and started the app, on debug mode
  3. Paused at a breakpoint in which, at the stack, I had access to the code I wanted to debug
  4. Double clicked such stack, and then hit Load Symbols.
  5. This time around, for some reason, the Microsoft Symbol Server was skipped, and the right pdbs were downloaded

Note that, still, I couldn´t download some "optimized symbols" like system.net.http, but I´ll try to figure that out next

Also, I setup the symbols servers using that as a reference, which helped me to promptly get any third party symbols (Except .net)

https://www.symbolsource.org/Public/Wiki/Using

enter image description here

EDIT:

With the help of dotPeeker I was able to get all the missing pdb files by:

  1. Loading these dlls into dotpeeker (ex: System.Net.Http)
  2. Load one of the source files from that DLL
  3. Hit Generate PDB and store it into the same cache folder as VS2017 uses

PHEW!! What a hassle for something that should have been trivial!

like image 136
Luiz Henrique Martins Lins Rol Avatar answered Oct 04 '22 03:10

Luiz Henrique Martins Lins Rol