你如何启用"允许.NET Framework的源步进"? [英] How do you enable "Enable .NET Framework source stepping"?

查看:414
本文介绍了你如何启用"允许.NET Framework的源步进"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新2013年2月22日:微软连接条目有纸条阿洛克施拉姆(项目经理,基类库,.NET框架),这个问题现在应该可以解决。该连接条目被标记为的解决(固定)的:

  

这个问题现在应该是固定的。我们发布了更新的参考来源。    请让我们知道如果您的问题仍未解决。

一年半。

奖金链接

  • <一个href="http://connect.microsoft.com/VisualStudio/feedback/details/697947/net-framework-4-reference-sources-fail-since-out-of-date">Vote这个错误将固定在微软连接。

  • <一个href="http://social.msdn.microsoft.com/Forums/en-US/refsourceserver/thread/41388c7b-582b-4e3f-8178-3d38a3c99639">Thread微软社会已持续了一年半的时间,问什么时候会被固定。

原始的问题

如何启用.NET Framework的源加强在Visual Studio 2010?


  

注意:这个问题是一体成型的一个更大的整体:

     
      
  • <一个href="http://stackoverflow.com/questions/196606/net-2-0-winform-supporting-dpi-and-default-font-changes">.NET 2.0的WinForm:支持DPI和默认字体更改
  •   
  • 在WinForms控件ScaleControl过程中不具有可扩展
  •   
  • VS2010:如何启用启用.NET Framework的源步进
  •   
  • <一个href="http://stackoverflow.com/questions/8139854/visual-studio-2010-professional-how-to-access-modules-window">Visual Studio 2010的专业:如何接入模块窗口
  •   
  • <一个href="http://stackoverflow.com/questions/8141424/visual-studio-2010-properties-settings-broken-after-retargetting-project-to-ne">Visual Studio 2010中:retargetting项目的.NET Framework 3.5后Properties.Settings破
  •   

Visual Studio 2010中附带了一个新功能:

  • 工具,选项,调试,一般,启用.NET Framework的源步进

在对这一MSDN页面如何:调试.NET Framework的源的:

  

为了让.NET框架源代码调试

     
      
  1. 工具菜单,点击选项

  2.   
  3. 选项对话框中,点击调试类别。

  4.   
  5. 常规中,选择以下复选框:

         
        
    • 启用.NET Framework的源步进
    •   
    • 启用源服务器支持
    •   
  6.   

我这样做:

注意:你会注意到,作为MSDN页笔记,因为我注意到,该检查启用.NET Framework的源步进将自动取消**启用仅我code(仅限托管)。我也使源服务器支持的诊断消息。

自动启用这些选项对我设置一个符号缓存下载位置:

注意:在 Microsoft符号服务器条目已经present(且无法删除)


在MSDN页说加载符号:

  

要使用加载模块窗口框架符号

     
      
  1. 模块窗口中,用鼠标右键单击其中未加载符号的模块。如果你可以告诉加载符号或不通过看符号状态列。

  2.   
  3. 指向加载符号从,然后点击 Microsoft符号服务器可以从Microsoft公共符号服务器或符号路径下载符号,从那里你有一个目录加载previously存储符号。

  4.   

我试试这个:

,然后所有的符号将被装载:

I&rsquo的;一直在坐在一个断点,这是即将调入.NET框架code:

 保护覆盖无效ScaleControl(的SizeF因素,BoundsSpecified指定)
{
    base.ScaleControl(系数,指定);
 

推<大骨节病> F11 导致调试器简单地跳到下一行:

 保护覆盖无效ScaleControl(的SizeF因素,BoundsSpecified指定)
{
    base.ScaleControl(系数,指定);

    //记录所用的办学规模因子
    this.scaleFactor =新的SizeF(
            this.scaleFactor.Width * factor.Width,
            this.scaleFactor.Height * factor.Height);
 

如何启用.NET Framework的源加强在Visual Studio 2010?


我在我的code坐在一个断点。我试着双击功能进一步在调用堆栈。这会,我希望,让我的应用于.NET code:

除了它不工作:Visual Studio中告诉我,有没有可用的源:

如何启用.NET Framework的源加强在Visual Studio 2010?


如果我切换到反汇编视图试图步入.NET code前(调试 - > 的Windows - > 拆卸) ,我可以看到一个通话到.NET code:

当我这样做,我最终调试的拆卸 System.Windows.Forms.ScaleControl

这是不一样的,或者是有用的,能够踏入.NET Framework源。

如何启用.NET Framework的源加强在Visual Studio 2010?


我的计算机上配置的符号缓存路径确实包含符号缓存文件:

所以它正在下载 PDB 符号文件,但拒绝使用它们。

如何启用.NET Framework的源加强在Visual Studio 2010?


Leppie建议我检查调试日志(与调试日志窗口打开;否则,不记录任何东西):

 步骤为:法无符号System.Windows.Forms.Form.ScaleControl走出过
 

日志我看到它加载符号在早期 System.Windows.Forms.dll中

 加载'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll',符号加载。
 

因此​​,它的的找到我的符号,但声称它无法找到他们。

如何启用.NET Framework的源加强在Visual Studio 2010?


这是微软意大利人建议关掉要求源文件原始版本完全匹配

这并没有解决它。

如何启用.NET Framework的源加强在Visual Studio 2010?


有人认为,有一个与微软的源服务器的.NET Framework 4.0 的错误。继该项建议,我切换了项目目标的的.NET Framework 3.5

这并没有解决它。

如何启用.NET Framework的源加强在Visual Studio 2010?


有人的地方悠闲地想知道其他人是否遇到同样的问题<一href="http://stackoverflow.com/questions/1428916/net-source-debugging-on-windows-7/1430944#1430944">was使用64位版本的调试器的。现在,有没有这样的事情作为一个64位版本的Visual Studio,但我想,从切换我的项目值为anycpu 86 (它被JIT编译到x64),在情况下,Microsoft不支持64位处理器:

这并没有解决它:

 步骤为:法无符号System.Windows.Forms.Form.ScaleControl走出过
 

如何启用.NET Framework的源加强在Visual Studio 2010?


另请参见

  • <一个href="http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-$c$c.aspx">Configuring Visual Studio中调试.NET Framework的源$ C ​​$ C
  • <一个href="http://stackoverflow.com/questions/6206847/unable-to-debug-net-framework-$c$c-in-vs2010">Unable调试.NET框架code在VS2010
  • <一个href="http://stackoverflow.com/questions/6084095/net-framework-source-stepping-not-working-despite-options-set">.NET框架源步进不能正常工作,尽管设置选项
  • <一个href="http://weblogs.asp.net/rajbk/archive/2010/04/21/setting-up-visual-studio-2010-to-step-into-microsoft-net-source-$c$c.aspx">Setting启动Visual Studio 2010将步入微软.NET源$ C ​​$ C
  • 的Visual Studio 2008 SP1的.NET Framework源代码调试
  • <一个href="http://social.msdn.microsoft.com/Forums/en-NZ/vsdebug/thread/fbc464b6-61fa-44b0-895f-93c2d1d73e7e">No调试>模块窗口在Visual Studio 2008版本9.0.21022.8 RTM
解决方案

在PDBS通过源$ C ​​$ C步进只张贴RTM和Service Pack。因此,当安全更新出来,并修改您要调试的DLL,它会导致源踩着无法正常工作(即,你会得到没有源可用以灰色显示浏览查找源)。

然而,一旦你做了所有适当的设置,可以使用以下解决方法。解决方法是从根本上找到导致DLL来更改安全更新,然后将其删除。这包括具有您的计算机上删除了这些安全更新的明显缺点。

解决方法

  1. 在确定哪些DLL您要调试到(如System.Windows.Forms.dll中)
  2. 在调试时,打开模块在Visual Studio窗口,找到的版本的列。如果版本不是RTM或服务包版本,那么你需要做的工作流程。通常情况下,RTM DLL会说:通过内置:RTMRel。虽然一个DLL,它是一个安全更新的一部分,会说由建:RTMGDR。注意版本号(例如4.0.30319.269通过内置:RTMGDR)
  3. 现在,我们要查找创建本次版本更新。通过搜索support.microsoft.com/kb/ DLL和版本号执行此操作 比如,我做了以下的谷歌搜索: 网​​站:support.microsoft.com/kb System.Windows.Forms.dll的4.0.30319.269
  4. 在搜索应调高有关的更新。注意:在地址栏的KB编号。在我的例子地址是 http://support.microsoft.com/kb/2604121 ,所以KB2604121,就是我们感兴趣的问题。
  5. 进入控制面板 - >程序和功能,然后单击查看已安装的更新
  6. 找到的更新,它列出了KB号码(可以使用在右上框中输入搜索)。
  7. 卸载该更新。
  8. 在重复此过程,这同一个DLL,直到DLL是回到其RTMRel版本或SP版本。例如,System.Windows.Forms.dll程序,我不得不删除KB2686827,KB2604121,KB2518870,然后才回RTMRel版本。

您需要做的.NET框架内,你关心调试到每个DLL。

一旦完成,将.NET源代码中设置断点(例如,转到断点选项卡,说新建 - >中断在功能,并输入System.Windows.Forms.Form.Form)或步入之一在.NET方法中的DLL。

Update 22nd Feb 2013: The Microsoft Connect entry has note from Alok Shriram (Program Manager, Base Class Libraries, .NET Framework) that the issue should now be resolved. The Connect entry is marked as Resolved (Fixed):

This issue should now be fixed. We published an update to reference sources. Please let us know in case your issue is still not fixed.

Year and a half.

Bonus Links

Original Question

How do I enable .NET framework source stepping in Visual Studio 2010?


Note: This question is one piece of a larger whole:


Visual Studio 2010 comes with a new feature:

  • Tools, Options, Debugging, General, Enable .NET Framework source stepping

Following the instructions on the MSDN page How to: Debug .NET Framework Source:

To enable .NET Framework source debugging

  1. On the Tools menu, click Options.

  2. In the Options dialog box, click the Debugging category.

  3. In the General box, select the following check boxes:

    • Enable .NET Framework source stepping
    • Enable source server support

I do this:

Note: You will note, as the MSDN page notes, and as I noticed, that checking Enable .NET Framework source stepping will automatically uncheck **Enable Just My Code (Managed only). I also enabled the diagnostic messages of source server support.

Enabling those options automatically set a symbol cache download location for me:

Note: The Microsoft Symbol Server entry is already present (and cannot be removed).


The MSDN page says to load the symbols:

To load Framework symbols using the Modules window

  1. In the Modules window, right-click a module for which symbols are not loaded. You can tell if symbols are loaded or not by looking at the Symbols Status column.

  2. Point to Load Symbols From and click Microsoft Symbol Servers to download symbols from the Microsoft public symbols server or Symbol Path to load from a directory where you have previously stored symbols.

I try this:

and then all the symbols are loaded:

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);

Pushing F11 causes the debugger to simply skip to the next line:

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);

How do I enable .NET Framework source stepping in Visual Studio 2010?


I am sitting at a breakpoint in my code. I try double-clicking on a function further up in the call stack. This would, I hope, allow me to jump to the .NET code:

Except that it doesn’t work: Visual Studio tells me that there’s no source available:

How do I enable .NET Framework source stepping in Visual Studio 2010?


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:

And when I do, I end up debugging a disassembly of System.Windows.Forms.ScaleControl:

Which isn’t the same as, or as useful as, being able to step into the .NET Framework source.

How do I enable .NET Framework source stepping in Visual Studio 2010?


The configured symbol cache path on my computer does contain symbol cache files:

So it is downloading pdb symbol files, but refusing to use them.

How do I enable .NET Framework source stepping in Visual Studio 2010?


Leppie suggested that I check the Debug log (with the debug log window open; otherwise it doesn’t log anything):

Step into: Stepping over method without symbols 'System.Windows.Forms.Form.ScaleControl'

Earlier in the log I see it loading symbols for System.Windows.Forms.dll:

Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Symbols loaded.

So it is finding my symbols, but claiming that it couldn’t find them.

How do I enable .NET Framework source stepping in Visual Studio 2010?


A guy from Microsoft Italy suggests turning off Require source files to exactly match original version:

That didn’t fix it.

How do I enable .NET Framework source stepping in Visual Studio 2010?


It has been suggested that there’s a bug with Microsoft’s source server for .NET Framework 4.0. Following that suggestion, I switched the project to target .NET Framework 3.5:

That didn’t fix it.

How do I enable .NET Framework source stepping in Visual Studio 2010?


Someone somewhere idly wondered whether another person experiencing the same problem was using the 64-bit version of the debugger. Now, there’s no such thing as a 64-bit version of Visual Studio, but I tried switching my project from AnyCPU to x86 (it was being JITed to x64), in case Microsoft doesn’t support 64-bit processors:

That didn’t fix it:

Step into: Stepping over method without symbols 'System.Windows.Forms.Form.ScaleControl'

How do I enable .NET Framework source stepping in Visual Studio 2010?


See also

解决方案

The PDBs for stepping through the source code are only posted for RTM and Service Packs. As such, when security update comes out and it modifies the dll you are trying to debug, it will cause source stepping to not work (that is, you'll get the "No source Available" with a greyed out "Browse to find Source").

However, once you've made all the appropriate settings, you can use the following workaround. The workaround is essentially to find the security updates that caused the dll to change, and then remove them. This has the obvious downside of having those security updates removed on your machine.

Workaround

  1. Identify which dll you want to debug into (e.g. System.Windows.Forms.dll)
  2. While debugging, open the Modules window in Visual studio, find the Version column. If the version is not the RTM or Service pack version, then you'll need to do the workflow. Typically the RTM dll will say "built by: RTMRel". While a dll that was part of a security update will say "built by: RTMGDR". Note the version number (for example 4.0.30319.269 built by: RTMGDR)
  3. Now, we want to find the update that created this version. Do this by searching for the dll and version number at support.microsoft.com/kb/ For example, I did the following google search: site:support.microsoft.com/kb System.Windows.Forms.dll 4.0.30319.269
  4. The search should turn up information about an update. Note the KB number in the address bar. In my example the address was http://support.microsoft.com/kb/2604121, so KB2604121, is what we're interested in.
  5. Go to Control Panel->Programs and Features, and click "View Installed Updates"
  6. Find an update which lists the KB number (you can use the search in the upper right box).
  7. Uninstall that update.
  8. Repeat this process for this same dll until the dll is back to its RTMRel version or SP version. For example, for System.Windows.Forms.dll, I had to remove KB2686827, KB2604121, KB2518870 before it was back to the RTMRel version.

You'll need to do this for each dll within the .NET framework that you care about debugging into.

Once that's done, set a breakpoint within the .net source (for example, go to the Breakpoints tab, say New->Break at Function, and enter System.Windows.Forms.Form.Form) or step into one of the .net methods in that dll.

这篇关于你如何启用&QUOT;允许.NET Framework的源步进&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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