Hi,
So we have an application that loads a dll for some functionality (LoadLibrary) and frees it again when it's done doing the work (FreeLibrary).
The following worked in VS2010 but stopped working once we switched to VS2012:
- Start the application in the debugger
- Load the dll
- do stuff
- Unload the dll
- recompile the dll
- copy dll and pdb over the old files
- Load the dll in the app and do work again
VS2010 seemed to correctly release the handle to the pdb file when we unload the dll (FreeLibrary). But VS2012 holds on to the pdb and only frees it once I stop the debugging session.
Now before any questions arise:
- The dll refcout is 0 and the dll is being unloaded after our call to FreeLibrary, 100% certain, that is not the issue.
- No one but devenv holds a handle to the pdb file after the call to FreeLibrary.
- The pdb will be opened by VS using exclusive write access, so just loading the pdb in our process with write access will result in VS not being able to open it.
Could someone please enlighten me what and why has changed between VS2010 and VS2012 and how I can work around that issue? Making this possible is quite important for specific workflows that we have so an answer like: "don't do it" is not going to help especially since this workflow worked perfectly well in the past few versions of VS.
Many thanks in advance.