Show / Hide Table of Contents

Debugging NUGET Packages

Setup VisualStudio for Nuget Package Debugging

1. Enable Source Server and SourceLink support

VS > Tools > Options > Debugging > General

Enable source server support | ON
  Print source server diagnostic messages to the Output window | ON
  Allow source server for partial trust assemblies | ON
  Always run untrusted source server commands without prompting | OFF

Enable Source Link support | ON
  Fall back to Git Credential Manager authentication for all Source Link requests | OFF

Screenshot showing result of above instructions

2. Enable Azure DevOps Symbol Server

Note that this can be any Azure DevOps user logged in to VS has permissions for and where the symbols can be located

VS > Tools > Options > Debugging > Symbols > [Top Right + Burger Menu] Symbol Server button

Select the symbol from the list (might take some time to load). Ensure you select the correct DevOps, as someone may have access to many

Screenshot showing result of above instructions

3. Configure Load Modules

VS > Tools > Options > Debugging > Symbols > Automatic symbol loading preference | Select Load only specified modules

Important to do this otherwise all assemblies, I mean all :D, are downloaded on startup. In next section we will see a way to selectively download modules on the fly.

4. Selectively Load Modules

weird quirk follows Enable Modules window in VS

Debug > Windows > Modules

This window allows us to selectively download sources for assemblies for the debug session. On the context menu of each time we can also mark automatic download

Screenshot showing how to find Modules window

Screenshot showing modules window

5. Function Debugging

Finally, Function Debugging allows us to select a class from local and downloaded sources.

Enable breakpoints windows

Debug > Windows > Breakpoints > New > Function Breakpoint

on the open window, for Function Name type in just the name, e.g. QueryService, of the service from external source and click ok

if the source is resolved, it will resolve the full namespace and automatically place a breakpoint of the first line that can have a breakpoint

Screenshot showing modules window

6. [Optional] Show Miscellaneous items

Enabling this allows us to see a list of external sources were we have set breakpoints for easy navigation

Tools > Options > Environment > Documents > Show Miscellaneous files in solution explorer

Screenshot showing how to enable misc files

Screenshot showing how to enable misc files

  • Improve this Doc
In This Article
Back to top Generated by DocFX