Edit

Share via


Activity.AddException(Exception, TagList, DateTimeOffset) Method

Definition

Add an ActivityEvent object containing the exception information to the Events list.

public System.Diagnostics.Activity AddException(Exception exception, in System.Diagnostics.TagList tags = default, DateTimeOffset timestamp = default);
member this.AddException : Exception * TagList * DateTimeOffset -> System.Diagnostics.Activity
Public Function AddException (exception As Exception, Optional ByRef tags As TagList = Nothing, Optional timestamp As DateTimeOffset = Nothing) As Activity

Parameters

exception
Exception

The exception to add to the attached events list.

tags
TagList

The tags to add to the exception event.

timestamp
DateTimeOffset

The timestamp to add to the exception event.

Returns

this for convenient chaining.

Remarks

- The name of the event will be "exception", and it will include the tags "exception.message", "exception.stacktrace", and "exception.type", in addition to the tags provided in the tags parameter.

- Any registered ActivityListener with the ExceptionRecorder callback will be notified about this exception addition before the ActivityEvent object is added to the Events list.

- Any registered ActivityListener with the ExceptionRecorder callback that adds "exception.message", "exception.stacktrace", or "exception.type" tags will not have these tags overwritten, except by any subsequent ActivityListener that explicitly overwrites them.

Applies to