Skip to content

[iOS] Redraw shape views when they are resized through their Frame - #40879

Closed
marcelomoresco wants to merge 1 commit into
dotnet:net11from
marcelomoresco:fix/32407-cv2-boxview-separator-net11
Closed

marcelomoresco wants to merge 1 commit into
dotnet:net11from
marcelomoresco:fix/32407-cv2-boxview-separator-net11

Conversation

@marcelomoresco

Copy link
Copy Markdown
Contributor

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

Targets net11: main now targets .NET 12, which this SDK can't build; MauiShapeView.cs is identical on both branches.

Description of Change

A BoxView with BackgroundColor, used as a separator in a CollectionView, could disappear after scrolling on iOS.

A shape with a background goes through ShapeViewHandler.NeedsContainer into a WrapperView, which sizes the child through its Frame instead of PlatformGraphicsView's Bounds setter — the place that invalidates the view. The default ContentMode just stretches the previous drawing, so a view that's displayed before it has a size stays blank.

MauiShapeView now sets ContentMode = Redraw, so it's invalidated whenever its Frame resizes it.

Verification

  • iOS 26.5 simulator: 107 separators checked pixel-by-pixel after 12 scrolls, across grouped and DataTemplateSelector collections.
Before After
Before After

Without the fix, 60 BackgroundColor separators were missing (1 Color one too); with it, only 1 remains missing, behind the Dynamic Island — an artifact of the check, not the bug.

  • New device test ShapeRedrawsWhenResizedByItsFrame: its logic run in the simulator reads a transparent pixel without the fix and the expected blue with it.

Not verified

Running the device test itself (this Xcode doesn't package net11), the issue's own repro app (used an equivalent scenario instead), a physical device, Mac Catalyst, iOS < 26, UI tests. The "wrong color" reports with Color (June 2026 comment) weren't reproduced.

Issues Fixed

Fixes #32407

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, the agent opens a follow-up PR that keeps your commits.

A shape view with a Background is hosted in a WrapperView, which sizes it by setting Frame. That doesn't go through the Bounds override that invalidates the drawing, and the default content mode only stretches what was already drawn, so a view displayed before it had its size stayed blank. With recycled CollectionView cells this made BoxView separators that use BackgroundColor disappear while scrolling.

MauiShapeView now uses the Redraw content mode, so UIKit redraws it whenever its size changes.

Fixes dotnet#32407
@github-actions

This comment has been minimized.

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Nov 30, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @marcelomoresco! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@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 9fb649f.

@github-actions

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue label Nov 30, 2026
@github-actions

This comment has been minimized.

kubaflo added a commit that referenced this pull request Nov 30, 2026
…utopilot (#40887)

<!-- copilot-assessment:v1 -->
### Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: `5fd5f3bbf9a20287c0fffbd88d4c3f1d8d741d5f`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 8.5/10 | ↑ Decision replayed on #40879's real NOT
QUEUED comment: stale → tests, fresh → stop.<br>↑ Workflow
compiles.<br>↓ Live retest after merge still pending (AzDO currently not
queueing builds). |
| Diagnosis confidence | 9.5/10 | ↑ #40879: test comment 15:29Z,
`/review autopilot` 15:50Z, Stopped 23s later without requesting tests.
|
| Evidence fit | 9/10 | ↑ Explains why restarting Autopilot after the
AzDO outage cannot recover #40709/#40710/#40836/#40879. |
<!-- /copilot-assessment -->

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

When the latest `/review run-tests` result for the PR head is an error,
NOT QUEUED or CANCELED, Autopilot stopped immediately — even if that
result predates the current `/review autopilot`. So after an infra
outage (dnceng-public AzDO not queueing builds), re-commenting `/review
autopilot` could never retry the tests.

Now a stale incomplete run (last updated before the loop started)
requests `/review run-tests` again; an incomplete run produced during
the current loop still stops, so there is no retry loop.

Validation: replayed the stage decision against #40879's real test
comment; `gh aw compile maui-expert-autopilot` succeeds.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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

This comment has been minimized.

@github-actions github-actions Bot added s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run and removed s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selected Tests

Result NOT QUEUED Platforms iOS, MacCatalyst Tests 9 UI, 3 device Commit 9fb649fb


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ❌ not queued 9 of 77 categories —
Device tests ❌ not queued 3 of 105 units —
🧪 UI tests — BoxView, CollectionView1, CollectionView2, CollectionView3 +5 on iOS, MacCatalyst

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

GPT-6.2 Sol: Validate shape redraws and the disappearing CollectionView separator scenario on iOS and Mac Catalyst.
MAI Code 2: iOS ShapeView frame-redraw fix; run shape, BoxView, and CollectionView UI tests on iOS and Mac Catalyst.

🧪 Running — 9 categories on iOS, MacCatalyst

Platform Categories
iOS BoxView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Shape
MacCatalyst BoxView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Shape
🧪 Device tests — Controls.BoxView, Controls.Shape, Core.ShapeView on iOS, MacCatalyst

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

GPT-6.2 Sol: Run the new frame-resize regression and shape and BoxView rendering tests on iOS and Mac Catalyst.
MAI Code 2: Run iOS and Mac Catalyst ShapeView handler and shape/BoxView controls device tests for the frame-resize redraw change.

🧪 Running — 3 categories on iOS, MacCatalyst

Platform Categories
iOS Controls.BoxView, Controls.Shape, Core.ShapeView
MacCatalyst Controls.BoxView, Controls.Shape, Core.ShapeView
⏭️ Skipped — what neither suite runs

UI tests — 68 categories, 2 platforms

Platforms not run: Android, Windows

Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, Brush, Button, CarouselView, 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, 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 — 102 categories, 2 platforms

Platforms not run: Android, Windows

Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, 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.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.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 Shape, BoxView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7 Shape, BoxView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7
MacCatalyst Shape, BoxView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7 Shape, BoxView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7
Windows — —

GPT-6.2 Sol — Validate shape redraws and the disappearing CollectionView separator scenario on iOS and Mac Catalyst.

  • MauiShapeView redraws on Frame resize: run Shape and BoxView on iOS and Mac Catalyst.
  • Run CollectionView because BoxView separators could disappear after scrolling.
  • No Android, Windows, or unrelated lanes: the change is UIKit shape-specific.

MAI Code 2 — iOS ShapeView frame-redraw fix; run shape, BoxView, and CollectionView UI tests on iOS and Mac Catalyst.

  • MauiShapeView.cs is iOS platform code and is shared by Mac Catalyst; Android and Windows are unaffected.
  • The ContentMode = Redraw change directly affects Shape/ShapeView rendering and BoxView implementations that use it.
  • CollectionView coverage targets the reported separator-disappearance scenario during scrolling and cell resizing.
  • Unrelated UI categories are excluded because the change is limited to iOS shape invalidation.

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 Core.ShapeView, Controls.Shape, Controls.BoxView Core.ShapeView, Controls.Shape, Controls.BoxView
MacCatalyst Core.ShapeView, Controls.Shape, Controls.BoxView Core.ShapeView, Controls.Shape, Controls.BoxView
Windows — —

GPT-6.2 Sol — Run the new frame-resize regression and shape and BoxView rendering tests on iOS and Mac Catalyst.

  • Core.ShapeView contains the new Frame-resize pixel regression.
  • Controls.Shape and Controls.BoxView cover rendering and backgrounds on the affected UIKit path.
  • No broader device units or other platforms: shared layout and collection handlers are unchanged.

MAI Code 2 — Run iOS and Mac Catalyst ShapeView handler and shape/BoxView controls device tests for the frame-resize redraw change.

  • The production change is in the iOS MauiShapeView handler platform view, so Core.ShapeView is directly affected.
  • Shape and BoxView controls exercise consumers of the shared shape rendering path under Controls.Shape and Controls.BoxView.
  • The new device test is iOS-specific, while the production file also compiles for Mac Catalyst.
  • No Graphics, Essentials, or unrelated device units are affected.

Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.

@github-actions github-actions Bot added s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue and 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 Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

MAUI Autopilot — Stopped

@kubaflo ❌ The test run could not complete. A maintainer can re-run /review run-tests and comment /review autopilot again.

@kubaflo

kubaflo commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for the investigation and the detailed measurements. We are closing this rather than changing the default redraw behavior for every shape view on iOS and Mac Catalyst. The change is behavioral and can increase redraws; an actual breaking scenario has not been demonstrated.

A narrower, opt-in BoxView customization is documented in #32407. It has not been verified against the original reproduction, and closing this PR does not mean the underlying regression is fixed.

This branch was previously deployed

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

Labels

community ✨ Community Contribution s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants