-
Notifications
You must be signed in to change notification settings - Fork 466
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
CA1416 MacCatalyst is a superset of iOS #5266
Conversation
...zers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.Value.cs
Show resolved
Hide resolved
if (value.AnalysisValues.Count != 0 && value.AnalysisValues.Count == parent.AnalysisValues.Count) | ||
{ | ||
var parentEnumerator = parent.AnalysisValues.GetEnumerator(); | ||
foreach (var val in value.AnalysisValues) | ||
{ | ||
if (parentEnumerator.MoveNext() && !parentEnumerator.Current.Equals(val.GetNegatedValue())) | ||
{ | ||
goto label; | ||
} | ||
} | ||
continue; | ||
} | ||
|
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.
This is for merging OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()
conditional which flow analysis value is (OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst()) && !OperatingSystem.IsMacCatalyst()
. Ideally it should be handled/merged by the flow analisys into just OperatingSystem.IsIOS()
CC @mavasani
Codecov Report
@@ Coverage Diff @@
## release/6.0.1xx #5266 +/- ##
===================================================
+ Coverage 95.59% 95.62% +0.02%
===================================================
Files 1233 1236 +3
Lines 283394 284484 +1090
Branches 16971 17068 +97
===================================================
+ Hits 270922 272025 +1103
+ Misses 10162 10155 -7
+ Partials 2310 2304 -6 |
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
...tAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
Outdated
Show resolved
Hide resolved
…into maccatalyst_updates
716d34e
to
7824cf6
Compare
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.
I see a lot of test cases that have comments indicating the message states the code is "reachable on all platforms" but the code is within some sort of a guard. I wasn't sure if those were accurate messages or copy/paste errors in the comments.
That is accurate, if the diagnostic is found inside a platform check method and the issue is caused by platform check then the message shows |
Seems @mavasani is out, if he gives a feedback later i will apply them with different PR, gonna merge |
Related to dotnet/runtime#53084
MacCatalyst is a superset of iOS
Acceptance Criteria
To consider the proposal of using
SupportedOSPlatformGuard
attributes on theOperatingSystem
methods to achieve a relationship of MacCatalyst as a superset of IOS, we will utilize the following acceptance criteria.OperatingSystem.IsIOS()
matches both IOS and MacCatalystOperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()
matches only IOS but not MacCatalystOperatingSystem.IsMacCatalyst()
matches only MacCatalyst but not IOS[SupportedOSPlatformGuard]
attributes is consistent with existing behavior[UnsupportedOSPlatform]
and[UnsupportedOSPlatformGuard]
attributes must continue to work as expected[UnsupportedOSPlatform]
attributes must respect the platform relationship definedProposal Summary
OperatingSystem.IsIOS
to returntrue
when the platform is "ios" OR "maccatalyst"[SupportedOSPlatformGuard]
attributes onSystem.OperatingSystem
OperatingSystem.IsIOS
with [SupportedOSPlatformGuard("maccatalyst")]
[SupportedOSPlatformGuard]
attributes on that platform'sIs{Platform}
methodIllustration of Acceptance Criteria