Aracılığıyla paylaş


Diagnostic Class

Definition

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

public ref class Diagnostic abstract : IEquatable<Microsoft::CodeAnalysis::Diagnostic ^>, IFormattable
[System.Diagnostics.DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
public abstract class Diagnostic : IEquatable<Microsoft.CodeAnalysis.Diagnostic>, IFormattable
[<System.Diagnostics.DebuggerDisplay("{GetDebuggerDisplay(), nq}")>]
type Diagnostic = class
    interface IEquatable<Diagnostic>
    interface IFormattable
Public MustInherit Class Diagnostic
Implements IEquatable(Of Diagnostic), IFormattable
Inheritance
Diagnostic
Attributes
Implements

Constructors

Diagnostic()

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

Create(DiagnosticDescriptor, Location, DiagnosticSeverity, IEnumerable<Location>, ImmutableDictionary<String,String>, Object[])

Creates a Diagnostic instance.

Create(DiagnosticDescriptor, Location, IEnumerable<Location>, ImmutableDictionary<String,String>, Object[])

Creates a Diagnostic instance.

Create(DiagnosticDescriptor, Location, IEnumerable<Location>, Object[])

Creates a Diagnostic instance.

Create(DiagnosticDescriptor, Location, ImmutableDictionary<String,String>, Object[])

Creates a Diagnostic instance.

Create(DiagnosticDescriptor, Location, Object[])

Creates a Diagnostic instance.

Create(String, String, LocalizableString, DiagnosticSeverity, DiagnosticSeverity, Boolean, Int32, Boolean, LocalizableString, LocalizableString, String, Location, IEnumerable<Location>, IEnumerable<String>, ImmutableDictionary<String,String>)

Creates a Diagnostic instance which is localizable.

Create(String, String, LocalizableString, DiagnosticSeverity, DiagnosticSeverity, Boolean, Int32, LocalizableString, LocalizableString, String, Location, IEnumerable<Location>, IEnumerable<String>, ImmutableDictionary<String,String>)

Creates a Diagnostic instance which is localizable.

Equals(Diagnostic)
Equals(Object)
GetHashCode()
GetMessage(IFormatProvider)

Get the culture specific text of the message.

GetSuppressionInfo(Compilation)

Gets the SuppressionInfo for suppressed diagnostics, i.e. IsSuppressed = true. Otherwise, returns null.

ToString()

Explicit Interface Implementations

IFormattable.ToString(String, IFormatProvider)

Applies to