diff --git a/src/Platforms/Exceptionless.AspNetCore/ExceptionlessDiagnosticListener.cs b/src/Platforms/Exceptionless.AspNetCore/ExceptionlessDiagnosticListener.cs index 9a591b28..12ecd3c3 100644 --- a/src/Platforms/Exceptionless.AspNetCore/ExceptionlessDiagnosticListener.cs +++ b/src/Platforms/Exceptionless.AspNetCore/ExceptionlessDiagnosticListener.cs @@ -6,46 +6,48 @@ namespace Exceptionless.AspNetCore { internal sealed class ExceptionlessDiagnosticListener { private readonly ExceptionlessClient _client; + public ExceptionlessDiagnosticListener(ExceptionlessClient client) { _client = client; } [DiagnosticName("Microsoft.AspNetCore.Diagnostics.HandledException")] - public void OnDiagnosticHandledException(HttpContext context, Exception ex) { + public void OnDiagnosticHandledException(HttpContext httpContext, Exception exception) { var contextData = new ContextData(); contextData.SetSubmissionMethod("Microsoft.AspNetCore.Diagnostics.UnhandledException"); - contextData.Add(nameof(HttpContext), context); + contextData.Add(nameof(HttpContext), httpContext); - ex.ToExceptionless(contextData, _client).Submit(); + exception.ToExceptionless(contextData, _client).Submit(); } [DiagnosticName("Microsoft.AspNetCore.Diagnostics.UnhandledException")] - public void OnDiagnosticUnhandledException(HttpContext context, Exception ex) { + public void OnDiagnosticUnhandledException(HttpContext httpContext, Exception exception) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("Microsoft.AspNetCore.Diagnostics.HandledException"); - contextData.Add(nameof(HttpContext), context); + contextData.Add(nameof(HttpContext), httpContext); - ex.ToExceptionless(contextData, _client).Submit(); + exception.ToExceptionless(contextData, _client).Submit(); } [DiagnosticName("Microsoft.AspNetCore.Hosting.UnhandledException")] - public void OnHostingUnhandledException(HttpContext context, Exception ex) { + public void OnHostingUnhandledException(HttpContext httpContext, Exception exception) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("Microsoft.AspNetCore.Hosting.UnhandledException"); - contextData.Add(nameof(HttpContext), context); + contextData.Add(nameof(HttpContext), httpContext); - ex.ToExceptionless(contextData, _client).Submit(); + exception.ToExceptionless(contextData, _client).Submit(); } [DiagnosticName("Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException")] - public void OnMiddlewareException(Exception ex, string name) { + public void OnMiddlewareException(HttpContext httpContext, Exception exception, string name) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); - contextData.SetSubmissionMethod(name); + contextData.SetSubmissionMethod(name ?? "Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException"); + contextData.Add(nameof(HttpContext), httpContext); - ex.ToExceptionless(contextData, _client).Submit(); + exception.ToExceptionless(contextData, _client).Submit(); } } } \ No newline at end of file