如何在 Visual Studio 2017 中调试 .NET 4.6 框架源代码? [英] How do I debug .NET 4.6 framework source code in Visual Studio 2017?

查看:31
本文介绍了如何在 Visual Studio 2017 中调试 .NET 4.6 框架源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我尝试过的:

在 Visual Studio 2017 中制作了一个新的控制台应用程序 (.NET Framework).

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

添加以下代码:

static void Main(string[] args)
{
    new Dictionary<int, int>().TryGetValue(3, out int x); //I want to step into TryGetValue() (this is just an example)
}

配置了此处列出的设置:https://blogs.msdn.microsoft.com/sburke/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code/

Configured the settings listed here: https://blogs.msdn.microsoft.com/sburke/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code/

在模块窗口中加载确认的符号:

Confirmed symbols are loaded in the Modules window:

mscorlib.dll 符号已加载.4.6.1586.0 构建者:NETFXREL2

mscorlib.dll Symbols loaded. 4.6.1586.0 built by: NETFXREL2

尝试过:步入 (F11)"

Tried: "Step Into (F11)"

尝试过:步入具体"|"System.Collections.Generic.Dictionary.TryGetValue"

Tried: "Step into Specific" | "System.Collections.Generic.Dictionary.TryGetValue"

两者都只是跨过线.

我尝试使用此处的详细信息配置 VS:http://www.symbolsource.org/Public/Home/VisualStudio

I've tried configuring VS using the details here: http://www.symbolsource.org/Public/Home/VisualStudio

同样的结果,调试器越界了.

Same result, the debugger steps over the line.

我在这里查看了答案:https://stackoverflow.com/a/12432029/297451

但这个版本似乎不是安全更新,搜索site:support.microsoft.com/kb 4.6.1586.0"一无所获.

But this version doesn't seem to be a security update, and a search for "site:support.microsoft.com/kb 4.6.1586.0" yields nothing.

我做错了什么?

推荐答案

这就是答案,感谢 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.

这篇关于如何在 Visual Studio 2017 中调试 .NET 4.6 框架源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆