TakeUntil not working as documented?

后端 未结 1 865
暗喜
暗喜 2021-01-06 02:06

From the docs for the TakeUntil operator (emphasis mine):

The TakeUntil subscribes and begins mirroring the source Observable. It also monitors a seco

相关标签:
1条回答
  • 2021-01-06 02:28

    Preston Guillot is on point in the comments section:

    The (old) MSDN Documentation is different than the main Rx site's, and only states that TakeUntil "Returns the values from the source observable sequence until the other observable sequence produces a value." without considering terminated observables.

    Let's take a look at the source code for Observable.TakeUntil, specifically class O which represents the "terminator" Observable. We can see that parent.OnCompleted notification is sent on O.OnNext and O.OnError.

    So the reason why your code is blocking, is that Observable.Empty (which acts as the "terminator") emits only an OnCompleted notification.

    0 讨论(0)
提交回复
热议问题