DynamicData
DynamicData copied to clipboard
Virtualise and Page cause exception on non-unique list
Virtualise and Page methods cause ArgumentOutOfRangeException if the list contains equal elements. Is it by design or a bug?
var source = new SourceList<string>();
source.AddRange(Enumerable.Repeat("item", 10));
source.Connect()
.Virtualise(new BehaviorSubject<IVirtualRequest>(new VirtualRequest(0, 3)))
.Subscribe();
or
var source = new SourceList<string>();
source.AddRange(Enumerable.Repeat("item", 10));
source.Connect()
.Page(new BehaviorSubject<IPageRequest>(new PageRequest(0, 3)))
.Subscribe();
Tested on version 7.4.9
The exception seems to occur because Virtualise and Page use LINQ Except method to detect added and removed items.
var adds = current.Except(previous);
var removes = previous.Except(current);
This approach works fine when all items in the list are unique, but fails when there are equal items.
Out of interest, is there an obvious and easy alternative to using linq?
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.