Bug 41079 - Can't deploy default Android application to Visual Studio Android Emulator: NullReferenceException is shown in the logs
Summary: Can't deploy default Android application to Visual Studio Android Emulator: N...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-05-13 16:11 UTC by Rostik
Modified: 2016-06-07 15:05 UTC (History)
3 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 Rostik 2016-05-13 16:11:31 UTC
I created a blank Android application in Visual Studio 2015 and clicked on Debug button with selected emulator "Kitkat XXHDPI Phone (Android 4.4)". 

*Result*: Emulator is started, deployment of an app hangs. 

In the logs at %localappdata%\Xamarin\Logs\14.0\*.lde.log I see:

Xamarin.VisualStudio.UnhandledExceptionsManager Error: 0 : [2016-05-13 17:14:41.3935] Unhandled exception.
System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Forms.ListBox.ItemArray.GetItem(Int32 virtualIndex, Int32 stateMask)
   at System.Windows.Forms.ListBox.ObjectCollection.get_Item(Int32 index)
   at Xamarin.VisualStudio.Android.DeviceChooser.UpdateList(IList`1 devices) in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Core\VisualStudio.Android\UserControls\DeviceChooser.cs:line 157
   at Xamarin.VisualStudio.Android.DeviceChooser.<.ctor>b__7_1(Object sender, IEnumerable`1 args) in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Core\VisualStudio.Android\UserControls\DeviceChooser.cs:line 29
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Xamarin.VisualStudio.Android.MonoAndroidDeviceProvider.<UpdateDevicesAsync>b__13_0() in C:\Users\builder\data\lanes\3062\0dd817c0\source\XamarinVS\src\Core\VisualStudio.Android\Devices\MonoAndroidDeviceProvider.cs:line 124
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

- Cancel build
- Use Build -> Deploy
Comment 1 Juan Marcelo Tondato 2016-05-18 14:45:55 UTC
Could you attach the VSX logs (Help\Xamarin) and the result of the build in diagnostic mode >

To set build output in diagnostic mode plese go to "Tools\Options\Projects and Solutions\Build and Run" and set the property "MSBuild project build output verbosity" with "Diagnostic".
Comment 2 Rostik 2016-06-07 15:05:38 UTC
The problem went away after I upgraded to latest stable