未加载符号文件以在 Visual Studio 2012 中调试自定义

Symbol file not loading for debugging custom project in Visual Studio 2012(未加载符号文件以在 Visual Studio 2012 中调试自定义项目)

本文介绍了未加载符号文件以在 Visual Studio 2012 中调试自定义项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2012 中有一个大型解决方案,其中包含可执行文件和类库项目.调试应用程序时,不会命中某个特定类库项目中的断点.

I have a large solution in Visual Studio 2012 which consists of executables and class library projects. When debugging the application the breakpoints in one particular class library project are not being hit.

我查看了 Debug> Windows> Modules 窗口以检查该项目的符号状态,它显示无法找到或打开 PDB 文件".
它还在 用户代码" 列下显示 否".
我注意到解决方案中的其他一些自定义项目在该列中显示否",并且它们的符号也无法加载.用户代码"下带有是"的任何内容似乎都已加载它的 pdb 没有问题.但我不确定这是否相关.

I looked at the Debug> Windows> Modules window to check the status of the symbols for that project and it says "Cannot find or open the PDB file".
It also says "No" under the "User Code" column.
I notice that there are a few other of the custom projects in the solution that are showing "No" in that column and their symbols are also failing to load. Anything with a "Yes" under "User code" seems to have had it's pdb loaded no problem. But I'm not sure if this is relevant.

我在 dll 上使用了 dumpbin/headers,并且 pdb 文件的路径存在且正确.

I have used dumpbin /headers on the dll and the path for the pdb file is present and correct.

该模块绝对不在符号加载的排除列表中.

The module is definitely not in the exclude list for the symbol loading.

我还尝试右键单击模块窗口中的条目,选择 加载符号" 并导航到 dll 标头中给出的路径.当我选择 pdb 时,它显示 在此文件夹中找不到匹配的符号文件".

I have also tried right clicking on the entry in the modules window, selecting "Load symbols" and navigating to the path given in the dll header. When I select the pdb it says "A matching symbol file was not found in this folder".

在我删除这些文件夹和文件、清理解决方案、关闭它并重建整个东西后,我得到了这个.pdb 肯定是与所讨论的 dll 同时构建的.

I get this after I have deleted these folders and files, cleaned the solution, closed it and rebuilt the whole thing. The pdb was definitely built at the same time as the dll in question.

很明显,问题在于错误消息的无法打开 pdb"部分.

So clearly the problem is the "cannot open the pdb" portion of the error message.

我已经在 2 台计算机上尝试过这个,并且都表现出相同的行为.

I have tried this on 2 computers and both are exhibiting the same behaviour.

任何人都可以提供任何关于从这里去哪里的建议,也许为什么地球上对应于 dll 的构建 pdb 不会为它加载?

Can anyone offer any suggestions on where to go from here, and perhaps why on earth the built pdb corresponding to the dll won't load for it?

推荐答案

我尝试了一些工具来检查 pdb 和 dll 是否真正匹配,并使用 chkmatch 我可以看到正在运行的 dll 中的 GUID 和 obj 文件夹中的 pdb 不匹配.

I tried a few tools to check if the pdb and the dll actually matched, and using chkmatch I could see that the GUIDs in the dll being run and the pdb in the obj folder didn't match.

事实证明,尽管项目的 obj 文件夹中的 dll 和 pdb 是匹配的,但实际上通过构建后事件复制到应用程序目标文件夹的 dll 是先前构建中的旧 dll.

So it turns out that although the dll and pdb in the project's obj folder are a match, the dll that was actually getting copied to the application's destination folder by a post-build event was the old dll from the previous build.

构建后事件在该特定项目构建或至少完成构建之前运行,并且正在从 bin 中复制现有 dll,随后被继续构建覆盖.

The post-build event was running before that particular project had built, or at least finished building, and was copying in the existing dll from the bin which was subsequently overwritten by the continuing build.

我已通过编辑解决方案的项目依赖项并确保具有构建后事件的项目依赖于未加载的项目,现在 pdb 在调试期间加载,从而解决了该问题.

I have resolved the problem by editing the project dependencies for the solution and ensuring that the project with the post-build event is dependent on the project that wasn't loading, and now the pdb loads during debug.

这篇关于未加载符号文件以在 Visual Studio 2012 中调试自定义项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:未加载符号文件以在 Visual Studio 2012 中调试自定义

基础教程推荐