Repository navigation
[iOS] Redraw shape views when they are resized through their Frame - #40879
marcelomoresco wants to merge 1 commit into
Conversation
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
This comment has been minimized.
This comment has been minimized.
|
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. |
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 9fb649f.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…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>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Selected Tests🧪 Test selection — click to expand
🧪 UI tests —
|
| 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.csis iOS platform code and is shared by Mac Catalyst; Android and Windows are unaffected.- The
ContentMode = Redrawchange 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
MauiShapeViewhandler platform view, soCore.ShapeViewis directly affected. - Shape and BoxView controls exercise consumers of the shared shape rendering path under
Controls.ShapeandControls.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.
|
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. |
Target Branch
mainnet11, for reviewTargets
net11:mainnow targets .NET 12, which this SDK can't build;MauiShapeView.csis identical on both branches.Description of Change
A
BoxViewwithBackgroundColor, used as a separator in aCollectionView, could disappear after scrolling on iOS.A shape with a background goes through
ShapeViewHandler.NeedsContainerinto aWrapperView, which sizes the child through itsFrameinstead ofPlatformGraphicsView'sBoundssetter — the place that invalidates the view. The defaultContentModejust stretches the previous drawing, so a view that's displayed before it has a size stays blank.MauiShapeViewnow setsContentMode = Redraw, so it's invalidated whenever itsFrameresizes it.Verification
DataTemplateSelectorcollections.Without the fix, 60
BackgroundColorseparators were missing (1Colorone too); with it, only 1 remains missing, behind the Dynamic Island — an artifact of the check, not the bug.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 withColor(June 2026 comment) weren't reproduced.Issues Fixed
Fixes #32407
Let AI finish this PR