Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public static bool IsMac()
return Environment.OSVersion.Platform == PlatformID.MacOSX;
#elif NET8_0_OR_GREATER
string OSDescription = RuntimeInformation.OSDescription;
return OSDescription.Contains("Darwin", StringComparison.OrdinalIgnoreCase);

// .NET 10 and later changes the OS string in `OSDescription`
return OSDescription.Contains("Darwin", StringComparison.OrdinalIgnoreCase) ||
Copy link

@cheenamalhotra cheenamalhotra Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View this comment as well: https://github.com/dotnet/runtime/pull/113041/files#r1985415935

You should be using RuntimeInformation.IsOSPlatform(OSPlatform.OSX) or OperatingSystem.IsMacOS() for .NET 10 onwards - maybe easier to handle it with if-def conditionally.

OSDescription.Contains("macOS", StringComparison.OrdinalIgnoreCase);
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
#endif
Expand Down