Skip to content

Commit

Permalink
Arg names must be uniquely named to work with Diagnostic listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Jun 21, 2016
1 parent de41e30 commit 7f16464
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

0 comments on commit 7f16464

Please sign in to comment.