I'm using Visual Studio 2019 Professional (version 16.7.7+30621.155), and when I'm compiling a big C++ DLL project (incl. our own static libs) the compiler and/or linker sometimes refuses to take in minor updates to the code.
Scenario:
- I stop a debug session and alter a line here and there in the static lib part of the code,
- I press F7 to recompile, and I see the static lib gets recompiled and the final DLL gets relinked,
- I press F5 to run the host app which loads my DLL in turn,
- The existing breakpoints in the file I just changed are now non-functional, saying that "The source code is different from the original version".
It doesn't happen every time, but enough times to really start to annoy me. A remedy is to clean and/or rebuild all, but in my case that is a lengthy process which I'd rather not do too often. I already once checked the timestamps of both the altered source file and the corresponding cached object file, and the object file did get updated...? Just now I also encountered this issue again, and I decided to "Project only \ Rebuild", and while it did rebuild the static lib the breakpoint is still inactive with the same message...? The object file's timestamp is a few minutes newer than the cpp file's timestamp, so I assume my changes got compiled in?
I also sometimes used to have this issue now and then under VS 2017 (using the 2015 toolchain), but one day the problem went away and I never saw it again. Until I now upgraded to VS 2019.
What could be the problem here?
ps: after writing this post I added+removed a space to the cpp file in question, pressed F5, the file got recompiled and the project re-linked, and now the (unaltered) breakpoints work again. It almost seems as if the compiler and/or linker use a minutes-only time resolution when comparing file time stamps, but that can't be true, right?