Class NcDiagnostic
A structured diagnostic from the SoftNcRunner pipeline, designed for IProgress<T> consumption. Implements IMessage so it shares the common message channel with SimpleMessage, step diagnostics, and progress fractions, while additionally carrying an NC-source SentenceCarrier anchor that non-NC messages do not have.
Also an ISentenceCarrier itself — GetSentence() and SentenceIndex delegate to SentenceCarrier so a diagnostic can be used directly anywhere a carrier is expected, without the consumer unwrapping the inner anchor.
Id is composed as {Primary}-{Secondary}--{Abbrev}
(e.g., Cycle-Peck--BadPeckQ, Syntax-Build--Exception).
For irregular cases that don't fit the pattern, use a custom string.
public class NcDiagnostic : IMessage, ISentenceCarrier, IGetSentence, ISentenceIndexed
- Inheritance
-
NcDiagnostic
- Implements
- Inherited Members
- Extension Methods
Constructors
NcDiagnostic(Severity, Category, string, string, object, ISentenceCarrier)
Creates a fully-populated NcDiagnostic.
public NcDiagnostic(Severity severity, Category category, string id, string notification, object detail = null, ISentenceCarrier sentenceCarrier = null)
Parameters
severitySeverityImportance level — see Severity.
categoryCategoryDiagnostic category — see Category.
idstringStructured diagnostic ID (see Id).
notificationstringEnd-user friendly notification text.
detailobjectOptional detail data or exception. Null if not applicable.
sentenceCarrierISentenceCarrierCarrier for the NC source block that triggered this diagnostic; null for pipeline-level messages.
Properties
Category
Diagnostic category.
public Category Category { get; }
Property Value
Detail
Optional detail data or exception. Null if not applicable.
public object Detail { get; }
Property Value
Id
Structured diagnostic ID for filtering and suppression.
Normally {Primary}-{Secondary}–{Abbrev}.
public string Id { get; }
Property Value
Notification
End-user friendly notification text.
public string Notification { get; }
Property Value
SentenceCarrier
Carrier of the NC source block that triggered this diagnostic, exposing both the source Sentence (via GetSentence()) and the execution-order SentenceIndex. Null for pipeline-level messages (e.g., lifecycle start/done) that have no source block.
public ISentenceCarrier SentenceCarrier { get; }
Property Value
SentenceIndex
Execution-order ordinal of the anchored NC source block, delegated from
SentenceCarrier. Returns -1 (the “not in pipeline”
sentinel) for pipeline-level messages whose SentenceCarrier
is null.
public int SentenceIndex { get; }
Property Value
Severity
Importance level.
public Severity Severity { get; }
Property Value
Methods
GetCategory()
Gets the classification — see Category.
public Category GetCategory()
Returns
- Category
The category of this message.
GetDetail()
Gets the optional detail payload or exception; null when not applicable.
public object GetDetail()
Returns
- object
The detail object, or null.
GetId()
Gets the structured id used for filtering / suppression; may be null.
public string GetId()
Returns
- string
The message id, or null when not applicable.
GetNotification()
Gets the end-user friendly notification text.
public string GetNotification()
Returns
- string
The notification text.
GetSentence()
Returns the anchored NC source Sentence, delegated from SentenceCarrier; null when there is no source block (pipeline-level messages).
public Sentence GetSentence()
Returns
GetSeverity()
Gets the importance level — see Severity.
public Severity GetSeverity()
Returns
- Severity
The severity of this message.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.