Skip to content

Commit bf797bd

Browse files
committed
add RequiresPreviewFeaturesAttribute
1 parent 324aa04 commit bf797bd

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,13 @@ struct UnscopedRefUsage
342342
<!-- endSnippet -->
343343

344344

345+
### RequiresPreviewFeaturesAttribute
346+
347+
* [RequiresPreviewFeatures](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.versioning.requirespreviewfeaturesattribute)
348+
* [Design](https://github.com/dotnet/designs/blob/main/accepted/2021/preview-features/preview-features.md)
349+
* [API Proposal](https://github.com/dapr/dotnet-sdk/issues/1219)
350+
351+
345352
### CallerArgumentExpressionAttribute
346353

347354
* [CallerArgumentExpressionAttribute](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callerargumentexpressionattribute)

src/Consume/Consume.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,4 +525,9 @@ public void Method(string x)
525525
public void Method(object x)
526526
{
527527
}
528+
529+
[RequiresPreviewFeatures("This method uses a preview feature.")]
530+
public void UsePreviewFeature()
531+
{
532+
}
528533
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// <auto-generated />
2+
#pragma warning disable
3+
4+
#nullable enable
5+
6+
#if !NET8_0_OR_GREATER
7+
8+
namespace System.Runtime.Versioning;
9+
10+
using System.Diagnostics;
11+
using System.Diagnostics.CodeAnalysis;
12+
using Link = System.ComponentModel.DescriptionAttribute;
13+
14+
[AttributeUsage(AttributeTargets.Assembly |
15+
AttributeTargets.Module |
16+
AttributeTargets.Class |
17+
AttributeTargets.Interface |
18+
AttributeTargets.Delegate |
19+
AttributeTargets.Struct |
20+
AttributeTargets.Enum |
21+
AttributeTargets.Constructor |
22+
AttributeTargets.Method |
23+
AttributeTargets.Property |
24+
AttributeTargets.Field |
25+
AttributeTargets.Event,
26+
Inherited = false)]
27+
[ExcludeFromCodeCoverage]
28+
[DebuggerNonUserCode]
29+
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.versioning.requirespreviewfeaturesattribute")]
30+
#if PolyPublic
31+
public
32+
#endif
33+
sealed class RequiresPreviewFeaturesAttribute :
34+
Attribute
35+
{
36+
/// <summary>
37+
/// Initializes a new instance of the <see cref="RequiresPreviewFeaturesAttribute"/> class.
38+
/// </summary>
39+
public RequiresPreviewFeaturesAttribute()
40+
{
41+
}
42+
43+
/// <summary>
44+
/// Initializes a new instance of the <see cref="RequiresPreviewFeaturesAttribute"/> class with the specified message.
45+
/// </summary>
46+
/// <param name="message">An optional message associated with this attribute instance.</param>
47+
public RequiresPreviewFeaturesAttribute(string? message) =>
48+
Message = message;
49+
50+
/// <summary>
51+
/// Returns the optional message associated with this attribute instance.
52+
/// </summary>
53+
public string? Message { get; }
54+
55+
/// <summary>
56+
/// Returns the optional URL associated with this attribute instance.
57+
/// </summary>
58+
public string? Url { get; set; }
59+
}
60+
61+
#endif

0 commit comments

Comments
 (0)