Struct RDCoreDiagnosticCode
- Namespace
- RDCore.SDK.Extensibility.Diagnostics
- Assembly
- RDCore.SDK.dll
The code a diagnostic is reported under: a prefix of three letters that says who issues it, and a number of five digits, as in XYZ00042
(RD-VBAL §1.1.4).
[JsonConverter(typeof(RDCoreDiagnosticCodeJsonConverter))]
public readonly record struct RDCoreDiagnosticCode : IEquatable<RDCoreDiagnosticCode>
- Implements
- Inherited Members
Remarks
The platform issues the VBC, VBR and VBA codes, and its core extension the RDC codes. The RDX codes are those of the
platform's first-party extensions, the core extension included. An extension of another publisher reports its own diagnostics under the prefix its manifest
declares (DiagnosticPrefix), which no other extension of the platform declares.
A code is serialized as it is written (ToString()), and read back with TryParse(string?, out RDCoreDiagnosticCode).
Constructors
RDCoreDiagnosticCode(string, int)
Creates the code of a prefix and a number.
public RDCoreDiagnosticCode(string prefix, int number)
Parameters
Exceptions
- ArgumentException
prefixis not three lettersAtoZ.- ArgumentOutOfRangeException
numberis not from 0 to MaxNumber.
Fields
ApplicationPrefix
The prefix of the codes of the errors a program raises itself.
public const string ApplicationPrefix = "VBA"
Field Value
CompilePrefix
The prefix of the codes of the platform's syntax and compile errors.
public const string CompilePrefix = "VBC"
Field Value
CorePrefix
The prefix of the codes of the core diagnostics, which the core extension reports.
public const string CorePrefix = "RDC"
Field Value
ExtensionPrefix
The prefix of the codes of the diagnostics of the platform's other first-party extensions.
public const string ExtensionPrefix = "RDX"
Field Value
MaxNumber
The largest number a code has: five digits.
public const int MaxNumber = 99999
Field Value
RuntimePrefix
The prefix of the codes of the run-time errors of the language.
public const string RuntimePrefix = "VBR"
Field Value
Properties
CanBeDisabled
Whether the diagnostics of the code can be disabled (Analysis.DisabledDiagnostics): those of the analyzers of the platform and of its extensions
can. The language's own errors (CompilePrefix, RuntimePrefix, ApplicationPrefix) cannot: code that has one does
not compile, or stops when it runs, whatever the settings say.
public bool CanBeDisabled { get; }
Property Value
FirstPartyPrefixes
The prefixes of the platform's own codes: the language's errors, and its first-party extensions' diagnostics.
public static IReadOnlyList<string> FirstPartyPrefixes { get; }
Property Value
IsFirstParty
Whether the code is one of the platform's own (FirstPartyPrefixes), which its documentation describes.
public bool IsFirstParty { get; }
Property Value
Number
The number of the diagnostic among those of Prefix.
public int Number { get; }
Property Value
Prefix
The three letters that say who issues the diagnostic.
public string Prefix { get; }
Property Value
Methods
IsFirstPartyPrefix(string)
Whether a prefix is one of the platform's own (FirstPartyPrefixes).
public static bool IsFirstPartyPrefix(string prefix)
Parameters
prefixstringThe prefix to check.
Returns
IsPrefix(string?)
Whether a text is a prefix of a diagnostic code: three letters A to Z.
public static bool IsPrefix(string? prefix)
Parameters
prefixstringThe text to check.
Returns
ToString()
The code as it is written: its prefix, and its number in five digits.
public override string ToString()
Returns
TryParse(string?, out RDCoreDiagnosticCode)
Reads a code written as its prefix and its five digits, as in XYZ00042.
public static bool TryParse(string? text, out RDCoreDiagnosticCode code)
Parameters
textstringThe text to read.
codeRDCoreDiagnosticCodeThe code read; default when
textis not one.
Returns
- bool
Whether
textis a code.