Bug 19708 - [CorDebugger] Debugger locks pdb file after aborting on Windows
Summary: [CorDebugger] Debugger locks pdb file after aborting on Windows
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: master
Assignee: David Karlaš
: 9951 20284 29186 ()
Depends on:
Reported: 2014-05-13 02:38 UTC by Lopatkin Ilja
Modified: 2016-11-07 10:41 UTC (History)
10 users (show)

Is this bug a regression?: ---
Last known good build:

Demo video (5.53 MB, application/octet-stream)
2014-05-13 02:38 UTC, Lopatkin Ilja

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Lopatkin Ilja 2014-05-13 02:38:10 UTC
If you run the application, stop somewhere at the breakpoint and then forcefully exit via "Stop" command, you end up with the locked executable. Any consequent attempts to rebuild the project fails because MSBuild can't overwrite the occupied pdb file. I've attached a demo video.
Comment 1 Lopatkin Ilja 2014-05-13 02:38:37 UTC
Created attachment 6788 [details]
Demo video
Comment 2 narayanp 2014-05-13 09:47:59 UTC
I have tried to reproduce this issue with following builds:

X.S 4.2.5(Build 0)
Git revision: 95ac543f224a70960a9ab71e24ce341eb87de06f

In my case when I click on 'Stop' button somewhere at the breakpoint, debugger gets disconnected and application gets stopped. This is the screencast for the same: http://www.screencast.com/t/Wjhbo7xJeMWy

@Lopatkin, Could you please let me know which SamarinStudio build you are using?
Comment 3 Lopatkin Ilja 2014-05-14 07:31:12 UTC
No, in fact it's not the same sequence of actions. I'm sorry, I've used shortcut (Control+F8) for rebuild and thought that it will be clear that I did it. In your scenario you've just rerun the same executable with attached debugger what doesn't requre write access to .exe or .pdb file. The key point here is to rebuild it. Like you've debugged the problem, fixed it, and now want to run debugger again with the fresh code compiled.
I belive that the specific build is not important because I've been observing this bug for a couple of years. Estimately from the MonoDevelop 3.0 times.
Could you please check the rebuild scenario?
Comment 4 David Karlaš 2014-05-16 06:47:00 UTC
Most cases when .pdb would be locked and require restart is now resolved in master. Before this change I had to restart XS every few hours now it only happened only once in 2 weeks.(Still have to find reason and fix this case)... After this case is fixed and if I won't get any locks for 1 month...
I will put this bug on resolved... So with next version(probably 5.1) of XS you shouldn't have problems with this anymore...
Comment 5 David Karlaš 2014-06-03 01:15:56 UTC
*** Bug 20284 has been marked as a duplicate of this bug. ***
Comment 6 Lopatkin Ilja 2014-10-31 01:35:20 UTC
I've updated to the current trunk version and now it's broken again. Every 2-3 debug sessions XS locks my files though before update everything worked more or less fine.
Comment 7 Mikayla Hutchinson [MSFT] 2015-02-03 15:18:15 UTC
I'm currently seeing this pretty much every time I debug XS with XS.
Comment 8 Jeffrey Stedfast 2015-02-20 12:03:42 UTC
I assume this is in the CorDebugger backend?
Comment 9 João Serra 2015-02-20 13:27:51 UTC
might be duplicated with Bug 26841
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2015-02-23 14:11:40 UTC
To add a few more keywords to this bug report for searchability, here's the warning message transcribed from the "View -> Pads -> Errors" window in the video from comment 0 (and translated to English thanks to bug 20284):

> Could not copy "obj\x86\Debug\Test.pdb" to "bin\Debug\Test.pdb". Beginning
> retry 1 in 1000ms. The process cannot access the file 'bin\Debug\Test.pdb'
> because it is being used by another process. (MSB3026)
Comment 11 xamarin-release-manager 2015-03-20 13:12:19 UTC
Fixed in version (new-project-model)
Comment 12 Lluis Sanchez 2015-03-20 13:31:04 UTC
Not yet fixed.
Comment 13 xamarin-release-manager 2015-03-24 13:22:07 UTC
Fixed in version (roslyn)
Comment 14 David Karlaš 2015-04-28 03:48:14 UTC
*** Bug 29186 has been marked as a duplicate of this bug. ***
Comment 15 David Karlaš 2016-11-07 10:40:56 UTC
This was fixed with release of XS 6.0
Comment 16 David Karlaš 2016-11-07 10:41:35 UTC
*** Bug 9951 has been marked as a duplicate of this bug. ***