Cosmos
Cosmos copied to clipboard
VS2019 locks .pdb file, which makes cosmos unrunable
Area of Cosmos - What area of Cosmos are we dealing with?
IDE
Expected Behaviour - What do you think that should happen?
IDE should release .pdb file after run, so cosmos would be runable again
Actual Behaviour - What unexpectedly happens?
IDE locks .pdb file, and an error about this is shown in the error list. It won't let you run cosmos again, until you close the IDE and reopen it.
Reproduction - How did you get this error to appear?
I made the vmplayer close because of uncaught exception (more about this behavior at #1344 ), after this I changed some lines (commented the problemaic line and added cw line) of code and it made this problem.
This is the line that made vm player close:
throw new Exception("closes the vm");
let it run, after vm-player closes, comment this line and run again.
Edit: you must have breakpoint in your code (anywhere), then have a breakpoint at the second run (can be other place) in order for it to heppen.
This what you get by doing this: 10x warnings of this:
Severity Code Description Project File Line Suppression State
Warning MSB3026 Could not copy "obj\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb" to "bin\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb' because it is being used by another process. The file is locked by: "Microsoft Visual Studio 2019 (8828)" Hello_Cosmos C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 4268
And this errors:
Severity Code Description Project File Line Suppression State
Error MSB3027 Could not copy "obj\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb" to "bin\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb". Exceeded retry count of 10. Failed. The file is locked by: "Microsoft Visual Studio 2019 (8828)" Hello_Cosmos C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 4268
Severity Code Description Project File Line Suppression State
Error MSB3021 Unable to copy file "obj\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb" to "bin\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb". The process cannot access the file 'bin\Debug\netcoreapp2.0\cosmos\Hello_Cosmos.pdb' because it is being used by another process. Hello_Cosmos C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 4268
Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?
User Kit 20190628
just restart VS that should fix it
Well, I know restart would force the ide to release the file, and I mentioned it in the "actual behaviour" description. Yet it's not what expected, as for each time you get this type of problem you must restart the ide. Keep in mind that if the code is long and complex, it would be harder to find the error, the ide not prompting anything about it. And if you didn't found it right away, you may get this error for several times, for each time you run your code and trying to debug
I found out this error appear only if you had breakpoint in the project before the crash, then you edit your code but leave the breakpoint. Updated the reproduction section. I think it has to do with edit-and-continue (ENC), maybe VS debugger not getting that the VM is closed.
Apparently, this happen on some CPU exceptions, no metter what goes on vs2019.
Stale issue message
Still happening on vs2022, that's why I prefer JetBrains Rider 😎
I think this got fixed