Skip to content

Reuse Windows CollectionView clip geometry - #40870

Merged
kubaflo merged 1 commit into
mainfrom
simonrozsival-windows-clip-geometry-reuse
Nov 30, 2026
Merged

kubaflo merged 1 commit into
mainfrom
simonrozsival-windows-clip-geometry-reuse

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: bc18b85cffdc5bdd490d08672069a1ae30881da3

Dimension Assessment Rationale
Change confidence 7/10 ↑ ArrangeOverride now 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

This PR is for Initial base
New features, API changes, or .NET 12 work (including .NET 12 fixes) main
.NET 11 servicing fixes net11, for review
Older servicing, release integration, infrastructure, or documentation The branch designated for that work

For .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 RectangleGeometry per ElementWrapper in the MeasureFirstItem arrange path. Update the rectangle only when its bounds change and assign Clip only 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 with NETSDK1005 because project-reference assets lacked the net12.0 target.

Issues Fixed

N/A — performance optimization; no linked issue.

Let AI finish this PR

  • Let the MAUI agent address review feedback and fix remaining issues on this PR. Maintainers still decide whether it is merged. For PRs from forks, keep "Allow edits by maintainers" on so the agent can push to your branch; otherwise it opens a follow-up PR that keeps your commits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 13:31
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 RectangleGeometry per ElementWrapper instead of allocating one on every arrange.
  • Updates rectangle bounds only when they change and assigns Clip only 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

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — No findings

Reviewed commit bc18b85.

@github-actions

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it label Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

MAUI Autopilot — Started

Models
  • Review: GPT-6.1 Sol (MAUI expert reviewer)
  • Fix: GPT-6.2 Sol, MAI Code 2 and Claude Opus 5.5 fix independently, then cross-examine each other; the best fix is kept
  • Test selection: GPT-6.2 Sol and MAI Code 2
Info
Label Meaning
s/autopilot-reviewing The MAUI expert reviewer is reviewing the PR
s/autopilot-fixing Fixing review findings or failing tests
s/autopilot-testing Running the relevant UI and device tests
s/autopilot-waiting-for-maintainer-review Review clean and tests passed
s/autopilot-needs-maintainer-decision The loop stopped; a maintainer decides how to continue

@github-actions github-actions Bot added the s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run label Nov 30, 2026
@kubaflo
kubaflo merged commit 2132a51 into main Nov 30, 2026
12 of 15 checks passed
@kubaflo
kubaflo deleted the simonrozsival-windows-clip-geometry-reuse branch November 30, 2026 22:16
@github-actions

Copy link
Copy Markdown
Contributor

Selected Tests

Result NOT QUEUED Platforms Windows Tests 8 UI, 2 device Commit bc18b85c


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ❌ not queued 8 of 77 categories —
Device tests ❌ not queued 2 of 105 units —
🧪 UI tests — CarouselView, CollectionView1, CollectionView2, CollectionView3 +4 on Windows

❌ Could not queue maui-pr-uitests: Azure Pipelines did not start maui-pr-uitests for the dispatch branch run-tests/pr40870-46524681652 within 10 minutes. Comment /review run-tests again, or use /azp run maui-pr-uitests for the full suite.

GPT-6.2 Sol: Run Windows CollectionView UI tests for the MeasureFirstItem clip reuse change.
MAI Code 2: Windows-only CollectionView2 clip geometry reuse; runs CollectionView and CarouselView UI tests on Windows.

🧪 Running — 8 categories on Windows

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.

@kubaflo kubaflo removed s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run labels Dec 1, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — bc18b85c Deployed Nov 30, 2026 by simonrozsival via conclusion #3518
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants