Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Clearing Bound ObservableCollection causes System.InvalidOperationException: 'Added item does not appear at given index '0'.' #2267
When calling ObservableCollection.Clear() and then re-loading (i.e. adding) items back into ObservableCollection, a System.InvalidOperationException: 'Added item does not appear at given index '0'.' gets thrown. I have provided a snippet of my code below. I have indicated where the issue is.
And here is the stack trace:
I'm not part of the WPF team but you'll probably have to add more context (ideally a piece of code which can be used to reproduce the scenario). The stack trace indicates that WPF is processing keyboard input when things go wrong and your issue description contains no information of what you were doing to trigger this or how