Fixes #4791 - ListView guards against out-of-range IListDataSource calls#4792
Merged
tig merged 4 commits intov2_developfrom Mar 5, 2026
Merged
Fixes #4791 - ListView guards against out-of-range IListDataSource calls#4792tig merged 4 commits intov2_developfrom
tig merged 4 commits intov2_developfrom
Conversation
Refactored OnDrawingContent to use Viewport properties (X, Y, Width, Height) throughout, replacing the local Rectangle variable. Improved safety by checking item bounds before calling IsMarked. Replaced local focus variable with direct HasFocus property usage. Updated drawing loops and Source.Render calls to use Viewport dimensions, and removed redundant variables for clarity. These changes ensure rendering is always consistent with the current viewport and improve code readability.
…ce count (2), asserts IsMarked is never called with index >= 2 - Draw_DoesNotCall_Render_OutOfRange — Same setup, asserts Render is never called with out-of-range index - Draw_DoesNotCall_SetMark_OutOfRange — Same setup with ShowMarks = true, asserts SetMark is never called with out-of-range index
Refactored the logic for determining the visual role in ListView from nested if/else statements to a switch statement using C# pattern matching on ShowMarks and MarkMultiple. This improves code clarity and maintainability while preserving existing behavior for all four selection/marking combinations. No changes to public APIs or event signatures.
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (60.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## v2_develop #4792 +/- ##
==============================================
+ Coverage 77.60% 77.64% +0.03%
==============================================
Files 464 464
Lines 45835 45822 -13
Branches 6859 6861 +2
==============================================
+ Hits 35572 35579 +7
+ Misses 8252 8235 -17
+ Partials 2011 2008 -3
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
BDisp
approved these changes
Mar 4, 2026
Expand ListViewTests with coverage for IValue events (Value, ValueChanging, ValueChanged), keyboard mark/unmark (Ctrl+A/U), and RowRender attribute overrides. Also improve mock setup formatting. These tests ensure correct behavior for selection, event firing, and row rendering customization.
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ListView.OnDrawingContentshould be defensive toitem<Source.Count#4791Summary
Guards
IsMarkedcall inOnDrawingContentwithitem < Source?.Countso it never passes out-of-range indices toIListDataSourceimplementations when the Viewport is taller than the item count\n- Refactors drawing loop to useViewportdirectly instead of separate local variablesIsMarked,Render, andSetMarkare never called with out-of-range indices