符号问题 - 无法进入.NET代码

时间:2011-07-08 13:25:57

标签: visual-studio visual-studio-2010 symbols

我无法让Visual Studio 2010 SP1进入任何.NET Framework类,我在互联网上找到了很多指南,但它们都没有工作......

Description

以下是输出窗口的内容:

Step into: Stepping over method without symbols 'System.Collections.Generic.SortedSet<Shared.Optimization.Solution<GaTest.CurveFitSimplex,double>>.Remove'

这是整个输出窗口内容:

'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\Lu4\documents\visual studio 2010\Projects\Estimator\GaTest\bin\Debug\GaTest.vshost.exe', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Symbols loaded.
The thread 'vshost.NotifyLoad' (0x1444) has exited with code 0 (0x0).
The thread '<No Name>' (0x3d8) has exited with code 0 (0x0).
The thread '<No Name>' (0x10a8) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0xc40) has exited with code 0 (0x0).
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\Lu4\documents\visual studio 2010\Projects\Estimator\GaTest\bin\Debug\GaTest.exe', Symbols loaded.
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\Lu4\documents\visual studio 2010\Projects\Estimator\GaTest\bin\Debug\Shared.dll', Symbols loaded.
Step into: Stepping over method without symbols 'System.Collections.Generic.SortedSet<Shared.Optimization.Solution<GaTest.CurveFitSimplex,double>>.Remove'
'GaTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Symbols loaded.

2 个答案:

答案 0 :(得分:5)

简答: http://referencesource.microsoft.com/downloadsetup.aspx

答案很长:

通常,PDB文件只是源代码和程序集IL代码之间的映射。要使其工作,您需要将源代码下载到PDB中的“硬编码”位置。 您只需在文本查看器中查看PDB文件即可找到此位置。例如,如果您看到System.pdb,您将看到如下行:

  

F:\ DD \ NDP \ FX \ SRC \净\ SYSTEM \净\的WebSockets \ websocketconnectionstream.cs   F:\ DD \ NDP \ FX \ SRC \服务\监测\ SYSTEM \ diagnosticts \ eventloginternal.cs

有一些记录不完整的方法可以覆盖这种行为,但这是另一个故事。 您还需要确保在visual studio中配置了正确的调试设置:Tools\Options\Debugging\General

您可以从here下载源代码和详细说明。

答案 1 :(得分:1)

Philipp Munin提到的

The article逐步解释了如何进入(调试).NET Framework代码。但是,如果您不想下载整个框架并想要进入特定的程序集,可以遵循一个稍微简单的过程:

(这些在VS2015中测试,其中调试选项与VS2010中的调试选项略有不同)

  1. 确保您可以使用自己的其他代码:

    调试→选项→常规

    • 启用只需清除我的代码
    • 必须选中启用.NET Framework源步骤(这会在附加到进程时不时触发符号下载,但可能会被取消)
    • 应清除属性和运算符
    • 应检查启用的源服务器支持
  2. 确保加载了装配符号(例如System.Data.dll

    • 转到调试→Windows→模块
    • 过滤System.Data.dll
    • 右键单击→符号设置→检查Microsoft符号服务器
    • 再次右键单击→加载符号
  3. 您可能不清楚Microsoft符号服务器,因为符号已被缓存。

    现在,您可以进入System.Data.dll中定义的类的方法。

    明显的副作用:如果启用(抛出)异常,许多异常可能会中断应用程序启动(带有框架的“隐藏”异常)。这可以通过取消选中特定的异常类型或在应用程序启动完成后手动附加(或Reattaching)来处理。