I have a Visual Studio solution with 12 C++ projects. Half of the projects build static libraries, and the other half build native desktop executables.
When I rebuild the entire solution from Visual Studio 2019's menu (Build > Rebuild Solution), it appears to work--I get functional, debuggable executables. However, some of the PDBs for some of the static libraries are missing. When I dig into the build log, I see a lot of linker warnings like this:
wingui.lib(text.obj) : warning LNK4099: PDB 'wingui.pdb' was not found with 'wingui.lib(text.obj)' or at 'D:\code\aid\apps\vcell\x64\Debug\wingui.pdb'; linking object as if no debug info
Indeed, wingui.pdb
is usually missing, but occasionally it's generated right where it should be. And if I turn off the parallelism in the build, it's always there. Race condition?
Updated 2021-07-24
Using procmon from the Sysinternals toolset, I logged all the operations to wingui.pdb
during a clean rebuild. Here's a summary:
- MSBuild looks for
wingui.pdb
and learns it doesn't exist. - CL creates it, writes it, reads some of it back, writes some more, and then closes it.
- MSBuild opens
wingui.pdb
, setsFILE_DISPOSITION_DELETE
, and then closes the file. Huh? - mspdbsrv tries to open
wingui.pdb
several times. Each attempt fails, of course, because MSBuild deleted it.
Can anyone explain step 3? Why would MSBuild mark a freshly made PDB file for deletion?