Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions proposals/csharp-12.0/experimental-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,32 @@ namespace System.Diagnostics.CodeAnalysis
}
```

## Warnings
The warning message is a specific message, where `'{0}'` is the fully-qualified type or member name.
```
'{0}' is for evaluation purposes only and is subject to change or removal in future updates.
```
## Reported diagnostic

The warning is reported for any reference to a type or member that is either:
Although the diagnostic is technically a warning (so that the compiler allows suppressing it),
it is treated as an error for purpose of reporting. This causes the build to fail if the diagnostic
is not suppressed.

The diagnostic is reported for any reference to a type or member that is either:
- marked with the attribute,
- in an assembly or module marked with the attribute,

except when the reference occurs within `[Experimental]` members (automatic suppression).

It is also possible to suppress the warning by usual means, such as an explicit compiler option or `#pragma`.
It is also possible to suppress the diagnostic by usual means, such as an explicit compiler option or `#pragma`.
For example, if the API is marked with `[Experimental("DiagID")]` or `[Experimental("DiagID", UrlFormat = "https://example.org/{0}")]`,
the diagnostic can be suppressed with `#pragma warning disable DiagID`.

The diagnostic ID given to the experimental attribute must be a [valid C# identifier](https://github.com/dotnet/csharpstandard/blob/standard-v7/standard/lexical-structure.md#643-identifiers).
This means the diagnostic ID should be valid as a variable name in C#.

The attribute is not inherited from base types or overridden members.

The warning is promoted to an error for purpose of reporting.
The diagnostic message is a specific message, where `'{0}'` is the fully-qualified type or member name.
```
'{0}' is for evaluation purposes only and is subject to change or removal in future updates.
```

The attribute is not inherited from base types or overridden members.

## ObsoleteAttribute and DeprecatedAttribute

Expand Down