即使加载了PDB,Visual Studio 2012也拒绝显示源代码

fer*_*olo 5 c# visual-studio visual-studio-debugging pdb-files visual-studio-2012

我正在尝试调试发布Web服务的Azure应用程序,而Visual Studio 2012拒绝显示源代码,即使加载了PDB也是如此.这是我的设置:

在DEBUG>选项和设置...>调试>常规:

  • []启用我的代码
  • []启用.NET Framework源步进
  • [x]启用源服务器支持
  • []要求源文件与原始版本完全匹配

在DEBUG>选项和设置...>调试>符号:

解决方案属性>调试源文件:

  • C:\路径\为\我\ CSfiles \
  • c:\ Program Files(x86)\ Microsoft Visual Studio 11.0\VC\crt\src \
  • 等等

重现步骤:

  1. 将Azure应用程序部署到Development Fabric(计算仿真器).
  2. 以管理员身份打开VS2012.
  3. 附加到WaWorkerHost.exe,等待符号加载并验证MyModule.dll是否加载了符号.
  4. [optional] Choose Solution Properties... > Debug Source Files and add c:\path\to\my\CSfiles\ as first entry.
  5. Choose DEBUG > New Breakpoint > Break At Function...
  6. Function: MyClass.MyMethod. Language: C#.
  7. VS2012 complains it was unable to find, but it adds the breakpoint.
  8. Make the breakpoint hit.
  9. Once hit, double click on first item of "call stack". It's the MyClass.MyMethod, called by a class from System.ServiceModel.dll.
  10. VS2012 shows the "No Source Available" with only the "Show Disassembly" option (image below):

在此输入图像描述

At Call Stack window, if I right-click on the current method (which was hit by the breakpoint), and choose Symbol Load Information..., the last line shows:

c:\path\to\my\PDBs\MyModule.pdb: Symbols loaded.
Run Code Online (Sandbox Code Playgroud)

If I open DEBUG > Windows > Modules, my module shows correctly:

  • Path is correct.
  • Optimized = No.
  • User Code = N/A (like everything else).
  • 符号状态=已加载符号.
  • 符号文件= c:\ path\to\my\PDBs\MyModule.pdb(这是正确的).

是的,应用程序是使用完整的调试信息构建的.我已经使用此工具转储了PDB ,并在正确的位置显示了我的源代码.

有趣的是,我可以从.NET Framework中看到所有来源.我只是看不到自己的来源,这真的令人沮丧.

我已经从user-dir\Documents\Visual Studio 2012\Projects中删除了任何.suo文件,但没有帮助.我想这无济于事,因为我总是附加一个可执行文件,它会自动创建一个新的解决方案.

小智 0

我以为微软发布了 .net 的所有代码。但显然 ServiceModel 程序集仍然关闭。

可能是 ServiceModel 在调用您的代码之前做了一些魔法,使调试器感到困惑。

但对于你的问题,听起来该服务正在运行旧版本的 dll。

尝试取消选中“要求源文件与原始文件完全匹配”设置,看看它是否在断点处中断。如果它在该阶段遇到断点,则意味着部署 dll 时出现一些问题。

您是否尝试过像 resharper 这样的反编译器来看看它是否有效?