Skip to content

Add SupportedOSPlatformGuard, UnsupportedOSPlatformGuard attributes#52028

Merged
buyaa-n merged 2 commits intodotnet:mainfrom
buyaa-n:platform_guard_attributes
May 3, 2021
Merged

Add SupportedOSPlatformGuard, UnsupportedOSPlatformGuard attributes#52028
buyaa-n merged 2 commits intodotnet:mainfrom
buyaa-n:platform_guard_attributes

Conversation

@buyaa-n
Copy link
Contributor

@buyaa-n buyaa-n commented Apr 29, 2021

Fixes #51541
Add SupportedOSPlatformGuard and UnsupportedOSPlatformGuard attributes which can be applied to boolean Field, Property or Method and used as a custom guard for platform check functionality in flow analysis of Platform Compatibility Analyzer (CA1416) using.

See more from #51541

@ghost
Copy link

ghost commented Apr 29, 2021

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
public sealed class SupportedOSPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems because of the renaming from MinimumOSPlatformAttribute => SupportedOSPlatformAttribute broke the alphabetical order, moved the API down, Same for RemovedOSPlatformAttribute => UnsupportedOSPlatformAttribute

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.

Just saw 1 typo; otherwise looks good to me.

…ning/PlatformAttributes.cs

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
@buyaa-n
Copy link
Contributor Author

buyaa-n commented May 3, 2021

The failures are unrelated and there is issues for tracking: #49105, #52031, merging

@buyaa-n buyaa-n merged commit e6bb456 into dotnet:main May 3, 2021
@buyaa-n buyaa-n deleted the platform_guard_attributes branch May 3, 2021 05:55
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SupportedOSPlatformGuard and UnsupportedOSPlatformGuard Platform-Guard attributes

4 participants