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?
In Visual Studio, open Tools > Options > Debugging > Symbols (or Debug > Options > Symbols).
Go to Tools->Options->Debugging->Symbols and add the path to the .
The easiest way to use the PDB file is to let Visual Studio do the heavy lifting - either launch your program with Visual Studio's "Debug" command (F5 by default), or run the program and use the "Attach to Process" item in Visual Studio's Debug menu.
Open Settings: Tools->Options -> Debugging -> Symbols and add directory, where your . PDB files are located. You can add custom path, like for each project, and also you can edit common path, where Visual Studio will save all . pdb cache.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With