-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/Libraries/Microsoft.Extensions.TimeProvider.Testing/ExperimentalAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Diagnostics.CodeAnalysis; | ||
|
||
/// <summary> | ||
/// Indicates that an API element is experimental and subject to change without notice. | ||
/// </summary> | ||
[ExcludeFromCodeCoverage] | ||
[AttributeUsage( | ||
AttributeTargets.Class | | ||
AttributeTargets.Struct | | ||
AttributeTargets.Enum | | ||
AttributeTargets.Interface | | ||
AttributeTargets.Delegate | | ||
AttributeTargets.Method | | ||
AttributeTargets.Constructor | | ||
AttributeTargets.Property | | ||
AttributeTargets.Field | | ||
AttributeTargets.Event | | ||
AttributeTargets.Assembly)] | ||
internal sealed class ExperimentalAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class. | ||
/// </summary> | ||
public ExperimentalAttribute() | ||
{ | ||
// Intentionally left empty. | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class. | ||
/// </summary> | ||
/// <param name="message">Human readable explanation for marking experimental API.</param> | ||
public ExperimentalAttribute(string message) | ||
{ | ||
#pragma warning disable R9A014 // Use the 'Microsoft.Extensions.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance | ||
#pragma warning disable R9A039 // Remove superfluous null check when compiling in a nullable context | ||
#pragma warning disable R9A060 // Consider removing unnecessary null coalescing (??) since the left-hand value is statically known not to be null | ||
#pragma warning disable SA1101 // Prefix local calls with this | ||
Message = message ?? throw new ArgumentNullException(nameof(message)); | ||
#pragma warning restore SA1101 // Prefix local calls with this | ||
#pragma warning restore R9A060 // Consider removing unnecessary null coalescing (??) since the left-hand value is statically known not to be null | ||
#pragma warning restore R9A039 // Remove superfluous null check when compiling in a nullable context | ||
#pragma warning restore R9A014 // Use the 'Microsoft.Extensions.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance | ||
} | ||
|
||
/// <summary> | ||
/// Gets a human readable explanation for marking API as experimental. | ||
/// </summary> | ||
public string? Message { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters