-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception on Update or Remove in ObservableDictionary after upgrading to 0.8 #1
Comments
Hey there! Thanks for reporting the problem.. but that's strange.. the ObservableDictionary class hasn't changed since March 2016 (and the line mentioned)... hrm. Same for the extension method used.. that last one converts the events to NotifyCollectionChangedEvent(Args) via this method.. so either of the two is doing something 'wrong' / different what WPF expects. Digging a little around Stephen Clearly explains a little more in-depth what properties for the event args must/should be set to which value(s). I can't fix this at the moment myself (and none of my active projects currently use the ObservableDictionary so no immediate client need, too), but if you want to take a stab at it and send a PR over, it would be highly welcome! |
Thanks for quick reply! Yeah, I also stumbled upon that article from Stephen Clearly but it didn't help me much so far. btw: |
Here's the version details and commit sha for 0.7.0 (at the top): https://ci.appveyor.com/project/jbattermann/jb-common/build/41/artifacts A lot changed from there on, yeah and while there are tests (https://github.com/jbattermann/JB.Common/tree/d8013fe8c2339ce697ea7e30b81dbe762581ac16/JB.Common.Collections.Reactive.Tests ... the ObservableDictionary* ones), this one apparently slipped through or WPF assumes something I did not anticipate :-/ |
Ok thanks alot! I have that |
I can say this is the last working commit: The follow-up commit shows the error (at least when updating items): |
Hello gentlemen,
I have been using this cool library for quite some time without problems with version
0.7.0
. Yesterday I updated via nuget to version0.8.114
and I am seeing some exceptions now.I am using
ObservableDictionary
in a WPF-Application bound by XAML to aListView
. So when I add items to theObservableDictionary
then they show up in theListView
. This still works fine.The problem is:
As soon as I try to update or remove an item in the dictionary then I see an exception.
For debugging purpose I checked out the project from Github and I am on this commit:
a37aee7771a2a92f8e6865d5d5cc0901aa0d506d
This is the exception on update:
System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.'
This is for the remove operation:
System.InvalidOperationException: 'Collection Remove event must specify item position.'
I tried to find out what the problem is and I think the WPF UI has subscribed changes of the
ObservableDictionary
. Now when an item changes theObservableDictionary
generates aNotifyCollectionChangedEventArgs
which triggers the exception. Seems like the object is somehow unexpected for the framework.The text was updated successfully, but these errors were encountered: