Export (0) Print
Expand All

EventSource.WriteEventWithRelatedActivityIdCore Method

[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.

This API is not CLS-compliant. 

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

'Declaration
<CLSCompliantAttribute(False)> _
Protected Sub WriteEventWithRelatedActivityIdCore ( _
	eventId As Integer, _
	childActivityID As Guid*, _
	eventDataCount As Integer, _
	data As EventSource.EventData* _
)

Parameters

eventId
Type: System.Int32

An identifier that uniquely identifies this event within the EventSource.

childActivityID
Type: System.Guid*

A pointer to the GUID of the child activity ID.

eventDataCount
Type: System.Int32

The number of items in the data field.

data
Type: System.Diagnostics.Tracing.EventSource.EventData*

A pointer to the first item in the event data field.

WriteEventWithRelatedActivityIdCore is similar to the WriteEventWithRelatedActivityId method but offers better performance, bevcause it does not have to unbox the childActivityID and data arguments.

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 WriteEventWithRelatedActivityIdCore 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.

The following C# code example shows how to define a method overload that calls WriteEventWithRelatedActivityIdCore.

    <EventSource(Name:="Litware-ProductName-ComponentName")> _
    Public NotInheritable Class LitwareComponentNameEventSource
        Inherits EventSource
        <[Event](1, Task:=Tasks.Request, Opcode:=EventOpcode.Send)> _
        Public Sub RequestStart(relatedActivityId As Guid, reqId As Integer, url As String)
            WriteEventWithRelatedActivityIdCore(1, relatedActivityId, reqId, url)
        End Sub 

    End Class



...


#Region "Keywords / Task / Opcodes" 
    Public NotInheritable Class Tasks
        Private Sub New()
        End Sub 
        Public Const Request As EventTask = DirectCast(&H1, EventTask)
    End Class
#End Region

.NET Framework

Supported in: 4.5.1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Windows Phone 8.1

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft