Bug 26841 - Cannot build: The last access/last write time on file "bin\Debug\Sensus.Android.dll.mdb" cannot be set.
Summary: Cannot build: The last access/last write time on file "bin\Debug\Sensus.Andr...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger (show other bugs)
Version: 3.9
Hardware: PC Windows
: High normal
Target Milestone: 3.11.2 (C5SR2)
Assignee: Ian Ceicys
URL:
: 31057 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-08 09:47 UTC by Matt Gerber
Modified: 2016-07-25 13:41 UTC (History)
35 users (show)

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


Attachments
Visual Studio Error List (114.31 KB, image/png)
2015-07-28 10:22 UTC, Simone
Details

Description Matt Gerber 2015-02-08 09:47:44 UTC
I just updated to Xamarin for Visual Studio 3.9.289, and now I cannot build after my debugging session ends. These subsequent builds fail with the following message:

===========================================================
The process cannot access the file 'C:\Users\Matthew Gerber\Documents\GitHub\sensus\Sensus.Android\bin\Debug\Sensus.Android.dll.mdb' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
   at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb)
   at Pdb2Mdb.Converter.Convert(String filename)
   at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()

The last access/last write time on file "bin\Debug\Sensus.Android.dll.mdb" cannot be set. The process cannot access the file 'C:\Users\Matthew Gerber\Documents\GitHub\sensus\Sensus.Android\bin\Debug\Sensus.Android.dll.mdb' because it is being used by another process.
===========================================================

I have to restart Visual Studio to get it to work.

Any ideas?
Comment 1 João Serra 2015-02-13 05:55:19 UTC
Im having the same issue, but i can fix it by closing the solution
Comment 2 Olaf Bartelt 2015-02-16 08:04:36 UTC
Same problem here, but I have to close and re-open VS every time I want to (re)start the app :-(
Comment 3 Petr Antos 2015-02-21 01:12:01 UTC
Thomas described fix by opening SLN in XamarinStudio here:
https://forums.xamarin.com/discussion/comment/105166/#Comment_105166
with my following post about sln/csproj/userprefs changes and status after this workaround.
Comment 4 Olaf Bartelt 2015-02-21 03:42:14 UTC
Doesn't work for me. App runs in Xamarin Studio, then in Visual Studio again only once, before the file becomes locked and I have to restart VS again. So annoying...
Comment 5 Thomas Weidman 2015-02-21 15:24:58 UTC
I was able to work around this by using handle.exe and removing the lock from the console.

Handle can be obtained from: https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx

Then use "handle <mdb name>" to get the hex number and pid so you can then execute "handle -c <handle> -p <pid>".

So far after I do this once the lock is removed for subsequent builds.
Comment 6 Brendan Zagaeski (Xamarin Support) 2015-02-23 14:12:53 UTC
I'll add a couple similar-looking bugs here to help keep them all coordinated in case they have the same underlying cause.

Possible duplicate: bug 19708.
Likely duplicate: bug 27192.
Comment 7 Petr Antos 2015-02-27 08:03:36 UTC
I must say that it happened again - but when I uninstalledd app from device and configured Droid project properties to Compile:Latest API level 21, Minimum API level 15 and Target SDK version, it SEEMS its better; previously I tried probably also Compile using API level 15 (without no big reason, though); as I deploy shared runtime and used also fast deployment, may be there some clash of versions?? If it occurs again now, handle.exe help, thanks
Comment 8 till 2015-03-05 08:55:32 UTC
same problem for Api level 19 Xamarin Android Application with Xamarin VS-Plugin 3.9.302
Comment 9 Dan Ardelean 2015-03-13 05:29:19 UTC
Same problem here with the latest version. Really really annoying Kills all the productivity Please fix it
Comment 10 Brendan Zagaeski (Xamarin Support) 2015-03-24 11:42:58 UTC
For record-keeping, one more likely duplicate: bug 28193.
Comment 11 philip 2015-03-29 23:57:11 UTC
I have the same problem
Comment 13 BMS 2015-04-13 02:09:00 UTC
I currently have the same problem and this is very annoying. I downgraded the Xamarin version to 3.9.236 to get Visual studio working without this bug! But this can't be the solution!
Are there any plans to fix this bug??

Thanks!
Comment 14 Alex Solovyov 2015-04-14 11:24:39 UTC
Same problem 
Xamarin   3.9.547.0 
Xamarin.Android   4.20.2.1 

Error	2	The last access/last write time on file "bin\Debug\****.dll.mdb" cannot be set. The process cannot access the file '****\bin\Debug\****.dll.mdb' because it is being used by another process.	****

Restarting VS2012 helps
Comment 15 Arthur 2015-04-16 23:58:07 UTC
Also encountering this very annoying bug.
Comment 16 Olaf Bartelt 2015-04-17 03:18:01 UTC
I'm also having this on Xamarin.iOS now :-(
Comment 17 Daniel Cazzulino 2015-04-17 10:08:43 UTC
Would be very nice to get the info of who's locking the file (i.e. using sysinternals tool as mentioned above). 

@Olaf: this is the first time we hear about it happening on Xamarin.iOS. Could you provide some more info on the circumstance, versions, etc.?

Thanks!
Comment 18 Olaf Bartelt 2015-04-17 10:29:00 UTC
The file is locked by Visual Studio (devenv.exe). The error message is:

Error	54	The "ConvertPdbToMdbTask" task failed unexpectedly.
System.IO.IOException: The process cannot access the file 'D:\AMTANGEE.Mobile\AMTANGEE.Mobile.iOS\AMTANGEE.Mobile.IOS\bin\iPhoneSimulator\Debug\AMTANGEEMobileiOS.exe.mdb' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
   at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb) in c:\w\978be3db\XamarinVS\msbuild\Xamarin.iOS.Tasks\Pdb2mdb\Driver.cs:line 51
   at Pdb2Mdb.Converter.Convert(String filename) in c:\w\978be3db\XamarinVS\msbuild\Xamarin.iOS.Tasks\Pdb2mdb\Driver.cs:line 38
   at Xamarin.iOS.Tasks.ConvertPdbToMdbTask.Execute() in c:\w\978be3db\XamarinVS\msbuild\Xamarin.iOS.Tasks\Tasks\ConvertPdbToMdbTask.cs:line 32
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()	AMTANGEE.Mobile.iOS

Version info:

Microsoft Visual Studio Professional 2012
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.50709

Installed Version: Professional

Team Explorer for Visual Studio 2012   04938-004-0033001-02794
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012   04938-004-0033001-02794
Microsoft Visual Basic 2012

Visual C# 2012   04938-004-0033001-02794
Microsoft Visual C# 2012

Visual C++ 2012   04938-004-0033001-02794
Microsoft Visual C++ 2012

Visual F# 2012   04938-004-0033001-02794
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker   04938-004-0033001-02794
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

InstallShield Limited Edition   
InstallShield. For more information visit the Flexera Software website at <http://www.FlexeraSoftware.com>. Copyright © 2013 Flexera Software LLC. All Rights Reserved.

NuGet Package Manager   2.0.30625.9003
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Xamarin   3.9.483.0 (978be3d)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.37 (9e05e39f02bafe8fc0b7ab025d99f3b446835ad4)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.8.0.0 (702be5207a1446b066f4653f68739da13c045227)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 19 Michael van der Horst 2015-04-23 02:28:33 UTC
Same problem 
Xamarin   3.9.547.0 
Xamarin.Android   4.20.2.1 
Visual Studio 12.0.31101.00 Update 4

Error	37	The last access/last write time on file "bin\Debug\*.dll.mdb" cannot be set. The process cannot access the file 'C:\Projects\*\*\bin\Debug\*.dll.mdb' because it is being used by another process.	*


Restarting VS2013 helps
Comment 20 Olaf Bartelt 2015-04-28 02:29:09 UTC
One thing I can add concerning Xamarin iOS is that it only seems to happen with the simulator. Rebuilding for the device seems to works fine every time (although it fails to launch the app every time :-().
Comment 22 Frederic 2015-04-29 11:09:20 UTC
I had the problem on Xamarin for Android and a I also downgraded the
Xamarin version to 3.9.236, which corrected the problem but also created new problems for me. I then decided to re-install 3.9.547.0 and I did not see the problem re-appear... that was about 7 days ago.
Comment 23 till 2015-05-06 09:42:13 UTC
The problem persists for our whole team working on a Xamarin.Android Project.
Please please please fix this. It totally decreases out teams productivity!
Comment 24 Ian Ceicys 2015-05-12 12:47:48 UTC
I have reached out to two customers and have heard the following regarding this issue: "Hi, after the last Xamarin update, seems, the problem is gone." Can I ask folks experiencing this bug to switch to the alpha channel, install the latest alpha channel build for Visual Studio [Xamarin   3.11.546.0 (8fffc2e)] and confirm if they are still experiencing the issue.

We have been unable to consistently reproduce the bug and we'd like your help to validate if we've fixed the issue or if there are additional fixes needed.
Comment 25 philip 2015-05-19 11:21:46 UTC
FYI yesterday I was having similar problems.  After clearing the watch list, it went away.  Others might want to try this to see if it helps.  Perhaps when there are invalid watch list items this causes issues?
Comment 26 Edwin 2015-05-20 07:55:41 UTC
I came across this problem while debugging this piece of code:

imageView.Click += delegate
  {
    ImageView iv = FindViewById<ImageView>(Resource.Id.imageView1);
    imageView.SetImageResource(Resource.Drawable.savebw);
  };
  linearLayout.AddView(imageView);

I had a Watch on iv.Height. When I removed all Watches, as philip recommended, the problem no longer persisted.
Comment 27 Ian Ceicys 2015-05-26 10:18:05 UTC
I have been able to repro and the suggested workaround is to "clear the watch list". I will investigate additional issues and possible causes, but at this time please report back if "clearing the watch list" successfully resolves the issue.
Comment 28 till 2015-05-26 10:27:27 UTC
For me as a user the only workaround is to either restart visual Studio or use a Tool like LockHunter to clear the lock from the file.
Comment 30 Brian Graham 2015-06-05 10:34:12 UTC
I was experiencing this bug as well, it was frustrating. I spent nearly a week trying to fix the issue. I tried downgrading and getting Alpha/Beta releases with no success. I also tried many other solutions that I had found in the Xamarin Forums. I re-installed Xamarin and that didn't work either. I then tried to reproduce the bug on a simple project, which I was unable to do. Then I just kept adding more and more of my other project in, to see at what point the bug would show itself, which it still didn't. I thought it was the project, so I re-built the Android project which was giving me problems by creating a new project and re-adding all the assets, which still had problems building/debugging. So then I tried to re-build my whole solution, re-adding my projects and re-creating my Android project. Finally I am able to build/debug without any problems. I looked over what changes had been made to the .sln file to see what could have been causing the problem and it looks like my .sln file had MANY Debug configurations declared in the file. The new file had less configurations, so I think that the configurations for the solution may have been causing the problem, but I am not sure. Either way I wanted to post this on here so that others could hopefully be able to get back to working.
Comment 32 Andy 2015-06-16 13:50:14 UTC
This happens repeatedly in 658 (Alpha).  Have to restart Visual Studio after every debugging session.  I don't have any watches.
Comment 35 sasamuel 2015-06-20 16:18:06 UTC
Since the problem still persists and, as others mentioned, kills all productivity, I'll try to provide some debugging data that should enable you to pinpoint the cause. Maybe others can follow the steps I took and compare the results, in particular the stack traces.

I'm seeing this issue in both VS 2013 and VS 2015 RC, and with Xamarin.iOS as well as Xamarin.Android.

My setup:
Windows 8.1 build 9600
Xamarin 3.11.658
Xamarin.iOS 8.10.2
Xamarin.Android 5.1.4.8



0. start Sysinternals Process Monitor
set the filter to include CreateFile and IRP_MJ_CLOSE entries and exclude everything that does not contain "bin/Debug/[AppName].dll.mdb" in its path.

1. delete /bin/Debug
2. start Visual Studio and open the project (in this case a Xamarin.Android project)
3. make sure that there are no breakpoints enabled (also, clear the watch list as others suggested)
4. start debugging in the Android simulator (successful)

At this point, the AppName.dll.mdb file appears in the bin/Debug folder.
This is what I see in Process Monitor:
 - [multiple accesses by MSBuild.exe]
 - devenv.exe (thread A): CreateFile (Read Attributes)
 - devenv.exe (thread A): IRP_MJ_CLOSE
 - devenv.exe (thread A): CreateFile (Read Attributes)
 - devenv.exe (thread A): IRP_MJ_CLOSE
 - devenv.exe (thread B): CreateFile (Generic Read)
 - devenv.exe (thread C): IRP_MJ_CLOSE

Also, at this point there are no open handles of the .mdb file.

5. make some trivial change in the code to force a rebuild
6. start debugging in the Android simulator (successful)

In Process Monitor, the last 6 entries are the same as in the first build, with equal stack traces.
You can repeat steps 5 and 6 multiple times with the same result.

7. again make a trivial change in the code
8. set a breakpoint
9. start debugging in the Android simulator (successful)

This is what I see in Process Monitor:
 - [multiple accesses by MSBuild.exe]
 - [the same 6 accesses by devenv.exe as before, with equal stack traces]
 - devenv.exe (thread D): CreateFile (Read Attributes) - stack trace below
 - devenv.exe (thread D): IRP_MJ_CLOSE - stack trace below
 - devenv.exe (thread D): CreateFile (Generic Read) - stack trace below

Obviously there's a Close call missing.
In Process Hacker (or any similar tool), one can confirm that devenv.exe sill holds a handle of the .mdb file.

10. once more, start debugging in the Android simulator (fails)
11. clean project: reportedly successful, but if we look closely, we see a warning that the .mdb file could not be deleted.

As you can see, setting the breakpoint caused an additional access to the .mdb file, and this access is the one that isn't closed properly.


Below are the relevant (native) stack traces. Interesting enough there's not even Xamarin in there, though that's probably because it's being interpreted by the CLR. Also apparently .mdb files are specific to Xamarin. In case anyone at Xamarin needs more data, I've created a memory dump of devenv.exe that I could send (it's 700MB though).


======== 3rd last log entry ========

Date & Time:	20.06.2015 19:47:46
Event Class:	File System
Operation:	CreateFile
Result:	SUCCESS
Path:	\\psf\Host\[...]\bin\Debug\[AppName].dll.mdb
TID:	5304
Duration:	0.0002718
Desired Access:	Read Attributes
Disposition:	Open
Options:	Open Reparse Point
Attributes:	n/a
ShareMode:	Read, Write, Delete
AllocationSize:	n/a
OpenResult:	Opened
Stack Trace:
0	fltmgr.sys	FltGetRequestorProcess + 0xd6b	0xfffff8000253403f	C:\Windows\system32\drivers\fltmgr.sys
1	fltmgr.sys	FltIsCallbackDataDirty + 0xd7c	0xfffff800025355ac	C:\Windows\system32\drivers\fltmgr.sys
2	fltmgr.sys	FltQueueDeferredIoWorkItem + 0x14495	0xfffff8000255d335	C:\Windows\system32\drivers\fltmgr.sys
3	ntoskrnl.exe	SePrivilegeCheck + 0x705	0xfffff800dc226dd1	C:\Windows\system32\ntoskrnl.exe
4	ntoskrnl.exe	FsRtlInitializeOplock + 0xda8	0xfffff800dc2addc4	C:\Windows\system32\ntoskrnl.exe
5	ntoskrnl.exe	ObOpenObjectByName + 0x1e3	0xfffff800dc23b6b3	C:\Windows\system32\ntoskrnl.exe
6	ntoskrnl.exe	RtlUpcaseUnicodeChar + 0x1dd7	0xfffff800dc2522d3	C:\Windows\system32\ntoskrnl.exe
7	ntoskrnl.exe	setjmpex + 0x34a3	0xfffff800dbf604b3	C:\Windows\system32\ntoskrnl.exe
8	ntdll.dll	NtQueryFullAttributesFile + 0xa	0x7ff876b4245a	C:\Windows\SYSTEM32\ntdll.dll
9	wow64.dll	wow64.dll + 0x6d1a	0x77aa6d1a	C:\Windows\SYSTEM32\wow64.dll
10	wow64.dll	Wow64SystemServiceEx + 0xfb	0x77aaa44b	C:\Windows\SYSTEM32\wow64.dll
11	wow64cpu.dll	TurboDispatchJumpAddressEnd + 0xb	0x77af1dc5	C:\Windows\system32\wow64cpu.dll
12	wow64.dll	Wow64LdrpInitialize + 0x23a	0x77ab219a	C:\Windows\SYSTEM32\wow64.dll
13	wow64.dll	Wow64LdrpInitialize + 0x172	0x77ab20d2	C:\Windows\SYSTEM32\wow64.dll
14	ntdll.dll	LdrInitializeThunk + 0x12b	0x7ff876ac8fdb	C:\Windows\SYSTEM32\ntdll.dll
15	ntdll.dll	LdrInitializeThunk + 0xe	0x7ff876ac8ebe	C:\Windows\SYSTEM32\ntdll.dll
16	ntdll.dll	NtQueryFullAttributesFile + 0xc	0x77b3d70c	C:\Windows\SysWOW64\ntdll.dll
17	KERNELBASE.dll	GetFileAttributesExW + 0x7e	0x7723f2ce	C:\Windows\SysWOW64\KERNELBASE.dll
18	mscorlib.ni.dll	mscorlib.ni.dll + 0x3b9cfc	0x73859cfc	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
19	mscorlib.ni.dll	mscorlib.ni.dll + 0x375dc9	0x73815dc9	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
20	mscorlib.ni.dll	mscorlib.ni.dll + 0x375d41	0x73815d41	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
21	mscorlib.ni.dll	mscorlib.ni.dll + 0x3843fe	0x738243fe	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
22	<unknown>	0x7ebf21d	0x7ebf21d	
23	<unknown>	0x7ebe519	0x7ebe519	
24	<unknown>	0x7ebdf33	0x7ebdf33	
25	<unknown>	0x1e490b33	0x1e490b33	
26	<unknown>	0x7ebdd8b	0x7ebdd8b	
27	Microsoft.DiagnosticsHub.SDK.dll	Microsoft.DiagnosticsHub.SDK.dll + 0xc567	0x382c567	C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\Microsoft.DiagnosticsHub.SDK.dll
28	<unknown>	0x1e4927ba	0x1e4927ba	
29	mscorlib.ni.dll	mscorlib.ni.dll + 0x345918	0x737e5918	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
30	mscorlib.ni.dll	mscorlib.ni.dll + 0x318ec7	0x737b8ec7	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
31	mscorlib.ni.dll	mscorlib.ni.dll + 0x318e16	0x737b8e16	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
32	mscorlib.ni.dll	mscorlib.ni.dll + 0x318dd1	0x737b8dd1	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
33	mscorlib.ni.dll	mscorlib.ni.dll + 0x3458a0	0x737e58a0	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
34	clr.dll	clr.dll + 0x1296	0x746d1296	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
35	clr.dll	DllUnregisterServerInternal + 0x168b5	0x746ecbf9	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
36	clr.dll	DllUnregisterServerInternal + 0x27866	0x746fdbaa	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
37	clr.dll	DllUnregisterServerInternal + 0x2974c	0x746ffa90	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
38	clr.dll	DllUnregisterServerInternal + 0x28cc3	0x746ff007	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
39	clr.dll	DllUnregisterServerInternal + 0x28d2d	0x746ff071	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
40	clr.dll	DllUnregisterServerInternal + 0x28dfa	0x746ff13e	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
41	clr.dll	DllUnregisterServerInternal + 0x28e6b	0x746ff1af	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
42	clr.dll	DllUnregisterServerInternal + 0x29573	0x746ff8b7	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
43	clr.dll	DllUnregisterServerInternal + 0x28c2c	0x746fef70	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
44	KERNEL32.DLL	BaseThreadInitThunk + 0x24	0x75717c04	C:\Windows\SysWOW64\KERNEL32.DLL
45	ntdll.dll	RtlInitializeExceptionChain + 0x8f	0x77b5ad1f	C:\Windows\SysWOW64\ntdll.dll
46	ntdll.dll	RtlInitializeExceptionChain + 0x5a	0x77b5acea	C:\Windows\SysWOW64\ntdll.dll




======== 2nd last log entry ========

Date & Time:	20.06.2015 19:47:46
Event Class:	File System
Operation:	IRP_MJ_CLOSE
Result:	SUCCESS
Path:	\\psf\Host\[...]\bin\Debug\[AppName].dll.mdb
TID:	5304
Duration:	0.0000080
Stack Trace:
0	fltmgr.sys	FltGetRequestorProcess + 0xd6b	0xfffff8000253403f	C:\Windows\system32\drivers\fltmgr.sys
1	fltmgr.sys	FltIsCallbackDataDirty + 0xd7c	0xfffff800025355ac	C:\Windows\system32\drivers\fltmgr.sys
2	fltmgr.sys	FltGetRequestorProcess + 0x2fa	0xfffff800025335ce	C:\Windows\system32\drivers\fltmgr.sys
3	fltmgr.sys	fltmgr.sys + 0x10aa	0xfffff800025330aa	C:\Windows\system32\drivers\fltmgr.sys
4	ntoskrnl.exe	NtReadFile + 0xce4	0xfffff800dc22aeb4	C:\Windows\system32\ntoskrnl.exe
5	ntoskrnl.exe	ProbeForWrite + 0x154	0xfffff800dc231944	C:\Windows\system32\ntoskrnl.exe
6	ntoskrnl.exe	ObfDereferenceObject + 0x8f	0xfffff800dbe5701f	C:\Windows\system32\ntoskrnl.exe
7	ntoskrnl.exe	SePrivilegeCheck + 0xeed	0xfffff800dc2275b9	C:\Windows\system32\ntoskrnl.exe
8	ntoskrnl.exe	FsRtlInitializeOplock + 0xda8	0xfffff800dc2addc4	C:\Windows\system32\ntoskrnl.exe
9	ntoskrnl.exe	ObOpenObjectByName + 0x1e3	0xfffff800dc23b6b3	C:\Windows\system32\ntoskrnl.exe
10	ntoskrnl.exe	RtlUpcaseUnicodeChar + 0x1dd7	0xfffff800dc2522d3	C:\Windows\system32\ntoskrnl.exe
11	ntoskrnl.exe	setjmpex + 0x34a3	0xfffff800dbf604b3	C:\Windows\system32\ntoskrnl.exe
12	ntdll.dll	NtQueryFullAttributesFile + 0xa	0x7ff876b4245a	C:\Windows\SYSTEM32\ntdll.dll
13	wow64.dll	wow64.dll + 0x6d1a	0x77aa6d1a	C:\Windows\SYSTEM32\wow64.dll
14	wow64.dll	Wow64SystemServiceEx + 0xfb	0x77aaa44b	C:\Windows\SYSTEM32\wow64.dll
15	wow64cpu.dll	TurboDispatchJumpAddressEnd + 0xb	0x77af1dc5	C:\Windows\system32\wow64cpu.dll
16	wow64.dll	Wow64LdrpInitialize + 0x23a	0x77ab219a	C:\Windows\SYSTEM32\wow64.dll
17	wow64.dll	Wow64LdrpInitialize + 0x172	0x77ab20d2	C:\Windows\SYSTEM32\wow64.dll
18	ntdll.dll	LdrInitializeThunk + 0x12b	0x7ff876ac8fdb	C:\Windows\SYSTEM32\ntdll.dll
19	ntdll.dll	LdrInitializeThunk + 0xe	0x7ff876ac8ebe	C:\Windows\SYSTEM32\ntdll.dll
20	ntdll.dll	NtQueryFullAttributesFile + 0xc	0x77b3d70c	C:\Windows\SysWOW64\ntdll.dll
21	KERNELBASE.dll	GetFileAttributesExW + 0x7e	0x7723f2ce	C:\Windows\SysWOW64\KERNELBASE.dll
22	mscorlib.ni.dll	mscorlib.ni.dll + 0x3b9cfc	0x73859cfc	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
23	mscorlib.ni.dll	mscorlib.ni.dll + 0x375dc9	0x73815dc9	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
24	mscorlib.ni.dll	mscorlib.ni.dll + 0x375d41	0x73815d41	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
25	mscorlib.ni.dll	mscorlib.ni.dll + 0x3843fe	0x738243fe	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
26	<unknown>	0x7ebf21d	0x7ebf21d	
27	<unknown>	0x7ebe519	0x7ebe519	
28	<unknown>	0x7ebdf33	0x7ebdf33	
29	<unknown>	0x1e490b33	0x1e490b33	
30	<unknown>	0x7ebdd8b	0x7ebdd8b	
31	Microsoft.DiagnosticsHub.SDK.dll	Microsoft.DiagnosticsHub.SDK.dll + 0xc567	0x382c567	C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\Microsoft.DiagnosticsHub.SDK.dll
32	<unknown>	0x1e4927ba	0x1e4927ba	
33	mscorlib.ni.dll	mscorlib.ni.dll + 0x345918	0x737e5918	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
34	mscorlib.ni.dll	mscorlib.ni.dll + 0x318ec7	0x737b8ec7	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
35	mscorlib.ni.dll	mscorlib.ni.dll + 0x318e16	0x737b8e16	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
36	mscorlib.ni.dll	mscorlib.ni.dll + 0x318dd1	0x737b8dd1	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
37	mscorlib.ni.dll	mscorlib.ni.dll + 0x3458a0	0x737e58a0	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
38	clr.dll	clr.dll + 0x1296	0x746d1296	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
39	clr.dll	DllUnregisterServerInternal + 0x168b5	0x746ecbf9	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
40	clr.dll	DllUnregisterServerInternal + 0x27866	0x746fdbaa	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
41	clr.dll	DllUnregisterServerInternal + 0x2974c	0x746ffa90	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
42	clr.dll	DllUnregisterServerInternal + 0x28cc3	0x746ff007	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
43	clr.dll	DllUnregisterServerInternal + 0x28d2d	0x746ff071	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
44	clr.dll	DllUnregisterServerInternal + 0x28dfa	0x746ff13e	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
45	clr.dll	DllUnregisterServerInternal + 0x28e6b	0x746ff1af	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
46	clr.dll	DllUnregisterServerInternal + 0x29573	0x746ff8b7	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
47	clr.dll	DllUnregisterServerInternal + 0x28c2c	0x746fef70	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
48	KERNEL32.DLL	BaseThreadInitThunk + 0x24	0x75717c04	C:\Windows\SysWOW64\KERNEL32.DLL
49	ntdll.dll	RtlInitializeExceptionChain + 0x8f	0x77b5ad1f	C:\Windows\SysWOW64\ntdll.dll
50	ntdll.dll	RtlInitializeExceptionChain + 0x5a	0x77b5acea	C:\Windows\SysWOW64\ntdll.dll




======== last log entry ========

Date & Time:	20.06.2015 19:47:46
Event Class:	File System
Operation:	CreateFile
Result:	SUCCESS
Path:	\\psf\Host\[...]\bin\Debug\[AppName].dll.mdb
TID:	5304
Duration:	0.0002022
Desired Access:	Generic Read
Disposition:	Open
Options:	Synchronous IO Non-Alert, Non-Directory File, Open No Recall
Attributes:	n/a
ShareMode:	Read
AllocationSize:	n/a
OpenResult:	Opened
Stack Trace:
0	fltmgr.sys	FltGetRequestorProcess + 0xd6b	0xfffff8000253403f	C:\Windows\system32\drivers\fltmgr.sys
1	fltmgr.sys	FltIsCallbackDataDirty + 0xd7c	0xfffff800025355ac	C:\Windows\system32\drivers\fltmgr.sys
2	fltmgr.sys	FltQueueDeferredIoWorkItem + 0x14495	0xfffff8000255d335	C:\Windows\system32\drivers\fltmgr.sys
3	ntoskrnl.exe	SePrivilegeCheck + 0x705	0xfffff800dc226dd1	C:\Windows\system32\ntoskrnl.exe
4	ntoskrnl.exe	FsRtlInitializeOplock + 0xda8	0xfffff800dc2addc4	C:\Windows\system32\ntoskrnl.exe
5	ntoskrnl.exe	ObOpenObjectByName + 0x1e3	0xfffff800dc23b6b3	C:\Windows\system32\ntoskrnl.exe
6	ntoskrnl.exe	NtCreateFile + 0x3f7	0xfffff800dc2544db	C:\Windows\system32\ntoskrnl.exe
7	ntoskrnl.exe	NtCreateFile + 0x78	0xfffff800dc25415c	C:\Windows\system32\ntoskrnl.exe
8	ntoskrnl.exe	setjmpex + 0x34a3	0xfffff800dbf604b3	C:\Windows\system32\ntoskrnl.exe
9	ntdll.dll	NtCreateFile + 0xa	0x7ff876b4171a	C:\Windows\SYSTEM32\ntdll.dll
10	wow64.dll	wow64.dll + 0x9c68	0x77aa9c68	C:\Windows\SYSTEM32\wow64.dll
11	wow64.dll	Wow64SystemServiceEx + 0xfb	0x77aaa44b	C:\Windows\SYSTEM32\wow64.dll
12	wow64cpu.dll	TurboDispatchJumpAddressEnd + 0xb	0x77af1dc5	C:\Windows\system32\wow64cpu.dll
13	wow64.dll	Wow64LdrpInitialize + 0x23a	0x77ab219a	C:\Windows\SYSTEM32\wow64.dll
14	wow64.dll	Wow64LdrpInitialize + 0x172	0x77ab20d2	C:\Windows\SYSTEM32\wow64.dll
15	ntdll.dll	LdrInitializeThunk + 0x12b	0x7ff876ac8fdb	C:\Windows\SYSTEM32\ntdll.dll
16	ntdll.dll	LdrInitializeThunk + 0xe	0x7ff876ac8ebe	C:\Windows\SYSTEM32\ntdll.dll
17	ntdll.dll	NtCreateFile + 0xc	0x77b3c9cc	C:\Windows\SysWOW64\ntdll.dll
18	KERNELBASE.dll	CreateFileW + 0x347	0x772342e7	C:\Windows\SysWOW64\KERNELBASE.dll
19	KERNELBASE.dll	CreateFileW + 0x62	0x77234002	C:\Windows\SysWOW64\KERNELBASE.dll
20	mscorlib.ni.dll	mscorlib.ni.dll + 0x3b7b00	0x73857b00	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
21	mscorlib.ni.dll	mscorlib.ni.dll + 0x36a8d9	0x7380a8d9	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
22	mscorlib.ni.dll	mscorlib.ni.dll + 0x36a4bd	0x7380a4bd	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
23	mscorlib.ni.dll	mscorlib.ni.dll + 0x322753	0x737c2753	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
24	<unknown>	0x7ebf242	0x7ebf242	
25	<unknown>	0x7ebe519	0x7ebe519	
26	<unknown>	0x7ebdf33	0x7ebdf33	
27	<unknown>	0x1e490b33	0x1e490b33	
28	<unknown>	0x7ebdd8b	0x7ebdd8b	
29	Microsoft.DiagnosticsHub.SDK.dll	Microsoft.DiagnosticsHub.SDK.dll + 0xc567	0x382c567	C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\Microsoft.DiagnosticsHub.SDK.dll
30	<unknown>	0x1e4927ba	0x1e4927ba	
31	mscorlib.ni.dll	mscorlib.ni.dll + 0x345918	0x737e5918	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
32	mscorlib.ni.dll	mscorlib.ni.dll + 0x318ec7	0x737b8ec7	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
33	mscorlib.ni.dll	mscorlib.ni.dll + 0x318e16	0x737b8e16	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
34	mscorlib.ni.dll	mscorlib.ni.dll + 0x318dd1	0x737b8dd1	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
35	mscorlib.ni.dll	mscorlib.ni.dll + 0x3458a0	0x737e58a0	C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\c8c8664a9c81e789f687f21d43815da7\mscorlib.ni.dll
36	clr.dll	clr.dll + 0x1296	0x746d1296	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
37	clr.dll	DllUnregisterServerInternal + 0x168b5	0x746ecbf9	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
38	clr.dll	DllUnregisterServerInternal + 0x27866	0x746fdbaa	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
39	clr.dll	DllUnregisterServerInternal + 0x2974c	0x746ffa90	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
40	clr.dll	DllUnregisterServerInternal + 0x28cc3	0x746ff007	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
41	clr.dll	DllUnregisterServerInternal + 0x28d2d	0x746ff071	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
42	clr.dll	DllUnregisterServerInternal + 0x28dfa	0x746ff13e	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
43	clr.dll	DllUnregisterServerInternal + 0x28e6b	0x746ff1af	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
44	clr.dll	DllUnregisterServerInternal + 0x29573	0x746ff8b7	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
45	clr.dll	DllUnregisterServerInternal + 0x28c2c	0x746fef70	C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
46	KERNEL32.DLL	BaseThreadInitThunk + 0x24	0x75717c04	C:\Windows\SysWOW64\KERNEL32.DLL
47	ntdll.dll	RtlInitializeExceptionChain + 0x8f	0x77b5ad1f	C:\Windows\SysWOW64\ntdll.dll
48	ntdll.dll	RtlInitializeExceptionChain + 0x5a	0x77b5acea	C:\Windows\SysWOW64\ntdll.dll
Comment 36 Peter Collins 2015-06-23 12:07:13 UTC
*** Bug 31057 has been marked as a duplicate of this bug. ***
Comment 37 Simone 2015-07-28 10:22:50 UTC
Created attachment 12249 [details]
Visual Studio Error List

The "ConvertPdbToMdb" task failed unexpectedly.
System.IO.IOException: The process cannot access the file 'C:\Stage\Stage Xamarine\Main\GPS_Native_Shared-MVVM\GPS_Native_Shared_MVVM.iOS\bin\iPhoneSimulator\Debug\GPS_Native_Shared_MVVMiOS.exe.mdb' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
   at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb) in c:\w\5160db74\XamarinVS\msbuild\Xamarin.iOS.Tasks\Pdb2mdb\Driver.cs:line 51
   at Pdb2Mdb.Converter.Convert(String filename) in c:\w\5160db74\XamarinVS\msbuild\Xamarin.iOS.Tasks\Pdb2mdb\Driver.cs:line 38
   at Xamarin.iOS.Tasks.ConvertPdbToMdb.Execute() in c:\w\5160db74\XamarinVS\msbuild\Xamarin.iOS.Tasks\Tasks\ConvertPdbToMdbTask.cs:line 32
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()	GPS_Native_Shared_MVVM.iOS
Comment 38 Francesco Colombo 2015-08-06 09:39:23 UTC
Having the same issue, till yesterday all was fine. After a nuget package restore I'm getting this issue every deploy :(
Comment 39 Dirk 2015-11-06 11:55:57 UTC
I encountered this problem today on the iOS project of a xamarin.forms solution. 

The file myProject/myProject.iOS/bin/iPhone/Debug/somePcl.dll was not released, so subsequent builds failed because the file couldn't be copied there.

After shutting down VS and deleting the file I was only able build one time.

A longer-lasting solution for me was to MOVE the file to a different Folder. The moved file remained unreleased, but copying to the original folder worked now, so building succeeded - and more than once.
Comment 40 João Serra 2015-11-06 15:34:21 UTC
The bug is not fixed, I have no idea why its confirmed fixed.  In my case it happens more in android than ios and for dlls more than mdb.

Note You need to log in before you can comment on or make changes to this bug.