Bug 5608 - can't access [projectname].dll.mdb
Summary: can't access [projectname].dll.mdb
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
: 5662 5717 5882 ()
Depends on:
Reported: 2012-06-11 11:31 UTC by Miha Markic
Modified: 2016-08-03 15:22 UTC (History)
9 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 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 Miha Markic 2012-06-11 11:31:54 UTC
I've found an annoying bug which results in debugger not stopping at breakpoints after few application runs. After few experiments I think I know what is causing it.

When I open Visual Studio and debug the application it works. It works for a while - I do stop the debugger, change something and debug again. But after few such cycles I start to get this error during compilation:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3607,9): warning MSB3061: Unable to delete file "[PATH]\[APPLICATIONNAME].dll.mdb". The process cannot access the file 'PATH]\[APPLICATIONNAME].dll.mdb' because it is being used by another process.
  LocationSpy -> D:\TFS Projects\Righthand\LocationSpy\Main\Source\LocationSpy\Source\LocationSpy\bin\Debug\LocationSpy.dll
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning : The process cannot access the file 'PATH]\[APPLICATIONNAME].dll.mdb' because it is being used by another process.
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,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)
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning :    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning :    at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile(Guid guid)
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning :    at Pdb2Mdb.Converter.Convert(AssemblyDefinition assembly, IEnumerable`1 functions, MonoSymbolWriter mdb)
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning :    at Pdb2Mdb.Converter.Convert(String filename)
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(988,2): warning :    at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute()

Looks like the mdb file gets locked by Visual Studio at certain point in time and after that the application *doesn't compile anymore* even though it says 
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ========== at the end (before the above error is written).

So, during the compilation I get the mdb file locked event and compiler still says that application has been compiled. When I start debugging at this time, the application would run, but the older version, not the latest (obviously it wasn't compiled or it just wasn't deployed) and debugger won't stop.

Repro: not 100% sure, but running an application, hitting stop button, running again, hitting stop button, ... would lead to this bug eventually.
Comment 1 Jonathan Pobst 2012-06-13 16:36:15 UTC
Fixed in f6849dfe10fe02712362ae78b65793ba21e3779d.

Should be available in 4.2.4 or 4.4.

Thanks for the report!
Comment 2 Jonathan Pobst 2012-06-14 20:27:02 UTC
*** Bug 5662 has been marked as a duplicate of this bug. ***
Comment 3 Mikayla Hutchinson [MSFT] 2012-06-27 13:57:32 UTC
*** Bug 5882 has been marked as a duplicate of this bug. ***
Comment 4 Mikayla Hutchinson [MSFT] 2012-06-29 19:12:03 UTC
*** Bug 5717 has been marked as a duplicate of this bug. ***