How to prevent visual studio 2019 from locking pdb files? - c++

I have a DLL and an executable setup to allow for code hot reloading. The executable reloads the DLL when there are any changes to it. It works fine when using a standalone debugger such as windbg. I would like to be able to use the visual studio debugger the same way.
The problem is that if I attempt to rebuild the project, the linker is unable to write to the pdb files because visual studio has them locked. So I get the following error:
LINK : fatal error LNK1201: error writing to program database 'c:\Users\maxim\source\repos\transforms\x64\Debug\particles.pdb'; check for insufficient disk space, invalid path, or insufficient privilege
How can I prevent visual studio 2019 from locking the pdb files?

Related

How to fix the "Cannot find or open the PDB file." in Visual Studio 2017

Every time I run a project in Visual Studio 2017, it loads all dll files. In the Debug output, I can see "Symbols loaded." after most of the dll files. But after the "msvcp140d.dll" and "ig4icd32.dll" files, it says "Cannot find or open the PDB file."
How can I fix this?
Can someone help???
How can I fix this?
There is nothing to "fix".
If you run your program in the Visual Studio debugger, it tries to probe for PDB files when DLLs are loaded at the startup of your program.
The message just states that the PDB files for some DLLs cannot be found and loaded.
Usually this will not be a problem since you don't need to debug msvcp140d.dll or similar system essentials.
For pdb missing, Clean Solution and perform Rebuild Solution from project menu.
For 'msvcp140d.dll file not found' ,check your project settings, choose toolkit14, debug mode and linker setting for dynamic link. Try to install MS redistributable c++ for 2015 x86 and x64.

Error opening .exe of Visual Studio project in another computer

When I open the .exe file of my Visual Studio C++ project (C++ CLR project) in another computer(that probably doesn't have VS), I get this error:
The program can't start because MSVCR120D.dll is missing from your computer. Try reinstalling the program to fix this problem.
Can you help me how can I solve it that my program can be opened in other computers?
You must create a Release build. Your problem is caused by copying over a Debug build, but that build is intended for the Visual Studio Debugger.

Microsoft Visual Studio 2010 Cannot find or open the PDB file- McAfee

I am trying to debug my C++ program in Microsoft Visual Studio 2010- having just recompiled the code after making some changes, have run the program, and am now trying to attach to the process (Debug -> Attach To Process...).
However, when I do this, I am presented with an error that I've never seen before:
'AMSCDNUSimulatord.exe': Loaded 'C:\Program Files (x86)\McAfee\Host Intrusion Prevention\HcApi.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x1c04) has exited with code 0 (0x0).
I haven't done anything differently to what I normally do (built the project, copied the 'AMSCDNUSimulatord.exe' (debug executable for my program) from the workspace to the release folder of the program- overwriting the existing .exe file), run the program, and attached to process from Visual Studio's Debug menu.
This usually works with no problems at all- but for some reason, I'm now getting the above error in Visual Studio's console... Anyone know anything about this?
I haven't changed any configuration of McAfee or anything, so can't think why it would be complaining about that.
I have tried checking the "Microsoft Symbol Servers under Symbol Locations" as suggested in answer to: Visual Studio 2010 "Cannot find or open the PDB file", but this doesn't seem to have made any difference.
With regard to the set up of my project, the source is in the folder C:\Workspace\Simulator, and that is where the .exe file is placed when the project is built. I am then running the release from C:\workspace\release\Simulator, so I copy the .exe from the first folder to the second once it's built, and run it from there. The thing is, that I've been following that method exactly for months, and never had any problems running the program and attaching to the process before, so I doubt that the issue is anything to do with the change to that I've made to the code... but how/ why would McAfee now be preventing me from attaching to the process?

Visual Studio test host does not load debug information

I am attempting to run a C++ unit test in Visual Studio 2008. While the test seems to run fine, when I attempt to debug it (after compiling in debug mode) I get the following message:
Debugging information for VSTestHost.exe cannot be found or does not match. Cannot find or open the PDB file.
This happens even if I open a completely new, empty unit test. The same happens in Visual Studio 2010 and 2012, with the test host being QTAgent32.exe and vstest.executionengine.x86.exe, respectively. If I inspect the test host process (VSTestHost.exe) using ProcessExplorer while the dialog appears, I see it is running in its own directory (Common7\IDE under the Visual Studio installation directory). Copying the PDB file there however does not help.
I stress again that this happens with a clean and empty test. How do I make the test host process load the test project's PDB file?
Turns out this message can be ignored. While the host process is indeed without debug information, the test project's PDB file should be loaded correctly, so that breakpoints in the test code will be hit.

pdb file, check for insufficient disk space, invalid path, or insufficient privilege

I am getting this error all of a sudden and I don't know why. I have to restart VS2010 everytime I make change to the code because apparently it locks the pdb files.
1>LINK : fatal error LNK1201: error writing to program database 'C:\code\MyProject\Debug\MyProject.pdb'; check for insufficient disk space, invalid path, or insufficient privilege
Even if I clean the project it doens't delete this file. I have tried the solution proposed here by Toni but it didn't work for me either. When add path to pre-build like he has suggested I get the following error:
1>C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(103,5):
error MSB3073: The command "C:\Program Files (x86)\Microsoft Visual
Studio 10.0\freepdb MyProject 1>C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(103,5):
error MSB3073: :VCEnd" exited with code 9009.
The culprit was deleaker that I had installed to detect memory leak and it looks like it was holding up the debugger/pdb files. After uninstalling my problem is fixed.
It worked for me when I closed ProcessExplorer (sysinternal tool procexp64.exe) which I was using to check number of thread memory usage. Search that file and then close it.
[Update]: You can also use Windows "Task Manager" as efficiently as "Process Explorer of Sysinternal" to locate any zombie handles.
Task Manager | Performance | Open Resource Monitor | CPU |Associated Handles | search ->
I have faced similar problem when I worked with single pdb file in two Visual Studio versions. Closing one visual studio version solved the problem.
I faced the similar issue and the reason for me was windbg was holding all the pdb files,so when the visual studio was trying to create new fresh pdb files it was unable to overwrite old files as these were being use by windbg.
So the obvious problem is when ever Visual studio is unable to overwrite the existing files with a new output files it outputs the following error.
Your antivirus is blocking the write access. Please unblock the folder protection