Skip to content

[iOS] Fix collapsed layouts staying unmeasured after becoming visible - #40894

Merged
kubaflo merged 2 commits into
dotnet:mainfrom
Redth:fix-collapsed-measure-invalidation
Nov 30, 2026
Merged

kubaflo merged 2 commits into
dotnet:mainfrom
Redth:fix-collapsed-measure-invalidation

Conversation

@Redth

@Redth Redth commented Nov 30, 2026

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 2c39636936c735896d9c2e22795cf80134ec61fc

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ New device test fails without the fix and passes with it (iOS 27.2 simulator).
↑ All 35 LayoutTests and the ScrollView category pass on the net11.0 branch.
↓ Validated on net11.0; main builds need a .NET 12 SDK I did not have, though the touched code is identical.
↓ Mac Catalyst not run separately.
Diagnosis confidence 9/10 ↑ Traced the latched _measureInvalidatedPropagated flag on the affected views with logging in a real app.
↑ Each part of the fix is needed: removing either one makes a repro fail.
Evidence fit 9/10 ↑ Fixes the blank chip row in the .NET MAUI Gallery header on iPhone, verified on device.

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!

Description of Change

#33459 made iOS MauiView skip repeated measure invalidation with the _measureInvalidatedPropagated flag, which is reset when the view is measured (SizeThatFits) or laid out (LayoutSubviews). In two cases the flag stays set and a later, real invalidation stops at the view, so its ancestors never re-measure:

  1. Hidden views. A collapsed view is skipped by its parent's measure and arrange, so the flag set while it was hidden is never reset. When it becomes visible its invalidation never reaches the parent and it stays at zero size.
    • Don't latch the flag while the view is Hidden, and reset it whenever Hidden changes.
  2. Invalidation during measure. SizeThatFits resets the flag before measuring descendants. If that measure invalidates a descendant again, the flag is latched while the fresh size is cached as valid.
    • Reset the flag again after the measure result is cached.

Adds CollapsedLayoutMadeVisibleDuringArrangeIsMeasured to the iOS layout device tests: a collapsed FlexLayout made visible from OnSizeAllocated inside a ScrollView. It fails without this change and passes with it.

Issues Fixed

Fixes #40893

MauiView latches _measureInvalidatedPropagated to stop redundant measure
invalidation propagation (dotnet#33459). The flag was left set in two cases where
no later measure or layout pass resets it before the next real change:

- A hidden (IsVisible=false) view is skipped by its parent's measure and
  arrange, so the flag set while hidden swallowed the invalidation raised
  when it became visible again. Don't latch the flag while hidden, and reset
  it when Hidden changes.
- Measuring descendants in SizeThatFits can invalidate them again (for
  example when content is updated during measure), latching the flag while
  the new size is cached as valid. Reset it after caching the measure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 17:42
@Redth
Redth temporarily deployed to copilot-pat-pool November 30, 2026 17:42 — with GitHub Actions Inactive
@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

The shared MauiView invalidation change needs platform-owner confirmation because runtime evidence comes from another branch, while target-branch and Mac Catalyst native layout behavior remain unverified.

No open issues 🎉

What changed in this PR

Fixes #40893, a regression from #33459 where collapsed layouts could remain at zero size after becoming visible on iOS and Mac Catalyst. The change adjusts MauiView’s measure-invalidation tracking so later size changes can reach ancestor views.

Changes:

  • Avoid latching invalidation propagation while hidden, and reset it when visibility changes or measurement completes.
  • Add a device regression test that reveals a collapsed layout during arrange inside a ScrollView.
  • Record the Hidden override in both Apple-platform public API files.
File Description
src/​Core/​src/​PublicAPI/​net-maccatalyst/​PublicAPI.Unshipped.txt Records the Hidden override for Mac Catalyst.
src/​Core/​src/​PublicAPI/​net-ios/​PublicAPI.Unshipped.txt Records the Hidden override for iOS.
src/​Core/​src/​Platform/​iOS/​MauiView.cs Resets invalidation tracking after measurement and visibility changes; avoids latching while hidden.
src/​Controls/​tests/​DeviceTests/​Elements/​Layout/​LayoutTests.iOS.cs Adds coverage for a collapsed layout becoming visible during arrange.

Review effort: Balanced

@Redth
Redth temporarily deployed to copilot-pat-pool November 30, 2026 17:48 — with GitHub Actions Inactive
@Redth
Redth temporarily deployed to copilot-pat-pool November 30, 2026 17:48 — with GitHub Actions Inactive
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@Redth

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 the s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress label Nov 30, 2026

@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 2c39636.

@github-actions github-actions Bot added s/autopilot-testing MAUI Autopilot: relevant UI/device tests are being selected or run and removed s/autopilot-reviewing MAUI Autopilot: MAUI expert review in progress labels Nov 30, 2026
@github-actions

This comment has been minimized.

@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

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

@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 — 1 finding

Reviewed commit 2c39636.

See inline comments for details.

// A hidden view is skipped by its parent's measure and arrange, so SizeThatFits and
// LayoutSubviews would never run to reset the flag. Don't latch it while hidden,
// or the invalidation raised when the view becomes visible again would be swallowed.
if (!Hidden)

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.

[moderate] Performance-Critical Path Optimization - This disables invalidation coalescing for the entire time a view remains hidden. Changing Padding and Spacing repeatedly on an attached collapsed VerticalStackLayout now propagates every invalidation through its hidden, non-fixed-size ancestors: ViewExtensions.InvalidateAncestorsMeasures calls each ancestor's InvalidateMeasure, clearing its cache and calling SetNeedsLayout, until a visible ancestor can coalesce. Previously only the first invalidation traversed that chain. This restores repeated ancestor-walk work during binding updates to hidden panels, which #33459 avoided. Preserve coalescing while hidden and reset it on visibility transitions instead; the new Hidden override already provides that reset. Add coverage that repeated invalidations coalesce while hidden and propagate again after showing the view.

@github-actions

Copy link
Copy Markdown
Contributor

Selected Tests

Result NOT QUEUED Platforms Android, iOS, MacCatalyst, Windows Tests all UI, 102 device Commit 2c396369


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ❌ not queued all 77 categories —
Device tests ❌ not queued 102 of 105 units —
🧪 UI tests — the full suite on every platform

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

GPT-6.2 Sol: Run all iOS and Mac Catalyst UI categories because the shared Apple MauiView measure invalidation path changed.
MAI Code 2: iOS/MacCatalyst MauiView measure invalidation fix; run full UI coverage because it changes the shared platform measure pipeline.

🧪 Running — 77 categories on Android, iOS, MacCatalyst, Windows

The complete maui-pr-uitests suite runs on every platform (same as /azp run).

🧪 Device tests — Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior +98 on iOS, MacCatalyst

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

GPT-6.2 Sol: Run Controls and Core device tests on iOS and Mac Catalyst for the MauiView measure change, including the new layout regression.
MAI Code 2: iOS/MacCatalyst MauiView layout-measure fix; run all Controls and Core device-test units, including the new Controls.Layout regression test.

🧪 Running — 102 categories on iOS, MacCatalyst

Platform Categories
iOS Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, 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.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
MacCatalyst Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, 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.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
⏭️ Skipped — what neither suite runs

Device tests — 3 categories, 2 platforms

Platforms not run: Android, Windows

Categories not run: 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 — all categories
iOS Accessibility, ActionSheet, ActivityIndicator, Animation, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DragAndDrop, Entry, Editor, 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 all categories
MacCatalyst Accessibility, ActionSheet, ActivityIndicator, Animation, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DragAndDrop, Entry, Editor, 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 all categories
Windows — all categories

GPT-6.2 Sol — Run all iOS and Mac Catalyst UI categories because the shared Apple MauiView measure invalidation path changed.

  • MauiView changes visibility and measure invalidation for Apple view hierarchies, so run every enabled category on iOS and Mac Catalyst.
  • Android and Windows do not compile this path; the PublicAPI files only record the override.

MAI Code 2 — iOS/MacCatalyst MauiView measure invalidation fix; run full UI coverage because it changes the shared platform measure pipeline.

  • MauiView.SizeThatFits and invalidation propagation affect measurement for all views, so UI coverage must include the full iOS and Mac Catalyst suites.
  • The changed file is in Platform/iOS; Android and Windows are deliberately excluded because they do not compile this implementation.
  • The fix targets hidden/collapsed views and invalidation during measure, making partial Layout or ScrollView coverage too narrow.

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 Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, 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.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 Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, 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.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
MacCatalyst Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, 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.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 Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, 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.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
Windows — —

GPT-6.2 Sol — Run Controls and Core device tests on iOS and Mac Catalyst for the MauiView measure change, including the new layout regression.

  • MauiView changes how hidden views and invalidations during measure propagate to ancestors, affecting both Controls and Core on iOS and Mac Catalyst.
  • Controls.Layout covers the new regression: a collapsed FlexLayout becomes visible during arrange inside a ScrollView.
  • Android, Windows, and the standalone Graphics, Essentials, and BlazorWebView projects are not affected by this change.

MAI Code 2 — iOS/MacCatalyst MauiView layout-measure fix; run all Controls and Core device-test units, including the new Controls.Layout regression test.

  • MauiView is base platform measurement and invalidation infrastructure, so the whole Controls and Core device suites are affected rather than only one control.
  • The changed LayoutTests.iOS.cs test adds the required Controls.Layout category, which is covered by Controls.
  • Android and Windows are excluded; the implementation change is specific to the iOS platform layer, with Mac Catalyst also compiling it.
  • Graphics, Essentials, and BlazorWebView are omitted because they are not affected by this measure-invalidation change.

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

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

kubaflo commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Resolved the iOS and Mac Catalyst API inventory conflicts with main in 9cb8d97bd2. Kept both MauiView.Hidden accessors and the newer API entries from main. The layout fix and its regression test are unchanged.

@dalexsoto stamp

@kubaflo
kubaflo merged commit 11505c4 into dotnet:main Nov 30, 2026
4 of 5 checks passed

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

The change affects invalidation behavior across all UIKit MauiView layouts, but runtime evidence comes from another branch and excludes Mac Catalyst, leaving current-revision layout correctness and repeated-invalidation behavior unverified.

No open issues 🎉

Review effort: Balanced

@kubaflo

This comment has been minimized.

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

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

Self-reported assessment, not an independent review.

Assessed revision: `9b2c5d0dd5f7fd92922bd91a2c5b071353cd2474`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 8.5/10 | ↑ Decision replayed on #40894's real test
comment: stale error → re-run tests, repeated error → done with "Could
not run".<br>↑ Workflow compiles.<br>↓ Live run pending merge (AzDO
still not queueing builds, so it will exercise this path). |
| Diagnosis confidence | 9.5/10 | ↑ #40894 and 5 contributor PRs stopped
at `needs-maintainer-decision` only because dnceng-public queued no
builds. |
| Evidence fit | 9/10 | ↑ Matches the maintainer request: a missing test
run should not block conflicts and earlier findings. |
<!-- /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 `/review run-tests` cannot complete (NOT QUEUED, error, canceled)
during the loop, Autopilot stopped with "needs maintainer decision"
(e.g. #40894). Conflicts, expert findings and review threads are already
handled before the tests stage, so the test run should not block the
outcome.

Now, after the existing one retry, an incomplete test run finishes the
loop as **Ready for maintainer review**, with the Tests row showing "⚠️
Could not run; re-run `/review run-tests` when CI is available". Docs
table updated.

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Dec 1, 2026
…40906)

### Description of Change

On iOS, when a view inside a `Border` changes a child's
`WidthRequest`/`HeightRequest` in its own `SizeChanged` handler, the
child keeps its old bounds. The same code works outside a Border (as
page content, in a Grid cell, in a ContentView) and on Android.

What happens, traced on `net11`:

1. `Border.LayoutSubviews` arranges the host view. The host's
`SizeChanged` sets the child's size requests. The invalidation clears
the host's measure cache and marks the host and the Border for layout,
then stops at the Border because the Border has a fixed size. Unlike
ContentView, TemplatedView and Grid, Border doesn't override
`ComputeConstraintForView`, so the host inside it isn't treated as
fixed.
2. In the same pass, `host.LayoutSubviews` runs. Its superview is
responsible for measuring it, so it doesn't measure, and it arranges the
child with the stale desired size (46x90.5 in the repro).
3. On the next pass the Border measures the host again and gets the
right size, but the host's frame doesn't change, so
`host.LayoutSubviews` never runs again and the child stays small.

When the host is fixed (the working cases), the invalidation stops at
the host, which measures again in its own layout pass.

With this PR, when `MauiView.SizeThatFits` has to measure because the
cache was cleared, it also calls `SetNeedsLayout()`. After an
invalidation, the invalidation's own `SetNeedsLayout` is normally still
pending, so the extra call changes nothing. It only matters when the
view's layout already ran with stale sizes, as in step 2. It can't loop,
because `LayoutSubviews` measures through `CrossPlatformMeasure`, not
`SizeThatFits`. With the fix the child is arranged at 46x90.5 and then
at 360x360, the same two steps the issue shows on Android.

About #40894: I applied its `MauiView` change on `net11` and it doesn't
fix this case. Here `_measureInvalidatedPropagated` never blocks an
invalidation. Both PRs touch `MauiView.SizeThatFits`, but not the same
lines, and #40894's patch applies cleanly on top of this one.

### Tests

`BorderTests.SizeRequestsSetInSizeChangedApplyInsideBorder` (Controls
device tests, iOS and Mac Catalyst): a 200x300 Border holds a
ContentView whose `SizeChanged` sets a centered Grid's size requests to
the smaller of its width and height. The test waits up to 2 s for the
Grid to reach that size.

| iOS 26.5 simulator | Without the fix | With the fix |
|---|---|---|
| Border | 6 passed, 1 failed (`The square kept its old bounds instead
of the size requests set in SizeChanged`) | 7 passed |
| Layout | 34 passed, 1 skipped | 34 passed, 1 skipped |

With the fix, the ContentView (4/4), ScrollView (14 passed, 1 skipped),
Frame (25/25) and Page (5/5) categories pass as well.

**Before / after** (Sandbox app, iPhone 17 simulator, iOS 26.5): the
"keep it square" board from the AbsoluteLayout docs, inside a Border.

| Before: the board keeps its first, tiny size | After: the board is
square |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40808-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40808-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40808-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/40808-after.mp4)

Not checked: Mac Catalyst (shared code; the test is compiled for it),
Release/AOT builds, and performance. The extra `SetNeedsLayout` only has
an effect in the stale-layout case above.

### Issues Fixed

Fixes #40808

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[iOS] Collapsed layout made visible during a layout pass stays at zero size (regression from #33459)

3 participants