Skip to content

mlaunch: Retrieving device logs via --logdev in Xharness not working on iOS 18 queue #22394

@matouskozak

Description

@matouskozak

Using new mlaunch (version 1.1.11) inside Xharness leads to failure:

[01:23:08.6266650] /private/tmp/helix/working/B64E09AC/p/microsoft.dotnet.xharness.cli/10.0.0-dev/tools/net8.0/any/../../../runtimes/any/native/mlaunch/bin/mlaunch --sdkroot /Applications/Xcode_16.1.app --logdev --devname Dncengosx162
[01:23:09.5567310] error MT0000: Unexpected error - Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
[01:23:09.5582790] System.InvalidCastException: Unable to cast object of type 'Xamarin.Hosting.DeviceCtlDevice' to type 'Xamarin.Hosting.RealDevice'.
[01:23:09.5582830]    at Xamarin.Hosting.Logger.LogAsync(String, TextWriter) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Hosting/Logger.cs:line 152
[01:23:09.5582840]    at Xamarin.Hosting.Logger.LogToConsoleAsync(String) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Hosting/Logger.cs:line 172
[01:23:09.5582850]    at Xamarin.Hosting.Logger.<>c__DisplayClass5_0.<<LogToConsole>b__0>d.MoveNext() in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Hosting/Logger.cs:line 179
[01:23:09.5582850] --- End of stack trace from previous location ---
[01:23:09.5582860]    at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
[01:23:09.5582870]    at Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:line 176
[01:23:09.5582880]    at InvokeStub_NSAsyncSynchronizationContextDispatcher.Apply(Object, Object, IntPtr*)
[01:23:09.5583020]    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object, BindingFlags)
[01:23:09.5583030] --- End of stack trace from previous location ---
[01:23:09.5583040]    at ObjCRuntime.Runtime.InvokeMethod(MethodBase, Object, IntPtr) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.CoreCLR.cs:line 777
[01:23:09.5583050]    at ObjCRuntime.Runtime.InvokeMethod(MonoObject*, MonoObject*, IntPtr) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.CoreCLR.cs:line 667
[01:23:09.5583050]    at ObjCRuntime.Runtime.bridge_runtime_invoke_method(MonoObject* method, MonoObject* instance, IntPtr parameters, IntPtr* exception_gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/runtime/Delegates.generated.cs:line 1296
[01:23:09.5583060]    at ObjCRuntime.Messaging.void_objc_msgSend_NativeHandle(IntPtr, IntPtr, NativeHandle)
[01:23:09.5583070]    at Foundation.NSRunLoop.RunUntil(NSDate) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/macos/generated-sources/Foundation/NSRunLoop.g.cs:line 225
[01:23:09.5583210]    at Xamarin.Utils.NSRunLoopExtensions.RunUntilEvent(NSRunLoop, ManualResetEvent, Nullable`1 ) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Utils/Extensions.cs:line 16
[01:23:09.5583220]    at Xamarin.Hosting.Services.RunMainLoopUntil(ManualResetEvent) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Hosting/Services.cs:line 1750
[01:23:09.5583220]    at Xamarin.Hosting.Logger.LogToConsole(String) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Hosting/Logger.cs:line 182
[01:23:09.5583230]    at Xamarin.Launcher.DevController.ShowLog(String) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Launcher/controller-device.cs:line 46
[01:23:09.5583270]    at Xamarin.Launcher.Driver.MainAsync() in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Launcher/Main.cs:line 452
[01:23:09.5583280]    at Xamarin.Utils.NSRunLoopExtensions.RunUntilTaskCompletion[T](NSRunLoop, Task`1) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Utils/Extensions.cs:line 29
[01:23:09.5583280]    at Xamarin.Launcher.Driver.Main2(String[]) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Launcher/Main.cs:line 441
[01:23:09.5583320]    at Xamarin.Launcher.Driver.Main(String[]) in /Users/builder/azdo/_work/9/s/src/Xamarin.Hosting/Xamarin.Launcher/Main.cs:line 128
[01:23:09.5644180] 

The same Xharness code used to retrieve the device log:
https://github.com/dotnet/xharness/blob/4d96da724de267c2fe804b2c973f0047b00237ea/src/Microsoft.DotNet.XHarness.iOS.Shared/Execution/Arguments.cs#L43-L48

works well on older iPhone queue running with iOS 15.4.

Per offline discussion with Rolf, retrieving device logs via --logdev doesn't work on iOS 17+. A possible workaround might be using log collect --device-udid <UDID> with the disadvantage that it requires elevated privileges.


fyi: @rolfbjarne @vitek-karas @ivanpovazan

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions