Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Exceptions handled by IExceptionHandler<T> implementations are shown as Unhandled in APM UI #2312

Open
ben-wallis opened this issue Mar 21, 2024 · 1 comment
Labels
agent-dotnet bug Something isn't working community

Comments

@ben-wallis
Copy link

ben-wallis commented Mar 21, 2024

APM Agent version

1.26.0

Environment

Operating system and version:
N/A

.NET Framework/Core name and version
.NET 8.0.2

Application Target Framework(s) (e.g. net462, netcoreapp3.1):
net80

Describe the bug

In .NET 8 ASP.NET Core applications, the new IExceptionHandler<T> exception handlers result in exceptions showing as Unhandled in the APM UI even when they return true to indicate the exception was handled.

To Reproduce

A reproduction is available here: ben-wallis@be1ac9d

Even though ArithmericExceptionHandler in the above reproduction correclty handles the exception and returns true the exception is still shown on the Errors tab as Unhandled in APM:

image

Exceptions handled by IExceptionHandler<T> implementations emit the Microsoft.AspNetCore.Diagnostics.HandledException diagnostic event, whereas those that are truly unhandled emit the Microsoft.AspNetCore.Diagnostics.UnhandledException diagnostic event. Despite this difference, both diagnostic events result in the exception being captured as unhandled in AspNetCoreDiagnosticListener.cs due to both of these diagnostic events being handled in the same code path: https://github.com/elastic/apm-agent-dotnet/blame/a82dba1e52b20f303c16a772c3fdfdbffcdbfb76/src/integrations/Elastic.Apm.AspNetCore/DiagnosticListener/AspNetCoreDiagnosticListener.cs#L77

Expected behavior

Handled exceptions are not shown as Unhandled in the APM UI

Actual behavior

Handled exceptions are shown as Unhandled in the APM UI

@ben-wallis ben-wallis added the bug Something isn't working label Mar 21, 2024
@stevejgordon
Copy link
Contributor

Thanks for raising this and including the repro @ben-wallis. We'll take a look at amending the logic to account for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-dotnet bug Something isn't working community
Projects
None yet
Development

No branches or pull requests

2 participants