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

Allow opt-out from TaskScheduler.UnobservedExceptions #1914

Merged

Conversation

idg10
Copy link
Collaborator

@idg10 idg10 commented Apr 19, 2023

Resolves #1256

Various Rx operators and extension methods can wrap a Task as an IObservable<T>. Historically, if you unsubscribe before the task is finished and the task subsequently fails, the resulting exception pops out through TaskScheduler.UnobservedException.

There is a point of view that this is inconsistent with how we cope with exceptions in things like Select projection callbacks that occur after unsubscription - those are just swallowed.

This PR provides the ability to ask for these kinds of orphaned exceptions to be ignored when they occur in tasks, just like they are in other scenarios.

The default behaviour does not change because that would break applications depending on the UnobservedException event. This adds new overloads enabling opting out.

@idg10 idg10 marked this pull request as ready for review April 19, 2023 12:06
Copy link
Collaborator

@HowardvanRooijen HowardvanRooijen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@idg10 idg10 merged commit 3507d5e into main Apr 19, 2023
7 checks passed
@idg10 idg10 deleted the feature/1256-observablefromasync-unobserved-exceptions-alternate branch April 19, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Observable.FromAsync produces unobserved task exceptions
3 participants