Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 9, 2025

Summary

Fixes #1090 (and similar issues) where XHarness fails to create iOS 26 simulators with Xcode 16.4 because iPhone XS is not compatible with the latest iOS runtime.

Problem

When attempting to create iOS simulators for iOS 26.0 with Xcode 16.4, XHarness was requesting an iPhone XS device type which is no longer supported:

Running /Applications/Xcode_16.4.0.app/Contents/Developer/usr/bin/simctl create "iPhone Xs (iOS 26.0) - created by XHarness" com.apple.CoreSimulator.SimDeviceType.iPhone-XS com.apple.CoreSimulator.SimRuntime.iOS-26-0
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=403):
Incompatible device
Unable to create a device for device type: iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS)

Changes

Updated SimulatorSelector.cs to conditionally select the iOS device type based on Xcode version:

  • Xcode 16+: Uses iPhone-16 (fixes iOS 26 simulator creation)
  • Xcode 15 and earlier: Uses iPhone-XS (maintains backward compatibility)
  • No version info available: Defaults to iPhone-XS (safe fallback)

This applies to both iOS simulator device types and watchOS companion device types. The minimum version device type (iPhone-6s) remains unchanged for backward compatibility.

Implementation Details

  • Added constructor parameter to DefaultSimulatorSelector to accept IMlaunchProcessManager (optional)
  • Created GetDefaultiOSDevice() method that checks XcodeVersion.Major >= 16
  • Updated SimulatorLoader to pass process manager to selector for version detection

Testing

  • Added comprehensive unit tests for GetDeviceType and GetCompanionRuntimeAndDeviceType methods with Xcode version checks
  • Updated test data (simulators.xml) to include both iPhone-16 and iPhone-XS device types
  • All 294 iOS.Shared tests pass ✅
  • All 77 Apple tests pass ✅

cc @rolfbjarne @matouskozak @premun

Fixes #1470

Original prompt

This section details on the original issue you should resolve

<issue_title>XHarness can't create iOS18 simulators with Xcode26 on the machine</issue_title>
<issue_description>

Similar to. #1090 it seems that if a new Xcode26 on the machine when trying to create a simulator iOS-simulator-x64 it fails since we are requesting a iPhone-XS that is not supported on the latest iOS Runtime.

 [18:02:11.2377400] Running /Applications/Xcode_16.4.0.app/Contents/Developer/usr/bin/simctl create "iPhone Xs (iOS 26.0) - created by XHarness" com.apple.CoreSimulator.SimDeviceType.iPhone-XS com.apple.CoreSimulator.SimRuntime.iOS-26-0
[18:02:11.5741310] An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=403):
[18:02:11.5741900] Incompatible device
[18:02:11.5755120] Unable to create a device for device type: iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS), runtime: iOS 26.0 (26.0 - 23A5297i) - com.apple.CoreSimulator.SimRuntime.iOS-26-0

it's calling simctl from Xcode 16.4
It's trying to use iPhone Xs, which is not compatible with iOS 26</issue_description>

<agent_instructions>Please try bump to a device like "iPhone 16" </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@rmarinho cc @rolfbjarne @matouskozak @premun @matouskozak We probably should update https://github.com/dotnet/xharness/blob/cbaa911ef1bce4cf92a7e4f7ffa5171eddd1a8fd/src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorSelector.cs#L39 to something higher

Fixes #1470


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Fix XHarness issue creating iOS18 simulators with Xcode26 Update default iOS simulator device type from iPhone XS to iPhone 16 for iOS 26 compatibility Oct 9, 2025
@Copilot Copilot AI requested a review from rmarinho October 9, 2025 20:30
Copilot finished work on behalf of rmarinho October 9, 2025 20:30
@rmarinho rmarinho marked this pull request as ready for review October 9, 2025 20:39
@rmarinho
Copy link
Member

@copilot is it possible to just use the iPhone 16 if we are using Xcode 26 ?

Copy link
Contributor Author

Copilot AI commented Oct 10, 2025

@copilot is it possible to just use the iPhone 16 if we are using Xcode 26 ?

Yes! I've updated the implementation to conditionally use iPhone 16 only when Xcode 16+ is detected. The selector now checks XcodeVersion.Major >= 16 and uses iPhone-16 for Xcode 16+, while falling back to iPhone-XS for older Xcode versions. This maintains backward compatibility while fixing the iOS 26 simulator creation issue. (commit: coming in next message)

@Copilot Copilot AI changed the title Update default iOS simulator device type from iPhone XS to iPhone 16 for iOS 26 compatibility Use Xcode version-aware iOS simulator device type selection for iOS 26 compatibility Oct 10, 2025
Copilot finished work on behalf of rmarinho October 10, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XHarness can't create iOS18 simulators with Xcode26 on the machine XHarness can't create iOS17 simulators

2 participants