Repository navigation
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedarea-System.RuntimeblockingMarks issues that we want to fast track in order to unblock other important work
Milestone
Description
It would be nice if there was a way to provide a description with RequiresPreviewFeaturesAttribute, like you can with ObsoleteAttribute. The description would show up in analyzers/build warnings.
A description would provide more information about why a feature is in preview and what a user should keep in mind if they choose to use the feature.
For example, HTTP/3 in .NET 6 is preview. Kind of detail we want to pass on when someone sees this warning:
- What scenarios HTTP/3 does and doesn't support in .NET 6.
- How to mitigate an app if HTTP/3 is turned on and problems are found.
API Proposal
namespace System.Runtime.Versioning
{
public sealed class RequiresPreviewFeaturesAttribute : Attribute
{
// Existing
// public RequiresPreviewFeaturesAttribute();
public RequiresPreviewFeaturesAttribute(string message);
public string Message { get; }
public string Url { get; set; }
}
}Note: The URL property allows us to surface the URL directly via the Roslyn diagnostic, so that people can click the diagnostic ID in the error list, rather than copy & pasting the URL.
API Usage
namespace Microsoft.AspNetCore.Server.Kestrel.Core
{
[Flags]
public enum HttpProtocols
{
Http1 = 0x1,
Http2 = 0x2,
Http1AndHttp2 = Http1 | Http2,
+ [RequiresPreviewFeatures("Kestrel HTTP3 support for .NET 6 is in preview", Url = "https://aka.ms/kestrel-http3")]
Http3 = 0x4,
+ [RequiresPreviewFeatures("Kestrel HTTP3 support for .NET 6 is in preview", Url = "https://aka.ms/kestrel-http3")]
Http1AndHttp2AndHttp3 = Http1 | Http2 | Http3
}
}Reacted by Sergio Pedri, Michael Hawker, AraHaan, Jeff Handley and Jody Donetti
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedarea-System.RuntimeblockingMarks issues that we want to fast track in order to unblock other important work
Activity
stephentoub commentedon Jul 29, 2021
cc: @jeffhandley, @terrajobst, @pgovind, @tannergooding
terrajobst commentedon Jul 29, 2021
@JamesNK I've added the API proposal and sample information and marked the issue as ready for review. We'll take a look next Tuesday, I'll send you an invite on Monday.
JamesNK commentedon Jul 30, 2021
Ok. I might not make it because of time zones, but I think the issue is pretty self explanatory.
terrajobst commentedon Aug 3, 2021
Video
ObsoleteAttributeUrlFormatbut justUrl