Bug 17754 - After debug, cannot rebuild because Access to Path Denied.
Summary: After debug, cannot rebuild because Access to Path Denied.
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger (show other bugs)
Version: 4.2.x
Hardware: PC Windows
: Low normal
Target Milestone: 5.0
Assignee: Jeffrey Stedfast
: 18540 19101 (view as bug list)
Depends on:
Reported: 2014-02-13 12:17 UTC by NB
Modified: 2014-05-05 07:52 UTC (History)
8 users (show)

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

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 NB 2014-02-13 12:17:30 UTC
I just finished a debugging session, the console for the old process is gone, and the Xamarin Studio GUI left 'Debug View' going back to 'Solution View'. But when I try to run or debug the same project again, it rebuilds and fails on the error below.

This happens the majority of the time after a debugging session, but not 100% of the time. The only fix I have is to close Xamarin Studio. 

This only happens when Active Runtime is Mono. It doesn't happen when Active Runtime is MS. (But when Active Runtime is MS the debugger doesn't let me inspect anything so that isn't a usable alternative).

It does sound a lot like Bug 5295, but its happening in 4.2.2, current Stable.

----- Builder Error Message -----

Target DeployOutputFiles:
		Copying file from 'C:\Dev\gitsrc\Cheese\Cheese\obj\Debug\Cheese.dll.mdb' to 'C:\Dev\gitsrc\Cheese\Cheese\bin\Debug\Cheese.dll.mdb'
		Copying file from 'C:\Dev\gitsrc\Cheese\Cheese\obj\Debug\Cheese.dll' to 'C:\Dev\gitsrc\Cheese\Cheese\bin\Debug\Cheese.dll'
C:\Program Files (x86)\Mono-3.2.3\lib\mono\4.0\Microsoft.Common.targets: error : Access to the path "C:\Dev\gitsrc\Cheese\Cheese\bin\Debug\Cheese.dll" is denied.  at System.IO.File.Delete (System.String path) [0x00000] in <filename unknown>:0 
  at Microsoft.Build.Tasks.Copy.CopyFile (System.String source, System.String dest, Boolean create_dir) [0x00000] in <filename unknown>:0 
  at Microsoft.Build.Tasks.Copy.Execute () [0x00000] in <filename unknown>:0 
	Task "Copy" execution -- FAILED
	Done building target "DeployOutputFiles" in project "C:\Dev\gitsrc\Cheese\Cheese\Cheese.csproj".-- FAILED
Comment 1 NB 2014-02-16 19:46:50 UTC
4.2.3 was just pushed to Stable. It happens there too.
Comment 2 NB 2014-03-14 23:26:12 UTC
Anything? Restarting Xamarin Studio every test run is really not practical.
Comment 3 Jeffrey Stedfast 2014-03-18 17:42:08 UTC
Either the debugee's mono runtime is still running or XS still has the .mdb files open for calculating breakpoints (although the code appears to correctly close them).

Do you have breakpoints set? If so, what if you run the app w/o any breakpoints set? Does build afterward still cause this problem?
Comment 4 Marius Ungureanu 2014-03-18 22:16:09 UTC
I want to add that this happens with MS.NET too.
Comment 5 NB 2014-03-18 23:10:49 UTC
No, no breakpoints. I can confirm that whenever this happens a mysterious extra 'mono' process is hanging around.
Comment 6 Jeffrey Stedfast 2014-03-19 10:46:16 UTC
Thanks NB, that helps narrow it down a bit and is what I was thinking might be the culprit.
Comment 7 Jeffrey Stedfast 2014-04-16 15:41:25 UTC
This was fixed a few weeks ago (although it was too late for 4.2.4)
Comment 8 Mikayla Hutchinson [MSFT] 2014-04-20 18:27:10 UTC
*** Bug 19101 has been marked as a duplicate of this bug. ***
Comment 9 Mikayla Hutchinson [MSFT] 2014-04-20 18:28:54 UTC
*** Bug 18540 has been marked as a duplicate of this bug. ***
Comment 10 Mohit Kheterpal 2014-05-05 07:52:45 UTC
I have tried to verify this issue but we are not able to build project when active runtime is mono. We have filled a separate issue for this i.e Bug 19495.

We will verify it when Bug 19495 will be Resolved.