Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

EventSource.WriteEventWithRelatedActivityId Method

.NET Framework 4.6 and 4.5

[Supported in the .NET Framework 4.5.1 and later versions]

Writes an event that indicates that the current activity is related to another activity.

Namespace:  System.Diagnostics.Tracing
Assemblies:   mscorlib (in mscorlib.dll)
  System.Diagnostics.Tracing (in System.Diagnostics.Tracing.dll)

member WriteEventWithRelatedActivityId : 
        eventId:int * 
        relatedActivityId:Guid * 
        args:Object[] -> unit


Type: System.Int32

An identifier that uniquely identifies this event within the EventSource.

Type: System.Guid

The related activity identifier.

Type: System.Object[]

An array of objects that contain data about the event.

The WriteEventWithRelatedActivityId method logs a transfer event. The activity of the current thread is logged with the event, and this allows two activities to be related by a consumer of events.

Your ETW event method calling this function must follow these guidelines:

  1. Specify the first parameter as a Guid named relatedActivityId.

  2. Specify either Send or Receive as the EventAttribute.Opcode property.

  3. Call WriteEventWithRelatedActivityId passing in the event ID, followed by the related ID GUID, followed by all the parameters the event method is passed, in the same order.

If args is not used, it is converted to an empty array for the resulting call to ETW.

The following code example shows how you might can specify an event source that calls WriteEventWithRelatedActivityId.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5.1

Supported in: Windows Phone 8.1
© 2015 Microsoft