Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
447 views
in Technique[技术] by (71.8m points)

c# - Symbol file not loading for debugging custom project in 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.

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.

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.

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

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.

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...