Bug 23353 - "No Devices Attached" shows in Visual Studio's iOS toolbar even when iOS device is connected to computer
Summary: "No Devices Attached" shows in Visual Studio's iOS toolbar even when iOS devi...
Status: CLOSED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.6
Hardware: PC Mac OS
: High major
Target Milestone: 3.7
Assignee: Bugzilla
URL:
: 23657 23999 ()
Depends on:
Blocks:
 
Reported: 2014-09-24 15:14 UTC by Dominic N [MSFT]
Modified: 2015-01-05 11:21 UTC (History)
15 users (show)

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


Attachments
mtbserver.log with exceptions (4.50 KB, text/plain)
2014-09-28 06:17 UTC, ian
Details


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:
Status:
CLOSED FIXED

Description Dominic N [MSFT] 2014-09-24 15:14:44 UTC
## Overview

We have multiple reports of connected iOS devices not showing up in the device list in Visual Studio. So far, all reports coming in have been running VS 2013, Xcode 6.0.1, and XS 5.4 (they're on the current stable).

All reporters have been able to debug on their device using Xcode on their Macs.


## Steps to reproduce

I have personally been unable to reproduce the issue at hand. I attempted to do so using an iPhone 6 on iOS 8 using a project file that was confirmed to not work that was provided by a customer.


## Expected results

Visual Studio users should be able to see their connected device in the device list in Visual Studio and be able to test on said device.


## Actual results

Device does not show up in device list in Visual Studio.


## Version information

Each report will be added privately with version attachments
Comment 5 Udham Singh 2014-09-25 13:01:55 UTC
I have tried to reproduce this issue but not able to reproduce this. 

To check this issue, I have used 3 iOS devices (iPhone 4S(7.1.2), iPhone 4S(8.0), iPhone 5S(8.0)) and I am able to see all the connected devices in VS device list and I am able to deploy applications on all connected devices successfully.

Screencast : http://www.screencast.com/t/8foHkCk4

Please let me know if I am missing anything.

Environment Info : 

Windows 8.1
VS 2013
Xamarin 3.6.249

OSX 10.9.4
Xamarin.iOS 8.0.0.62
Xcode 6.0.1
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-26 14:19:10 UTC
Some users on the forums have reported that downloading and reinstalling the Xamarin package from https://store.xamarin.com/account/my/subscription/downloads helped with the problem:

> http://forums.xamarin.com/discussion/24762/no-devices-attached-trying-to-debug-ios-app
Comment 7 Daniel Cazzulino 2014-09-26 16:00:43 UTC
@Dominique N: that attachment 8177 [details] (case 3) shows the customer is using a WAY old build of XamarinVS, 3.0!
Comment 9 ian 2014-09-28 06:17:05 UTC
Created attachment 8218 [details]
mtbserver.log with exceptions

When this problem occurs for me I see a bunch of ArgumentNullExceptions being printed to my mtbserver.log (snip attached) on the mac build host.
Comment 11 Ian Ceicys 2014-09-30 15:41:49 UTC
QA has repro'd the reported issue against build Xamarin VS 3.6.249, VS 2013 with Update 3, and Xcode 6.0.1, and as initially reported, 3 iphone devices are in fact missing in the device list (iPhone 4S(7.1.2), iPhone5S(8.0), iPhone 6(8.0)).

QA has verified that candidate build 3.6.262 fixes this issue when tested with VS 2013 with Update 3, and Xcode 6.0.1. The 3 iphone devices are now present in the device list(iPhone 4S(7.1.2), iPhone5S(8.0), iPhone 6(8.0)). 

Candidate 3.6.249 should improve the connectivity with Mac Build Host. 

Setting the status of this bug to verified / Fixed.
Comment 14 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-08 23:00:09 UTC
Unfortunately, I must re-open this bug because it is not yet fully resolved.

Based on the stack trace, I'd guess that the changes related to `Mtb.Server.DeviceListener` and `Mtb.Server.Commands.ListDevices.GetDevices()` from bug 23321 might stop this problem (bug 23353) too.

But in case those fixes *don't* stop the problem, here is some additional information.


## The error is intermittent

On at least a few users' machines, this problem is appearing and disappearing "unpredictably."

For example, in one case where I looked at the problem first-hand, the `Mtb.Server.DeviceListener.GetDevices()` command would fail repeatedly with the ArgumentNullException. But then, after both computers had been left untouched for a few minutes, the problem would eventually stop, and the device list in Visual Studio would refresh correctly. As far as I could tell `mtbserver` did not crash or restart during this time: the `mtbserver` process ID stayed the same, and no new crash logs appeared in "Console.app -> User Diagnostic Reports". This system had Visual Studio installed in a Parallels VM on the Mac build host (OS X 10.9.5).

In another case, each time the user installed a new Xamarin update from the updater service, the problem would stop temporarily (for maybe a day or two).


## The exception message and stack trace

The exception that appears in the log files is nothing too fancy. Here's the top of the stack trace (from comment 9):

> Exception: Exception type: System.ArgumentNullException
> Argument cannot be null.
> Parameter name: version
>   at System.Version..ctor (System.String version) [0x00000] in <filename unknown>:0 
>   at Mtb.Server.DeviceListener.<GetDevices>m__1 (Xamarin.MacDev.IPhoneDevice d) [0x00000] in <filename unknown>:0 


For some reason the call to `Mtb.Server.DeviceListener.<GetDevices>m__1 (Xamarin.MacDev.IPhoneDevice d)` is attempting to create a new `System.Version` object with a null input:

> new System.Version(null)

Presumably this means that an earlier method call is failing silently and returning `null` instead of a valid version string like "7.1.2". That kind of failure sounds like it could be the result of an Objective-C method call or a failed `as` conversion. Just to make one guess, the explanation might be that Xcode 6 sometimes return `null` when the build server queries it for the iOS versions of the attached simulators and devices. This could even be an _intentional_ behavior of Xcode 6. If that is the case, then the Xamarin build server will need to be adjusted accordingly.


## Possible temporary workaround

If the problem does depend on Xcode 6, then switching back to Xcode 5 might be one way to work around the problem temporarily.


I've posted most of this information and a little more discussion about possible workarounds on the forums:
http://forums.xamarin.com/discussion/25636/no-devices-attached-due-to-argumentnullexception-in-system-version-ctor
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-08 23:06:34 UTC
*** Bug 23657 has been marked as a duplicate of this bug. ***
Comment 16 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-17 18:18:59 UTC
I think we might now have at least 1 reliable way to reproduce this problem thanks to a forum comment [1]. Unfortunately the problem still exists on the latest hotfix builds from yesterday.

> [1] http://forums.xamarin.com/discussion/comment/81048/#Comment_81048


In short: enable "Sync with this iPhone over Wi-Fi" in iTunes for a device within Wi-Fi range.


## Steps I followed to reproduce

1. Start the Xamarin.iOS Build Host.

2. Attach iPhone 4s, iOS 7.1.2.

3. Open iTunes 12.0.1.

4. Select the iPhone icon toolbar under the rewind, play, fast-forward controls.

5. Enable "Sync with this iPhone over Wi-Fi", and then click "Apply".

6. Open an iOS project in Visual Studio.


## Results

If I leave iTunes running after step 6, then as long as I have the "Sync with this iPhone over Wi-Fi" setting enabled I _always_ hit the problem, and I get the same stack trace from comment 9.


## "Workaround" (for this particular way to reproduce the problem)

I can then stop the problem with the following 2 steps:

1. Disable the "Sync with this iPhone over Wi-Fi", and click "Apply".
2. Quit iTunes.


## Version information
Xamarin   3.7.226.0 (bde1ced5c221b04ff6c6c147e50fd5ca0000cbd1)
Xamarin.Android   4.18.0.38 (c0168255507205e3f50aba560ccf971c41a682ff)
Xamarin.iOS   8.2.0.0 (06812e63c56a62c5ed6298167da3c71c6baf8852)

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Windows 8.1 64-bit (VMWare Fusion 6.0.5)


### Mac build host
Xamarin.iOS 8.2.0.207 (Business Edition)
Hash: 3bf072d
Build date: 2014-10-15 21:44:26-0400

Xcode 6.0.1 (6528), Build 6A317
Mono 3.10.0 ((detached/e204655)
Mac OS X 10.9.5
Comment 17 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-20 22:48:10 UTC
I can further confirm the problem does not occur using the same conditions from comment 16 if I downgrade to Xamarin 3.5.58 + Xamarin.iOS 7.4.0.108.

After downgrading, I can successfully deploy and debug on the iPhone 4s, iOS 7.1.2. For this particular test, I didn't bother to downgrade Xcode, so I was still using Xcode 6.0.1. Of course, downgrading to Xcode 5 would be necessary in order to use the simulators.
Comment 19 GouriKumari 2014-10-23 17:53:58 UTC
*** Bug 23999 has been marked as a duplicate of this bug. ***
Comment 22 GouriKumari 2014-10-24 11:10:10 UTC
I verified this bug again with the following test environment and devices connected to the macbuild host are successfully retrieved and listed in VS instance. Also, more info can be found in bug 23999.

Test Env:
Xamarin: 3.7.0.236
Xamarin.iOS 8.4.0.16
Windows 7 VM
VS2012

Screencast: http://screencast.com/t/r9mDeVayQ0i5
Comment 24 Ian Ceicys 2014-11-11 11:10:55 UTC
This issue has been verified by QA and is fixed. Closing this bug.
Test Env:
Xamarin: 3.8.134
Windows 8.1 VM
VS2013.3
Comment 25 Ian Ceicys 2014-11-11 11:11:21 UTC
This issue has been verified by QA and is fixed. Closing this bug.
Test Env:
Xamarin: 3.8.134
Windows 8.1 VM
VS2013.3