[msbuild] Fix simulator OS version comparison in GetAvailableDevices#25975
[msbuild] Fix simulator OS version comparison in GetAvailableDevices#25975rolfbjarne wants to merge 3 commits into
Conversation
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>
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🔥 [CI Build #83fc196] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 1 tests failed, 194 tests passed. Failures❌ msbuild tests1 tests failed, 1 tests passed.Failed tests
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 macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
GetAvailableDevices.RunSimCtlAsync()used the device type'sMinRuntimeVersionString(e.g."26.0.0") as the simulator's OS version when filtering against the app'sMinimumOSVersion. This is wrong — it should use the actual runtime version fromsimctl(e.g."26.5").The device type's
minRuntimeVersionStringrepresents 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 hasminRuntimeVersionString: "26.0.0", but when created with the iOS 26.5 simulator runtime, its actual OS version is 26.5.This causes
dotnet run --deviceto reject every simulator device when the SDK version exceeds all device typeminRuntimeVersionStringvalues — for example in Xcode 26.5 (iOS 26.5 SDK) where every device type hasminRuntimeVersionString <= 26.3.The fix
Use the actual
simctlruntime version, matching howRunDeviceCtlAsync()already handles physical devices:Removing
maximumOSVersionmaximumOSVersionwas always set to the sentinel maximum value (65535.255.255) in both the simulator and physical-device code paths —simctlitself reportsmaxRuntimeVersionStringas65535.255.255for every device type. As a result the max-version comparison in the filtering logic could never discard a device. This PR removes the now-redundantDeviceInfo.MaximumOSVersionproperty, 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