Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 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.
[XVS C5SR2] Locked .dll files: Could not copy "... PortableClassLibrary1.dll" to "bin\Debug\PortableClassLibrary1.dll". Exceeded retry count of 10. Failed.
This is a preliminary bug report to start tracking a new problem that has similar symptoms to Bug 26841.
I do not yet have a set of steps to reproduce the problem, nor do I have log files, but it "feels" like this problem could have been directly caused by the fix for Bug 26841 or one of the project-cleaning fixes related to debugging. Those changes have only been present in the most recent XamarinVS releases.
I will expand on this bug report if I am able to reproduce the problem again.
## Regression status: suspected regression between Cycle 5 Service Release 1 and Cycle 5 Service Release 2.
The symptoms closely resemble Bug 26841, but importantly the files that are locked in this case are `.dll` files _not_ `.dll.mdb` files. The evidence available so far suggests that the problem is specific to Portable Class Libraries.
### Error messages from the Error List
> Could not copy "C:\source\UnifiedSingleViewIphone1\PortableClassLibrary1\bin\Debug\PortableClassLibrary1.dll" to "bin\Debug\PortableClassLibrary1.dll". Exceeded retry count of 10. Failed.
> Unable not copy "C:\source\UnifiedSingleViewIphone1\PortableClassLibrary1\bin\Debug\PortableClassLibrary1.dll" to "bin\Debug\PortableClassLibrary1.dll". The process cannot access the file 'bin\Debug\PortableClassLibrary1.dll' because it is being used by another process.
## Reports to date
- I encountered the problem once myself while troubleshooting an unrelated issue.
- A customer has also reported the issue once here: https://kb.xamarin.com/agent/case/177604.
Im having the same problem, and were NOT using a PCL.
I have two dll's in Class library that exhibit the problem. What i have to do is to exit VS. Kill all MSBuild processes, delete the dll's and then restart VS.
I can run the SysInternals program Handle.exe and it says that devenv owns the handle to the file.
I have the issue on occasion as well. The "The process cannot access the file" issue only seems to affect references to portable library projects. The error is only appears when build/rebuilding the application project.
A clean removes all file except the .dll file that causes the problem.
The work around I use to close Visual Studio 2013, delete the build folder for the application project and reopen VS were the application can be build once before needing to perform the work around again.
Created attachment 11921 [details]
Verbose build log
The 'Exceeded retry count of 10' error message is on line 4077.
I worked with another customer and we were able to resolve the issue the customer was facing with this post by using the pre-build event in the VS project properties Build Events configuration section:
We added the following to the VS project properties Build Events configuration section:
if exist "$(TargetPath).locked" del "$(TargetPath).locked" if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
If other customers are experiencing this issue please try the above and if you have a case that is easy to reproduce please attach it here so we can investigate it further.
I updated to Xamarin Forms 22.214.171.12476 in the morning today and i have not
received this error since this time. I keeping my fingers crossed and hope to
never saw it agai
Error came back today. So i got a break of 2 days.
I included the Build Events logic and it did not help.
We do not have a case that is easy to reproduce sorry.
Productivity is grinding to a halt.
Hi mitchell. I've followed up on email and I'm hoping we can have a GoToMeeting screen sharing session today in order to figure out what is happening with your specific configuration and how we can resolve the issue.
Please let me know the version information (visual studio version\Xamarin) you are running so I can setup an environment to more easily reproduce the issue.
Hi Ian and Mitchell
Did you manage to setup a screen sharing session and if so did it have a positive result?
Today I updated some nuget packages and did a clean then rebuild. The rebuild failed because some files failed to be copied from the new nuget version. And the copy failed because some files with the same name but an older version were not be cleaned from the build folder.
So I removed the files and kept a copy of them. Then the rebuild would work as well as subsequent cleans. I then copied the previous files that failed to be cleaned back into the build folder and the rebuild/clean would fail again. I did this several times to confirm the error was repeatable.
I concluded that VS would not remove the files unless the file name and the file version matched.
I now felt pretty clever as I seemed to have found a repeatable mechanism for the error and so I made projects to simulate the problem. But, I can not reproduce the issue in the new projects... darn. Furthermore, after closing and reopening VS I can no longer reproduce it in the original project.
The bright side to all this is that my original project is building and cleaning ok now. Or, for now, I should say.
This is happening to me since updating my Xamarin.Android and other things.
handle.exe from sysinternals confirms devenv.exe is holding the file lock on around 5 of my product's DLLs. Including FSharp.Core.dll for some reason, as well.
Copyright (C) 1997-2013 Mark Russinovich
Sysinternals - www.sysinternals.com
cmd.exe pid: 3280 type: File 1BC: C:\Sandbox\Singapore\Singapore.Mobile.Android
devenv.exe pid: 4908 type: File 1054: C:\Users\nbevans\AppData\Local\Microsoft\VisualStudio\12.0\ProjectAssemblies\fddedgxh01\Singapore.Mobile.Android.dll
devenv.exe pid: 4908 type: File 19AC: C:\Sandbox\Singapore\Singapore.Mobile.Android\bin\Debug\Singapore.Core.Configuration.dll
devenv.exe pid: 4908 type: File 1BC0: C:\Sandbox\Singapore\Singapore.Mobile.Android\bin\Debug\FSharp.Core.dll
devenv.exe pid: 4908 type: File 1F14: C:\Sandbox\Singapore\Singapore.Mobile.Android\bin\Debug\Singapore.Core.Metaforms.dll
devenv.exe pid: 4908 type: File 262C: C:\Sandbox\Singapore\Singapore.Mobile.Android\bin\Debug\Singapore.Mobile.Storage.dll
devenv.exe pid: 4908 type: File 29AC: C:\Sandbox\Singapore\Singapore.Mobile.Android\bin\Debug\Singapore.Core.Metaforms.Engine.dll
Here is a workaround I just came up with using SysInternals' handle.exe tool. My F# script will enumerate the relevant locked files and then forcefully kill those open file handles. I've inserted this script into my pre-build event on the project and my productivity has now been restored.
I have tried to reproduce this issue at my end with XVS 3.11 builds, but I am unable to reproduce the reported behavior
I have used following steps:
1. Created Android/XamarinPortable Forms application in XS- Windows
2. I am able to run android application successfully
3. Now I have open same in VS Windows
4. Run same android/XamarinPortable sample in VS with XVS 3.11.1433
5. I have run application multiple times
Result: I am successfully able to deploy android application on device every time through VS.
Windows: XVS 3.11.1433 and XS 5.11 (build 29)
I am not sure about its correct steps to reproduce/verify this issue.
Could you please provide a testcase? So that I can verify this issue efficiently.
I began having this issue suddenly in VS 2017 u2, then switched to VS 2017 u3 preview, and the error did not happen but after several days, it began coming, and restarting VS 2017 u3 preview, will stop it from appearing, but after several builds, it returns, and again i need to restart it, but when i installed the .vsix thanks to @RSUK, it stopped at both VS 2017 u2 & u3.
Shortly i finished my project, so i don't know if i continued for long time it will return or not, but i am afraid that even when VS 2017 u3, comes to release, this error will return, so please, this a show stopper.
this is the build output from VS 2017 u3 preview:
this is restated in here:
VS 2017 15.3 (26510.0-Preview)
Xamarin 126.96.36.1990: installed throug the extensions and updates.
Startup project: the android project.
You're right, the issue reported on Comment 19 was Bug 56275.
The root cause was identified, we found out it's totally unrelated to this bug 31423, although the symptom is the same, and it was already fixed (but not published yet for VS2017).
Thanks for reporting.