DynamicData icon indicating copy to clipboard operation
DynamicData copied to clipboard

[Bug]: ArgumentOutOfRangeException/Index out of range exception when using TransformAsync

Open oysteinkrog opened this issue 3 years ago • 1 comments

Describe the bug 🐞

Message: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Source: System.Private.CoreLib
TargetSite: Void ThrowArgumentOutOfRange_IndexException()
StackTrace:
   at void DynamicData.ChangeAwareList<T>.InsertItem(int index, T item) in /_/src/DynamicData/List/ChangeAwareList.cs:line 445
   at async Task DynamicData.List.Internal.TransformAsync<TSource, TDestination>.Transform(ChangeAwareList<TransformedItemContainer> transformed, IChangeSet<TSource> changes) in /_/src/DynamicData/List/Internal/TransformAsync.cs:line 78
   at async Task<ChangeAwareList<TransformedItemContainer>> DynamicData.List.Internal.TransformAsync<TSource, TDestination>+<>c__DisplayClass3_0.<Run>b__1(?)+(?) => { } in /_/src/DynamicData/List/Internal/TransformAsync.cs:line 52
   at void System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServicesImpl.cs:line 19
   at void System.Reactive.ExceptionHelpers.Throw(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs:line 16
   at void System.Reactive.Stubs.Throw(Exception ex) in /_/Rx.NET/Source/src/System.Reactive/Internal/Stubs.cs:line 16
   at void System.Reactive.AnonymousSafeObserver<T>.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 62
   at void System.Reactive.Sink<TTarget>.ForwardOnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 60
   at void System.Reactive.Concurrency.Synchronize<TSource>+_.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.Synchronize.cs:line 50
   at void System.Reactive.AutoDetachObserver<T>.OnErrorCore(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/AutoDetachObserver.cs:line 77
   at void System.Reactive.ObserverBase<T>.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 59
   at void System.Reactive.Sink<TTarget>.ForwardOnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 60
   at void System.Reactive.Sink<TSource, TTarget>.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 94
   at void System.Reactive.Subjects.Subject<T>.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 120
   at void DynamicData.SourceList<T>.OnError(Exception exception) in /_/src/DynamicData/List/SourceList.cs:line 204
.....
....


InnerException(1): System.ArgumentOutOfRangeException
Message: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Source: System.Private.CoreLib
TargetSite: Void ThrowArgumentOutOfRange_IndexException()
StackTrace:
   at void DynamicData.ChangeAwareList<T>.InsertItem(int index, T item) in /_/src/DynamicData/List/ChangeAwareList.cs:line 445
   at async Task DynamicData.List.Internal.TransformAsync<TSource, TDestination>.Transform(ChangeAwareList<TransformedItemContainer> transformed, IChangeSet<TSource> changes) in /_/src/DynamicData/List/Internal/TransformAsync.cs:line 78
   at async Task<ChangeAwareList<TransformedItemContainer>> DynamicData.List.Internal.TransformAsync<TSource, TDestination>+<>c__DisplayClass3_0.<Run>b__1(?)+(?) => { } in /_/src/DynamicData/List/Internal/TransformAsync.cs:line 52
   at void System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServicesImpl.cs:line 19
   at void System.Reactive.ExceptionHelpers.Throw(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/ExceptionServices.cs:line 16
   at void System.Reactive.Stubs.Throw(Exception ex) in /_/Rx.NET/Source/src/System.Reactive/Internal/Stubs.cs:line 16
   at void System.Reactive.AnonymousSafeObserver<T>.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 62
   at void System.Reactive.Sink<TTarget>.ForwardOnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 60
   at void System.Reactive.Concurrency.Synchronize<TSource>+_.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.Synchronize.cs:line 50
   at void System.Reactive.AutoDetachObserver<T>.OnErrorCore(Exception exception) in /_/Rx.NET/Source/src/System.Reactive/Internal/AutoDetachObserver.cs:line 77
   at void System.Reactive.ObserverBase<T>.OnError(Exception error) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 59

Step to reproduce

I will try to create a repro scenario.

Reproduction repository

N/A yet

Expected behavior

Exception should not happen :)

Screenshots 🖼️

No response

IDE

No response

Operating system

No response

Version

No response

Device

No response

DynamicData Version

7.9.7

Additional information ℹ️

This is with the latest DD version (after index out of range fix for normal Transform).

oysteinkrog avatar Jul 29 '22 13:07 oysteinkrog

I hope this is fixed now. Can you try and let me know

RolandPheasant avatar Sep 06 '22 20:09 RolandPheasant

I think these should have been fixed. Can you confirm @oysteinkrog?

RolandPheasant avatar Nov 23 '22 12:11 RolandPheasant

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 08 '22 01:12 github-actions[bot]