Skip to content
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

Add ObsoletedInOSPlatform attribute support in Platform Compat Analyzer #6082

Merged
merged 6 commits into from
Aug 3, 2022

Conversation

buyaa-n
Copy link
Member

@buyaa-n buyaa-n commented Jul 22, 2022

We have added ObsoletedInOSPlatform Attribute in 7.0 recently, now need to add the analyzer support for this in PlatformCompatibilityAnalyzer. By the approved API:

  • the warnings for obsoleted should have different diagnostic ID
  • optional Message and Url properties that should be appended to the existing message.
  • optional Message property is added to the UnsupportedOSPlatform attribute which also needs update in the analyzer
  1. Call sites having ObsoletedInOSPlatform or UnsupportedOSPlatform attributes with greater than or equal version could suppress obsoleted warnings
  2. Same as unsupported attribute diagnostic the obsoleted diagnostics could be guarded with negated OperatingSystem APIs (for example: if (!OperatingSystem.IsLinux())
  3. Also could be guarded with an API that annotated with UnsupportedOSPlatformGuard attribute having matching platform/version, same for negated SupportedOSPlatformGuard
  4. No warning if the obsoleted platform and version is not in the call site supported range. Same as UnsupportedOSPlatform no warning for cross platform build in case the platform is not included in MSBuild SupportedPlatforms list
  5. Warning message structure is same as the existing warnings, user message and/or Url will be appended at the end of each platform/version
  6. MacOS == OSX and iOS is MacCatalyst relations would work same as how it does for unsupported scenarios

Fixes #6081

@codecov
Copy link

codecov bot commented Jul 23, 2022

Codecov Report

Merging #6082 (fe9829d) into main (805420e) will increase coverage by 0.00%.
The diff coverage is 96.44%.

@@           Coverage Diff            @@
##             main    #6082    +/-   ##
========================================
  Coverage   96.04%   96.05%            
========================================
  Files        1338     1339     +1     
  Lines      308692   309416   +724     
  Branches     9824     9855    +31     
========================================
+ Hits       296497   297198   +701     
- Misses       9817     9833    +16     
- Partials     2378     2385     +7     

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

I left a few fit-and-finish and test recommendations, but the implementation looks good.

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

Looks good. I only saw a few test code comments that are out of date with the message format.

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
@buyaa-n buyaa-n enabled auto-merge (squash) August 3, 2022 20:41
@buyaa-n buyaa-n merged commit b83e9cb into dotnet:main Aug 3, 2022
@github-actions github-actions bot added this to the vNext milestone Aug 3, 2022
@buyaa-n buyaa-n deleted the obsolete-support branch August 3, 2022 22:51
@jmarolf jmarolf modified the milestones: vNext, .NET 7.x Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ObsoletedInOSPlatform Attribute support in Platform Compat Analyzer
4 participants