Table of Contents

Class NcDiagnosticProgress

Namespace
Hi.NcParsers
Assembly
HiMech.dll

Helper that emits NcDiagnostic records — retaining them in Diagnostics (their canonical home) and forwarding each to an IProgress<T> of IMessage sink for live consumption. Provides one method per (Category, Severity) pair, each with an optional Sentence overload locating the issue in the NC source. Each method has a *Fmt sibling taking a FormattableString that keeps the interpolated template and values (Format / Args) for client-side localization; the sibling must be opted into by name — an interpolated string literal passed to the string method binds to string and is not captured. A caller that runs a bounded operation (an NC play, a writeback run) can wrap it in BeginRepeatFold() so identical repeated diagnostics fold into a first occurrence plus one counted summary instead of flooding the sink.

public class NcDiagnosticProgress : IProgress<NcDiagnostic>
Inheritance
NcDiagnosticProgress
Implements
Inherited Members
Extension Methods

Constructors

NcDiagnosticProgress(IProgress<IMessage>)

Creates a NcDiagnosticProgress that retains every reported NcDiagnostic in Diagnostics and also forwards it to shippingProgress for live consumption.

public NcDiagnosticProgress(IProgress<IMessage> shippingProgress)

Parameters

shippingProgress IProgress<IMessage>

Sink that receives each diagnostic. An IProgress<T> of object (e.g. the legacy SessionProgress0) is accepted here via IProgress<T> contravariance, so existing call sites keep forwarding diagnostics to the legacy message panel unchanged during the migration.

Properties

Diagnostics

All diagnostics reported through this instance, in report order. This is the canonical home for NC diagnostics — consumers read from here rather than from a shared, mixed message collection.

public IReadOnlyList<NcDiagnostic> Diagnostics { get; }

Property Value

IReadOnlyList<NcDiagnostic>

Methods

AsMessageSink(ISentenceCarrier)

Returns an IProgress<T> of IMessage face over this sink: each reported message is wrapped into an NcDiagnostic (an already-typed NcDiagnostic passes through; sentenceCarrier anchors the wrapped ones) and reported here. Lets sink-agnostic IMessage producers (e.g. the HardNc parse pipeline) feed the NC-diagnostic home.

public IProgress<IMessage> AsMessageSink(ISentenceCarrier sentenceCarrier = null)

Parameters

sentenceCarrier ISentenceCarrier

Optional NC-source anchor for the wrapped messages.

Returns

IProgress<IMessage>

BeginRepeatFold()

Opens a repeat-fold window over this sink — production wraps each NC play / writeback run in one window. While the window is open, the first diagnostic of each (Id, Notification) pair is appended as usual — keeping its NC-source anchor, the position a reader jumps to — and identical repeats are absorbed and only counted. Disposing the window appends, for every pair that repeated, one summary diagnostic carrying the original severity / category / id, a [repeated Nx in this run, first at Sn=...] suffix and the last occurrence's anchor. The window only ever appends, so incremental readers (e.g. the webservice sinceIndex polling) never see an already-delivered index change.

public IDisposable BeginRepeatFold()

Returns

IDisposable

Remarks

A nested call returns a no-op scope — the outermost window wins. Clear() during an open window also drops the window's accumulation, so summaries never resurrect diagnostics from before the clear. The fold key is exactly the (id, notification) pair: distinct notifications under the same id stay separate entries, while repeats matching on both fold even when their Detail objects differ — absorbed repeats' details are not retained and the summary carries a null detail.

Clear()

Removes all diagnostics (e.g. on runtime / controller reset).

public void Clear()

ConfigurationError(ISentenceCarrier, string, string, object)

Emits Configuration + Error located at sentenceCarrier.

public void ConfigurationError(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

ConfigurationError(string, string, object)

Emits Configuration + Error (dependency/config missing, cannot proceed).

public void ConfigurationError(string id, string text, object detail = null)

Parameters

id string
text string
detail object

ConfigurationErrorFmt(ISentenceCarrier, string, FormattableString, object)

Templated ConfigurationError(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void ConfigurationErrorFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

ConfigurationErrorFmt(string, FormattableString, object)

Templated ConfigurationError(string, string, object) — keeps format + args for localization.

public void ConfigurationErrorFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

ConfigurationMessage(ISentenceCarrier, string, string)

Emits Configuration + Message located at sentenceCarrier.

public void ConfigurationMessage(ISentenceCarrier sentenceCarrier, string id, string text)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string

ConfigurationMessage(string, string)

Emits Configuration + Message (dependency/config applied, informational event).

public void ConfigurationMessage(string id, string text)

Parameters

id string
text string

ConfigurationMessageFmt(ISentenceCarrier, string, FormattableString)

Templated ConfigurationMessage(ISentenceCarrier, string, string) — keeps format + args for localization.

public void ConfigurationMessageFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString

ConfigurationMessageFmt(string, FormattableString)

Templated ConfigurationMessage(string, string) — keeps format + args for localization.

public void ConfigurationMessageFmt(string id, FormattableString text)

Parameters

id string
text FormattableString

ConfigurationWarning(ISentenceCarrier, string, string, object)

Emits Configuration + Warning located at sentenceCarrier.

public void ConfigurationWarning(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

ConfigurationWarning(string, string, object)

Emits Configuration + Warning (dependency/config missing, using fallback).

public void ConfigurationWarning(string id, string text, object detail = null)

Parameters

id string
text string
detail object

ConfigurationWarningFmt(ISentenceCarrier, string, FormattableString, object)

Templated ConfigurationWarning(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void ConfigurationWarningFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

ConfigurationWarningFmt(string, FormattableString, object)

Templated ConfigurationWarning(string, string, object) — keeps format + args for localization.

public void ConfigurationWarningFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

Report(NcDiagnostic)

Reports a progress update.

public void Report(NcDiagnostic value)

Parameters

value NcDiagnostic

The value of the updated progress.

SystemError(ISentenceCarrier, string, string, object)

Emits System + Error located at sentenceCarrier.

public void SystemError(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

SystemError(string, string, object)

Emits System + Error (pipeline exception or unconsidered case).

public void SystemError(string id, string text, object detail = null)

Parameters

id string
text string
detail object

SystemErrorFmt(ISentenceCarrier, string, FormattableString, object)

Templated SystemError(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void SystemErrorFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

SystemErrorFmt(string, FormattableString, object)

Templated SystemError(string, string, object) — keeps format + args for localization.

public void SystemErrorFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

SystemMessage(ISentenceCarrier, string, string)

Emits System + Message located at sentenceCarrier.

public void SystemMessage(ISentenceCarrier sentenceCarrier, string id, string text)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string

SystemMessage(string, string)

Emits System + Message (pipeline lifecycle / informational).

public void SystemMessage(string id, string text)

Parameters

id string
text string

SystemMessageFmt(ISentenceCarrier, string, FormattableString)

Templated SystemMessage(ISentenceCarrier, string, string) — keeps format + args for localization.

public void SystemMessageFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString

SystemMessageFmt(string, FormattableString)

Templated SystemMessage(string, string) — keeps format + args for localization.

public void SystemMessageFmt(string id, FormattableString text)

Parameters

id string
text FormattableString

UnsupportedError(ISentenceCarrier, string, string, object)

Emits Unsupported + Error located at sentenceCarrier.

public void UnsupportedError(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

UnsupportedError(string, string, object)

Emits Unsupported + Error (recognized but unimplemented, likely matters).

public void UnsupportedError(string id, string text, object detail = null)

Parameters

id string
text string
detail object

UnsupportedErrorFmt(ISentenceCarrier, string, FormattableString, object)

Templated UnsupportedError(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void UnsupportedErrorFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

UnsupportedErrorFmt(string, FormattableString, object)

Templated UnsupportedError(string, string, object) — keeps format + args for localization.

public void UnsupportedErrorFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

UnsupportedMessage(ISentenceCarrier, string, string, object)

Emits Unsupported + Message located at sentenceCarrier.

public void UnsupportedMessage(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

UnsupportedMessage(string, string, object)

Emits Unsupported + Message (recognized, intentionally not simulated, considered safe / no-op offline).

public void UnsupportedMessage(string id, string text, object detail = null)

Parameters

id string
text string
detail object

UnsupportedMessageFmt(ISentenceCarrier, string, FormattableString, object)

Templated UnsupportedMessage(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void UnsupportedMessageFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

UnsupportedMessageFmt(string, FormattableString, object)

Templated UnsupportedMessage(string, string, object) — keeps format + args for localization.

public void UnsupportedMessageFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

UnsupportedWarning(ISentenceCarrier, string, string, object)

Emits Unsupported + Warning located at sentenceCarrier.

public void UnsupportedWarning(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

UnsupportedWarning(string, string, object)

Emits Unsupported + Warning (recognized but unimplemented, likely harmless).

public void UnsupportedWarning(string id, string text, object detail = null)

Parameters

id string
text string
detail object

UnsupportedWarningFmt(ISentenceCarrier, string, FormattableString, object)

Templated UnsupportedWarning(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void UnsupportedWarningFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

UnsupportedWarningFmt(string, FormattableString, object)

Templated UnsupportedWarning(string, string, object) — keeps format + args for localization.

public void UnsupportedWarningFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

ValidationError(ISentenceCarrier, string, string, object)

Emits Validation + Error located at sentenceCarrier.

public void ValidationError(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

ValidationError(string, string, object)

Emits Validation + Error (manufacturing/physics is unfeasible).

public void ValidationError(string id, string text, object detail = null)

Parameters

id string
text string
detail object

ValidationErrorFmt(ISentenceCarrier, string, FormattableString, object)

Templated ValidationError(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void ValidationErrorFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

ValidationErrorFmt(string, FormattableString, object)

Templated ValidationError(string, string, object) — keeps format + args for localization.

public void ValidationErrorFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

ValidationWarning(ISentenceCarrier, string, string, object)

Emits Validation + Warning located at sentenceCarrier.

public void ValidationWarning(ISentenceCarrier sentenceCarrier, string id, string text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text string
detail object

ValidationWarning(string, string, object)

Emits Validation + Warning (manufacturing/physics may be unfeasible).

public void ValidationWarning(string id, string text, object detail = null)

Parameters

id string
text string
detail object

ValidationWarningFmt(ISentenceCarrier, string, FormattableString, object)

Templated ValidationWarning(ISentenceCarrier, string, string, object) — keeps format + args for localization.

public void ValidationWarningFmt(ISentenceCarrier sentenceCarrier, string id, FormattableString text, object detail = null)

Parameters

sentenceCarrier ISentenceCarrier
id string
text FormattableString
detail object

ValidationWarningFmt(string, FormattableString, object)

Templated ValidationWarning(string, string, object) — keeps format + args for localization.

public void ValidationWarningFmt(string id, FormattableString text, object detail = null)

Parameters

id string
text FormattableString
detail object

Events

Cleared

Raised after Clear() empties the collection.

public event Action Cleared

Event Type

Action

MessageAdded

Raised after a diagnostic has been appended. Carries the index it landed at in Diagnostics and the appended diagnostic, so a consumer can place it and reach nearby items by indexing into Diagnostics.

public event Action<int, NcDiagnostic> MessageAdded

Event Type

Action<int, NcDiagnostic>