Packaging Failed / cannot debug on Visual Studio Android

ChristopherNymannChristopherNymann USUniversity ✭✭

Hello,

I have the following problem when trying to debug with Visual Studio to Android:

  • I build my Android app and debug.
  • my app throws an unhandled exception.
  • I press Break, then stop the debugger by pressing shift F5.
  • I restart the debugger and get a message box indicating "Packaging Failed. Could not create the Android package. See Exception for more details.
  • Exception details are the following:

Copying file from "obj\Debug\PayAtTable.Platform.pdb" to "bin\Debug\PayAtTable.Platform.pdb".
The process cannot access the file 'C:\xamarin-prototypes\PayAtTable\PayAtTable\PayAtTable\PayAtTable.Droid\bin\Debug\PayAtTable.Platform.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()
Touching "bin\Debug\PayAtTable.Platform.dll.mdb".
The last access/last write time on file "bin\Debug\PayAtTable.Platform.dll.mdb" cannot be set. The process cannot access the file 'C:\xamarin-prototypes\PayAtTable\PayAtTable\PayAtTable\PayAtTable.Droid\bin\Debug\PayAtTable.Platform.dll.mdb' because it is being used by another process.
Done building project "PayAtTable.Droid.csproj" -- FAILED.
Build FAILED.

Looks like some other process is accessing the mdb file. I have to restart Visual Studio to be able to move past this.

Note that this does not happen without the unhandled exception being thrown in the debugger.

Also note that this started happening with the latest Xamarin update.

Has anyone else seen this? If so any better workaround than restarting Visual Studio?

Restarting Visual Studio to continue is very inconvenient.

Any assistance is appreciated.

thanks,

-Chris

Posts

  • ChristopherNymannChristopherNymann USUniversity ✭✭

    Update: And it turns out that downgrading to previous version did change the symptom. Now the problem happens any time I debug after the first time. Now after starting Visual Studio, the first time I debug, deployment happens successfully and the debugger starts. When I am done debugging, I press shift F5 to stop debugging. Now any time I press F5 to debug, I get the deployment error indicated above until I shut down Visual Studio and restart. Android debugging is not usable.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai
    edited April 2015

    I have added you to the list of customers known to be affected by this bug: https://bugzilla.xamarin.com/show_bug.cgi?id=26841.

    One of the commenters on that bug report suggested an interesting possible temporary workaround involving the handle.exe command: https://bugzilla.xamarin.com/show_bug.cgi?id=26841#c5.

  • IPutuYogaPermanaIPutuYogaPermana IDMember ✭✭

    Hi, same with me, i just moving on from xamarin indie to business. Work fine with Xamarin Studio, but when go to Visual Studio, i'm trying debugging, then 'Failed packaging' appeared and can't deploy.
    Now xamarin android on visual studio is unusable. I attach the txt that contain the exception.

    Best Regard

  • ChristopherNymannChristopherNymann USUniversity ✭✭

    yes this is still happening. Went away and then comes back sometimes. Even with using handle.exe to unlock the pdb file, this is an extreme productivity killer. Please fix this.

  • BetaVIBetaVI USMember ✭✭

    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.

Sign In or Register to comment.