From 7f16464a817811a81dd9480441ee299560b5c6c7 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 21 Jun 2016 10:08:40 -0500 Subject: [PATCH] Arg names must be uniquely named to work with Diagnostic listeners --- .../ExceptionlessDiagnosticListener.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) 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