diff --git a/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Eventing/ExceptionsEventSource.cs b/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Eventing/ExceptionsEventSource.cs index efa325bb9a9..95806453b32 100644 --- a/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Eventing/ExceptionsEventSource.cs +++ b/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Eventing/ExceptionsEventSource.cs @@ -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 data = stackalloc EventData[8]; diff --git a/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Pipeline/Steps/ExceptionEventsPipelineStep.cs b/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Pipeline/Steps/ExceptionEventsPipelineStep.cs index ec3dd331d44..6d8455208e7 100644 --- a/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Pipeline/Steps/ExceptionEventsPipelineStep.cs +++ b/src/Microsoft.Diagnostics.Monitoring.StartupHook/Exceptions/Pipeline/Steps/ExceptionEventsPipelineStep.cs @@ -60,7 +60,7 @@ public void Invoke(Exception exception, ExceptionPipelineExceptionContext contex frameIds, context.Timestamp, GetInnerExceptionsIds(exception), - context.ActivityId, + context.ActivityId ?? string.Empty, context.ActivityIdFormat ); } diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Exceptions/IExceptionInstance.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Exceptions/IExceptionInstance.cs index 5b178bc477a..9ab5869d3d4 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Exceptions/IExceptionInstance.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Exceptions/IExceptionInstance.cs @@ -23,7 +23,7 @@ internal interface IExceptionInstance ulong[] InnerExceptionIds { get; } - public string? ActivityId { get; } + public string ActivityId { get; } public ActivityIdFormat ActivityIdFormat { get; } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/Exceptions/Eventing/ExceptionsEventSourceTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/Exceptions/Eventing/ExceptionsEventSourceTests.cs index 64b9ba75129..2fbf7109167 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/Exceptions/Eventing/ExceptionsEventSourceTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/Exceptions/Eventing/ExceptionsEventSourceTests.cs @@ -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(), DateTime.UtcNow, Array.Empty(), null, ActivityIdFormat.Unknown); + source.ExceptionInstance(5, 7, ObjectDisposedExceptionMessage, Array.Empty(), DateTime.UtcNow, Array.Empty(), string.Empty, ActivityIdFormat.Unknown); Assert.Empty(listener.Exceptions); } @@ -120,7 +120,7 @@ public void ExceptionsEventSource_WriteException_NotEnabled() using ExceptionsEventListener listener = new(); - source.ExceptionInstance(7, 9, OperationCancelledExceptionMessage, Array.Empty(), DateTime.UtcNow, Array.Empty(), null, ActivityIdFormat.Unknown); + source.ExceptionInstance(7, 9, OperationCancelledExceptionMessage, Array.Empty(), DateTime.UtcNow, Array.Empty(), string.Empty, ActivityIdFormat.Unknown); Assert.Empty(listener.Exceptions); }