Diagnostic Class

Definition

Represents a diagnostic, such as a compiler error or a warning, along with the location where it occurred.

C#
[System.Diagnostics.DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
public abstract class Diagnostic : IEquatable<Microsoft.CodeAnalysis.Diagnostic>, IFormattable
Inheritance
Diagnostic
Attributes
Implements

Constructors

Properties

AdditionalLocations

Gets an array of additional locations related to the diagnostic. Typically these are the locations of other items referenced in the message.

DefaultSeverity

Gets the default DiagnosticSeverity of the diagnostic's DiagnosticDescriptor.

Descriptor

Gets the diagnostic descriptor, which provides a description about a Diagnostic.

Id

Gets the diagnostic identifier. For diagnostics generated by the compiler, this will be a numeric code with a prefix such as "CS1001".

IsSuppressed

Returns true if the diagnostic has a source suppression, i.e. an attribute or a pragma suppression.

IsWarningAsError

Returns true if this is a warning treated as an error; otherwise false.

Location

Gets the primary location of the diagnostic, or None if no primary location.

Properties

Gets property bag for the diagnostic. it will return Empty if there is no entry. This can be used to put diagnostic specific information you want to pass around. for example, to corresponding fixer.

Severity

Gets the effective DiagnosticSeverity of the diagnostic.

WarningLevel

Gets the warning level. This is 0 for diagnostics with severity Error, otherwise an integer greater than zero.

Methods

Explicit Interface Implementations

Applies to

Toode Versioonid
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0