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

BeforeSend not respected when exception is unhandled in a task #3751

Open
georgiosd opened this issue Nov 13, 2024 · 6 comments
Open

BeforeSend not respected when exception is unhandled in a task #3751

georgiosd opened this issue Nov 13, 2024 · 6 comments

Comments

@georgiosd
Copy link

Package

Sentry

.NET Flavor

.NET

.NET Version

6.0.0

OS

Windows

SDK Version

3.34.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

  1. Override OnBeforeSend to return null when event has exception of type SomeException.
  2. Throw SomeException from a Task.Run func.

Expected Result

Sentry filters out the exception.

Actual Result

Sentry still sends the exception "home".

@georgiosd
Copy link
Author

georgiosd commented Nov 13, 2024

I'm not 100% sure the repro is accurate - AFAIK it's the same conceptually with the real repro (below) but I couldn't get it to reproduce the same behavior.

"Real" repro:

  1. Register a background service.
  2. In ExecuteAsync add a small delay and then throw SomeException

I think this is accurate - but the issue I am seeing in production is related to UnobservedTaskException which is flooding our sentry even though we're dropping the event in OnBeforeSend. Ultimately related to this hardkoded/puppeteer-sharp#891

@bricefriha
Copy link
Collaborator

@georgiosd Thanks for reporting this, we're taking a look

@bricefriha
Copy link
Collaborator

Unfortunately, I'm unable to reproduce this yet.

@georgiosd, is it a UWP app, MAUI, or something else?
also, are you capturing the exception manually (with a SentrySdk.CaptureException(ex)), or is the exception unhandled?

@georgiosd
Copy link
Author

georgiosd commented Nov 13, 2024 via email

@jamescrosswell
Copy link
Collaborator

@georgiosd that Pupeteer repsitory is pretty big and there's a lot going on there. It makes it quite hard to reproduce this issue.

Are you able to provide a minimal reproduction of the issue that we could look at?

@georgiosd
Copy link
Author

Yeah, I understand. I'll spend some time and see if I can reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: No status
Development

No branches or pull requests

4 participants