Bug 37332 - error MSB4018: The "CopyMdbFiles" task failed unexpectedly.
Summary: error MSB4018: The "CopyMdbFiles" task failed unexpectedly.
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-30 12:05 UTC by Paul Hickman
Modified: 2016-05-18 13:46 UTC (History)
3 users (show)

Tags:
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 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:
Status:
RESOLVED FIXED

Description Paul Hickman 2015-12-30 12:05:49 UTC
I intermittently, but fairly frequently, get an error building an app that has class libraries that the "CopyMdbFiles" task failed unexpectedly. The MDB file for the class library is in use when compiling the parent app.

The workaround when this occurs is to restart visual studio. This does not happen in Xamarin Studio.

A sample of the build output is below:

12>  TheAA.DS.App.AA.Android.Pupil -> C:\Projects\L-Drive\TheAA.DS.App\TheAA.DS.App.AA.Android.Pupil\bin\Debug\TheAA.DS.App.AA.Android.dll
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning : The process cannot access the file 'C:\Projects\L-Drive\TheAA.DS.App\TheAA.DS.App.Core\bin\Debug\TheAA.DS.App.Core.dll.mdb' because it is being used by another process.
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    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)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(String filename)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning : The process cannot access the file 'C:\Projects\L-Drive\TheAA.DS.App\TheAA.DS.App.Core\bin\Debug\TheAA.DS.App.Core.dll.mdb' because it is being used by another process.
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    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)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(String filename)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning : The process cannot access the file 'C:\Projects\L-Drive\TheAA.DS.App\TheAA.DS.App.Core\bin\Debug\TheAA.DS.App.Core.dll.mdb' because it is being used by another process.
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    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)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(String filename)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning : The process cannot access the file 'C:\Projects\L-Drive\TheAA.DS.App\TheAA.DS.App.Core\bin\Debug\TheAA.DS.App.Core.dll.mdb' because it is being used by another process.
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    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)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Pdb2Mdb.Converter.Convert(String filename)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1467,2): warning :    at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018: The "CopyMdbFiles" task failed unexpectedly.
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018: System.IO.IOException: The process cannot access the file 'C:\Projects\L-Drive\TheAA.DS.App\TheAA.DS.App.Core.Android\bin\Debug\TheAA.DS.App.Core.Android.dll.mdb' because it is being used by another process.
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    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)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Xamarin.Android.Tools.Files.HashFile(String filename, HashAlgorithm hashAlg)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Xamarin.Android.Tools.Files.HashFile(String filename)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Xamarin.Android.Tools.Files.HasFileChanged(String source, String destination)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Xamarin.Android.Tools.Files.CopyIfChanged(String source, String destination)
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Xamarin.Android.Tasks.CopyMdbFiles.Execute()
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
12>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1474,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Comment 1 Jose Gallardo 2016-05-18 13:46:21 UTC
Hi Paul,

We fixed an issue causing the mdb files to be in use some time ago. I think that's what you were facing.

Can you please confirm if you're still seeing this behavior with latest builds? (i.e. current Stable or Beta).

I'm marking the bug as resolved, but please feel free to reopen it if needed.

Thanks!