-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IsOSVersionAtLeast
when build or revision are not provided
#108748
Fix IsOSVersionAtLeast
when build or revision are not provided
#108748
Conversation
src/libraries/System.Private.CoreLib/src/System/Environment.OSVersion.MacCatalyst.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Environment.OSVersion.MacCatalyst.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
It's not a regression so not sure if it is eligible for backport.
…Version.MacCatalyst.cs Co-authored-by: Adeel Mujahid <[email protected]>
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/Environment.OSVersion.MacCatalyst.cs
Outdated
Show resolved
Hide resolved
GetOSVersion
on MacCatalyst when build or revision are not providedIsOSVersionAtLeast
when build or revision are not provided
IsOSVersionAtLeast
when build or revision are not providedIsOSVersionAtLeast
when minor/build/revision are not provided
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs
Outdated
Show resolved
Hide resolved
IsOSVersionAtLeast
when minor/build/revision are not providedIsOSVersionAtLeast
when build or revision are not provided
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs
Outdated
Show resolved
Hide resolved
…m.cs Co-authored-by: Jan Kotas <[email protected]>
…m.cs Co-authored-by: Jan Kotas <[email protected]>
I still think that's a change that we should make, but I don't feel too strongly about it. The rationale is that it would align the behavior between iOS and Mac Catalyst. The apps are often built from the same source tree just with different TFM, so I would expect the APIs to behave as close as possible. Internally, LLVM version checks are also normalizing the values but I cannot think of any way that would be user exposed. |
@jkotas What is the cost of filling a breaking change notice? Not related to this PR, but something that seems a bit inconsistent. When using the full constructor overload, it requires the build and revision components to be >= 0, otherwise they are unspecified. This causes an issue on MacCatalyst with the following code: Version current = Environment.OSVersion.Version;
Version newVersion = new Version(current.Major, current.Minor, current.Build, current.Revision); // This will throw ArgumentOutOfRange exception |
src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs
Outdated
Show resolved
Hide resolved
I think user should check the values in this case, or they can use |
…m.cs Co-authored-by: Adeel Mujahid <[email protected]>
…m.cs Co-authored-by: Adeel Mujahid <[email protected]>
https://github.com/dotnet/runtime/blob/main/docs/project/breaking-change-process.md has the instructions |
Why is the behavior between iOS and Mac Catalyst different at the OS level? |
It’s really not different but the version values are retrieved in a different way. Both iOS and macOS use version numbers with 2 or 3 components and we were always normalizing that to 3 (by retrieving the version as Mac Catalyst is just macOS app like any other calling the same macOS libraries like a normal Mac app would and having the same structure. The principal difference is that the SDK exposes different parts of the API surface but at the end of the day it still calls the same libraries. There are some quirk flags to make some APIs behave like iOS but that mostly appeared when Apple added support for running unmodified iOS apps on ARM macOS. When it comes to Mac Catalyst versioning there is a mapping between a macOS version and the supported iOS API surface version. Retrieving |
src/libraries/System.Private.CoreLib/src/System/Environment.OSVersion.MacCatalyst.cs
Show resolved
Hide resolved
/ba-g browser-wasm timeouts |
/backport to release/9.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/11496583371 |
@kotlarmilos an error occurred while backporting to release/9.0-staging, please check the run log for details! Error: The specified backport target branch release/9.0-staging wasn't found in the repo. |
The |
/backport to release/9.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/11571315974 |
Description
This PR fixes #108694 by updating
IsOSVersionAtLeast
to treat unspecified build or revision components as zero.Breaking change notice: dotnet/docs#43156