The DiagnosticDescriptor
constructor takes an id
parameter that sets the Id
property.
A unique identifier for the diagnostic. For example, code analysis diagnostic ID "CA1001".
That's the documentation in its entirety. We're left to assume that "CA" stands for "code analysis", suggesting that we should follow some similar pattern when developing our own analyzers and source generators.
What mechanisms exist for ensuring the uniqueness of the ID? What would the consequences be if multiple third party tools used the same IDs? Are there any best practices for avoiding collisions, analogous to using a domain or company name as a namespace?