SortedBindingList exception in 5.4.2, but works in 4.11.2 #2301
Unanswered
michaelcsikos
asked this question in
Questions
Replies: 1 comment 2 replies
-
I suspect a change in .NET itself, as the history for SortedBindingList shows it hasn't changed in at least 6 years. Probably a lot longer would be my guess, as I haven't dealt with Windows Forms for a very long time. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've noticed some different behaviour which has shown up in
SortedBindingList
but I'm not sure this class is the root cause of the issue.I have a
BusinessBindingListBase
wrapped in aSortedBindingList
which is bound to aBindingSource
. Then add one or more new items to the list, then cancel the edit following the typical pattern. From the attached minimal test sample:In version 5.4.2,
current.CancelEdit()
is crashing inSortedBindingList
in theSourceChanged(object sender, ListChangedEventArgs e)
method handling thecase ListChangedType.ItemDeleted
. This method is being called twice with the same arguments, so when it goes to remove from the internal list it's throwing index out of range.I suppose the question is, why does
SourceChanged
get called twice in 5.4.2?The attached sample tests this for both 4.11.2 and 5.4.2. Click Add item one or more times, then click Cancel.
CslaSortedBindingListTest.zip
Are we supposed to be doing something different in 5.4.2? We've been using code like this for a very long time.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions