diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs index 669039c0c8054..80baa185a09fe 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs @@ -138,9 +138,9 @@ public void EndInstrumentReporting(string sessionId, string meterName, string? m } [Event(9, Keywords = Keywords.TimeSeriesValues | Keywords.Messages | Keywords.InstrumentPublishing)] - public void Error(string sessionId, string errorMessage, string errorStack) + public void Error(string sessionId, string errorMessage) { - WriteEvent(9, sessionId, errorMessage, errorStack); + WriteEvent(9, sessionId, errorMessage); } [Event(10, Keywords = Keywords.TimeSeriesValues | Keywords.InstrumentPublishing)] @@ -203,7 +203,7 @@ public void OnEventCommand(EventCommandEventArgs command) // This limitation shouldn't really matter because browser also doesn't support out-of-proc EventSource communication // which is the intended scenario for this EventSource. If it matters in the future AggregationManager can be // modified to have some other fallback path that works for browser. - Log.Error("", "System.Diagnostics.Metrics EventSource not supported on browser", ""); + Log.Error("", "System.Diagnostics.Metrics EventSource not supported on browser"); return; } #endif @@ -301,7 +301,7 @@ public void OnEventCommand(EventCommandEventArgs command) i => Log.EndInstrumentReporting(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), i => Log.InstrumentPublished(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), () => Log.InitialInstrumentEnumerationComplete(sessionId), - e => Log.Error(sessionId, e.Message, e.StackTrace?.ToString() ?? ""), + e => Log.Error(sessionId, e.ToString()), () => Log.TimeSeriesLimitReached(sessionId), () => Log.HistogramLimitReached(sessionId)); @@ -328,7 +328,7 @@ public void OnEventCommand(EventCommandEventArgs command) private bool LogError(Exception e) { - Log.Error(_sessionId, e.Message, e.StackTrace?.ToString() ?? ""); + Log.Error(_sessionId, e.ToString()); // this code runs as an exception filter // returning false ensures the catch handler isn't run return false; diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs index f0b77bf2af4b6..c63aaa1a8712f 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs @@ -1001,8 +1001,7 @@ private void AssertOnError() if (errorEvent != null) { string message = errorEvent.Payload[1].ToString(); - string stackTrace = errorEvent.Payload[2].ToString(); - Assert.True(errorEvent == null, "Unexpected Error event: " + message + Environment.NewLine + stackTrace); + Assert.True(errorEvent == null, "Unexpected Error event: " + message); } } }