[msbuild] Fix simulator OS version comparison in GetAvailableDevices#25931
Closed
Happypig375 wants to merge 2 commits into
Closed
[msbuild] Fix simulator OS version comparison in GetAvailableDevices#25931Happypig375 wants to merge 2 commits into
Happypig375 wants to merge 2 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.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes simulator OS version filtering in the GetAvailableDevices MSBuild task so dotnet run --device evaluates simulator eligibility using the simulator runtime’s actual OS version (from simctl runtimes) rather than the device type’s minimum-supported OS version.
Changes:
- Use the
simctlruntime version (runtimeVersion) when computing a simulator device’sminimumOSVersion. - Align simulator-path max OS handling with the device-path sentinel (
65535.255.255).
Member
|
Continued in #25975. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GetAvailableDevices.RunSimCtlAsync()uses the device type'sMinRuntimeVersionString(e.g."26.0.0") as the device'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
This matches how
RunDeviceCtlAsync()already handles physical devices:Note:
MaxRuntimeVersionStringwas always"65535.255.255"for every device type, so hardcoding the sentinel has no behavioral change but makes the code consistent with the physical device path.