我有一个 Web 项目,它从客户端代码发布到外部 dll 中的一个方法,我有这个外部 dll 的源代码文件和 pdb 文件。我想做的是使用源代码文件和 pdb 调试外部 dll。 Visual Studio 不会停止说此后没有为模块加载任何符号。
最佳答案
要调试一个具有相同版本的符号文件总是需要的。当您调试自己的应用程序时,您通常不必关心这一点。
但是后台发生了一些事情。当您构建应用程序时,Visual Studio 始终将符号文件放在调试文件夹中,并按照自动加载符号
中所述加载它们。
(当您分发您的应用程序时,您通常不想分发这些符号,因此它们不会被复制到您将构建配置更改为发布的发布目录。)
手动加载符号
如果您想手动加载符号,可以使用 Modules
对话框加载它们。
“调试”->“Windows”->“模块”
。
您可以右键单击一行,然后有“加载符号”选项可以让您指定要加载的 PDB 文件。
自动加载符号
当可以在以下位置之一找到符号时,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.
如果您想了解更多关于符号如何与 visual studio 一起使用的信息,您可以阅读 this关于了解符号文件和 Visual Studio 的符号设置
的文章。
关于c# - 在 Visual Studio 中使用 Pdb 文件和源代码文件进行调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44383026/