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

[generator] Add support for [ObsoletedOSPlatform]. #1026

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Aug 15, 2022

Context: dotnet/android#7234

Add support for a new lang-features=obsoleted-platform-attributes generator option.

When used, for API that was obsoleted in API levels greater than our .NET 7 minimum (API 21), we will generate .NET 7's new [ObsoletedOSPlatform] attribute instead of [Obsolete]:

// New
[global::System.Runtime.Versioning.ObsoletedOSPlatform ("android22.0", @"This class is obsoleted in this android platform")]
public partial class CookieSpecParamBean : Org.Apache.Http.Params.HttpAbstractParamBean { ... }

// Previous
[global::System.Obsolete (@"This class is obsoleted in this android platform")]
public partial class CookieSpecParamBean : Org.Apache.Http.Params.HttpAbstractParamBean { ... }

This is useful for a .NET 7+ context because we always compile against a "latest" Mono.Android, even if you are targeting an earlier version. For example, this causes the above class to throw an obsolete warning even if you are using $(SupportedOSPlatformVersion)=21.

Companion XA test PR: dotnet/android#7266

@jpobst jpobst marked this pull request as ready for review August 23, 2022 19:00
@jonpryor jonpryor merged commit d3ea180 into main Aug 23, 2022
@jonpryor jonpryor deleted the obsoleted-os-platform branch August 23, 2022 19:12
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants