RX2.0: ObjectDisposedException after diposing EventLoopScheduler

后端 未结 4 1602
有刺的猬
有刺的猬 2021-01-06 03:28

We have recently ported the system from RX 1.11111 to RX 2.0 and discovered this problem. We use an EventLoopScheduler for ObserveOn like this:

IDisposable s         


        
4条回答
  •  無奈伤痛
    2021-01-06 03:48

    Partially solved. The case was more complicated then shown here. The chain went like this:

    var published = someSubject.ObserveOn(m_eventLoopScheduler).SomeMoreRXFunctions().Publish();

    IDisposable disposable1 = published.Connect();

    IDisposable disposable2 = published.Subscribe((something)=>something);

    If I disposed both disposable1 and disposable2 the code in SomeMoreRXFunctions() wasn't executed any more. On the other hand trying to dispose the scheduler itself still throws the same exception.

    Unfortunately I can't reproduce the issue in simpler code. That's probably an indication there's something else I'm missing.

    This is a solution we can live with, but still I would love to find something better that closes the scheduler all at once with no chance of exceptions.

提交回复
热议问题