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, FormattableString, object, ISentenceCarrier)

Creates a templated NcDiagnostic: the interpolated template and its values are kept on Format / Args and Notification becomes the culture-invariant English rendering. An interpolated string literal passed to the string constructor is NOT captured here — call sites opt in through the *Fmt methods on NcDiagnosticProgress.

public NcDiagnostic(Severity severity, Category category, string id, FormattableString 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 FormattableString

Interpolated notification template.

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.

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.

NcDiagnostic(Severity, Category, string, string, string, object[], object, ISentenceCarrier)

Creates an NcDiagnostic carrying an already-split template — used when re-wrapping another IMessage whose format / args must survive (e.g. AsMessageSink(ISentenceCarrier)) instead of re-interpolating.

public NcDiagnostic(Severity severity, Category category, string id, string notification, string format, object[] args, 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

Already-rendered notification text.

format string

Composite-format template behind notification; null when untemplated.

args object[]

Values interpolated into format; null when untemplated.

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

Args

Values interpolated into Format; null when untemplated.

public object[] Args { get; }

Property Value

object[]

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

Format

Composite-format template behind Notification; null when the diagnostic was built from a plain string (untemplated).

public string Format { get; }

Property Value

string

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

GetArgs()

Gets the values interpolated into GetFormat(); null when GetFormat() is null, possibly empty for a hole-less template. Default interface method so external implementers are unaffected.

public object[] GetArgs()

Returns

object[]

The interpolation arguments, or null when untemplated.

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.

GetFormat()

Gets the composite-format template behind GetNotification() — a {0}-style .NET format string — when this message was produced from an interpolated template; null when the notification has no structured template. Together with GetArgs() this lets a consumer re-render the message in another language without losing the interpolated live values, while GetNotification() stays the invariant English rendering. Default interface method so external implementers are unaffected.

public string GetFormat()

Returns

string

The composite format string, or null when untemplated.

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.