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

16,241

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.

Share:
16,241

Related videos on Youtube

Chris
Author by

Chris

Updated on June 06, 2022

Comments

  • Chris
    Chris about 2 years

    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.

    • SLaks
      SLaks over 10 years
      Try cleaning the solution.
    • Darren Kopp
      Darren Kopp over 10 years
      Do you have the referenced project configured to build debug symbols?
    • Chris
      Chris over 10 years
      @SLaks Cleaning the solution doesn't solve the problem. The .pdb file is present in the build folder (along with the dll)
    • Chris
      Chris over 10 years
      @DarrenKopp It is definitely configured to build debug symbols. I verified that the pdb files are present, as well
    • Francis Ducharme
      Francis Ducharme over 10 years
      Timestamp on PDB file match the compile time ?
    • Francis Ducharme
      Francis Ducharme over 10 years
      I remember fixing it once by loading the symbols manually (in the Modules window, right lick, Load Symbol->Symbol Path). After that, I did not need to do it again.
  • Chris
    Chris over 10 years
    This is half of the issue, it seems. Closing anything else that might be using those DLLs/PDBs doesn't seem to help. However, if I overwrite the DLL/PDB files in my application's /bin directory with the dlls from the library's /bin directory, things work out as expected. So, it does seem to be that something is wrong with how the files are being copied to my application's /bin directory. Odd behaviour. In any case, it's not ideal but manually copying the files works in the short term. Thanks
  • Richard Brightwell
    Richard Brightwell over 6 years
    This was exactly my issue. I was trying to debug in VS while it was running in a command window.
  • Ankush Jain
    Ankush Jain over 6 years
    @Chris is absolutely right. I just checked at my end also and I found that the size and modified date both DLLs are different, but it should be the same. I am copying DLL & PDB files in post build event and I guess it is not copying latest dll file to destination folder.
  • Ankush Jain
    Ankush Jain over 6 years
    Solution: I had to stop IIS and build the project. It then copied all my files as expected.