Table of Contents

Class NcDiagnostic

Namespace
Hi.NcParsers
Assembly
HiMech.dll

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

severity Severity

Importance level — see Severity.

category Category

Diagnostic category — see Category.

id string

Structured diagnostic ID (see Id).

notification string

End-user friendly notification text.

detail object

Optional detail data or exception. Null if not applicable.

sentenceCarrier ISentenceCarrier

Carrier for the NC source block that triggered this diagnostic; null for pipeline-level messages.

Properties

Category

Diagnostic category.

public Category Category { get; }

Property Value

Category

Detail

Optional detail data or exception. Null if not applicable.

public object Detail { get; }

Property Value

object

Id

Structured diagnostic ID for filtering and suppression. Normally {Primary}-{Secondary}–{Abbrev}.

public string Id { get; }

Property Value

string

Notification

End-user friendly notification text.

public string Notification { get; }

Property Value

string

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

ISentenceCarrier

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

int

Severity

Importance level.

public Severity Severity { get; }

Property Value

Severity

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

Sentence

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.