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

后端 未结 2 1545
清酒与你
清酒与你 2020-12-01 05:51

Here\'s what I\'ve tried:

Made a new Console App (.NET Framework) in Visual Studio 2017.

Added the following code:

static void Main(string[]          


        
2条回答
  •  萌比男神i
    2020-12-01 06:27

    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.

      • How? Reference source specifies ".NET Framework 4.6.2" but a module version is something like: "4.6.1586.0"
      • You may need to uninstall security updates as explained here: How do you enable "Enable .NET Framework source stepping"?
    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.

提交回复
热议问题