-
Notifications
You must be signed in to change notification settings - Fork 342
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
[Proposal] [.NET 8] Use ExperimentalAttribute
instead of ObsoleteAttribute
to indicate alpha APIs.
#1219
Comments
@philliphoff - Would this be a breaking change if we switched them all over? Or is there a way to avoid that? Or, is this proposal just to use it for new features and the old features will be |
@halspang Yes, it would be breaking in that it's a different compiler/analyzer error to disable. That said, I just discovered that .NET 8 includes a new ExperimentalAttribute which seems even closer to what we want. ( |
RequiresPreviewFeaturesAttribute
instead of ObsoleteAttribute
to indicate alpha APIs.ExperimentalAttribute
instead of ObsoleteAttribute
to indicate alpha APIs.
@philliphoff Couldn't the analyzer just suggest using Also, regardless of whether it supports the atribute being defined manually (which it should IMO, there's no reason not to - it's simple to just check whether a type named |
Oh, this isn't about an analyzer, my bad. |
Describe the proposal
Currently alpha APIs are decorated with the
ObsoleteAttribute
which causes the compiler to generate a warning/error when used. While the generated message is not entirely accurate, it does ensure users see and understand the risks of using a potentially unstable API..NET 6 introduced a new attribute, RequiresPreviewFeaturesAttribute, which serves a purpose similar to our use of
ObsoleteAttribute
. This generates a similar message (but from the Rosyln analyzer rather than the compiler itself), and requires a slightly different method to disable (via MSBuild property). The main disadvantage is disabling applies to all uses of such decorated APIs, rather than individual uses.Still,
RequiresPreviewFeaturesAttribute
feels like a more appropriate way to indicate alpha APIs.The text was updated successfully, but these errors were encountered: