asp.net - 符号已加载,但仍无法进入.Net 源代码

标签 asp.net debugging visual-studio-2015 debug-symbols

我正在尝试查看调用连接互联网的 Web API 返回的原始响应消息。调用代码如下:

object[] results = this.Invoke("MethodName", new object[] { requestObject });

问题是,在调试时,results 变量已经完全反序列化,例如我感兴趣的日期属性已经是 DateTime 类型。

所以我做了以下事情:

  1. 关闭“仅启用我的代码”。

  2. 启用“启用 .Net Framework 源代码步进”。

  3. 启用符号加载并确保 System.Web.Services 模块已加载符号(“符号已加载。”):

    System.Web.Services.dll
    C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll
    C:\Users\user\AppData\Local\Temp\SymbolCache\System.Web.Services.pdb\312122031d1b4f30b59771eb845018121\System.Web.Services.pdb
    
  4. 我在以下方法中放置了一个断点:从 SoapHttpClientProtocol.cs 第 163 行开始(由我的客户端代码调用的方法):

    protected object[] Invoke(string methodName, object[] parameters)
    
  5. 我开始调试项目并使用我的 UI 触发发出请求的代码。当我到达上面的 Invoke 行并按 F11 时,它会尝试远程调试并单步进入远程服务器:

    Microsoft Visual Studio

    Unable to automatically step into the server. Connecting to the server machine 'api.example.com' failed. The Visual Studio 2015 Remote Debugger (MSVSMON.EXE) does not appear to be running on the remote computer. This may be because a firewall is preventing communication to the remote computer. Please see Help for assistance on configuring remote debugging.

    注意:我不想进行远程调试,我只想单步执行.Net代码。

    点击“确定”后,它会转到客户端代码中的下一行,而不会单步进入 .Net 库或命中断点。

  6. 当我在中断模式下查看断点时(指令指针在调用 Invoke 行之后仍然在线),它是一个空心圆圈,并显示“当前不会命中断点” .该文档尚未加载任何符号。”

    正如上面所证明的,这没有任何意义,因为符号已被加载。

如何进入 .Net 源代码,或通过其他方式执行此请求?此特定请求比某些请求稍微复杂一些,因为它需要证书(.pfx 文件)以及用户名和密码。

嗯……一个数据点是我删除的断点位于一个文件中,该文件在顶部显示:

// Decompiled with JetBrains decompiler
// Type: System.Web.Services.Protocols.SoapHttpClientProtocol
// Assembly: System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: A6D697F9-972E-41EC-820F-E59621A808B5
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.Services.dll

我突然觉得这可能就是差异的根源。 JetBrains 是否会干扰我进入 .Net 源代码?

最佳答案

Unable to automatically step into the server. Connecting to the server machine 'api.example.com' failed. The Visual Studio 2015 Remote Debugger (MSVSMON.EXE) does not appear to be running on the remote computer. This may be because a firewall is preventing communication to the remote computer.

所以实际上你只是在本地调试你的网络应用程序,但你得到了远程调试错误/警告,对吗?

在这里点赞此文档:

https://msdn.microsoft.com/en-us/library/ms164726.aspx?f=255&MSPPError=-2147217396

If you are getting this message while you are debugging locally, your anti-virus software or a third-party firewall may be to blame. Visual Studio is a 32-bit application, so it uses the 64-bit version of the remote debugger to debug 64-bit applications. The two processes communicate using the local network within the local computer. No traffic leaves the computer, but it is possible that third party security software may block the communication.

此外,您在讨论后使用正确的步骤来调试 .NET Framework 源代码:

enter image description here

但是如果你使用VS2015,你需要考虑一下Reference源码是否已经针对.NET框架进行了更新:

Cannot step into .NET framework source code

这里是用户的声音:

https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6886255-please-keep-the-reference-source-symbol-server-upd

关于asp.net - 符号已加载,但仍无法进入.Net 源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41193244/

相关文章:

asp.net - 即使在 Debug模式下,在 WebForms 中使用包也会输出缩小/组合的文件

asp.net - 在 Windows Shell 中转义传递给 perl 脚本的参数

c# - 无法使用 Visual Studio 2013 中的 F5 进行调试,模块窗口为空

java - (Android Studio)如何仅通过我的代码进行调试?

c++ - 为什么 "Attach to Process"不允许其他传输类型? VS 2008

visual-studio - Visual Studio 2015 更新 3 未安装(无错误或反馈)

asp.net - .Net框架: exception in w3wp. exe

visual-studio-2015 - Visual Studio nuget 没有使用 HTTPS 配置的提要,而是使用 HTTP

entity-framework - Visual Studio 2015 Update 2 打破 EF 逆向代码工程师 vsix

asp.net - Web.Config 文件中的多行文本