Click or drag to resize

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.

Inheritance Hierarchy
SystemObject
  DHI.Mike1D.GenericDiagnosticsHandler

Namespace:  DHI.Mike1D.Generic
Assembly:  DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 19.0.0.0 (11.1.1.1111)
Syntax
public class DiagnosticsHandler

The DiagnosticsHandler type exposes the following members.

Constructors
  NameDescription
Public methodDiagnosticsHandler
Constructor
Top
Properties
  NameDescription
Public propertyHeading
If diagnostic items are generated, then this heading is printed before the items. Immediately after the Heading is reset (hence only written once).
Public propertyNumberOfIdenticalMessagesToWrite
Number of identical messages to write.

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

Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNewMessage
Create directly a new message to be sent on
Public methodReset
Reset DiagnosticsHandler, clearing counters for error messages and any pending messages in the queue
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWrite
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.
Public methodWriteAllIssuesRecursive
Print hints, warnings, and erros of a Diagnostics to the listeners. Calls all children recursively.
Public methodWriteSkippedMessagesSummary
Print a summary of hints, warnings, and erros that has been skipped.
Top
Events
  NameDescription
Public eventMessageEvent
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.

Public eventMessageEventAll
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.

Top
See Also