Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"PDB does not match image" error in C# VS2010 project

I've been using a library in my code base for a while now, and I wanted to debug right into the library level. To do that, I downloaded the source code and included the project as an existing project into my C# solution. I then had my other projects reference that project instead of the downloaded .DLL.

Once the project was referenced instead of the DLL, I ran my solution through the debugger and tried to step into a function call that would have called into the external project, but it stepped right over it. While debugging, I opened up the "Modules" window and saw that the DLL's Symbol Status read "PDB does not match image", which is the likely cause of not being able to debug this project.

My question is simple, why does the PDB not match the image if my project is directly referencing the .csproj file as a reference? There should never be any ambiguity as to what version to run.

like image 644
Chris Avatar asked Dec 10 '13 16:12

Chris


People also ask

What is PDB file in C?

For C or C++ code, that Debugger relies upon a file, with the extension “. pdb”, called the “Program DataBase”, or simply “the PDB”. The PDB is written by the Linker when you build your program; it contains line-number and symbols information.

How do you fix Cannot find or open the PDB file?

Try go to Tools->Options->Debugging->Symbols and select checkbox "Microsoft Symbol Servers", Visual Studio will download PDBs automatically. PDB is a debug information file used by Visual Studio. These are system DLLs, which you don't have debug symbols for.

What is PDB file with DLL?

Program database (PDB) is a file format (developed by Microsoft) for storing debugging information about a program (or, commonly, program modules such as a DLL or EXE). PDB files commonly have a . pdb extension. A PDB file is typically created from source files during compilation.

What are PDB debugging files?

pdb file holds debugging and project state information that allows incremental linking of a Debug configuration of your app. The Visual Studio debugger uses . pdb files to determine two key pieces of information while debugging: The source file name and line number to display in the Visual Studio IDE.


1 Answers

I've run into this issue before when I have another project open that also references the DLL and uses its debug info (PDB). Basically the other project puts a file lock on the PDB in the referenced project and when you compile or debug the referenced project, it quietly fails to generate an up-to-date PDB file.

If this is what is going on, make sure you have no other apps running or instances of VS open that reference your DLL, and then seek out and delete all copies of the PDB from beneath the BIN and OBJ folders, then recompile it.

I hope that helps.

like image 197
rory.ap Avatar answered Oct 12 '22 10:10

rory.ap