Description
The ReactiveUI project uses Rx's ability to wrap a Task<T>
as an IObservable<T>
, but there's a capability they have wanted for a long time that Rx currently does not offer: the ability both to cancel the underlying task and to observe its progress after cancellation.
There's no built in way to do this, because the mechanism by which you cancel a Task<T>
wrapped in an IObservable<T>
is to unsubscribe (i.e. to call Dispose
on the IDisposable
returned by Subscribe
). The problem with this is that unsubscribing tells Rx that you don't want to receive any more notifications.
reactiveui/ReactiveUI#2153 describes a problem in ReactiveUI that can be attributed to this missing Rx capability.
Although this is not insurmountable, as the PR at reactiveui/ReactiveUI#3556 shows, it would would be useful if Rx provided an out-of-the-box solution to this. We could do this by providing something like the FromAsyncWithPostCancelNotifications
extension method defined by that PR:
As @ChrisPulman points out at reactiveui/ReactiveUI#3556 (comment) we would need a set of overloads to cover all the variations.
FromAsyncWithPostCancelNotifications
might not be the ideal name for this, but we can give that some thought later.