c# - 在 Visual Studio 中使用 Pdb 文件和源代码文件进行调试

标签 c# visual-studio visual-studio-2010 visual-studio-2012 pdb-files

我有一个 Web 项目,它从客户端代码发布到外部 dll 中的一个方法,我有这个外部 dll 的源代码文件和 pdb 文件。我想做的是使用源代码文件和 pdb 调试外部 dll。 Visual Studio 不会停止说此后没有为模块加载任何符号。

最佳答案

要调试一个具有相同版本的符号文件总是需要的。当您调试自己的应用程序时,您通常不必关心这一点。

但是后台发生了一些事情。当您构建应用程序时,Visual Studio 始终将符号文件放在调试文件夹中,并按照自动加载符号中所述加载它们。

(当您分发您的应用程序时,您通常不想分发这些符号,因此它们不会被复制到您将构建配置更改为发布的发布目录。)

手动加载符号

如果您想手动加载符号,可以使用 Modules 对话框加载它们。

“调试”->“Windows”->“模块”

您可以右键单击一行,然后有“加载符号”选项可以让您指定要加载的 PDB 文件。

enter image description here

自动加载符号

当可以在以下位置之一找到符号时,Visual Studio 也会自动加载符号 listed in the Specify Symbol (.pdb) and Source Files in the Visual Studio Debugger documentation :

  • The location that is specified inside the DLL or the executable file.

    (By default, if you have built a DLL or an executable file on your computer, the linker places the full path and file name of the associated .pdb file inside the DLL or the executable file. The debugger first checks to see if the symbol file exists in the location that is specified inside the DLL or the executable file. This is helpful, because you always have symbols available for code that you have compiled on your computer.)

  • .pdb files that could be present in the same folder as the DLL or executable file.

  • Any local symbol cache folders.

  • Any network, internet, or local symbol servers and locations that are specified on, such as the Microsoft symbol server if enabled.

enter image description here

如果您想了解更多关于符号如何与 visual studio 一起使用的信息,您可以阅读 this关于了解符号文件和 Visual Studio 的符号设置的文章。

关于c# - 在 Visual Studio 中使用 Pdb 文件和源代码文件进行调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44383026/

相关文章:

c# - 在进程停止响应(最好是C#)时获得通知

c# - 获取公共(public) Internet IP 地址/geo loc 的智能方法

c# - PCF 和服务栈

visual-studio - checkin 已重命名为 TFS 的 SLN

visual-studio - .net core 项目依赖项 - 黄色三角形

c++ - 使用 Visual Studio 为 x64 编译?

asp.net - 如何调试已部署的网站

c# - Apache Active MQ .Net 客户端 (Apache NMS) 和 Visual Studio 2010 C# Express

c# - 无法将电话号码插入数据库(MS Access 文件)

c++ - 如何修复 istringstream 编译器错误?