Skip to content

[Bug]: FilterOnObservable().Transform().Bind() causes Exception #533

Description

@J0nnyI

Version: Current (7.4.3)

I was able to write a minimal Unittest to reproduce the issue, shuffling the operators solves the problem but has performance implications.

Exception:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at DynamicData.List.Internal.Transformer`2.Transform(ChangeAwareList`1 transformed, IChangeSet`1 changes) in /_/src/DynamicData/List/Internal/Transformer.cs:line 50
   at DynamicData.List.Internal.Transformer`2.<Run>b__4_0(ChangeAwareList`1 state, IChangeSet`1 changes) in /_/src/DynamicData/List/Internal/Transformer.cs:line 38
   at System.Reactive.Linq.ObservableImpl.Scan`2._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Scan.cs:line 40

Unittest for reproduction:

[Test]
public void Bind_Transform_and_FilterOnObservable()
{
    var count = 3;
    var list = new SourceList<string>();
    list.AddRange(Enumerable.Range(1, count).Select(c => $"item {c}"));
    var bindedList = new ObservableCollectionExtended<string>();
    list.Connect()
        .FilterOnObservable(_ => Observable.Return(true))
        .Transform(str => str)
        .Bind(bindedList)
        .Subscribe(
            _ => { },
            ex => Assert.Fail("exception thrown: {0}", ex) // causes the test to fail
        );
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions