Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/area-system-runtime |
Added a HashSet for all Apple platform names and updated tests to verify Apple platform detection.
Add Ref and tests for public IsApplePlatform API
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
IsApplePlatforms publicly in OperatingSystemIsApplePlatform publicly in OperatingSystem
|
I assume we are going to need a corresponding pull request from someone for the compatibility analyzer? I don't know if the analyzer will handle this without changes. https://github.com/dotnet/dotnet/blob/4fd6fbb479abbacd43b32fdc0ef6f68414cc028d/src/sdk/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs |
…Pal.Unix.cs Co-authored-by: Jan Kotas <jkotas@microsoft.com>
|
|
I think it was a fine change - for consistency. We do not currently build and test for watch OS, but the code for it still there. |
It looks odd when one place in the same file assumes that watchOS does not exist, but other place treats it as a thing. |
Yeah, exactly. That’s why I initially added watchOS. However, after thinking about @vcsjones 's comment on the compatibility analyzer, I decided to remove Let's assume the platform compatibility analyzer supports I wanted to avoid this situation. After all, new APIs won't explicitly include |
Sure, I'll follow up on this, thanks! |
I do not think that this has any impact on platform compatibility analyzer user experience. The platform compatibility analyzer only checks compatibly for platforms specified via |
@jkotas Thanks for the clear explanation! I hadn’t realized that the analyzer’s platform checks are scoped by Given that, how would you prefer to handle watchOS in |
Closes #113262.
As discussed in #113262 and the video, we're good to make this helper exposed publicly in
OperatingSystem.cc @bartonjs
This pull request refactors platform detection logic across the codebase to use the new
OperatingSystem.IsApplePlatform()API, replacing multiple checks for individual Apple platforms (macOS, iOS, tvOS, MacCatalyst). It also makesIsApplePlatform()a public API, updates related tests, and ensures consistent platform checks throughout the libraries.Platform detection improvements:
OperatingSystem.IsApplePlatform()in various files, simplifying and centralizing Apple platform detection. [1] [2] [3] [4] [5] [6] [7]API changes:
OperatingSystem.IsApplePlatform()a public API, added documentation, and updated the reference assembly to include the new method. [1] [2]Test updates:
OperatingSystemTeststo validate the newIsApplePlatform()logic, including a new set of supported Apple platform names and corresponding assertions. [1] [2]