DiagnosticsHandler Class

DiagnosticsHandler collects all diagnostics messages entered by any of the Write method and triggers a MessageEvent. However, it only issues the same message 100 timers, the statistics for that can be retrieved by WriteSkippedMessagesSummary

It is thread safe, i.e. it handles synchronization issues between potential several worker threads.

To connect a diagnostics object for "live" messages, connect the DiagnosticsHandler object directly to the Diagnostics object: diagnostics.DiagnosticsEvent += diagnosticsHandler.Write; To write all messages of a diagnostics object, call the WriteAllIssuesRecursive(IDiagnostics) method.

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 DiagnosticsHandler
Inheritance
Object    DiagnosticsHandler

Constructors

DiagnosticsHandler Constructor

Properties

Heading If diagnostic items are generated, then this heading is printed before the items. Immediately after the Heading is reset (hence only written once).
NumberOfIdenticalMessagesToWrite Number of identical messages to write.

If more than this number of messages (same message id), these messages are skipped for the MessageEvent.

UnitProvider Unit provider, for unit conversions

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
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)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
NewMessage Create directly a new message to be sent on
Reset Reset DiagnosticsHandler, clearing counters for error messages and any pending messages in the queue
ToStringReturns a string that represents the current object.
(Inherited from Object)
Write Print one item of a Diagnostics to listeners. Can be used to connect to DiagnosticsEvent of another Diagnostics object, to transfer any items to this class.
WriteAllIssuesRecursive Print hints, warnings, and erros of a Diagnostics to the listeners. Calls all children recursively.
WriteSkippedMessagesSummary Print a summary of hints, warnings, and erros that has been skipped.

Events

MessageEvent Event that is triggered every time a new diagnostics message is produced by one of the connected diagnostics objects.

The number of identical messages is limited by _numberOfIdenticalMessagesToWrite

Parameters: Type of message and message content.

MessageEventAll Event that is triggered every time a new diagnostics message is produced by one of the connected diagnostics objects.

Parameters: Type of message, message id and message content

Message id can be null.

See Also