3
votes

I have a folder on my server that hosts my nuget packages. These packages do not contain source code or symbols (PDBs). This works well.

Recently I have set up another folder on my local server to host the symbols files from the assemblies in my nuget packages.

I have added the path to the symbols folder to visual studio and when I place the PDB files in the folder they are loaded correctly in VS and I am able to step into the code when debugging. If I look at the symbol load information in VS I can see that the PDB was downloaded from the symbols folder on my server, confirming that everything is working correctly.

I believe the preferred way to do this sort of thing is to have nuget create a symbols package at the same time as creating the nuget package and I would like to move to this way of working.

Creating the symbols and nuget package is not an issue. The issue is that when I push (using nuget) the symbols package to my symbols folder VS is not able to use it. When I try to step into my nuget package VS tries to find the PDB and I can see that it looks in my symbols folder but it can not find the PDB, which makes sense because it is contained inside a nuget symbols package.

Can anyone explain what I am missing?

1

1 Answers

5
votes

How can I debug using a nuget symbols package from a local folder?

AFAIK, you could not use local folder as symbol server, I tried it before and it didn't work, got the same error as you. That because the .pdb file is wrapped in the symbol package, Visual Studio could not access .pdb file directly in the symbol package.

You should setup your own SymbolServer or upload it to symbolsource.com, after you setup SymbolServer and upload nuget's with symbols, you must configure Visual Studio debugger.

Besides, if you do not want to setup your own SymbolServer or upload it to symbol server, there is a lightweight solution here:

  1. Put the pdb and source code file in the NuGet package alongside the dll.
  2. Add the source code to the Debug Source Files for the solution that references the package (right click on Solution, select Properties...Common Properties...Debug Source Files, and add the root source directory for the relevant binary reference.)

Please refer to this thread for more details on step 1 and step 2, .

Then you can debugging this nuget package with a local folder:

enter image description here

Hope this helps.