Bug 13 - When deploying my first simple app to the emulator, I get an Unhandled Exception
Summary: When deploying my first simple app to the emulator, I get an Unhandled Exception
Alias: None
Product: Android
Classification: Xamarin
Component: Tools and Addins ()
Version: 1.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pobst
Depends on:
Reported: 2011-07-18 12:22 UTC by Magnus Johansson
Modified: 2011-07-19 11:27 UTC (History)
2 users (show)

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

Screenshots (72.83 KB, application/x-zip-compressed)
2011-07-18 12:22 UTC, Magnus Johansson
The ADB log file (5.03 KB, application/octet-stream)
2011-07-19 03:01 UTC, Magnus Johansson

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 or GitHub 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 Magnus Johansson 2011-07-18 12:22:43 UTC
Created attachment 4 [details]

1. Create a simple empty app
2. Deploy to emulator.
3. Watch unhandled exception.


System.IndexOutOfRangeException: Index was outside the bounds of the array.

   at MonoDroid.InstalledPackage..ctor(String value)

   at MonoDroid.Adb.GetPackageListSafe(Device device)

   at MonoDroid.Adb.GetPackageList(Device device)

   at Novell.MonoDroidVS.DeviceDialog.DeployApplication(Device device, CancellationToken token)

   at Novell.MonoDroidVS.DeviceDialog.<>c__DisplayClass6.<button_ok_Click>b__5()

   at System.Threading.Tasks.Task.InnerInvoke()

   at System.Threading.Tasks.Task.Execute()
Comment 1 Jonathan Pobst 2011-07-18 13:40:12 UTC
Ouch, that's not good.

Can you go to Tools->Options->Mono for Android and turn on ADB logging.

Then try to deploy again so you get the error.

A log file will be written to your desktop called monodroid.log.

Can you please attach that to this bug?

Comment 2 Magnus Johansson 2011-07-19 03:01:53 UTC
Created attachment 6 [details]
The ADB log file
Comment 3 Magnus Johansson 2011-07-19 08:07:57 UTC
Hmmm.... I had MotoDev and a emulator running when this happened.
I close all of them, Vs, MotoDev and the AVD and restarted VS only.
Now the deployment worked.

I guess the moon and the stars were not properly aligned...
Comment 4 Jonathan Pobst 2011-07-19 11:27:41 UTC
Yeah, sounds like ADB just wasn't cooperating with us.  It seems like it gets in a bad state on rare occasions.

I added some additional error checking logic to try to guard against this issue in the future.

Thanks for reporting and I'm glad you got it working!