Describe the bug 🐞
TransformAsync on IChangeSet can silently drop events from the output observable. Specifically, it looks like in a change set that has both Remove and Add events, the Remove event is dropped.
Step to reproduce
The following test reproduces the problem. It uses a dummy transform. The last Assert fails.
public class TR
{
public long ID { get; set; }
public string Name { get; set; } = string.Empty;
}
[Fact(Timeout = 5000)]
public async Task TransformAsyncTest()
{
var trA = new TR() { ID = 1, Name = "Foo" };
var trB = new TR() { ID = 1, Name = "Bar" };
List<ChangeSet<TR>> changes = [
new ChangeSet<TR>([
new Change<TR>(ListChangeReason.Add, trA )]),
new ChangeSet<TR>([
new Change<TR>(ListChangeReason.Remove, trA ),
new Change<TR>(ListChangeReason.Add, trB )])];
var observable = changes.ToObservable();
var changesSync = new List<IChangeSet<TR>>();
using var _1 = observable.Subscribe(changesSync.Add);
Assert.Equal(2, changesSync.Count);
Assert.Equal(1, changesSync[0].Count);
Assert.Equal(2, changesSync[1].Count);
var changesAsync = new List<IChangeSet<TR>>();
static async Task<TR> transform(TR rec, Optional<TR> existing) => rec;
using var _2 = observable.TransformAsync<TR, TR>(transform).Subscribe(changesAsync.Add);
Assert.Equal(2, changesAsync.Count);
Assert.Equal(1, changesAsync[0].Count);
Assert.Equal(2, changesAsync[1].Count);
}
Reproduction repository
https://github.com/FilippoPolo/DynamicData
Expected behavior
I would expect a dummy transform not to change the output.
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
DynamicData Version
9.4.33
Additional information ℹ️
No response
Describe the bug 🐞
TransformAsync on IChangeSet can silently drop events from the output observable. Specifically, it looks like in a change set that has both Remove and Add events, the Remove event is dropped.
Step to reproduce
The following test reproduces the problem. It uses a dummy transform. The last Assert fails.
Reproduction repository
https://github.com/FilippoPolo/DynamicData
Expected behavior
I would expect a dummy transform not to change the output.
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
DynamicData Version
9.4.33
Additional information ℹ️
No response