PostSharp SDK 2023.0 / / Class Reference / Post­Sharp.​Sdk.​Extensibility Namespace / Messenger Class

Messenger Class

Publish-subscribe channel for error messages (Message).
Inheritance Hierarchy

Namespace:  PostSharp.Sdk.Extensibility
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 2023.0.3.0 (2023.0.3.0)
public sealed class Messenger : MarshalByRefObject, 
	IMessageSink, IDisposable

The Messenger type exposes the following members.

Public methodMessenger
Initializes a new Messenger.
Public propertyStatic memberCurrent
Gets the Messenger associated with the current thread.
Public propertyDisabledMessages
Public propertyErrorCount
Gets the current number of emitted error messages.
Public propertyFatalCount
Gets the number of emitted fatal error messages.
Public propertyInfoCount
Gets the current number of emitted info messages.
Public propertyMaxErrorCount
Gets or sets the maximal number of errors before a fatal error is emitted.
Public propertyMessageCount
Gets the total number of messages emitted by this Messenger.
Public propertyWarningCount
Gets the current number of emitted warning messages.
Public methodAddRemoteSink
Adds a remote message sink to the current Messenger.
Public methodDisableMessage
Disables a message given its identifier.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodEscalateMessage
Escalates a message, given its identifier.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberInitialize
Forces to initialize the static Messenger instance.
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodRemoveRemoteSink
Removes a remote message sink from the current Messenger.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWrite
Emits a message.
Public eventMessage
Event raised when a message is emitted.
Each thread has its own instance of the Messenger class. Message emitters should use the Write(Message) method, consumers should subscribe to the Message event or implement the IMessageSink interface and register it using the AddRemoteSink(IMessageSink, Boolean) method.
See Also