68516

Visual Studio 2010 debugger build correctly - compiler pdb and linker pdb not in synch?

I have a solution in MS VS 2010 that compiles and builds properly after a rebuild all (1). However, after I make a change to a source file and begin debugging, VS recognizes the project is out of date and builds the project (2) successfully (as expected).

The problem is that it seems VS begins debugging the project using obj/pdb/etc.. from (1) above instead of (2). If I break into the debugger and navigate to the module that changed in the file of interest, I'm told "the source file is different from when the module was built". Indicating I don't want to rebuild the source, I'm given the following info below: (Note that in order to get a "good" build I have to rebuild the solution (or delete vc100.pdb)).

<hr>

Locating source for "file of interest". Checksum: MD5 {59 96 7d 1 9f b 33 20 63 4c 81 1d d7 c6 94 30}

Determining whether the checksum matches for the following locations: 1: "file of interest" Checksum: MD5 {61 66 43 cb d1 97 d1 d5 0 dc 9b 60 64 71 b2 b6} Checksum doesn't match. The file "file of interest" exists.

Looking in script documents for "file of interest"...

Determining whether the checksum matches for the following locations:

1: "file of interest" Checksum: MD5 {61 66 43 cb d1 97 d1 d5 0 dc 9b 60 64 71 b2 b6} Checksum doesn't match.

Looking in the projects for "file of interest".

The file was not found in a project.

Looking in directory

.

misc directories

.

The debugger will ask the user to find the file: "file of interest".

The user pressed Cancel in the Find Source dialog. The debug source files settings for the active solution have been modified so that the debugger will not ask the user to find the file: "file of interest".

The debugger could not locate the source file "file of interest".

<hr>

At this point the debugger recognizes the pdb hashes are out of synch even though compiler/linker failed to recognize this earlier. Everything works correctly after a rebuild but doesn't seem to build itself correctly after a change to a source file.

It seems that a "rebuild" properly builds both vc100.pdb and debugger pdb while a "normal" build only only touches the compiler/linker vc100.pdb...but I'm not positive.

Anyone have any ideas?

Thanks,

Paul

Answer1:

Solution is very simple.

    <li>

    Just Exclude the file from the project (the one for which checksum issue occured).

    </li> <li>

    Include the same file again in project

    </li> <li>

    Rebuild whole project

    </li> </ul>

    Thast it. I hope this will resolve your problem. SAM

    Answer2:

    The problem isn't with the pdb it's that the VS isn't correctly detecting when modules should be re-compiled.

    More specifically, I have a source-controlled code base that is tested via a suite of unit tests.

    The unit tests are keyed off of a main file, say MainTest.cpp, which has the int main(...) function that launches all of the tests. This is just a glue file and rarely changes. The files that change often are the test classes it imports.

    Now, all my test classes are "header-less" i.e. all definitions/declarations are contained within one module (such as TestClass1.cpp, TestClass2.cpp, etc...) mainly because they're just tests and I don't want the extra clutter.

    The problem is that when I make changes to TestClass1.cpp and build, VS 2010 doesn't deem it necessary to re-build MainTest.cpp saying:

    Skipping... (no relevant changes detected) MainTest.cpp

    Apparently this is a known issue, see:

    http://connect.microsoft.com/VisualStudio/feedback/details/99825/code-change-in-header-does-not-re-compile-correctly

    To correctly build, I have to force VS to re-compile MainTest.cpp. As a workaround, I put a "touch MainTest.cpp" in my project's Pre-Build Event.

    Some follow-up questions:

    <ol> <li>Does MS intend to fix this? If so, have they?</li> <li>Is there a better workaround?</li> </ol>

    Answer3:

    Excluding the file from the project and then including it again collowed by a project compile is the only solution that worked. Thanks to SAM. I am writing so as to document potential solutions and to show this suggestion was the most effective.

    The following often suggested solutions did not work:

    <ol> <li>Manually compiling all the .cpp files in the project using right click in the solution explorer.</li> <li>Touching Main.cpp (running: touch main.cpp) or any/all of project files, then rebuilding project.</li> <li>Resetting the project settings (inside tool-> Import and Export Settings) and the recompiling the project. </li> </ol>

    Answer4:

    I`ve found how to reproduce it

    if Intermediate Directory is set to something like

    $(TMP)\Build\$(SolutionName) - $(Platform).$(Configuration) - $(ProjectName)\

    then linker will not see changes, but if you set it to

    S:\Build\$(SolutionName) - $(Platform).$(Configuration) - $(ProjectName)\

    then linking will be ok

    Answer5:

    the problem is with th PDB file. make Clean on the project before rebuild it

    Answer6:

    Problem occurs because of the PDB file. Clean the project and rebuild it. Or remove the file from the project and include it again and rebuild it.

Recommend

  • How do I downgrade a SQL 2008 MDF file for use in SQL 2005?
  • How to manually update Entity framework Code first model so that it updates a database (with a new c
  • Why revision # different between show log and svn update?
  • How to refresh/Synch View based on a Query with dynamic range?
  • Using hash symbol in forward URL with RequestDispatcher
  • How Strings are stored in a VBA Dictionary structure?
  • URL hash format, what's allowed and what's not?
  • Getting android_key_not_configured facebook error
  • Returning this from a constructor function in JS
  • dismiss Progress Dialog in another Activity … Android
  • How to remove all of a jQuery UI dialog when it is closed
  • What is the correct way to synchronize a shared, static object in Java?
  • How to load more than one div at a time
  • Eloquent update method change created_at timestamp
  • How to get Eclipse Oxygen to run on Java 9
  • Custom Tabgroup Appcelerator
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Alert pop up with LWUIT
  • Can I check if a recipient has an automatic reply before I send an email?
  • Android screen density dpi vs ppi
  • Getting last autonumber in access
  • Counter field in MS Access, how to generate?
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • Where to put my custom functions in Wordpress?
  • Javascript + PHP Encryption with pidCrypt
  • Websockets service method fails during R startup
  • XCode can't find symbols for a specific iOS library/framework project
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • need help with bizarre java.net.HttpURLConnection behavior
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is there any way to bind data to data.frame by some index?
  • Busy indicator not showing up in wpf window [duplicate]
  • How can i traverse a binary tree from right to left in java?