Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
StartActivity(String, ActivityKind) |
Creates and starts a new activity if there are active listeners for it, using the specified name and activity kind. |
StartActivity(ActivityKind, ActivityContext, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, DateTimeOffset, String) |
Creates and starts a new Activity object if there is any listener to the Activity events, returns |
StartActivity(String, ActivityKind, ActivityContext, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, DateTimeOffset) |
Creates and starts a new activity if there are active listeners for it, using the specified name, activity kind, parent activity context, tags, optional activity link and optional start time. |
StartActivity(String, ActivityKind, String, IEnumerable<KeyValuePair<String,Object>>, IEnumerable<ActivityLink>, DateTimeOffset) |
Creates and starts a new activity if there are active listeners for it, using the specified name, activity kind, parent Id, tags, optional activity links and optional start time. |
Creates and starts a new activity if there are active listeners for it, using the specified name and activity kind.
public System.Diagnostics.Activity? StartActivity(string name = "", System.Diagnostics.ActivityKind kind = System.Diagnostics.ActivityKind.Internal);
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind = System.Diagnostics.ActivityKind.Internal);
member this.StartActivity : string * System.Diagnostics.ActivityKind -> System.Diagnostics.Activity
Public Function StartActivity (Optional name As String = "", Optional kind As ActivityKind = System.Diagnostics.ActivityKind.Internal) As Activity
Public Function StartActivity (name As String, Optional kind As ActivityKind = System.Diagnostics.ActivityKind.Internal) As Activity
The operation name of the activity.
The activity kind.
The created activity object, if it had active listeners, or null
if it has no event listeners.
Product | Versions |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Creates and starts a new Activity object if there is any listener to the Activity events, returns null
otherwise.
public System.Diagnostics.Activity? StartActivity(System.Diagnostics.ActivityKind kind, System.Diagnostics.ActivityContext parentContext = default, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags = default, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = default, DateTimeOffset startTime = default, string name = "");
member this.StartActivity : System.Diagnostics.ActivityKind * System.Diagnostics.ActivityContext * seq<System.Collections.Generic.KeyValuePair<string, obj>> * seq<System.Diagnostics.ActivityLink> * DateTimeOffset * string -> System.Diagnostics.Activity
Public Function StartActivity (kind As ActivityKind, Optional parentContext As ActivityContext = Nothing, Optional tags As IEnumerable(Of KeyValuePair(Of String, Object)) = Nothing, Optional links As IEnumerable(Of ActivityLink) = Nothing, Optional startTime As DateTimeOffset = Nothing, Optional name As String = "") As Activity
The ActivityKind
The parent ActivityContext object to initialize the created Activity object with.
The optional tags list to initialize the created Activity object with.
The optional ActivityLink list to initialize the created Activity object with.
The optional start timestamp to set on the created Activity object.
The operation name of the Activity.
The created Activity object or null
if there are no listeners.
Product | Versions |
---|---|
.NET | 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Creates and starts a new activity if there are active listeners for it, using the specified name, activity kind, parent activity context, tags, optional activity link and optional start time.
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, System.Diagnostics.ActivityContext parentContext, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags = default, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = default, DateTimeOffset startTime = default);
member this.StartActivity : string * System.Diagnostics.ActivityKind * System.Diagnostics.ActivityContext * seq<System.Collections.Generic.KeyValuePair<string, obj>> * seq<System.Diagnostics.ActivityLink> * DateTimeOffset -> System.Diagnostics.Activity
Public Function StartActivity (name As String, kind As ActivityKind, parentContext As ActivityContext, Optional tags As IEnumerable(Of KeyValuePair(Of String, Object)) = Nothing, Optional links As IEnumerable(Of ActivityLink) = Nothing, Optional startTime As DateTimeOffset = Nothing) As Activity
The operation name of the activity.
The activity kind.
The parent ActivityContext object to initialize the created activity object with.
The optional tags list to initialize the created activity object with.
The optional ActivityLink list to initialize the created activity object with.
The optional start timestamp to set on the created activity object.
The created activity object, if it had active listeners, or null
if it has no event listeners.
Product | Versions |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Creates and starts a new activity if there are active listeners for it, using the specified name, activity kind, parent Id, tags, optional activity links and optional start time.
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, string? parentId, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags = default, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = default, DateTimeOffset startTime = default);
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, string parentId, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object?>>? tags = default, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = default, DateTimeOffset startTime = default);
member this.StartActivity : string * System.Diagnostics.ActivityKind * string * seq<System.Collections.Generic.KeyValuePair<string, obj>> * seq<System.Diagnostics.ActivityLink> * DateTimeOffset -> System.Diagnostics.Activity
Public Function StartActivity (name As String, kind As ActivityKind, parentId As String, Optional tags As IEnumerable(Of KeyValuePair(Of String, Object)) = Nothing, Optional links As IEnumerable(Of ActivityLink) = Nothing, Optional startTime As DateTimeOffset = Nothing) As Activity
The operation name of the activity.
The activity kind.
The parent Id to initialize the created activity object with.
The optional tags list to initialize the created activity object with.
The optional ActivityLink list to initialize the created activity object with.
The optional start timestamp to set on the created activity object.
The created activity object, if it had active listeners, or null
if it has no event listeners.
Product | Versions |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in