Bug 38695 - Can't deploy to simulator. Issue seems to be resolved by unplugging and replugging in an iOS device.
Summary: Can't deploy to simulator. Issue seems to be resolved by unplugging and replu...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: 4.1.0 (C7)
Assignee: Jon Goldberger [MSFT]
: 37613 40416 ()
Depends on:
Reported: 2016-02-11 20:42 UTC by Jon Goldberger [MSFT]
Modified: 2016-06-15 04:27 UTC (History)
10 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 Jon Goldberger [MSFT] 2016-02-11 20:42:14 UTC
Created attachment 15011 [details]

## Description

I ran across a few users in the forums running into this issue and one desk case came in and mentioned this as a side note after he got other XMA connection issues resolved. 

Forum threads:


I did get some logs from the Desk case and have attached them. 

I do not have steps to reproduce at this time unfortunately.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-03-01 04:35:53 UTC
It seems that one common symptom of this problem is the following error message in the `*Ide.log` file:

> Xamarin.Messaging.Client.MessagingClient Error: 0 : [2016-02-10 20:32:25.1463] An error occured on client vs8908pc while executing a post for topic xvs/idb/
> System.TimeoutException: The operation has timed out.
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
>    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
>    at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__23`2.MoveNext()

The first post in [1] includes example stack traces for timeouts both during this "set-settings" topic as well as during the "show-app" topic.

[1]  https://forums.xamarin.com/discussion/58984/cant-start-ios-simulator/p1
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-03-01 04:55:23 UTC
There is a chance this behavior might already be improved in the current "Cycle 7 Preview" versions now on the Alpha updater channel [1].

[1] https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/.

In particular, a very similar error message [2] was reported to be mostly resolved by a "hotfix build" [3] that added some candidate fixes. And all of those candidate fixes are now also included on the current Alpha channel versions.

[2] http://forums.xamarin.com/discussion/comment/174447/#Comment_174447
[3] http://forums.xamarin.com/discussion/comment/176976/#Comment_176976
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-03-01 23:14:34 UTC
In case the current Cycle 7 Preview builds do not yet help with this problem...

## Some additional possible workarounds from an earlier bug report (Bug 37613) about the same problem

Workaround 1 (work at 100%):

(Re-summarized from the original text in Bug 37613)

- Run `/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch --launchsim` by hand in a Terminal.app command prompt to launch the app. One way to find the full `mtouch` command line to use is to run the following in a Terminal.app command prompt after attempting to launch the app on simulator:

ps -ax | grep 'mtouch --launchsim'

The full command should look similar the following:

> /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch
>     --launchsim /Users/macuser/Library/Caches/Xamarin/mtbs/builds/UnifiedSingleViewIphone1/0804ca0b24f10dbf3483e99a63b05d80/bin/iPhoneSimulator/Debug/UnifiedSingleViewIphone1.app
>     --device=:v2:udid=B3767998-58FB-43FD-8AF1-0E00D8F57EF7
>     -stdout /Users/macuser/Library/Caches/Xamarin/mtbs/builds/UnifiedSingleViewIphone1/0804ca0b24f10dbf3483e99a63b05d80/out.log
>     -stderr /Users/macuser/Library/Caches/Xamarin/mtbs/builds/UnifiedSingleViewIphone1/0804ca0b24f10dbf3483e99a63b05d80/err.log
>     -argument=-monodevelop-port
>     -argument=59882
>     --sdkroot /Applications/Xcode.app/Contents/Developer
>     -sdk 9.2

> Workaround 2: (work at 50%)
> - kill the app in the simulator. The new app version will then deploy
>   and run fine immediatly.

> Workaround 3: (work at 50% because of other bugs)
> - Close VS and kill the remaining IDB.exe process on the mac. Reopen
>   VS. If the list of simulators fills correctly, you are lucky.
>   Otherwise close VS again.

> Workaround 4:
> - quit the ios simulator. It will relaunched almost immediatly with
>   the deployed app ok.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2016-03-01 23:16:13 UTC
*** Bug 37613 has been marked as a duplicate of this bug. ***
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2016-03-07 21:36:40 UTC
## Preliminary customer verifications that the bug is indeed fixed on the "Cycle 7 Preview" currently available on the Alpha channel

- 2016-03-04, https://kb.xamarin.com/agent/case/285056
- 2016-03-04, http://forums.xamarin.com/discussion/comment/183909/#Comment_183909
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2016-04-19 22:53:04 UTC
*** Bug 40416 has been marked as a duplicate of this bug. ***
Comment 7 mag@xamarin.com 2016-05-11 15:00:53 UTC
This bug should be fixed at maximum in the master branch from this commit: 77293dae7aec74164c54896d14d4a10c82ea001a

Many improvements has been added related to timeouts due to errors in the SSH commands and XMA messages. Many are already in Cycle7 and many others are still in master. Testing from that master commit should ensure the resolution.
Comment 8 Jose Gallardo 2016-06-15 04:27:59 UTC
Changing the status to "Resolved" as the patch has been already shipped to stable in XVS