RolandPheasant / DynamicData.ReactiveUI

Adaptors to integrate Dynamic Data with ReactiveUI
Microsoft Public License
63 stars 9 forks source link

Bind to ReactiveList can destroy further DisposeMany/OnItemRemoved #5

Closed StefanDoubleU closed 8 years ago

StefanDoubleU commented 8 years ago

Under some circumstances, it happens that after Bind() the OnItemRemoved is not getting called. I wasn't able to get any differences when it happens and when its working. (have two similar places I use it)

With ObservableCollectionExtended, everything work as expected.

var sc = new SourceCache<int, int>(i => i.GetHashCode());
var rl = new ReactiveList<int>();

sc.Connect()
   .OnItemRemoved(model => Logger.Info("removed"))
   .Bind(rl)
   .OnItemRemoved(model => Logger.Info("removed after"))
   .DisposeMany()
   .Subscribe()
StefanDoubleU commented 8 years ago

ObserveOnDispatcher() fixes the issue. OnItemRemoved is only getting called if Bind is already on the dispatcher, which is recommended anyway.

But, is it really good, that DisposeMany is depended on the Scheduler?

RolandPheasant commented 8 years ago

Have you tried subscribing to exceptions?

RolandPheasant commented 8 years ago

Dynamic data is scheduler agnostic

StefanDoubleU commented 8 years ago

Unfortunately, everything looks fine in the first place. Even the binding works.

RolandPheasant commented 8 years ago

It could be a thread exception