DiagnosticSource.StartActivity(Activity, Object) Method

Definition

Starts an Activity and writes a start event.

public:
 System::Diagnostics::Activity ^ StartActivity(System::Diagnostics::Activity ^ activity, System::Object ^ args);
public System.Diagnostics.Activity StartActivity (System.Diagnostics.Activity activity, object args);
member this.StartActivity : System.Diagnostics.Activity * obj -> System.Diagnostics.Activity
Public Function StartActivity (activity As Activity, args As Object) As Activity

Parameters

activity
Activity

The Activity to be started.

args
Object

An object that represent the value being passed as a payload for the event.

Returns

Activity

The started activity for convenient chaining.

Remarks

The Activity describes the logical operation, its context, and parent relation; the current Activity flows through the operation processing.

This method starts the given Activity, maintains a global Activity.Current and Activity.Parent activity for the given Activity, and notifies consumers that a new Activity was started. Consumers can access Activity.Current to add context and/or augment telemetry.

Producers may pass additional details to the consumer in the payload.

Applies to