Fixed ArgumentOutOfRangeException in AdvancedCollectionView#4349
Fixed ArgumentOutOfRangeException in AdvancedCollectionView#4349w-ahmad wants to merge 2 commits intoCommunityToolkit:mainfrom
Conversation
|
Thanks w-libs for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
Thanks @XAML-Knight, These issues are not related to AdvancedCollectionView. If you try to use CollectionViewSource, same error will happen again. So the problem is within DataGrid at line 957, where we are trying to get removed item from collection but item is not exist. |
| j++; | ||
| } | ||
| } | ||
| newViewIndex = _view.Select(x => _source.IndexOf(x)) // Get indexes of all items that are currently in view |
There was a problem hiding this comment.
Definitely worried about the performance impact here, this seems like a lot of extra work and memory to determine this calculation.
There was a problem hiding this comment.
Yes it could impact on performance, but not sure about any other possible solutions right now. Someone should have to run benchmark stuff on this method to get a better overview.
There was a problem hiding this comment.
If the unit test you added shows the failure case at least, then it'd be good if we can figure out how to fix the original algorithm here. We wouldn't want to add extra overhead to this helper.
This class is relatively isolated, so you may be able to pull it out to run benchmarking on it in isolation vs. trying to add benchmarking within the project. @Sergio0694 any tips/resources/articles to point @w-ahmad to for benchmarking code like this?

Fixes #4339
PR Type
What kind of change does this PR introduce?
Bugfix
What is the current behavior?
What is the new behavior?
PR Checklist
Please check if your PR fulfills the following requirements:
Other information