Diagnostics Class

A collection of error, warning and hint messages. It implements a tree like strukture of IDiagnostics, to be able to handle the diagnostics in a stack-trace like manner. Whenever an item is added, an event is triggered. Calling any of the recursive method must be done from one thread at a time only, otherwise it will fail.

Definition

Namespace: DHI.Mike1D.Generic
Assembly: DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class Diagnostics : IDiagnostics
Inheritance
Object    Diagnostics
Implements
IDiagnostics

Constructors

Diagnostics Create a new unnamed Diagnostics. Use only if this diagnostics at a later stage is appended to a named diagnostics.
Diagnostics(IDiagnosticItem) Create a new named Diagnostics
Diagnostics(String) Create a new named Diagnostics
Diagnostics(String, Object) Create a new named Diagnostics

Properties

Children Children of sub-diagnostics, implementing a tree-like structure of Diagnostics. If you add children to the list, remember to se teh parent - or use AddChild().
ErrorCountRecursive The number of issues in this diagnostics, including issues in the stack.
Errors Get a list of all errors (not from the stack)
ErrorsRecursive Get a list of all errors, recursively
HintCountRecursive The number of warnings in this diagnostics, including warnings in the stack.
Hints Get a list of all hints (not from the stack)
HintsRecursive Get a list of all warnings, recursively
Infos Get a list of all hints (not from the stack)
IssueCount The number of issues in this diagnostics
IssueCountRecursive The number of issues in this diagnostics, including issues in the stack.
Name Name or origin of Diagnostics. Can be null/empty string.
Parent Parent diagnostic. Diagnostics can belong to a tree with one parent and several children. If parent is null, then this diagnostic is the root.
Source Source object that created the Diagnostics
SourceDescription Description of Diagnostics source. Can be null/empty string.
WarningCountRecursive The number of warnings in this diagnostics, including warnings in the stack.
Warnings Get a list of all warnings (not from the stack)
WarningsRecursive Get a list of all warnings, recursively

Methods

AddChild Add a child diagnostics to the diagnostics tree. Sets the parent of the child.
Append Append errors, warnings and hints from input diagnostics to this diagnostics, and add stack items
Clear Clear diagnostics, as well errors as warnings as hints as stack.
ClearIssuesRecursive Remove all issues from this Diagnostics and all child Diagnostics
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Error Add an error DiagnosticItem
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Hint Add a hint DiagnosticItem
Info(IDiagnosticItem) Add an information DiagnosticItem
Info(String) Add an information DiagnosticItem
IsParent Return true if diagnostics is the parent of this diagnostics. It checks the parent recursively to the root.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
RuntimeError(IDiagnosticItem) Create an error DiagnosticItem and throw an exception
RuntimeError(IDiagnosticItem, Exception) Create an error DiagnosticItem and throw an exception
ToStringReturns a string that represents the current object.
(Inherited from Object)
Warning Add a warning DiagnosticItem

Events

DiagnosticsEvent The event which is called when a diagnostics event is encountered. If this is null, then the event of the root diagnostic (the parent's parent until parent is null) is called.

Fields

GetAdditionalInformation Delegate to access additional information to add to items. Used to append time step information to items from HD.
MessageIdToWarning ID of messages that, if reported as errors, are reported as warnings

Extension Methods

Error Add an error to the diagnostics item.
(Defined by GenericExtensions)
ExceptionToError Add an error DiagnosticItem, and throw an exception
(Defined by GenericExtensions)
RuntimeError Add an error DiagnosticItem, and throw an exception
(Defined by GenericExtensions)
Warning Add a warning message
(Defined by GenericExtensions)

See Also