Bug 15872 - When a physical device is disconnected, we should not automatically deploy to an emulator.
Summary: When a physical device is disconnected, we should not automatically deploy to...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Dominique Louis
Depends on:
Reported: 2013-11-01 06:41 UTC by softlion
Modified: 2016-08-03 15:23 UTC (History)
6 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 softlion 2013-11-01 06:41:09 UTC
Often my Nexus 7 disconnects itself because the mini USB plug is an horror.

In VS, the dropdown selecting the "deploy device" switches automatically to device emulator.

I press F5 to try the project and the emulator opens. I closed it immediately and unplug/replug the nexus 7.

BUT after closing the emulator, VS is still in a "deploy" state and refuses to cancel the build with a message:
Microsoft Visual Studio
The project 'XXX, Configuration: Debug Any CPU' is not able to cancel deploying at this moment. Please try again later.

I have to kill VS, and reopen all the opened files as VS won't automatically save the user configuration.

Comment 1 softlion 2013-11-01 06:41:57 UTC
Ah, and VS can not be closed at all:

Microsoft Visual Studio
The build must be stopped before the solution can be closed.
Comment 2 PJ 2013-11-04 11:00:42 UTC
Thanks softlion! 

The end state here is similar to bug 15659.

We should also prevent people getting to that state. Even just the cost of starting up and closing an emulator accidentally would be a frustrating experience even if it did not result in 15659.

The change would be not re-selecting a new default device when a physical device is disconnected.

Dominique, thoughts?

Softlion, if you don't mind I'll be modifying the title here a little bit just to reflect the difference between this bug and 15659.
Comment 3 Dominique Louis 2013-11-05 09:39:06 UTC
Yes PJ, the end state is related to #15659

I will investigate the device pluging issue.
Comment 4 Dominique Louis 2013-11-05 14:01:29 UTC
Hi @softlion,
  In the next release, if you shutdown the Emulator before it has fully started, you will be able to go to Build->Cancel to return the IDE to a state that will allow you to progress. Also in future versions due to the slow rampup time of emulators, you'll be asked if you are sure you want to start the emulator. This should give you the opportunity to stop the emulator launching accidentally in your scenario.

I hope these changes help.

Comment 5 Dominique Louis 2013-11-05 14:02:23 UTC
PJ as per discussion, grab a build from - https://wrench.internalx.com/Wrench//ViewLane.aspx?lane_id=746&host_id=63&revision_id=213917 - when its finished building.
Comment 6 Nischal 2013-11-06 11:09:05 UTC
Today we have checked this issue with following builds :

VS 2013
X.Android : 4.10.01045

As per comment 4, now we are getting window that asks "you are sure you want to start the emulator" and we are able to cancel build vial Build->Cancel before emulator fully start.

Screencast : http://screencast.com/t/SAk3Wn2vWBi

Hecne closing this issue.