Choosing diagnostic IDs - C# (original) (raw)

A diagnostic ID is the string associated with a given diagnostic, such as a compiler error or a diagnostic that is produced by an analyzer.

The IDs are surfaced from various APIs, such as:

Diagnostic IDs are also used as identifiers in source, for example, from#pragma warning disable or .editorconfig files.

Considerations

Note

It's a source breaking change to change diagnostic IDs, as existing suppressions would be ignored if the ID changed.

Don't limit your prefix to two-characters (such as CSXXXand CAXXXX). Instead, use a longer prefix to avoid conflicts. For example, the System.*diagnostics use SYSLIB as their prefix.