Skip to content

[Apple] Update mlaunch version#1422

Merged
kotlarmilos merged 9 commits intodotnet:mainfrom
kotlarmilos:improvement/bump-mlaunch-version
Jul 10, 2025
Merged

[Apple] Update mlaunch version#1422
kotlarmilos merged 9 commits intodotnet:mainfrom
kotlarmilos:improvement/bump-mlaunch-version

Conversation

@kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Jun 17, 2025

Description

This PR updates mlaunch version to fix TCP mlaunch failures.

@kotlarmilos
Copy link
Member Author

[10.0.0-ci] XHarness command issued: apple test --app /tmp/helix/working/9A17086D/w/AB1E09AC/e/System.Numerics.Vectors.Tests.app --output-directory /tmp/helix/working/9A17086D/w/AB1E09AC/uploads --target ios-simulator-64 --timeout 00:07:00 --launch-timeout 00:03:30 --xcode /Applications/Xcode_16.1.app -v
[07:37:51] info: Preparing run for ios-simulator-64
[07:37:51] info: Looking for available ios-simulator-64 simulators..
[07:37:51] dbug: Looking for available ios-simulator-64 simulators. Storing logs into list-ios-simulator-64-20250617_073751.log
[07:37:53] fail: Failed to find/create suitable simulator
[07:37:53] dbug: Saving diagnostics data to '/tmp/helix/working/9A17086D/w/AB1E09AC/e/diagnostics.json'
XHarness exit code: 81 (DEVICE_NOT_FOUND)

@rolfbjarne Does the new mlaunch require an explicit command to create a simulator?

@kotlarmilos
Copy link
Member Author

.packages\microsoft.dotnet.arcade.sdk\10.0.0-beta.25313.2\tools\Sign.proj(76,5): error SIGN004: Signing 3rd party library 'D:\a_work\1\s\artifacts\tmp\Debug\ContainerSigning\108\runtimes/any/native/mlaunch/lib/mlaunch/mlaunch.app/Contents/MonoBundle/cs/.xamarin/osx-arm64/Xamarin.Hosting.resources.dll' with Microsoft certificate 'Microsoft400'. The library is considered 3rd party library due to its copyright: ' '.

@rolfbjarne Did I pick the wrong version?

@rolfbjarne
Copy link
Member

[10.0.0-ci] XHarness command issued: apple test --app /tmp/helix/working/9A17086D/w/AB1E09AC/e/System.Numerics.Vectors.Tests.app --output-directory /tmp/helix/working/9A17086D/w/AB1E09AC/uploads --target ios-simulator-64 --timeout 00:07:00 --launch-timeout 00:03:30 --xcode /Applications/Xcode_16.1.app -v
[07:37:51] info: Preparing run for ios-simulator-64
[07:37:51] info: Looking for available ios-simulator-64 simulators..
[07:37:51] dbug: Looking for available ios-simulator-64 simulators. Storing logs into list-ios-simulator-64-20250617_073751.log
[07:37:53] fail: Failed to find/create suitable simulator
[07:37:53] dbug: Saving diagnostics data to '/tmp/helix/working/9A17086D/w/AB1E09AC/e/diagnostics.json'
XHarness exit code: 81 (DEVICE_NOT_FOUND)

@rolfbjarne Does the new mlaunch require an explicit command to create a simulator?

mlaunch should be able to create simulators, but maybe something isn't working right.

However, that output doesn't say the exact mlaunch command, nor mlaunch's output, so I have no idea what went wrong.

@rolfbjarne
Copy link
Member

.packages\microsoft.dotnet.arcade.sdk\10.0.0-beta.25313.2\tools\Sign.proj(76,5): error SIGN004: Signing 3rd party library 'D:\a_work\1\s\artifacts\tmp\Debug\ContainerSigning\108\runtimes/any/native/mlaunch/lib/mlaunch/mlaunch.app/Contents/MonoBundle/cs/.xamarin/osx-arm64/Xamarin.Hosting.resources.dll' with Microsoft certificate 'Microsoft400'. The library is considered 3rd party library due to its copyright: ' '.

@rolfbjarne Did I pick the wrong version?

This is interesting, I have no idea what's causing this. I'll have a look.

@rolfbjarne
Copy link
Member

.packages\microsoft.dotnet.arcade.sdk\10.0.0-beta.25313.2\tools\Sign.proj(76,5): error SIGN004: Signing 3rd party library 'D:\a_work\1\s\artifacts\tmp\Debug\ContainerSigning\108\runtimes/any/native/mlaunch/lib/mlaunch/mlaunch.app/Contents/MonoBundle/cs/.xamarin/osx-arm64/Xamarin.Hosting.resources.dll' with Microsoft certificate 'Microsoft400'. The library is considered 3rd party library due to its copyright: ' '.

@rolfbjarne Did I pick the wrong version?

This is interesting, I have no idea what's causing this. I'll have a look.

MAybe this will fix it: https://devdiv.visualstudio.com/DevDiv/_git/macios-mlaunch/pullrequest/644208

@kotlarmilos
Copy link
Member Author

[10.0.0-ci] XHarness command issued: apple test --app /tmp/helix/working/9A17086D/w/AB1E09AC/e/System.Numerics.Vectors.Tests.app --output-directory /tmp/helix/working/9A17086D/w/AB1E09AC/uploads --target ios-simulator-64 --timeout 00:07:00 --launch-timeout 00:03:30 --xcode /Applications/Xcode_16.1.app -v
[07:37:51] info: Preparing run for ios-simulator-64
[07:37:51] info: Looking for available ios-simulator-64 simulators..
[07:37:51] dbug: Looking for available ios-simulator-64 simulators. Storing logs into list-ios-simulator-64-20250617_073751.log
[07:37:53] fail: Failed to find/create suitable simulator
[07:37:53] dbug: Saving diagnostics data to '/tmp/helix/working/9A17086D/w/AB1E09AC/e/diagnostics.json'
XHarness exit code: 81 (DEVICE_NOT_FOUND)

@rolfbjarne Does the new mlaunch require an explicit command to create a simulator?

mlaunch should be able to create simulators, but maybe something isn't working right.

However, that output doesn't say the exact mlaunch command, nor mlaunch's output, so I have no idea what went wrong.

Here is the error log:

[07:37:34.1379020] 
[07:37:34.1380690] Running /private/tmp/helix/working/9A17086D/p/microsoft.dotnet.xharness.cli/10.0.0-ci/tools/net8.0/any/../../../runtimes/any/native/mlaunch/bin/mlaunch --sdkroot /Applications/Xcode_16.1.app --listsim=/tmp/helix/working/9A17086D/t/tmp2bEyEP.tmp --output-format=XML -v -v -v -v -v
[07:37:35.7792340] Using Xcode 16.1 found in /Applications/Xcode_16.1.app
[07:37:35.8480690] xcrun simctl list --json --json-output /tmp/helix/working/9A17086D/t/tmpeVsaJa.tmp
[07:37:36.1700180] 	simctl: unrecognized option `--json-output'
[07:37:36.1700730] 	List available devices, device types, runtimes, or device pairs.
[07:37:36.1700870] 	Usage: simctl list [-j | --json] [-e | --no-escape-slashes] [-v] [devices|devicetypes|runtimes|pairs] [<search term>|available]
[07:37:36.1700980] 	-j     Print as JSON
[07:37:36.1701080] 	-e     Encode slashes without escapes in JSON output
[07:37:36.1701170] 	-v     More verbose output
[07:37:36.1701260] 	
[07:37:36.1701380] 	Specify one of 'devices', 'devicetypes', 'runtimes', or 'pairs' to list only items of that type. If a type filter is specified you may also specify a search term. Search terms use a simple case-insensitive contains check against the item's description. You may use the search term 'available' to only list available items.
[07:37:36.1701510] 	
[07:37:36.5355880] error HE1045: Failed to execute 'simctl': 'simctl list --json --json-output /tmp/helix/working/9A17086D/t/tmpeVsaJa.tmp' returned the exit code 117.
[07:37:36.5359280] error HE1046: Additional output: xcrun simctl list --json --json-output /tmp/helix/working/9A17086D/t/tmpeVsaJa.tmp
[07:37:36.5359600] error HE1046: Additional output: simctl: unrecognized option `--json-output'
[07:37:36.5359740] error HE1046: Additional output: List available devices, device types, runtimes, or device pairs.
[07:37:36.5359870] error HE1046: Additional output: Usage: simctl list [-j | --json] [-e | --no-escape-slashes] [-v] [devices|devicetypes|runtimes|pairs] [<search term>|available]
[07:37:36.5359970] error HE1046: Additional output: -j     Print as JSON
[07:37:36.5360080] error HE1046: Additional output: -e     Encode slashes without escapes in JSON output
[07:37:36.5360170] error HE1046: Additional output: -v     More verbose output
[07:37:36.5360270] error HE1046: Additional output: 
[07:37:36.5360920] error HE1046: Additional output: Specify one of 'devices', 'devicetypes', 'runtimes', or 'pairs' to list only items of that type. If a type filter is specified you may also specify a search term. Search terms use a simple case-insensitive contains check against the item's description. You may use the search term 'available' to only list available items.
[07:37:36.5361120] error HE1046: Additional output: 
[07:37:36.5422850] Process mlaunch exited with 1
[07:37:36.5460630] mlaunch failed when listing simulators but trying to parse the results anyway
[07:37:36.5481590] Simulator listing finished (1 kB)
[07:37:36.5787080] Failed to find/create simulator (attempt 1/3):
Microsoft.DotNet.XHarness.Common.CLI.NoDeviceFoundException: Failed to find a suitable OS runtime version for tvos-simulator
   at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 403
   at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Int32 retryCount, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 517
[07:37:36.5791580] Failed to find/create simulator (attempt 2/3):
Microsoft.DotNet.XHarness.Common.CLI.NoDeviceFoundException: Failed to find a suitable OS runtime version for tvos-simulator
   at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 403
   at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Int32 retryCount, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 517
[07:37:36.5793900] Failed to find/create simulator (attempt 3/3):
Microsoft.DotNet.XHarness.Common.CLI.NoDeviceFoundException: Failed to find a suitable OS runtime version for tvos-simulator
   at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 403
   at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators(TestTargetOs target, ILog log, Int32 retryCount, Boolean createIfNeeded, Boolean minVersion, CancellationToken cancellationToken) in /_/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:line 517

Looks like a recent mlaunch PR "Use simctl much more to avoid Xcode's internal APIs".

@rolfbjarne
Copy link
Member

[07:37:35.7792340] Using Xcode 16.1 found in /Applications/Xcode_16.1.app
[07:37:35.8480690] xcrun simctl list --json --json-output /tmp/helix/working/9A17086D/t/tmpeVsaJa.tmp
[07:37:36.1700180] simctl: unrecognized option `--json-output'

This looks like the system has an older version of simctl installed, --json-output works fine for me.

simctl is updated whenever a new version of Xcode is launched for the first time (this can be triggered from the command line by executing "xcodebuild -runFirstLaunch" as well).

Can you get the output of simctl --version on this system?

@kotlarmilos
Copy link
Member Author

[10:03:49.2241720] 
[10:03:49.2243670] Running /bin/bash -c "xcrun simctl --version"
[10:04:07.2420200] @(#)PROGRAM:simctl  PROJECT:CoreSimulator-987.2
[10:04:07.2439250] Process bash exited with 0
[10:04:07.2943720] 

@rolfbjarne
Copy link
Member

[10:03:49.2241720] 
[10:03:49.2243670] Running /bin/bash -c "xcrun simctl --version"
[10:04:07.2420200] @(#)PROGRAM:simctl  PROJECT:CoreSimulator-987.2
[10:04:07.2439250] Process bash exited with 0
[10:04:07.2943720] 

I have this on my Xcode 16.4 system:

@(#)PROGRAM:simctl PROJECT:CoreSimulator-1010.15

and this on my Xcode 26 b1 system:

@(#)PROGRAM:simctl PROJECT:CoreSimulator-1031

so it looks like this is an older version of simctl/CoreSimulator.

I guess one way around this would be to have mlaunch check the simctl version.

In the meantime, you can pass --use-sim-ctl:false to mlaunch to have it use the old method.

@kotlarmilos
Copy link
Member Author

Thanks. Now it reports:

[08:25:09] dbug: Running /private/tmp/helix/working/ACC20998/p/microsoft.dotnet.xharness.cli/10.0.0-ci/tools/net8.0/any/../../../runtimes/any/native/mlaunch/bin/mlaunch --sdkroot /Applications/Xcode_16.1.app --device=:v2:udid=5FF66F34-895D-45AA-9D32-6711A7DE5293 --installsim /tmp/helix/working/ACC20998/w/AC9A0965/e/System.Numerics.Vectors.Tests.app --use-sim-ctl:false -v -v
[08:25:09] dbug: Using Xcode 16.1 found in /Applications/Xcode_16.1.app
[08:25:09] dbug: error HE1203: Could not get shared SimServiceContext:

@rolfbjarne
Copy link
Member

Thanks. Now it reports:

[08:25:09] dbug: Running /private/tmp/helix/working/ACC20998/p/microsoft.dotnet.xharness.cli/10.0.0-ci/tools/net8.0/any/../../../runtimes/any/native/mlaunch/bin/mlaunch --sdkroot /Applications/Xcode_16.1.app --device=:v2:udid=5FF66F34-895D-45AA-9D32-6711A7DE5293 --installsim /tmp/helix/working/ACC20998/w/AC9A0965/e/System.Numerics.Vectors.Tests.app --use-sim-ctl:false -v -v
[08:25:09] dbug: Using Xcode 16.1 found in /Applications/Xcode_16.1.app
[08:25:09] dbug: error HE1203: Could not get shared SimServiceContext:

That's strange, I can't reproduce this.

That said, I fixed our usage of simctl so you shouldn't have to pass --use-sim-ctl:false anymore, and it should just work: https://devdiv.visualstudio.com/DevDiv/_git/macios-mlaunch/pullrequest/644580

@kotlarmilos
Copy link
Member Author

kotlarmilos commented Jun 18, 2025

Thanks, I will wait for the new version and try again.

@ymebrugts
Copy link

Hi, I was encountering the same issue. Has this already been fixed upstream, or is this PR still pending to address it?

@kotlarmilos
Copy link
Member Author

@ymebrugts The mlaunch issue has been fixed, and this PR is verifying the new changes. Are you using mlaunch or xharness? Also, are you using iOS 18 devices?

@kotlarmilos
Copy link
Member Author

@rolfbjarne After you added the assembly attributes for company and copyright, the build started signing Xamarin.Hosting.dll with the third-party certificate. Before that change, it was using the failing Xamarin.Hosting.resources.dll, which was auto-generated and missing the copyright.

Other failures have been resolved — thank you.

@rolfbjarne
Copy link
Member

After you added the assembly attributes for company and copyright, the build started signing Xamarin.Hosting.dll with the third-party certificate.

Looks like that will have to be fixed here:

<FileSignInfo Include="Xamarin.Hosting.dll" CertificateName="3PartySHA2" />

@ymebrugts
Copy link

@ymebrugts The mlaunch issue has been fixed, and this PR is verifying the new changes. Are you using mlaunch or xharness? Also, are you using iOS 18 devices?

Xharness to launch and test plus using iOS 18 devices. "iPhone Xs (iOS 18.5) - created by XHarness"

@kotlarmilos kotlarmilos marked this pull request as ready for review July 9, 2025 14:55
@kotlarmilos kotlarmilos self-assigned this Jul 9, 2025
@kotlarmilos kotlarmilos added the apple iOS/tvOS/WatchOS/Mac Catalyst area label Jul 9, 2025
@kotlarmilos kotlarmilos merged commit faf00a1 into dotnet:main Jul 10, 2025
17 checks passed
@kotlarmilos kotlarmilos deleted the improvement/bump-mlaunch-version branch July 10, 2025 07:38
@kotlarmilos
Copy link
Member Author

@ymebrugts You can try the new version and if you still encounter errors please create a tracking issue with the error logs, so we can follow up.

@ymebrugts
Copy link

@ymebrugts You can try the new version and if you still encounter errors please create a tracking issue with the error logs, so we can follow up.

It's working again. Thanks!

kotlarmilos added a commit to kotlarmilos/xharness that referenced this pull request Mar 16, 2026
* Update mlaunch version

* Test simctl version

* Add --use-sim-ctl argument

* Add --use-sim-ctl argument

* Fix test

* Bump mlaunch version

* Update Microsoft.Tools.Mlaunch version to 1.1.71

* Fix comment

* Remove Xamarin.Hosting.dll from signing configuration
kotlarmilos added a commit to kotlarmilos/xharness that referenced this pull request Mar 16, 2026
* Update mlaunch version

* Test simctl version

* Add --use-sim-ctl argument

* Add --use-sim-ctl argument

* Fix test

* Bump mlaunch version

* Update Microsoft.Tools.Mlaunch version to 1.1.71

* Fix comment

* Remove Xamarin.Hosting.dll from signing configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apple iOS/tvOS/WatchOS/Mac Catalyst area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants