How do I debug .NET 4.6 framework source code in Visual Studio 2017?

Here is the answer, thanks to Hans Passant. Note that this solution raises additional questions.

  1. Ensure https://referencesource.microsoft.com/ contains the exact version you’re debugging.

  2. Configure Visual Studio as specified here:
    https://referencesource.microsoft.com/setup.html

    • Untick “Enable Just My Code”
    • Tick “Enable .NET Framework source stepping” (this should have been the only step needed)
    • Tick “Enable source server support”
    • Untick “Require source files to exactly match the original version”
  3. Confirm symbols are loaded in the Modules window, with source indexing included.

    • How can you tell if source indexing is included? The modules window doesn’t specify if a PDB has stripped source information.

Microsoft could make this process a lot more robust by giving helpful error messages instead of silently failing.

Leave a Comment