mono-reactive
mono-reactive copied to clipboard
Use SerialDisposable in Concat() implementation.
Currently we use CompositeDisposable to handle disposables from IObservable.Subscribe() on each IObservable object. This is not effective and it should be possible to use SerialDisposable instead. However, somehow that class does not work.
It could be a bug in SerialDisposable, or wrong usage in Concat() implementation.
The problem seems gone.
Actually I had to revert this back. For some reason, it is likely that some concatenated IObservable's Subscribe() result is set to SerialDisposable.Disposable in unexpected order, so that the sequence is disposed before iterating to the next observable.
I have added a test case as HistoricalSchedulerTest.AdvanceByRaisesEvent2() that uncovered this implementation issue (though I cannot identify which part of the library code is problematic).