Update 22nd Feb 2013:Microsoft Connect条目中有来自Alok Shriram(程序管理器,基类库,.NET Framework)的注释,该问题现在应该得到解决.连接条目标记为Resolved (Fixed):
这个问题现在应该得到解决.我们发布了参考资料的更新.
一年半了.
Bonus Links
Thread on Microsoft Social that has been going for a year and a half, asking when it will be fixed美元.
Original Question
如何在Visual Studio2010中启用.NET Framework源代码单步执行?
Note:这个问题是一个更大的整体的一部分:
- .NET 2.0 WinForm: Supporting DPI and Default Font Changes
- WinForms控件在ScaleControl期间不zoom
- VS2010: How to enable "启用.NET Framework源代码单步执行"?
- Visual Studio 2010 Professional: How to access Modules window?
- Visual Studio 2010: Properties.Settings broken after retargetting project to .NET Framework 3.5
Visual Studio 2010附带了一个新功能:
- 工具、选项、调试、常规、启用.NET Framework源代码单步执行
遵循MSDN第How to: Debug .NET Framework Source页上的说明:
使能.NET框架源代码调试
在Tools菜单上,单击Options.
在"Options"对话框中,单击"Debugging"类别.
在General框中,选中以下复选框:
- 启用.NET Framework源代码单步执行
- 启用源服务器支持
我这样做:
Note:您会注意到,正如MSDN页面所指出的,正如我所注意到的,选中启用.NET Framework源代码单步执行将自动取消选中**仅启用我的代码(仅限托管).我还启用了源服务器支持的诊断消息.
启用这些选项会自动为我设置符号缓存下载位置:
Note:Microsoft Symbol Server条目已存在(无法删除).
MSDN页面显示要加载符号:
To load Framework symbols using the Modules window
在Modules窗口中,右键单击未加载符号的模块.通过查看Symbols Status列,可以判断是否加载了符号.
指向Load Symbols From,然后单击Microsoft Symbol Servers从Microsoft public symbols server下载符号,或从以前存储符号的目录加载符号路径.
我试试这个:
然后加载所有符号:
I’ve been sitting on a breakpoint, which is about to call into .NET framework code:
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
{
base.ScaleControl(factor, specified);
按F11键会导致调试器直接跳到下一行:
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
{
base.ScaleControl(factor, specified);
//Record the running scale factor used
this.scaleFactor = new SizeF(
this.scaleFactor.Width * factor.Width,
this.scaleFactor.Height * factor.Height);
如何启用.Visual Studio 2010中的NET Framework源代码?
我坐在代码中的断点处.我try 双击调用堆栈中更上层的函数.我希望,这将使我有机会参加jump场比赛.网络代码:
只是它不起作用:Visual Studio告诉我没有可用的源代码:
如何启用.Visual Studio 2010中的NET Framework源代码?
If I switch to disassembly view before trying to step into .NET code (Debug -> Windows -> Disassembly), I can see a call
into the .NET code:
当我这么做的时候,我最终调试了System.Windows.Forms.ScaleControl
的反汇编:
这不同于能够单步执行.NET Framework源代码,也不像能够单步执行.NET Framework源代码那样有用.
如何启用.Visual Studio 2010中的NET Framework源代码?
我的计算机上配置的符号缓存路径确实包含符号缓存文件:
所以它下载了pdb
个符号文件,但拒绝使用它们.
如何启用.Visual Studio 2010中的NET Framework源代码?
Lepbie建议我判断Debug
日志(log)(在调试日志(log)窗口打开的情况下;否则它不会记录任何内容):
Step into: Stepping over method without symbols 'System.Windows.Forms.Form.ScaleControl'
在日志(log)的前面部分,我看到它加载了System.Windows.Forms.dll
个符号:
Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Symbols loaded.
所以它找不到我的符号,却声称找不到.
如何启用.Visual Studio 2010中的NET Framework源代码?
一位来自微软意大利的家伙建议关闭Require source files to exactly match original version:
这并没有解决问题.
如何启用.Visual Studio 2010中的NET Framework源代码?
有人认为微软的源服务器有一个.NET Framework 4.0年的漏洞.根据这个建议,我将项目切换到目标.NET Framework 3.5:
这并没有解决问题.
如何启用.Visual Studio 2010中的NET Framework源代码?
有人在某个地方无所事事地想知道是否另一个人遇到了同样的问题was using the 64-bit version of the debugger.现在,没有64位版本的Visual Studio,但我try 将我的项目从AnyCPU切换到x86(它被JIT到x64),以防微软不支持64位处理器:
但这并没有解决问题:
Step into: Stepping over method without symbols 'System.Windows.Forms.Form.ScaleControl'
如何启用.Visual Studio 2010中的NET Framework源代码?
另请参阅
- Configuring Visual Studio to Debug .NET Framework Source Code
- Unable to debug .NET framework code in VS2010个
- .NET framework source stepping not working despite options set
- Setting up Visual Studio 2010 to step into Microsoft .NET Source Code
- Visual Studio 2008 SP1 .NET Framework Source Debugging
- No Debug>Modules window in Visual Studio 2008 Version 9.0.21022.8 RTM