dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.28k stars 5.91k forks source link

[Breaking change]: `GetOSVersion` on MacCatalyst now normalizes the build component to `0` if undefined (`-1`) #43156

Open kotlarmilos opened 1 month ago

kotlarmilos commented 1 month ago

Description

This update ensures that MacCatalyst version components retrieved from the OS are always normalized to three components: major, minor, and build. The build component is set to 0 if undefined (-1), ensuring consistent behavior between iOS and MacCatalyst versions for version checks.

https://github.com/dotnet/runtime/issues/108694

Version

.NET 10 Preview 1

Previous behavior

The build component in Version was not previously normalized, which led to incorrect version checks on MacCatalyst when only two components (major and minor) were provided. This resulted in invalid version checks.

New behavior

The MacCatalyst build component is now normalized to 0, ensuring consistent version checks. The revision component is always set to -1, as it is not specified on MacCatalyst or iOS.

Type of breaking change

Reason for change

Prevent incorrect version checks and align MacCatalyst versioning with iOS, ensuring consistent version components.

Recommended action

Use versions of up to three components (major, minor, and build) on MacCatalyst.

Feature area

Core .NET libraries

Affected APIs

public static bool IsMacCatalystVersionAtLeast (int major, int minor = 0, int build = 0);
public static bool IsOSPlatformVersionAtLeast (string platform, int major, int minor = 0, int build = 0, int revision = 0);
public static string Environment.OSVersion.Version.ToString()
jeffhandley commented 1 month ago

@kotlarmilos -- To answer a question you asked in email, once the breaking change PR is merged into dotnet/runtime, you do not need to close this issue. The content from this issue will be turned into a breaking change document on the https://learn.microsoft.com/dotnet/core/compatibility/breaking-changes portion of the docs site. The docs team will close this issue once that's completed. We don't yet have a .NET 10 section in the docs.