Skip to content

Commit

Permalink
Prevent collected exceptions from being dropped due to null event val…
Browse files Browse the repository at this point in the history
…ues (#7301) (#7302)

Co-authored-by: Joe Schmitt <1146681+schmittjoseph@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and schmittjoseph authored Sep 11, 2024
1 parent 4714d20 commit 3190b32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public void ExceptionGroup(
public void ExceptionInstance(
ulong ExceptionId,
ulong ExceptionGroupId,
string? ExceptionMessage,
string ExceptionMessage,
ulong[] StackFrameIds,
DateTime Timestamp,
ulong[] InnerExceptionIds,
string? ActivityId,
string ActivityId,
ActivityIdFormat ActivityIdFormat)
{
Span<EventData> data = stackalloc EventData[8];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void Invoke(Exception exception, ExceptionPipelineExceptionContext contex
frameIds,
context.Timestamp,
GetInnerExceptionsIds(exception),
context.ActivityId,
context.ActivityId ?? string.Empty,
context.ActivityIdFormat
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void ExceptionsEventSource_WriteException_LevelTooHigh()
using ExceptionsEventListener listener = new();
listener.EnableEvents(source, EventLevel.Warning);

source.ExceptionInstance(5, 7, ObjectDisposedExceptionMessage, Array.Empty<ulong>(), DateTime.UtcNow, Array.Empty<ulong>(), null, ActivityIdFormat.Unknown);
source.ExceptionInstance(5, 7, ObjectDisposedExceptionMessage, Array.Empty<ulong>(), DateTime.UtcNow, Array.Empty<ulong>(), string.Empty, ActivityIdFormat.Unknown);

Assert.Empty(listener.Exceptions);
}
Expand All @@ -120,7 +120,7 @@ public void ExceptionsEventSource_WriteException_NotEnabled()

using ExceptionsEventListener listener = new();

source.ExceptionInstance(7, 9, OperationCancelledExceptionMessage, Array.Empty<ulong>(), DateTime.UtcNow, Array.Empty<ulong>(), null, ActivityIdFormat.Unknown);
source.ExceptionInstance(7, 9, OperationCancelledExceptionMessage, Array.Empty<ulong>(), DateTime.UtcNow, Array.Empty<ulong>(), string.Empty, ActivityIdFormat.Unknown);

Assert.Empty(listener.Exceptions);
}
Expand Down

0 comments on commit 3190b32

Please sign in to comment.