I've got a BusinessListBase with multiple LinqObservableCollections (LOC) pointed at it. I've noticed a few things.
1) when a new object is added to the BusinessListBase, that object appears in all filtered lists, without conforming to the filter (understandably so since the LINQ query returns an enumeration).
2) when an object is deleted from the original list the LOCs which do not have that object in their list, throw an InvalidOperationException stating "Cannot find removed item." When the LOCs are not databound, the exception is not thrown.
The first is minor, the second is a little bigger of an issue.
Since the LOC is a filtered view, in the lamda expression which handles the _baseCollection.CollectionChanged event (line 54 of LinqObservableCollection) we check the returned indexes to see if they are > -1.
item = (T)e.OldItems;
index = _filteredCollection.IndexOf(item);
if(index > -1)
newE = new NotifyCollectionChangedEventArgs(e.Action, item, index);
I apologize if I have not formatted things correctly, I'm not sure if there are any code tags on this forum.
Thank you, I'll file this as a bug.
Interestingly enough, I have been unable to create a failing unit test for this issue.
Still, the code change you propose makes sense, so I've made this change to 4.5.13.
Copyright (c) Marimer LLC