Allow opt-out from TaskScheduler.UnobservedExceptions #1910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: we are more likely to go with #1914 instead now. A problem with the approach in this PR is that it creates additional opportunities for overload resolution ambiguity, so although this is a binary-compatible change, it might cause build errors when people upgrade.
Resolves #1256
Various Rx operators and extension methods can wrap a
Task
as anIObservable<T>
. Historically, if you unsubscribe before the task is finished and the task subsequently fails, the resulting exception pops out throughTaskScheduler.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.