public virtual void ForEach <TSource>(IObservable <TSource> source, Action <TSource> onNext) { using var sink = new ForEach <TSource> .Observer(onNext); using (source.SubscribeSafe(sink)) { sink.Wait(); } sink.Error?.Throw(); }