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

时间:2020-12-01 00:37:08

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.

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

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.

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

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

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

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

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

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".

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

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肯定是与有问题的dll同时构建的。

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

很明显问题是“无法打开pdb”部分的错误消息。

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

我在两台计算机上试过这个,两者都表现出相同的行为。

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?

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

14 个解决方案

#1


34  

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.

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

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.

事实证明,尽管项目的obj文件夹中的dll和pdb是匹配的,但实际上通过构建后事件复制到应用程序的目标文件夹的dll是来自上一版本的旧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.

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

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.

我通过编辑解决方案的项目依赖项来确定问题,并确保具有post-build事件的项目依赖于未加载的项目,现在pdb在调试期间加载。

#2


29  

I simply deleted bin and obj folder from the startup project folder and rebuild the solution.

我只是从启动项目文件夹中删除了bin和obj文件夹并重建了解决方案。

#3


10  

For me I just deleted the project from IIS and created it again and it works fine

对我来说,我刚刚从IIS中删除了该项目并再次创建它,它工作正常

#4


9  

For me it helped to use chkmatch tool and then just close and open visual studio, make clean and rebuild. Now my pdb gets also loaded. You can make sure it does, as Nanhydrin pointed out, from Debug -> Windows -> Modules - this view is only accessible during debugging.

对我来说,它有助于使用chkmatch工具,然后关闭并打开visual studio,进行清理和重建。现在我的pdb也被加载了。正如Nanhydrin指出的那样,你可以确保它来自Debug - > Windows - > Modules - 这个视图只能在调试期间访问。

#5


7  

In my case older version of referenced dll was in my GAC. Cleared it out, and it worked.

在我的情况下,引用的dll的旧版本在我的GAC中。清除它,它工作。

#6


6  

I found that the project I was receiving the message about, was being optimized when built.

我发现我收到消息的项目在构建时正在优化。

I went into the projects properties, Compile Tab, Advanced Compile Options... and unchecked the Enable Optimizations checkbox

我进入了项目属性,编译选项卡,高级编译选项...并取消选中启用优化复选框

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

#7


3  

Reminder: Put the project into "Debug" configuration... for those like me who forget and feel silly.

提醒:将项目置于“调试”配置中...对于那些忘记和感到愚蠢的人。

#8


2  

Deleted the project from solution and added it again to the solution worked for me. :)

从解决方案中删除了项目,并将其再次添加到为我工作的解决方案中。 :)

#9


2  

Bit late to the party here - just in case this is helpful.

在这里聚会迟到 - 以防万一这是有帮助的。

We have a couple of separate websites (in different solutions in Visual Studio). On initial load of one of the sites, we were making a call to the other site which would return an image.

我们有几个独立的网站(在Visual Studio的不同解决方案中)。在其中一个站点的初始加载时,我们正在调用另一个将返回图像的站点。

Both of these sites referenced a common DLL, but while working on one site, had not realised that the other site had been left in a 'Release' build - after the site loaded, the offending DLL was rebuilt, but without symbols.

这两个站点都引用了一个常见的DLL,但是当在一个站点上工作时,没有意识到另一个站点已经被放置在“Release”构建中 - 在加载站点之后,重建了有问题的DLL,但是没有符号。

Kudos to Nanhydrin for both mentioning the modules debug window (very helpful) and for putting me on the right track with the post build event.

感谢Nanhydrin提到模块调试窗口(非常有帮助),以及使用post build事件让我走上正确的轨道。

#10


1  

Answer from another thread that worked for me: https://*.com/a/28476665/5969306
- In Visual Studio: Project Properties -> Build -> Advanced button -> Debug info drop-down and make sure the value is not “none”.

从另一个对我有用的线程中回答:https://*.com/a/28476665/5969306 - 在Visual Studio中:项目属性 - >构建 - >高级按钮 - >调试信息下拉列表并确保值不是“没有”。

#11


1  

I just had this issue and thought I would put my fix here, as it my help others (maybe even myself again?!) in the future...

我刚刚遇到这个问题并且认为我会把我的解决方案放在这里,因为我将来帮助其他人(甚至可能是我自己?)

Make sure that when you are attaching to the process on the remote server, that the "Attach to" is set to

当您连接到远程服务器上的进程时,请确保将“附加到”设置为

Automatically determine the type of code to debug

自动确定要调试的代码类型

To do this, When the server qualifier has been provided and a list of processes is visible, click the "Select" button next to the "Attach to" input.

为此,在提供服务器限定符并显示进程列表时,单击“附加到”输入旁边的“选择”按钮。

未加载符号文件以在Visual Studio 2012中调试自定义项目 Then, select "Automatically determine the type of code to debug" and OK out of the screen, then attach.

然后,选择“自动确定要调试的代码类型”,然后单击“确定”,然后选择“附加”。

未加载符号文件以在Visual Studio 2012中调试自定义项目
This fixed the issue for me, at least.

这至少为我解决了这个问题。

#12


0  

I had a line like this in my debug window:

我的调试窗口中有这样一行:

Symbols for the module 'MyModule.dll' were not loaded.

未加载模块“MyModule.dll”的符号。

I removed the 'Optimize code' option in Project properties -> Build. And the error disappeared.

我删除了Project properties - > Build中的'Optimize code'选项。错误消失了。

#13


0  

This issue may be due to wrong reference of dlls used in project.

此问题可能是由于项目中使用的dll的错误引用。

Delete obj and bin folders in current project and build project again.

删除当前项目中的obj和bin文件夹,然后重新构建项目。

#14


0  

Check for permission to ASP.NET Temporary folder:

检查ASP.NET临时文件夹的权限:

"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"

User of application pool has to have the rights to subfolder with ASP.NET files, something like:

应用程序池的用户必须拥有使用ASP.NET文件的子文件夹的权限,例如:

root\60039743\c28e12ee

#1


34  

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.

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

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.

事实证明,尽管项目的obj文件夹中的dll和pdb是匹配的,但实际上通过构建后事件复制到应用程序的目标文件夹的dll是来自上一版本的旧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.

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

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.

我通过编辑解决方案的项目依赖项来确定问题,并确保具有post-build事件的项目依赖于未加载的项目,现在pdb在调试期间加载。

#2


29  

I simply deleted bin and obj folder from the startup project folder and rebuild the solution.

我只是从启动项目文件夹中删除了bin和obj文件夹并重建了解决方案。

#3


10  

For me I just deleted the project from IIS and created it again and it works fine

对我来说,我刚刚从IIS中删除了该项目并再次创建它,它工作正常

#4


9  

For me it helped to use chkmatch tool and then just close and open visual studio, make clean and rebuild. Now my pdb gets also loaded. You can make sure it does, as Nanhydrin pointed out, from Debug -> Windows -> Modules - this view is only accessible during debugging.

对我来说,它有助于使用chkmatch工具,然后关闭并打开visual studio,进行清理和重建。现在我的pdb也被加载了。正如Nanhydrin指出的那样,你可以确保它来自Debug - > Windows - > Modules - 这个视图只能在调试期间访问。

#5


7  

In my case older version of referenced dll was in my GAC. Cleared it out, and it worked.

在我的情况下,引用的dll的旧版本在我的GAC中。清除它,它工作。

#6


6  

I found that the project I was receiving the message about, was being optimized when built.

我发现我收到消息的项目在构建时正在优化。

I went into the projects properties, Compile Tab, Advanced Compile Options... and unchecked the Enable Optimizations checkbox

我进入了项目属性,编译选项卡,高级编译选项...并取消选中启用优化复选框

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

#7


3  

Reminder: Put the project into "Debug" configuration... for those like me who forget and feel silly.

提醒:将项目置于“调试”配置中...对于那些忘记和感到愚蠢的人。

#8


2  

Deleted the project from solution and added it again to the solution worked for me. :)

从解决方案中删除了项目,并将其再次添加到为我工作的解决方案中。 :)

#9


2  

Bit late to the party here - just in case this is helpful.

在这里聚会迟到 - 以防万一这是有帮助的。

We have a couple of separate websites (in different solutions in Visual Studio). On initial load of one of the sites, we were making a call to the other site which would return an image.

我们有几个独立的网站(在Visual Studio的不同解决方案中)。在其中一个站点的初始加载时,我们正在调用另一个将返回图像的站点。

Both of these sites referenced a common DLL, but while working on one site, had not realised that the other site had been left in a 'Release' build - after the site loaded, the offending DLL was rebuilt, but without symbols.

这两个站点都引用了一个常见的DLL,但是当在一个站点上工作时,没有意识到另一个站点已经被放置在“Release”构建中 - 在加载站点之后,重建了有问题的DLL,但是没有符号。

Kudos to Nanhydrin for both mentioning the modules debug window (very helpful) and for putting me on the right track with the post build event.

感谢Nanhydrin提到模块调试窗口(非常有帮助),以及使用post build事件让我走上正确的轨道。

#10


1  

Answer from another thread that worked for me: https://*.com/a/28476665/5969306
- In Visual Studio: Project Properties -> Build -> Advanced button -> Debug info drop-down and make sure the value is not “none”.

从另一个对我有用的线程中回答:https://*.com/a/28476665/5969306 - 在Visual Studio中:项目属性 - >构建 - >高级按钮 - >调试信息下拉列表并确保值不是“没有”。

#11


1  

I just had this issue and thought I would put my fix here, as it my help others (maybe even myself again?!) in the future...

我刚刚遇到这个问题并且认为我会把我的解决方案放在这里,因为我将来帮助其他人(甚至可能是我自己?)

Make sure that when you are attaching to the process on the remote server, that the "Attach to" is set to

当您连接到远程服务器上的进程时,请确保将“附加到”设置为

Automatically determine the type of code to debug

自动确定要调试的代码类型

To do this, When the server qualifier has been provided and a list of processes is visible, click the "Select" button next to the "Attach to" input.

为此,在提供服务器限定符并显示进程列表时,单击“附加到”输入旁边的“选择”按钮。

未加载符号文件以在Visual Studio 2012中调试自定义项目 Then, select "Automatically determine the type of code to debug" and OK out of the screen, then attach.

然后,选择“自动确定要调试的代码类型”,然后单击“确定”,然后选择“附加”。

未加载符号文件以在Visual Studio 2012中调试自定义项目
This fixed the issue for me, at least.

这至少为我解决了这个问题。

#12


0  

I had a line like this in my debug window:

我的调试窗口中有这样一行:

Symbols for the module 'MyModule.dll' were not loaded.

未加载模块“MyModule.dll”的符号。

I removed the 'Optimize code' option in Project properties -> Build. And the error disappeared.

我删除了Project properties - > Build中的'Optimize code'选项。错误消失了。

#13


0  

This issue may be due to wrong reference of dlls used in project.

此问题可能是由于项目中使用的dll的错误引用。

Delete obj and bin folders in current project and build project again.

删除当前项目中的obj和bin文件夹,然后重新构建项目。

#14


0  

Check for permission to ASP.NET Temporary folder:

检查ASP.NET临时文件夹的权限:

"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"

User of application pool has to have the rights to subfolder with ASP.NET files, something like:

应用程序池的用户必须拥有使用ASP.NET文件的子文件夹的权限,例如:

root\60039743\c28e12ee