System.Diagnostics.EventLog.SynchronizingObject Property

Gets or sets the object used to marshal the event handler calls issued as a result of an System.Diagnostics.EventLog entry written event.

Syntax

[System.ComponentModel.Browsable(false)]
[System.ComponentModel.DefaultValue(null)]
[System.Diagnostics.MonitoringDescription("An object that synchronizes event handler calls.")]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

When EventLog.SynchronizingObject is null, methods handling the EventLog.EntryWritten event are called on a thread from the system thread pool. For more information on system thread pools, see System.Threading.ThreadPool.

When the EventLog.EntryWritten event is handled by a visual Windows Forms component, such as a button, accessing the component through the system thread pool might not work, or might result in an exception. Avoid this by setting EventLog.SynchronizingObject to a Windows Forms component, which causes the methods handling the EventLog.EntryWritten event to be called on the same thread on which the component was created.

If the System.Diagnostics.EventLog is used inside vsprvslong in a Windows Forms designer, EventLog.SynchronizingObject is automatically set to the control containing the System.Diagnostics.EventLog. For example, if you place anĀ System.Diagnostics.EventLog on a designer for Form1 (which inherits from System.Windows.Forms.Form) the EventLog.SynchronizingObject property of System.Diagnostics.EventLog is set to the instance of Form1.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0