public PartialItemsRequestProgressObservable( ISerializer serializer, ProgressToken token, IObservable <TResult> requestResult, Func <IEnumerable <TItem>, TResult> factory, CancellationToken cancellationToken, Action onCompleteAction ) { _serializer = serializer; _dataSubject = new ReplaySubject <IEnumerable <TItem> >(int.MaxValue, Scheduler.Immediate); _disposable = new CompositeDisposable() { _dataSubject }; _task = Observable.Create <TResult>( observer => new CompositeDisposable() { _dataSubject .Aggregate( new List <TItem>(), (acc, data) => { acc.AddRange(data); return(acc); } ) .Select(factory) .ForkJoin( requestResult .Do( result => _dataSubject.OnNext(result ?? Enumerable.Empty <TItem>()), _dataSubject.OnError, _dataSubject.OnCompleted ), (items, result) => items?.Count() > result?.Count() ? items : result ) .Subscribe(observer), Disposable.Create(onCompleteAction) } ) .ToTask(cancellationToken); ProgressToken = token; }