xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.42k stars 507 forks source link

`mlaunch` fails to list AppleTV paired with Xcode #20579

Closed viniciusjarina closed 1 month ago

viniciusjarina commented 2 months ago

mlaunch fails to list paired AppleTV device causing VSMac/Rider to not show AppleTV device. The device shows normally on Devices & Simulator

Xcode 15.3 15E204a macOS 14.4.1 Xamarin.iOS Version: 17.2.0.43 Visual Studio Community - Hash: 2cb9d6666

viniciusjarina@JarinaM3:~$ /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch --version
Xamarin.Launcher 1.0.83 (refs/heads/main: 699ed5eaf2)

Steps to Reproduce

  1. Launch mlaunch with --listdev -v

  2. Get NullReferenceException:

error MT0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.Hosting.RealDevice.ConnectToken() in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:line 121
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__273_0(Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&, Thread )
--- End of stack trace from previous location ---
   at Xamarin.Hosting.RealDevice.IsUnlockedAsync() in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:line 192
   at Xamarin.Launcher.DevController.GetDeviceInfoAsync(RealDevice, Boolean) in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:line 678
   at Xamarin.Launcher.DevController.<>c__DisplayClass22_1.<<GetDevicesAsyncUsingAMDevice>b__2>d.MoveNext() in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:line 552

Expected Behavior

Actual Behavior

Environment

Version information ``` ```

Build Logs

Example Project (If Possible)

rolfbjarne commented 2 months ago

What's the exact command you're executing, and the output you're getting?

Which mlaunch version are you using?

viniciusjarina commented 2 months ago

@rolfbjarne sorry I click save before I was finish with details.

rolfbjarne commented 1 month ago

@viniciusjarina what's the output of this command:

xcrun devicectl list devices --columns '*'
viniciusjarina commented 1 month ago

@rolfbjarne

viniciusjarina@JarinaM3:~$ xcrun devicectl list devices --columns '*'
Devices:
Name           Hostname                                     Identifier                             State                Model                                    UDID                                       Serial Number   Platform   OS Version   OS Build
------------   ------------------------------------------   ------------------------------------   ------------------   --------------------------------------   ----------------------------------------   -------------   --------   ----------   --------
AppleTV HD     AppleTV-HD.coredevice.local                  D6C7BAB4-E3F4-4B90-BF82-01143A447DA0   connected            Apple TV (4th generation) (AppleTV5,3)   6c5914ee452a524dfa501e3d5c67bc58e2e562b3   C07FP7610FNL    tvOS       21L227       17.4    
eyePhone13     eyePhone13.coredevice.local                  A52E15D1-87CA-4231-888C-59F26E354791   connected            iPhone 13 (iPhone14,5)                   00008110-00041D440239A01E                  VHJQX5FXXR      iOS        21E237       17.4.1  
eyePhoneMini   00008110-00064912349B801E.coredevice.local   E7207BFC-EE38-4066-8574-9D1929311535   available (paired)   iPhone 13 mini (iPhone14,4)              00008110-00064912349B801E                  VVHHCV716C      iOS        21E236       17.4.1  
viniciusjarina commented 1 month ago

i tried to forgot and repair. But still hit the same NRE:

error MT0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.Hosting.RealDevice.ConnectToken() in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:line 121
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__273_0(Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&, Thread )
--- End of stack trace from previous location ---
   at Xamarin.Hosting.RealDevice.IsUnlockedAsync() in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:line 192
   at Xamarin.Launcher.DevController.GetDeviceInfoAsync(RealDevice, Boolean) in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:line 678
   at Xamarin.Launcher.DevController.<>c__DisplayClass22_1.<<GetDevicesAsyncUsingAMDevice>b__2>d.MoveNext() in /Users/builder/azdo/_work/2/s/tools/mlaunch/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:line 552
rolfbjarne commented 1 month ago

Can you try using the mlaunch in this NuGet, and see if that works better?

https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.Tools.Mlaunch/overview/1.0.162-ci.pr.gh2813.162%2006007cf77d

I can't reproduce this, so we might have to iterate a few times until it's fully working.

microsoft-github-policy-service[bot] commented 1 month ago

Hi @viniciusjarina. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

microsoft-github-policy-service[bot] commented 1 month ago

Hi @viniciusjarina. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you.