EventSource.SetCurrentThreadActivityId EventSource.SetCurrentThreadActivityId EventSource.SetCurrentThreadActivityId EventSource.SetCurrentThreadActivityId Method

Definition

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

Sets the activity ID on the current thread.

Overloads

SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid)

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

Sets the activity ID on the current thread.

SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid)

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

Sets the activity ID on the current thread, and returns the previous activity ID.

SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid)

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

Sets the activity ID on the current thread.

public:
 static void SetCurrentThreadActivityId(Guid activityId);
public static void SetCurrentThreadActivityId (Guid activityId);
static member SetCurrentThreadActivityId : Guid -> unit
Public Shared Sub SetCurrentThreadActivityId (activityId As Guid)
Parameters
activityId
Guid Guid Guid Guid

The current thread's new activity ID, or Empty to indicate that work on the current thread is not associated with any activity.

Remarks

Calling the SetCurrentThreadActivityId method sets the activity ID on a per-thread basis. All events on the thread will have that activity ID until a new activity is started on the same thread.

This method is called only by libraries that manage their own threads.

SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid)

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

Sets the activity ID on the current thread, and returns the previous activity ID.

public:
 static void SetCurrentThreadActivityId(Guid activityId, [Runtime::InteropServices::Out] Guid % oldActivityThatWillContinue);
public static void SetCurrentThreadActivityId (Guid activityId, out Guid oldActivityThatWillContinue);
static member SetCurrentThreadActivityId : Guid *  -> unit
Public Shared Sub SetCurrentThreadActivityId (activityId As Guid, ByRef oldActivityThatWillContinue As Guid)
Parameters
activityId
Guid Guid Guid Guid

The current thread's new activity ID, or Empty to indicate that work on the current thread is not associated with any activity.

oldActivityThatWillContinue
Guid Guid Guid Guid

When this method returns, contains the previous activity ID on the current thread.

Remarks

You can call the SetCurrentThreadActivityId(Guid, Guid) method to temporarily overwrite the current thread's activity ID with a new activity ID. You must then restore the previous activity ID by passing the oldActivityThatWillContinue argument to the SetCurrentThreadActivityId(Guid) method.

Applies to