且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Visual Studio 2017 中调试 .NET 4.6 框架源代码?

更新时间:2021-12-07 08:31:27

这就是答案,感谢 Hans Passant.请注意,此解决方案会引发其他问题.

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

  1. 确保 https://referencesource.microsoft.com/ 包含您的确切版本调试.

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

按照此处指定的方式配置 Visual Studio:https://referencesource.microsoft.com/setup.html

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

  • 取消勾选仅启用我的代码"
  • 勾选启用 .NET Framework 源单步执行"(这应该是唯一需要的步骤)
  • 勾选启用源服务器支持"
  • 取消勾选要求源文件与原始版本完全匹配"

确认符号加载到模块窗口中,包括源索引.

Confirm symbols are loaded in the Modules window, with source indexing included.

  • 如何判断是否包含源索引?模块窗口未指定 PDB 是否已剥离源信息.

Microsoft 可以通过提供有用的错误消息而不是默默地失败来使这个过程更加健壮.

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