Skip to content

[msbuild] Fix simulator OS version comparison in GetAvailableDevices#25975

Draft
rolfbjarne wants to merge 3 commits into
mainfrom
dev/rolf/fix-simulator-os-version-comparison
Draft

[msbuild] Fix simulator OS version comparison in GetAvailableDevices#25975
rolfbjarne wants to merge 3 commits into
mainfrom
dev/rolf/fix-simulator-os-version-comparison

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Jul 8, 2026

Copy link
Copy Markdown
Member

GetAvailableDevices.RunSimCtlAsync() used the device type's MinRuntimeVersionString (e.g. "26.0.0") as the simulator's OS version when filtering against the app's MinimumOSVersion. This is wrong — it should use the actual runtime version from simctl (e.g. "26.5").

The device type's minRuntimeVersionString represents the minimum OS version the physical device hardware supports, not the actual OS version running on the simulator. For example, an iPhone 17 Pro device type has minRuntimeVersionString: "26.0.0", but when created with the iOS 26.5 simulator runtime, its actual OS version is 26.5.

This causes dotnet run --device to reject every simulator device when the SDK version exceeds all device type minRuntimeVersionString values — for example in Xcode 26.5 (iOS 26.5 SDK) where every device type has minRuntimeVersionString <= 26.3.

The fix

Use the actual simctl runtime version, matching how RunDeviceCtlAsync() already handles physical devices:

Version.TryParse (device.OSVersion, out var minimumOSVersion);

Removing maximumOSVersion

maximumOSVersion was always set to the sentinel maximum value (65535.255.255) in both the simulator and physical-device code paths — simctl itself reports maxRuntimeVersionString as 65535.255.255 for every device type. As a result the max-version comparison in the filtering logic could never discard a device. This PR removes the now-redundant DeviceInfo.MaximumOSVersion property, the constructor parameter, the local variables, and the dead filter loop.

Note

This is partially a re-creation of #25931 (from @Happypig375). We have to re-create it because #25931 is from a fork, and our CI can't build from forks.

🤖 Pull request created by Copilot

Happypig375 and others added 3 commits July 8, 2026 18:49
Use the actual simulator runtime version from simctl (e.g. '26.5') instead
of the device type's MinRuntimeVersionString (e.g. '26.0.0') when filtering
simulators against the app's MinimumOSVersion.

The device type's minRuntimeVersion is the minimum OS version the device
hardware supports, not the actual OS version running on the simulator.
For example, an iPhone 17 Pro device type has minRuntimeVersionString 26.0.0,
but when created with an iOS 26.5 runtime, its actual OS version is 26.5.

This matches how RunDeviceCtlAsync handles physical devices:
    Version.TryParse (device.OSVersion, out var minimumOSVersion);
    var maximumOSVersion = new Version (65535, 255, 255);

Fixes the bug where dotnet run --device would reject every simulator device
with 'Device OS version X is lower than the app's minimum OS version Y'
when the SDK version (Y) exceeds all device type minRuntimeVersionString values.
maximumOSVersion was always set to the maximum value (65535.255.255) in
both the simulator and physical-device code paths, so the max-version
comparison in the filtering logic could never discard a device. Remove
the redundant field, constructor parameter, local variables and filter
loop.

This resolves the TODO left in the previous commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 83fc19667e5989b9bd1abe0b793e226fae6fcd23 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #83fc196] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 1 tests failed, 194 tests passed.

Failures

❌ msbuild tests

1 tests failed, 1 tests passed.

Failed tests

  • MSBuild tasks tests: Failed (Execution failed with exit code 1)
    • Xamarin.MacDev.Tasks.GetAvailableDevicesTests.Ctl1: Multiple failures or warnings in test:
  1. Device 1 UDID mismatch.
    Assert.That(task.Devices [0].ItemSpec, Is.EqualTo ("000080...
    * Xamarin.MacDev.Tasks.GetAvailableDevicesTests.Ctl1_iPhone: Multiple failures or warnings in test:
  2. Device 1 UDID mismatch.
    Assert.That(task.Devices [0].ItemSpec, Is.EqualTo ("000080...
    * Xamarin.MacDev.Tasks.GetAvailableDevicesTests.Ctl1_OSVersion: Multiple failures or warnings in test:
  3. Devices count mismatch.
    Assert.That(task.Devices.Count, Is.EqualTo (3))
    Expected...

Html Report (VSDrops) Download

❌ xcframework tests

🔥 Failed catastrophically on VSTS: test results - xcframework (no summary found).

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 17 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 83fc19667e5989b9bd1abe0b793e226fae6fcd23 [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Community contribution ❤ copilot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants