Photo by Jiawei Zhao on Unsplash

Debugging into NuGet packages

Stephan Bester
2 min readMay 18, 2022

--

This is a straightforward article that describes how you can step into a NuGet package while debugging your project. I’m assuming that you have access to the source code for the package.

Debugging options

First, you need to allow Visual Studio to debug other people’s code.

Choose Options from the Tools menu. Under the General section of the Debugging node, untick the box for “Enable Just My Code”.

Untick the Enable Just My Code option

Next, under the Symbols section, you need to tell Visual Studio where to find the symbols file for the NuGet package. (This could be under your local “.nuget/packages” folder.) In the list of symbol file locations, add a new item and enter the file path to the .pdb file of your package. Make sure the box for this item is ticked.

Add a symbol file location

Locating the source

Start the debugger and try to step into code from the NuGet package.

The first time Visual Studio needs the location for a .cs file, it will pause debugging and prompt you to browse for the file. If this happens, simply navigate to your source code for the package and choose the file from there. Hint: If you need help finding the file in the project, the file dialogue displays the original location at the top.

You should now be able to step into the source.

References

Used for this article

  • .NET 5
  • Visual Studio Enterprise 2022

--

--

Stephan Bester

Software developer walking the edge between legacy systems and modern technology. I also make music: stephanbmusic.com