如何在Visual Studio 2017中调试.NET 4.6框架源代码? [英] How do I debug .NET 4.6 framework source code in Visual Studio 2017?
问题描述
这是我尝试的方法:
在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)
}
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.
-
确保 https://referencesource.microsoft.com/ 包含您要调试的确切版本。
Ensure https://referencesource.microsoft.com/ contains the exact version you're debugging.
- 如何?参考源指定 .NET Framework 4.6.2,但模块版本类似于: 4.6.1586.0
- 您可能需要按以下说明卸载安全更新:如何启用启用.NET Framework源步进?
- 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"?
按此处指定的方式配置Visual Studio:
https://referencesource.microsoft.com/setup.html
Configure Visual Studio as specified here: https://referencesource.microsoft.com/setup.html
- 取消勾选启用我的代码
- 勾选启用.NET Framework源代码步进(这应该是唯一需要的步骤)
- 勾选启用源服务器支持
- 取消勾选要求源文件与原始版本完全匹配
- 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"
确认符号已加载到模块窗口中,其中包括源索引。
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屋!