Symbol file not loading for debugging custom project in Visual Studio 2012

77,774

Solution 1

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.

Solution 2

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

Solution 3

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

Solution 4

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.

Solution 5

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

Deselect Enable Optimizations

Share:
77,774
Nanhydrin
Author by

Nanhydrin

A mostly C# mender who's very fond of a spot of hardware integration, performance tuning, and config management.

Updated on July 08, 2022

Comments

  • Nanhydrin
    Nanhydrin almost 2 years

    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?