File tree 3 files changed +55
-0
lines changed
System.Private.CoreLib/src/System/Runtime/Versioning
tests/System/Runtime/Versioning
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,28 @@ namespace System.Runtime.Versioning
17
17
AttributeTargets . Event , Inherited = false ) ]
18
18
public sealed class RequiresPreviewFeaturesAttribute : Attribute
19
19
{
20
+ /// <summary>
21
+ /// Initializes a new instance of the <seealso cref="RequiresPreviewFeaturesAttribute"/> class.
22
+ /// </summary>
20
23
public RequiresPreviewFeaturesAttribute ( ) { }
24
+
25
+ /// <summary>
26
+ /// Initializes a new instance of the <seealso cref="RequiresPreviewFeaturesAttribute"/> class with the specified message.
27
+ /// </summary>
28
+ /// <param name="message">An optional message associated with this attribute instance.</param>
29
+ public RequiresPreviewFeaturesAttribute ( string ? message )
30
+ {
31
+ Message = message ;
32
+ }
33
+
34
+ /// <summary>
35
+ /// Returns the optional message associated with this attribute instance.
36
+ /// </summary>
37
+ public string ? Message { get ; }
38
+
39
+ /// <summary>
40
+ /// Returns the optional URL associated with this attribute instance.
41
+ /// </summary>
42
+ public string ? Url { get ; set ; }
21
43
}
22
44
}
Original file line number Diff line number Diff line change @@ -13612,6 +13612,9 @@ private protected OSPlatformAttribute(string platformName) { }
13612
13612
public sealed partial class RequiresPreviewFeaturesAttribute : System.Attribute
13613
13613
{
13614
13614
public RequiresPreviewFeaturesAttribute() { }
13615
+ public RequiresPreviewFeaturesAttribute(string? message) { }
13616
+ public string? Message { get { throw null; } }
13617
+ public string? Url { get { throw null; } set { } }
13615
13618
}
13616
13619
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
13617
13620
[System.Diagnostics.ConditionalAttribute("RESOURCE_ANNOTATION_WORK")]
Original file line number Diff line number Diff line change @@ -12,5 +12,35 @@ public void RequiresPreviewFeaturesAttributeTest()
12
12
{
13
13
new RequiresPreviewFeaturesAttribute ( ) ;
14
14
}
15
+
16
+ [ Fact ]
17
+ public static void Ctor_Default ( )
18
+ {
19
+ var attribute = new RequiresPreviewFeaturesAttribute ( ) ;
20
+ Assert . Null ( attribute . Message ) ;
21
+ Assert . Null ( attribute . Url ) ;
22
+ }
23
+
24
+ [ Theory ]
25
+ [ InlineData ( null ) ]
26
+ [ InlineData ( "" ) ]
27
+ [ InlineData ( "message" ) ]
28
+ public void Ctor_String_Message ( string message )
29
+ {
30
+ var attribute = new RequiresPreviewFeaturesAttribute ( message ) ;
31
+ Assert . Same ( message , attribute . Message ) ;
32
+ Assert . Null ( attribute . Url ) ;
33
+ }
34
+
35
+ [ Theory ]
36
+ [ InlineData ( null , "" ) ]
37
+ [ InlineData ( "" , null ) ]
38
+ [ InlineData ( "message" , "https://aka.ms/preview-features/" ) ]
39
+ public void Ctor_String_Url ( string message , string url )
40
+ {
41
+ var attribute = new RequiresPreviewFeaturesAttribute ( message ) { Url = url } ;
42
+ Assert . Same ( message , attribute . Message ) ;
43
+ Assert . Same ( url , attribute . Url ) ;
44
+ }
15
45
}
16
46
}
You can’t perform that action at this time.
0 commit comments