Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlaunch fails to list devices (with Apple Watch paired?) #21564

Open
borrrden opened this issue Nov 1, 2024 · 6 comments
Open

mlaunch fails to list devices (with Apple Watch paired?) #21564

borrrden opened this issue Nov 1, 2024 · 6 comments
Labels
mlaunch need-attention An issue requires our attention/response
Milestone

Comments

@borrrden
Copy link

borrrden commented Nov 1, 2024

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

.NET 8.0.403 xHarness 8.0.0-prerelease.24529.2 Xamarin.Launcher 1.0.256 (refs/heads/main: ad4af9cde4)

Description

Various ios-device based xharness commands are being extremely flaky (i.e. at least 50% fail rate) with the following

Steps to Reproduce

Run xharness apple device ios-device several times

I believe this may require an Apple Watch to be paired with a connected iOS device

Did you find any workaround?

Power off the Apple Watch (Nevermind, even THIS doesn't stop it)

Relevant log output

[10:19:39.9343160] Xamarin.Hosting: Loaded Xcode plugins successfully.
[10:19:39.9678880] Xamarin.Hosting: Device discovery started
[10:19:40.1295340] Xamarin.Hosting: Device discovery event: GizmoPaired (00008006-001174960C03402E)
[10:19:40.1295770] Xamarin.Hosting: Device discovery event: Connected (a30eb9b2916eb79ffc490fa27b5993c84596622d)
[10:19:40.1297140] Xamarin.Hosting: Device discovery event: Connected (00008006-001174960C03402E)
[10:19:40.1365440] Xamarin.Hosting: Connected to \<ios-device-redacted> (a30eb9b2916eb79ffc490fa27b5993c84596622d) in 00:00:00.0021184
[10:19:40.1975250] Xamarin.Hosting: Connected to \<watch-device-redacted> (00008006-001174960C03402E) in 00:00:00.0025502
[10:19:40.1995150] Failed to start session on \<watch-device-redacted>: Missing Pair Record Error (error: 0xe8000025)
[10:19:40.2199630] Xamarin.Hosting: Connecting to '\<ios-device-redacted>', token is 0x7fea42f4ad00
[10:19:40.2730740] Xamarin.Hosting: Connected to '\<ios-device-redacted>'
[10:19:40.2871700] Xamarin.Hosting: Failed to get value 'DeveloperStatus' from the device a30eb9b2916eb79ffc490fa27b5993c84596622d: Missing Value Error (error: 0xe8000015)
[10:19:40.2919850] Xamarin.Hosting: Failed to get value 'EnableWifiDebugging' from the device a30eb9b2916eb79ffc490fa27b5993c84596622d: Missing Value Error (error: 0xe8000015)
[10:19:40.3052840] Xamarin.Hosting: Failed to get value 'WirelessHosts' from the device a30eb9b2916eb79ffc490fa27b5993c84596622d: Missing Value Error (error: 0xe8000015)
[10:19:40.5667060] Xamarin.Hosting: Device discovery event: Connected (a30eb9b2916eb79ffc490fa27b5993c84596622d)
[10:19:40.5834820] Xamarin.Hosting: Device discovery event: GizmoPaired (00008006-001174960C03402E)
[10:19:40.5941570] Xamarin.Hosting: Connected to \<ios-device-redacted> (a30eb9b2916eb79ffc490fa27b5993c84596622d) in 00:00:00.0164008
[10:19:40.5942240] Xamarin.Hosting: Device discovery event: Connected (00008006-001174960C03402E)
[10:19:40.9341920] Xamarin.Hosting: Connected to \<watch-device-redacted> (00008006-001174960C03402E) in 00:00:00.0195551
[10:19:40.9352640] Failed to start session on \<watch-device-redacted>: Missing Pair Record Error (error: 0xe8000025)
[10:19:41.4379430] Xamarin.Hosting: Device discovery event: Unsubscribed ()
[10:19:41.4380130] Xamarin.Hosting: Device discovery event: Unsubscribed ()
[10:19:41.4385650] Xamarin.Hosting: Device discovery stopped
[10:19:41.4873690] error MT0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
[10:19:41.5391590] System.NullReferenceException: Object reference not set to an instance of an object.
[10:19:41.5392270]    at Xamarin.Hosting.RealDevice.ConnectToken() in /Users/builder/azdo/_work/1/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:line 121
[10:19:41.5392360]    at System.Threading.Tasks.Task.InnerInvoke()
[10:19:41.5392580]    at System.Threading.Tasks.Task.\<>c.\<.cctor>b__281_0(Object obj)
[10:19:41.5392640]    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object)
[10:19:41.5392830] --- End of stack trace from previous location ---
[10:19:41.5392880]    at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object)
[10:19:41.5393000]    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&, Thread )
[10:19:41.5393040] --- End of stack trace from previous location ---
[10:19:41.5393090]    at Xamarin.Hosting.RealDevice.IsUnlockedAsync() in /Users/builder/azdo/_work/1/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:line 192
[10:19:41.5393160]    at Xamarin.Launcher.DevController.GetDeviceInfoAsync(RealDevice, Boolean) in /Users/builder/azdo/_work/1/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:line 695
[10:19:41.5513730] Process mlaunch exited with 1
[10:19:41.5612360] Failed to parse device list: System.Exception: Failed to list devices.
@borrrden borrrden changed the title xharness fails to list devices (with Apple Watch paired?) mlaunch fails to list devices (with Apple Watch paired?) Nov 1, 2024
@rolfbjarne
Copy link
Member

I'll try to make the code a bit more resilient (work in progress here: https://github.com/xamarin/maccore/pull/2952), I'll let you know when there's a NuGet to try.

@rolfbjarne rolfbjarne added this to the Future milestone Nov 1, 2024
@borrrden
Copy link
Author

borrrden commented Nov 1, 2024

I personally find it odd that watch devices are considered at all when I am trying to enumerate ios-device. Could they just simply be skipped instead?

@rolfbjarne
Copy link
Member

I personally find it odd that watch devices are considered at all when I am trying to enumerate ios-device. Could they just simply be skipped instead?

We have to connect to the device to figure out it's a watch.

In any case, here's a version that should be a bit more resilient, can you try this one?

1.0.266-ci.refs-pull-2952-merge

(https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.Tools.Mlaunch/overview/1.0.266-ci.refs-pull-2952-merge.266%202b0f58e6d4)

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Nov 4, 2024
@borrrden
Copy link
Author

borrrden commented Nov 6, 2024

This build seems more stable and the logs show it talking to the devices but for some reason nothing is actually listed as discovered:

Logs

./mlaunch --listdev --use-device-ctl=false -vv Using Xcode 16.0 found in /Applications/Xcode-16.0.0.app/Contents/Developer Xamarin.Hosting: Xamarin.Hosting Xamarin.Hosting: Version: 2b0f58e6d4 (refs/pull/2952/merge) Xamarin.Hosting: Xcode: /Applications/Xcode-16.0.0.app Xamarin.Hosting: Xcode Version: 16.0 Xamarin.Hosting: Verbosity: 2 2024-11-06 11:14:27.735 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.IDEDebugger.VariablesViewQuickLookProvider for extension Xcode.IDEDebugger.SpriteKitQuickLookProvider of plug-in com.apple.IDESpriteKitParticleEditor 2024-11-06 11:14:27.736 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.IDEDebugger.VariablesViewQuickLookProvider for extension Xcode.SpriteKit.GKStateMachineQuickLookProvider of plug-in com.apple.IDESpriteKitParticleEditor 2024-11-06 11:14:27.750 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.IDEPlaygroundsKit.PlaygroundBottomBarExecutionAdaptor for extension Xcode.IDEPlaygroundEditor.IDEPlaygroundBottomBarExecutionAdaptor of plug-in com.apple.dt.IDEPlaygroundEditorPlugin 2024-11-06 11:14:27.753 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.DataSourceConnection for extension Xcode.DebuggerFoundation.watchOS.DataSourceConnectionTargetHub of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.753 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorSlice for extension Xcode.Xcode3ProjectSupport.InfoEditorSlice.WatchOS.BundleInfo of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.753 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3UI.Xcode3SupportedDestinations for extension IDEWatchSupportUI:IDEWatchSupportUI.plugindata/plug-in[1]/extension[11] of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.753 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.ViewDescriber for extension Xcode.DebuggerFoundation.watchOS.ViewDescriber of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.753 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.ViewDescriber for extension Xcode.DebuggerFoundation.watchOSSimulator.ViewDescriber of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.753 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorType for extension Xcode.Xcode3ProjectSupport.InfoEditorType.WatchOS.Bundle of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.754 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.DataSourceConnection for extension Xcode.DebuggerFoundation.watchOSSimulator.DataSourceConnectionTargetHub of plug-in com.apple.dt.IDEWatchSupportUI 2024-11-06 11:14:27.754 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.IDEiOSSupportCore.iOSDeviceLocatorMapping for extension Xcode.IDEiOSSupportCore.iOSDeviceLocatorMapping.driverkit of plug-in com.apple.dt.IDEDriverKitSupportCore 2024-11-06 11:14:27.754 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3UI.Xcode3SupportedDestinations for extension IDEDriverKitSupportUI:IDEDriverKitSupportUI.plugindata/plug-in[1]/extension[2] of plug-in com.apple.dt.IDEDriverKitSupportUI 2024-11-06 11:14:27.755 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3UI.Xcode3SupportedDestinations for extension IDEOSXSupportUI:IDEOSXSupportUI.plugindata/plug-in[1]/extension[5] of plug-in com.apple.dt.IDEOSXSupportUI 2024-11-06 11:14:27.756 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorType for extension Xcode.Xcode3ProjectSupport.InfoEditorType.Reality.Bundle of plug-in com.apple.dt.IDEVisionSupportUI 2024-11-06 11:14:27.756 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3UI.Xcode3SupportedDestinations for extension IDEVisionSupportUI:IDEVisionSupportUI.plugindata/plug-in[1]/extension[5] of plug-in com.apple.dt.IDEVisionSupportUI 2024-11-06 11:14:27.756 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorType for extension Xcode.Xcode3ProjectSupport.InfoEditorType.Reality.Framework of plug-in com.apple.dt.IDEVisionSupportUI 2024-11-06 11:14:27.756 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorType for extension Xcode.Xcode3ProjectSupport.InfoEditorType.Reality.Application of plug-in com.apple.dt.IDEVisionSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorSlice for extension Xcode.Xcode3ProjectSupport.InfoEditorSlice.appletvos.BundleTargetInfo of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.DataSourceConnection for extension Xcode.DebuggerFoundation.tvOSSimulator.DataSourceConnectionTargetHub of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3UI.Xcode3SupportedDestinations for extension IDEAppleTVSupportUI:IDEAppleTVSupportUI.plugindata/plug-in[1]/extension[11] of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.DeviceIconProvider for extension Xcode.DebuggerFoundation.DeviceIconProvider.AppleTV of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.ViewDescriber for extension Xcode.DebuggerFoundation.ATVSimulator.ViewDescriber of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.Xcode3ProjectSupport.InfoEditorType for extension Xcode.Xcode3ProjectSupport.InfoEditorType.appletvos.Bundle of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.ViewDescriber for extension Xcode.DebuggerFoundation.ATV.ViewDescriber of plug-in com.apple.dt.IDEAppleTVSupportUI 2024-11-06 11:14:27.757 mlaunch[10454:216387] Requested but did not find extension point with identifier Xcode.DebuggerFoundation.DataSourceConnection for extension Xcode.DebuggerFoundation.tvOS.DataSourceConnectionTargetHub of plug-in com.apple.dt.IDEAppleTVSupportUI Xamarin.Hosting: Device discovery started Xamarin.Hosting: Device discovery event: Connected (a30eb9b2916eb79ffc490fa27b5993c84596622d) Xamarin.Hosting: Device discovery event: GizmoPaired (00008006-001174960C03402E) Xamarin.Hosting: Device discovery event: Connected (00008006-001174960C03402E) Xamarin.Hosting: Connected to (a30eb9b2916eb79ffc490fa27b5993c84596622d) in 00:00:00.0019624 Xamarin.Hosting: Connected to (00008006-001174960C03402E) in 00:00:00.0023353 Failed to start session on : Missing Pair Record Error (error: 0xe8000025) Xamarin.Hosting: Connecting to '', token is 0x7fae7825fe30 Xamarin.Hosting: Connected to '' Xamarin.Hosting: Failed to get value 'DeveloperStatus' from the device a30eb9b2916eb79ffc490fa27b5993c84596622d: Missing Value Error (error: 0xe8000015) Xamarin.Hosting: Failed to get value 'EnableWifiDebugging' from the device a30eb9b2916eb79ffc490fa27b5993c84596622d: Missing Value Error (error: 0xe8000015) Xamarin.Hosting: Failed to get value 'WirelessHosts' from the device a30eb9b2916eb79ffc490fa27b5993c84596622d: Missing Value Error (error: 0xe8000015)

Furthermore the default of using devicectl is hairy. There is no way that I can see to pass the argument to not use it from xharness, so no devices show up from xharness. devicectl requires iOS 17.0 as far as I can tell but this device is iOS 16.x and EoL (can't get iOS 17).

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Nov 6, 2024
@rolfbjarne
Copy link
Member

Furthermore the default of using devicectl is hairy.

We're using both devicectl and the old method to find devices, so there's no need to disable devicectl. Disabling devicectl will only prevent new devices from being listed.

Failed to start session on : Missing Pair Record Error

That said, it looks like the device isn't paired with the Mac. Does it show up in Xcode? And if it shows up in Xcode, try again with mlaunch, sometimes Xcode automatically fixes problems.

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated no-auto-reply For internal use and removed need-attention An issue requires our attention/response labels Nov 6, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the no-auto-reply For internal use label Nov 6, 2024
@borrrden
Copy link
Author

borrrden commented Nov 6, 2024

Ugh sorry github once again showed things differently in the preview so my "redactions" are all invisible. That missing pair record is referring to the watch device, not the phone. Furthermore when the older version of mlaunch (1.0.256) runs it will correctly output two devices when it does not throw an exception (showing IsPaired: false for the watch). This is all while the same device is plugged in. The new version simply doesn't report anything.

Here is what I believe to be the relevant parts of the two logs:

1.0.256 (non-exception run)

Xamarin.Hosting: Device discovery started
Xamarin.Hosting: Device discovery event: GizmoPaired (|udid2-redacted|)
Xamarin.Hosting: Device discovery event: Connected (|udid-redacted|)
Xamarin.Hosting: Device discovery event: Connected (|udid2-redacted|)
Xamarin.Hosting: Connected to |iphone-device-redacted| (|udid-redacted|) in 00:00:00.0018850
Xamarin.Hosting: Connected to |watch-device-redacted| (|udid2-redacted|) in 00:00:00.0023387
Failed to start session on |watch-device-redacted|: Missing Pair Record Error (error: 0xe8000025)
Xamarin.Hosting: Connecting to '|iphone-device-redacted|', token is 0x7fb1c8768f60
Xamarin.Hosting: Connected to '|iphone-device-redacted|'
Xamarin.Hosting: Failed to get value 'DeveloperStatus' from the device |udid-redacted|: Missing Value Error (error: 0xe8000015)
Xamarin.Hosting: Failed to get value 'EnableWifiDebugging' from the device |udid-redacted|: Missing Value Error (error: 0xe8000015)
Xamarin.Hosting: Failed to get value 'WirelessHosts' from the device |udid-redacted|: Missing Value Error (error: 0xe8000015)
|iphone-device-redacted|: |udid-redacted|
        ActivationState: Activated
        AmountDataAvailable: 72120090624
        BatteryCurrentCapacity: 99
        BluetoothAddress: 68:ef:43:af:0a:ed
        BuildVersion: 20H350
        ChipID: 32789
        CPUArchitecture: arm64
        DeviceClass: iPhone
        DeviceColor: 1
        DeviceEnclosureColor: 1
        DeviceIdentifier: |udid-redacted|
        DevToolsAvailable: Standard
        HardwareModel: D22AP
        InterfaceType: Usb
        InternationalMobileEquipmentIdentity: 356739082115034
        IsLocked: False
        IsPaired: True
        IsUsableForDebugging: True
        IsValid: True
        ModelNumber: MQC12
        Name: |iphone-device-redacted|
        PasswordProtected: False
        ProductionSOC: 1
        ProductType: iPhone10,3
        ProductVersion: 16.7.10
        SerialNumber: F17VPK4UJCLC
        TotalDataCapacity: 250949189632
        UDID: |udid-redacted|
        UniqueChipID: 3792259362521134
        WatchCompanionCapability: True
        WiFiAddress: 68:ef:43:af:0a:ec
|watch-device-redacted|: |udid2-redacted| (companion: |udid-redacted|)
        CompanionIdentifier: |udid-redacted|
        DeviceClass: Watch
        DeviceIdentifier: |udid2-redacted|
        InterfaceType: 3
        IsPaired: False
        IsValid: True
        Name: |watch-device-redacted|
        UDID: |udid2-redacted|
Xamarin.Hosting: Device discovery event: Unsubscribed ()
Xamarin.Hosting: Device discovery event: Unsubscribed ()
Xamarin.Hosting: Device discovery stopped

1.0.266 (PR version)

xcrun devicectl -j /var/folders/xh/0fjs6cmj7nq2k1vh3gzlfy_40000gn/T/tmpU4qlAb.tmp -v list devices
        Using verbose logging.
        No devices found.
        Saving JSON output file to /var/folders/xh/0fjs6cmj7nq2k1vh3gzlfy_40000gn/T/tmpU4qlAb.tmp

        Command Completed, took 0.008 seconds

[..........]
Xamarin.Hosting: Device discovery started
Xamarin.Hosting: Device discovery event: Connected (|udid-redacted|)
Xamarin.Hosting: Device discovery event: GizmoPaired (|udid2-redacted|)
Xamarin.Hosting: Device discovery event: Connected (|udid2-redacted|)
Xamarin.Hosting: Connected to |iphone-device-redacted| (|udid-redacted|) in 00:00:00.0017503
Xamarin.Hosting: Connected to |watch-device-redacted| (|udid2-redacted|) in 00:00:00.0020379
Failed to start session on |watch-device-redacted|: Missing Pair Record Error (error: 0xe8000025)
Xamarin.Hosting: Connecting to '|iphone-device-redacted|', token is 0x7f8e12061610
Xamarin.Hosting: Connected to '|iphone-device-redacted|'
Xamarin.Hosting: Failed to get value 'DeveloperStatus' from the device |udid-redacted|: Missing Value Error (error: 0xe8000015)
Xamarin.Hosting: Failed to get value 'EnableWifiDebugging' from the device |udid-redacted|: Missing Value Error (error: 0xe8000015)
Xamarin.Hosting: Failed to get value 'WirelessHosts' from the device |udid-redacted|: Missing Value Error (error: 0xe8000015)
Xamarin.Hosting: Device discovery event: Unsubscribed ()
Xamarin.Hosting: Device discovery event: Unsubscribed ()
Xamarin.Hosting: Device discovery stopped

Note that it's pretty much identical except for the lack of device output.

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlaunch need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

2 participants