Repository navigation
Reuse Windows CollectionView clip geometry - #40870
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Windows compilation and runtime validation are unavailable, leaving rendered clipping during resizing and wrapper recycling unconfirmed when RectangleGeometry is mutated without reassigning Clip; existing tests check bounds rather than pixels.
No open issues 🎉
What changed in this PR
Optimizes the Windows CollectionView Items2 handler’s MeasureFirstItem arrange path by reusing clip geometry while preserving the existing clipping bounds.
Changes:
- Caches one
RectangleGeometryperElementWrapperinstead of allocating one on every arrange. - Updates rectangle bounds only when they change and assigns
Cliponly when needed.
Windows runtime behavior and before/after performance remain unverified, as noted in the PR description.
| File | Description |
|---|---|
src/Controls/src/Core/Handlers/Items2/Windows/ItemFactory.cs |
Caches clip geometry and skips unchanged bounds and clip assignments. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — No findings
Reviewed commit bc18b85.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
MAUI Autopilot — StartedModels
Info
|
Selected Tests🧪 Test selection — click to expand
🧪 UI tests —
|
| Platform | Categories |
|---|---|
| Windows | CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7 |
🧪 Device tests — Controls.CarouselView, Controls.CollectionView on Windows
❌ Could not queue maui-pr-devicetests: Azure Pipelines did not start maui-pr-devicetests for the dispatch branch run-devicetests/pr40870-46524681652 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-devicetests for the full suite.
GPT-6.2 Sol: Run Windows Controls.CollectionView device tests for the CollectionViewHandler2 item wrapper change.
MAI Code 2: Windows-only Items2 wrapper clipping change; runs CollectionView and CarouselView control device tests on Windows.
🧪 Running — 2 categories on Windows
| Platform | Categories |
|---|---|
| Windows | Controls.CarouselView, Controls.CollectionView |
⏭️ Skipped — what neither suite runs
UI tests — 69 categories, 3 platforms
Platforms not run: Android, iOS, MacCatalyst
Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Editor, Effects, Essentials, FlyoutPage, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, Lifecycle, ManualReview, Maps, Navigation, Page, Performance, Picker, ProgressBar, RadioButton, RefreshView, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, Shell1, Shell2, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, Window, WebView, Material3
Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.
Device tests — 103 categories, 3 platforms
Platforms not run: Android, iOS, MacCatalyst
Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CheckBox, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Editor, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.FlyoutPage, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Lifecycle, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Modal, Controls.NavigationPage, Controls.Page, Controls.PageTransitions, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.RefreshView, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Shell, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.Window, Controls.WindowOverlay, Controls.Xaml, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay, Graphics, Essentials, BlazorWebView
Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.
🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)
UI tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | — | — |
| iOS | — | — |
| MacCatalyst | — | — |
| Windows | CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7 |
CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, CarouselView |
GPT-6.2 Sol — Run Windows CollectionView UI tests for the MeasureFirstItem clip reuse change.
- Items2/Windows/ItemFactory.cs changes clipping during arrange of realized CollectionView items, including reused containers.
- Skip other platforms and CarouselView: the change is WinUI-only and Windows CarouselView uses a separate handler.
MAI Code 2 — Windows-only CollectionView2 clip geometry reuse; runs CollectionView and CarouselView UI tests on Windows.
- src/Controls/src/Core/Handlers/Items2/Windows/ItemFactory.cs changes Windows item-wrapper clipping during arrange, selecting Windows only.
- Items2 affects CollectionView2 and CarouselView behavior, so both mapped UI categories are selected.
- CollectionView uses the umbrella to cover every enabled CollectionView shard on Windows.
- Other platforms are omitted because the file is Windows-specific; no wide-blast-radius full run is needed.
Device tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | — | — |
| iOS | — | — |
| MacCatalyst | — | — |
| Windows | Controls.CollectionView |
Controls.CollectionView, Controls.CarouselView |
GPT-6.2 Sol — Run Windows Controls.CollectionView device tests for the CollectionViewHandler2 item wrapper change.
- CollectionViewTests.Windows.cs exercises CollectionViewHandler2, whose item wrappers now reuse clip geometry.
- Exclude CarouselView, Core, and other platforms: Windows CarouselView uses the legacy Items handler, and no Core or shared code changed.
MAI Code 2 — Windows-only Items2 wrapper clipping change; runs CollectionView and CarouselView control device tests on Windows.
- The changed Items2 handler is under the Windows platform path, selecting Windows only.
- Items2 handler changes map to Controls.CollectionView and Controls.CarouselView device-test units.
- The change is localized to item-wrapper clip geometry, so the full Controls/Core suites and unrelated platforms are omitted.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
bc18b85cffdc5bdd490d08672069a1ae30881da3ArrangeOverridenow reuses a per-wrapper rectangle geometry and avoids unchanged clip assignments.↓ Windows compilation, runtime behavior, and before/after profiling remain unverified.
[!NOTE]
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Target Branch
mainnet11, for reviewFor .NET 11 fixes, only a maintainer retargets the approved PR to the active
inflight lane and merges it after CI validates that final base. Do not merge
individual fixes directly into
net11; agents must not retarget or merge.Description of Change
Reuse a
RectangleGeometryperElementWrapperin theMeasureFirstItemarrange path. Update the rectangle only when its bounds change and assignCliponly when needed, avoiding a new geometry allocation for every arrange while retaining the same clipping bounds.Validation: Windows runtime validation and before/after profiling have not been performed. A local cross-target build was attempted with
dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 --no-restore -p:EnableWindowsTargeting=true --verbosity quiet; it stopped withNETSDK1005because project-reference assets lacked thenet12.0target.Issues Fixed
N/A — performance optimization; no linked issue.
Let AI finish this PR