Click or drag to resize

Diagnostic Class



Represents a diagnostic, such as a compiler error or a warning, along with the location where it occurred.
A diagnostic (such as a compiler error or a warning), along with the location where it occurred.
Inheritance Hierarchy
SystemObject
  Microsoft.CodeAnalysisDiagnostic

Namespace:  Microsoft.CodeAnalysis
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public abstract class Diagnostic : IEquatable, 
	IFormattable

The Diagnostic type exposes the following members.

Constructors
  NameDescription
Protected methodDiagnostic
Initializes a new instance of the Diagnostic class
Top
Properties
  NameDescription
Public propertyAdditionalLocations
Gets an array of additional locations related to the diagnostic. Typically these are the locations of other items referenced in the message.
Public propertyDefaultSeverity
Gets the default DiagnosticSeverity of the diagnostic's DiagnosticDescriptor.
Public propertyDescriptor
Gets the diagnostic descriptor, which provides a description about a Diagnostic.
Public propertyId
Gets the diagnostic identifier. For diagnostics generated by the compiler, this will be a numeric code with a prefix such as "CS1001".
Public propertyIsSuppressed
Returns true if the diagnostic has a source suppression, i.e. an attribute or a pragma suppression.
Public propertyIsWarningAsError
Returns true if this is a warning treated as an error; otherwise false.
Public propertyLocation
Gets the primary location of the diagnostic, or None if no primary location.
Public propertyProperties
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.
Public propertySeverity
Gets the effective DiagnosticSeverity of the diagnostic.
Public propertyWarningLevel
Gets the warning level. This is 0 for diagnostics with severity Error, otherwise an integer between 1 and 4.
Top
Methods
  NameDescription
Public methodStatic memberCreate(DiagnosticDescriptor, Location, Object)
Creates a Diagnostic instance.
Public methodStatic memberCreate(DiagnosticDescriptor, Location, IEnumerableT, Void)
Public methodStatic memberCreate(DiagnosticDescriptor, Location, ImmutableDictionaryString, String, Object)
Creates a Diagnostic instance.
Public methodStatic memberCreate(DiagnosticDescriptor, Location, IEnumerableT, Void, Location)
Public methodStatic memberCreate(String, String, LocalizableString, DiagnosticSeverity, DiagnosticSeverity, Boolean, Int32, LocalizableString, LocalizableString, String, Location, IEnumerableT, Void, Location)
Public methodStatic memberCreate(String, String, LocalizableString, DiagnosticSeverity, DiagnosticSeverity, Boolean, Int32, Boolean, LocalizableString, LocalizableString, String, Location, IEnumerableT, Void, Location)
Public methodEquals(Object)
Public methodEquals(Diagnostic)
Public methodGetHashCode
Public methodGetMessage
Get the culture specific text of the message.
Public methodGetSuppressionInfo
Gets the SuppressionInfo for suppressed diagnostics, i.e. IsSuppressed = true. Otherwise, returns null.
Public methodToString
Top
See Also