EventWrittenEventArgs EventWrittenEventArgs EventWrittenEventArgs EventWrittenEventArgs Class

Definition

Provides data for the OnEventWritten(EventWrittenEventArgs) callback.

public ref class EventWrittenEventArgs : EventArgs
public class EventWrittenEventArgs : EventArgs
type EventWrittenEventArgs = class
    inherit EventArgs
Public Class EventWrittenEventArgs
Inherits EventArgs
Inheritance
EventWrittenEventArgsEventWrittenEventArgsEventWrittenEventArgsEventWrittenEventArgs

Remarks

Whenever an event is dispatched to an EventListener, the EventListener.OnEventWritten callback method is invoked. It is passed an EventWrittenEventArgs instance that contains information associated with the event. All property values of the EventWrittenEventArgs class are valid only during the callback.

The following sections contain additional information about individual EventWrittenEventArgs properties.

ActivityId property

When using System.Activities.Activity and its derived classes, threads can be marked as having an activity associated with them. The ActivityId property returns the activity ID of the thread that logged the event. Note that threads do not have to have an activity, in which case this property returns Guid.Empty.

OSThreadId and TimeStamp properties

Starting with .NET Core 2.2, EventListener objects can subscribe to native runtime events (such as GC, JIT, and threadpool events) in addition to events emitted by EventSource objects. In previous versions of .NET Core and all versions of .NET Framework, the thread ID and timestamp can be gathered from the environment, because they are dispatched synchronously on the same thread that emitted them. Not all native runtime events can be dispatched synchronously, however. Some events, such as GC events, are emitted when managed thread execution is suspended. These events are buffered in native code and are dispatched by a dispatcher thread once managed code can execute again. Because these events are buffered, the environment cannot be used to reliably retrieve the thread ID and timestamp. Because of this, starting with .NET Core 2.2, thread ID and timestamp information are available as members of the EventWrittenEventArgs class.

RelatedActivityId property

A related activity is an activity that is strongly related to the current one. Typically, it is either the activity that caused the current activity (events with the Start opcode typically do this) or an activity that was created by the current one (events with the Send opcode typically do this). When it is used, the RelatedActivityID is explicitly passed by the method doing the logging. Many events don't pass a RelatedActivityId, in which case this property returns Guid.Empty.

Properties

ActivityId ActivityId ActivityId ActivityId

Gets the activity ID on the thread that the event was written to.

Channel Channel Channel Channel

Gets the channel for the event.

EventId EventId EventId EventId

Gets the event identifier.

EventName EventName EventName EventName

Gets the name of the event.

EventSource EventSource EventSource EventSource

Gets the event source object.

Keywords Keywords Keywords Keywords

Gets the keywords for the event.

Level Level Level Level

Gets the level of the event.

Message Message Message Message

Gets the message for the event.

Opcode Opcode Opcode Opcode

Gets the operation code for the event.

OSThreadId OSThreadId OSThreadId OSThreadId

Gets the thread identifier for the OS thread that wrote the event. (.NET Core 2.2 and later only.)

Payload Payload Payload Payload

Gets the payload for the event.

PayloadNames PayloadNames PayloadNames PayloadNames

Returns a list of strings that represent the property names of the event.

RelatedActivityId RelatedActivityId RelatedActivityId RelatedActivityId

Gets the identifier of an activity that is related to the activity represented by the current instance.

Tags Tags Tags Tags

Returns the tags specified in the call to the Write(String, EventSourceOptions) method.

Task Task Task Task

Gets the task for the event.

TimeStamp TimeStamp TimeStamp TimeStamp

Gets the time that the event was originally generated as a DateTime timestamp. (.NET Core 2.2 and later only.)

Version Version Version Version

Gets the version of the event.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to