Repository navigation
Conversation
Make the per-edge safe area interfaces and shared bindable-property plumbing reusable outside MAUI. Keep platform inset reporting internal, migrate built-in controls, and add custom-view regression coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37750Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37750" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR exposes public per-edge safe-area contracts for custom MAUI views and native hosts, adds shared plumbing, and preserves internal iOS inset reporting.
Changes:
- Publishes safe-area interfaces and edge lookup APIs.
- Migrates built-in controls to shared safe-area helpers.
- Adds API baselines and regression coverage.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Summary |
|---|---|
src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt |
Records Core API additions. |
src/Core/src/Primitives/SafeAreaEdges.cs |
Exposes per-edge lookup. |
src/Core/src/Platform/iOS/MauiView.cs |
Uses the internal inset sink. |
src/Core/src/Core/ISafeAreaView2.cs |
Publishes the per-edge safe-area contract. |
src/Core/src/Core/ISafeAreaInsets.cs |
Defines internal inset reporting. |
src/Core/src/Core/ISafeAreaElement.cs |
Publishes the shared element contract. |
src/Controls/tests/Core.UnitTests/SafeAreaTests.cs |
Critical (1 vote): the private CustomSafeAreaView has a non-public constructor, causing Activator.CreateInstance(Type) to throw MissingMethodException. |
src/Controls/src/Core/ScrollView/ScrollView.cs |
Migrates safe-area behavior. |
src/Controls/src/Core/SafeAreaElement.cs |
Adds shared safe-area property plumbing. |
src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt |
Records Controls API additions. |
src/Controls/src/Core/Page/Page.cs |
Implements inset handling. |
src/Controls/src/Core/Layout/Layout.cs |
Migrates safe-area behavior. |
src/Controls/src/Core/ContentView/ContentView.cs |
Migrates safe-area behavior. |
src/Controls/src/Core/ContentPage/ContentPage.cs |
Migrates safe-area behavior. |
src/Controls/src/Core/Border/Border.cs |
Migrates safe-area behavior. |
Suppressed comments (4)
src/Controls/src/Core/ContentPage/ContentPage.cs:174
HasExplicitSafeAreaEdgesnow correctly usesIsSafeAreaEdgesSet, but the adjacent per-edge resolver still usesIsSet.IsSettreats default-value creation as set, so merely readingSafeAreaEdgesfirst causes this method to skip the iOSIgnoreSafeAreafallback and return the defaultNoneinstead. UseSafeAreaElement.IsSafeAreaEdgesSet(this)here as well and cover the read-then-resolve sequence.
bool ISafeAreaView2.HasExplicitSafeAreaEdges => SafeAreaElement.IsSafeAreaEdgesSet(this);
src/Controls/src/Core/Layout/Layout.cs:376
- Please regenerate the profiled AOT artifacts for this rename. The checked-in
maui.aotprofile.txtandmaui-sc.aotprofile.txtstill listLayout/ScrollView:ISafeAreaElement.SafeAreaEdgesDefaultValueCreator, while these implementations are nowGetDefaultSafeAreaEdges;Microsoft.Maui.Controls.targetsimports the corresponding binary profiles for Android, so these calls will no longer match the profiled methods (and the profile tool may report missing methods).
SafeAreaEdges ISafeAreaElement.GetDefaultSafeAreaEdges()
{
return SafeAreaEdges.Container;
}
src/Controls/src/Core/ScrollView/ScrollView.cs:553
- This renames the explicit
ISafeAreaElementimplementation used byLayoutandScrollView, but the checked-in profiled-AOT lists still referenceMicrosoft.Maui.ISafeAreaElement.SafeAreaEdgesDefaultValueCreator(inmaui.aotprofile.txtandmaui-sc.aotprofile.txt). Regenerate those profile outputs so they referenceGetDefaultSafeAreaEdges; otherwise the profiles are stale and no longer describe methods in the assembly.
SafeAreaEdges ISafeAreaElement.GetDefaultSafeAreaEdges()
src/Controls/tests/Core.UnitTests/SafeAreaTests.cs:287
- These assertions verify the public contracts and property mapping only; they never create a handler or send insets through the iOS
MauiView/Android inset-listener paths. A regression in the platform-sideISafeAreaView2lookup or listener refresh would therefore still pass these tests even though a direct customViewno longer receives the advertised per-edge behavior. Add focused device coverage for the custom view on Android and iOS, or include the probe as an automated test.
public void CustomView_CanReuseSafeAreaEdgesContract()
{
var view = new CustomSafeAreaView();
var safeAreaView = (ISafeAreaView2)view;
|
Validated the review findings against the current head:
This branch is actively owned in another worktree with recent source/build activity, so the monitor is reply-only here: I did not edit or push, and the actionable thread remains open for the owning agent. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@copilot-pull-request-reviewer addressed the validated feedback in ecf8393: corrected ContentPage explicit-edge detection after default-value reads, regenerated both binary/text AOT profiles for the renamed explicit implementations, fixed private test-view construction, and added Android/iOS custom-view handler coverage. Focused validation passed (64 unit, 40 iOS View, 5 iOS Page, and 51 Android View tests). This is ready for re-review — thanks! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 36 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
src/Controls/src/Core/SafeAreaElement.cs:24
- This newly reusable property is not wired to safe-area invalidation on Mac Catalyst: the existing
ViewHandlermapper is guarded by#if ANDROID || IOS, whileMauiViewandViewHandler.iOS.csalso compile for Mac Catalyst. Consequently, changing a custom view'sSafeAreaEdgesafter its handler is connected does not invalidate the safe-area layout there. RegisterMapSafeAreaEdgesforMACCATALYSTas well and add a post-handler-change regression test.
public static readonly BindableProperty SafeAreaEdgesProperty =
BindableProperty.Create(nameof(ISafeAreaElement.SafeAreaEdges), typeof(SafeAreaEdges), typeof(ISafeAreaElement), SafeAreaEdges.Default,
defaultValueCreator: SafeAreaEdgesDefaultValueCreator);
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@copilot-pull-request-reviewer[bot] addressed both latest findings in dc737cb: descendant safe-area caches are invalidated when an ancestor strategy changes, and the mapper now runs on Mac Catalyst. Focused View device tests passed 41/41 on both iOS and Mac Catalyst. This is ready for re-review — thanks! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 38 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/maui-sc.aotprofile.txt:3287
- The text snapshot now records
GetDefaultSafeAreaEdges, but the pairedmaui-sc.aotprofilebinary is not regenerated.Microsoft.Maui.Controls.targetsimports that binary for Android profiled AOT, so consumers will still ship a profile containing the removed interface method and will not profile the new calls. Please rerun the documentedRecordtarget formaui-scand commit the regenerated binary with this snapshot.
src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/maui.aotprofile.txt:2594 - The text snapshot now records
GetDefaultSafeAreaEdges, but the pairedmaui.aotprofilebinary is not regenerated.Microsoft.Maui.Controls.targetsimports that binary for Android profiled AOT, so consumers will still ship a profile containing the removed interface method and will not profile the new calls. Please rerun the documentedRecordtarget formauiand commit the regenerated binary with this snapshot.
Microsoft.Maui.SafeAreaEdges Microsoft.Maui.Controls.Layout:Microsoft.Maui.ISafeAreaElement.GetDefaultSafeAreaEdges ()
|
Thanks for the re-review. The two suppressed AOT-profile notes are already satisfied by ecf8393: that commit changed both |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: de9c7c01-82c4-42fd-9ab7-882279aadd15
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 9 findings
See inline comments for details.
Clarify native inset and invalidation semantics, strengthen keyboard cache coverage, and keep frame-relative keyboard overlap out of desired-size growth. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: de9c7c01-82c4-42fd-9ab7-882279aadd15
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 4 findings
See inline comments for details.
| // depend on whether the ancestor has already completed its layout pass. | ||
| // Keyboard overlap only changes Bottom, so farther ancestors can omit that | ||
| // calculation after the nearest nonzero Bottom has been classified. | ||
| var safeArea = mauiView.GetAdjustedSafeAreaInsets( |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Performance-Critical Path — This ancestor walk recomputes each ancestor's full adjusted safe area on every cache miss. GetAdjustedSafeAreaInsets resolves the strategy (SafeAreaViewStrategy.TryGetSafeAreaEdges), loops all four edges through GetSafeAreaForEdge, and — when includeKeyboardOverlap is true — crosses into UIKit via ConvertRectToView/ConvertRectFromCoordinateSpace. The previous implementation read the already-computed mv._appliesSafeAreaAdjustments field and short-circuited via FindParent at the first matching ancestor; the new loop only exits once all four edges are non-None, so in the common case (page applies Top only, or nothing applies) it walks to the root recomputing insets at every level.
Concrete scenario: a ContentPage > Grid > Border > ContentView > Layout chain of depth N where each level is a MauiView. Every ValidateSafeArea on level i walks i ancestors and fully re-resolves each, giving O(N²) inset resolutions per layout pass — and _parentHandledSafeAreaEdges is now invalidated far more often (soft-input overlap change at line ~828, InvalidateDescendantSafeAreas cascade), so cache misses are frequent rather than one-time.
Suggestion: cache the ancestor's resolved insets on the ancestor itself (it already computes them in ValidateSafeArea) and reuse that, or short-circuit the ancestor loop once the edges this view actually requests are all classified rather than requiring all four.
| (oldSafeArea.EqualsAtPixelLevel(_safeArea) || !_appliesSafeAreaAdjustments); | ||
|
|
||
| if (!interactionUnchanged) | ||
| InvalidateDescendantSafeAreas(); |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Layout Measure-Arrange Correctness — InvalidateDescendantSafeAreas() is invoked from ValidateSafeArea, which runs inside the layout pass (LayoutSubviews). It recursively walks the entire native descendant subtree (InvalidateSafeArea(UIView) at line 982), marshalling a fresh managed UIView[] from Subviews at every node and calling SetNeedsLayout() on every descendant MauiView/MauiScrollView. Each invalidated descendant then re-runs ValidateSafeArea on the next pass and, if its interaction changed, invalidates its own subtree again.
Concrete scenario: rotation or keyboard show on a deep page — the root MauiView's interaction changes, it dirties the whole subtree; the direct children then each dirty their own (overlapping) subtrees on the following pass, so a single safe-area change produces repeated full-subtree walks and multiple extra layout passes proportional to nesting depth. This is the same class of layout-oscillation risk the pixel-level comparison at line 866 exists to suppress.
Suggestion: restrict the cascade to descendants whose cached _parentHandledSafeAreaEdges is actually non-null (i.e. would change), and stop recursing into a subtree once a descendant's classification is unaffected, instead of an unconditional full-subtree walk.
|
|
||
| if (handler.PlatformView is PlatformView platformView) | ||
| { | ||
| MauiView.InvalidateSafeArea(platformView); |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Performance-Critical Path — MapSafeAreaEdges now triggers a full recursive walk of the platform view's entire descendant subtree (MauiView.InvalidateSafeArea allocates a managed UIView[] per node and calls SetNeedsLayout() on every MauiView/MauiScrollView found). This mapper also fires more often than before: SafeAreaElement.SafeAreaEdgesProperty sets the new UpdateHandlerOnSpecificityChange = true flag (SafeAreaElement.cs), so Element.OnBindablePropertySet now calls UpdateHandlerValue(..., true) when only the setter specificity changed and the resolved value is identical.
Concrete scenario: a page with an implicit style that sets SafeAreaEdges, applied/removed during a visual-state or theme change — the value never changes, but every specificity transition now walks and dirties the whole page subtree. Consider scoping the invalidation to the handler's own platform view plus descendants that actually cache ancestor-handled edges, or short-circuiting when the resolved SafeAreaEdges value is unchanged.
| /// <see cref="HasExplicitSafeAreaEdges"/> and <see cref="GetDefaultSafeAreaEdges"/> are required because platform | ||
| /// handlers need both values to distinguish configured behavior from each control's default behavior. | ||
| /// </remarks> | ||
| public interface ISafeAreaElement |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Public API Surface Design — ISafeAreaElement is promoted from internal to public with three required members (SafeAreaEdges, HasExplicitSafeAreaEdges, GetDefaultSafeAreaEdges()) and no default interface implementations. Once shipped, any future member cannot be added without a binary/source breaking change for every third-party implementer — which is exactly the constraint that forced the ISafeAreaView → ISafeAreaView2 numbered-interface churn this PR is unwinding.
Two of the three members have an obvious, safe default: HasExplicitSafeAreaEdges is documented to be implemented as SafeAreaElement.IsSafeAreaEdgesSet(this) and GetDefaultSafeAreaEdges() almost always returns SafeAreaEdges.None. Providing these as default interface methods (leaving only SafeAreaEdges required) would both reduce the implementation burden for custom views and establish the DIM pattern that makes future additive members non-breaking.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 12 findings
See inline comments for details.
| Microsoft.Maui.ISafeAreaElement.GetDefaultSafeAreaEdges() -> Microsoft.Maui.SafeAreaEdges | ||
| Microsoft.Maui.SafeAreaElementExtensions | ||
| static Microsoft.Maui.SafeAreaElementExtensions.GetEffectiveSafeAreaEdges(this Microsoft.Maui.ISafeAreaElement! safeAreaElement) -> Microsoft.Maui.SafeAreaEdges | ||
| Microsoft.Maui.StatusBarTheme |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[critical] Public API Surface — These five StatusBarTheme entries (lines 8-12) are duplicates: the same symbols already exist further down this file at lines 26-30 and were not removed. PublicAPI.Unshipped.txt must not contain duplicate entries, so the public-API analyzer fails the build (RS0025 "Do not duplicate symbols in public API files") for Microsoft.Maui on every net target. This is what the gate observed as a with-fix HostApp BUILD ERROR (Issue28986_ParentChildTest and Issue32586 legs). These entries are also unrelated to the safe-area feature — they appear to be an accidental re-add during a rebase. Remove lines 8-12 and keep only the ISafeAreaElement/SafeAreaElementExtensions additions.
| Microsoft.Maui.ISafeAreaElement.GetDefaultSafeAreaEdges() -> Microsoft.Maui.SafeAreaEdges | ||
| Microsoft.Maui.SafeAreaElementExtensions | ||
| static Microsoft.Maui.SafeAreaElementExtensions.GetEffectiveSafeAreaEdges(this Microsoft.Maui.ISafeAreaElement! safeAreaElement) -> Microsoft.Maui.SafeAreaEdges | ||
| Microsoft.Maui.StatusBarTheme |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[critical] Public API Surface — Same duplication as the net baseline: Microsoft.Maui.StatusBarTheme and its three members are added at lines 8-11 while identical entries already exist at lines 25-28. RS0025 fails the build for the netstandard2.0 target. Remove the newly added StatusBarTheme block.
| // depend on whether the ancestor has already completed its layout pass. | ||
| // Keyboard overlap only changes Bottom, so farther ancestors can omit that | ||
| // calculation after the nearest nonzero Bottom has been classified. | ||
| var safeArea = mauiView.GetAdjustedSafeAreaInsets( |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Performance-Critical Path — GetParentHandledSafeAreaEdges recomputes each ancestor's full adjusted safe area from scratch (GetAdjustedSafeAreaInsets → SafeAreaViewStrategy.TryGetSafeAreaEdges interface dispatch, SafeAreaInsets marshalling, and for the first ancestor ConvertRectToView + keyboard-frame conversion) instead of reading the ancestor's already-computed _safeArea. This runs on the layout path for every MauiView/MauiScrollView whose ancestor-edge cache was dropped. Concrete scenario: a page with a nested layout depth of ~8 and 100 MauiView descendants — a single keyboard show invalidates the whole subtree (InvalidateSafeArea, line 982), so the next layout pass performs ~800 full ancestor inset recomputations with per-ancestor coordinate conversions, none of them shared between siblings. The comment justifies bypassing the ancestor's cached state ("so suppression does not depend on whether the ancestor has already completed its layout pass"), but the cost is O(depth) per view per invalidation with no memoization; consider caching the resolved per-ancestor result for the duration of one layout pass.
| /// <summary> | ||
| /// Invalidates safe area state for a native subtree. | ||
| /// </summary> | ||
| internal static void InvalidateSafeArea(UIView platformView) |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Performance-Critical Path / Memory — InvalidateSafeArea(UIView) walks the entire native subtree recursively and UIView.Subviews allocates a new managed array (marshalled from NSArray) at every node, including for the many non-MAUI intermediate views. It is invoked from MapSafeAreaEdges (ViewHandler.iOS.cs), from every keyboard will-show/will-hide/change notification (ClearKeyboardState, OnKeyboardWillShow), and indirectly from InvalidateDescendantSafeAreas on each safe-area interaction change. Concrete scenario: a CollectionView page with several hundred realized cells — each keyboard toggle allocates one array per view in the subtree and calls SetNeedsLayout() on every MauiView, forcing a full-subtree layout pass rather than only the views whose safe area actually changed. Consider bounding the walk (stop descending into subtrees that cannot respond to safe area, e.g. below a UIScrollView where RespondsToSafeArea() is already false) and avoiding the repeated Subviews allocation.
| (oldSafeArea.EqualsAtPixelLevel(_safeArea) || !_appliesSafeAreaAdjustments); | ||
|
|
||
| if (!interactionUnchanged) | ||
| InvalidateDescendantSafeAreas(); |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Layout Measure-Arrange Correctness — InvalidateDescendantSafeAreas() is called from inside UpdateSafeAreaValues, which runs on the layout path. Each descendant is marked _safeAreaInvalidated and gets SetNeedsLayout(), and each descendant that then changes its own interaction state re-invalidates its descendants. The only guard against re-entry is the pixel-level comparison in EqualsAtPixelLevel. Concrete scenario: a parent whose padding change alters a child's frame, where the child's SoftInput bottom overlap is frame-relative (TryGetSoftInputBottomOverlap) — parent invalidates child → child's overlap changes → child invalidates its own descendants and requests layout → parent re-measures. During a keyboard animation the frames move every frame, so the pixel quantization is the sole thing preventing a sustained invalidate/layout cycle of the kind #32586 and #33934 previously hit. The added device tests exercise settled states; please add explicit coverage that the number of layout passes converges while the keyboard frame is animating (not just after it settles).
| && AreEqualAtPixelLevel(Bottom, other.Bottom, scale); | ||
| } | ||
|
|
||
| public static bool AreEqualAtPixelLevel(double first, double second, double scale) |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Logic and Correctness / iOS Platform — AreEqualAtPixelLevel/IsZeroAtPixelLevel take an explicit scale, and the new call sites in MauiView pass the view's own screen scale (view.Window?.Screen.Scale ?? UIScreen.MainScreen.Scale), but EqualsAtPixelLevel (line 39) still hardcodes UIScreen.MainScreen.Scale. The two quantizations therefore disagree whenever the window is not on the main screen — external display, Stage Manager, or Mac Catalyst with a non-1.0 backing scale. Concrete effect: GetParentHandledSafeAreaEdges classifies an edge as "not zero" at the window scale while UpdateSafeAreaValues decides the interaction is "unchanged" at the main-screen scale, so a real inset change can be swallowed (stale padding) or a sub-pixel one can be treated as a change (extra layout passes). Route EqualsAtPixelLevel through the same window-derived scale.
|
|
||
| var oldApplyingSafeAreaAdjustments = _appliesSafeAreaAdjustments; | ||
| _appliesSafeAreaAdjustments = !IsParentHandlingSafeArea() && RespondsToSafeArea() && !_safeArea.IsEmpty; | ||
| _appliesSafeAreaAdjustments = RespondsToSafeArea() && !_safeArea.IsEmpty; |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Layout Measure-Arrange Correctness — _appliesSafeAreaAdjustments no longer includes the parent-handled check, and suppression is now folded into _safeArea only on the manual-inset branch (line 379). On the else branch the value is taken verbatim from SystemAdjustedContentInset with no ancestor filtering. Concrete scenario: a ScrollView inside a Grid with SafeAreaEdges="Container" whose content is initially shorter than the bounds (manual branch, bottom suppressed because the parent already padded it) and then grows past the bounds — UIKit starts reporting a non-zero SystemAdjustedContentInset and the same bottom inset is applied a second time, shifting content by roughly 2× the home-indicator inset at the moment the content crosses the scroll bounds. The inline comment argues UIKit already accounts for ancestor geometry; if that is the intended contract, please state which UIKit guarantee makes the ancestor's padding observable in SystemAdjustedContentInset, and add a device test that crosses the content-size threshold with a padding ancestor (the existing ScrollViewTransitionToSystemAdjustedInsetsDropsParentSuppression asserts the suppression is dropped, not that the result is not double-padded).
|
|
||
| // Step 5: Verify UI is still responsive | ||
| // Step 5: Verify UI is still responsive from either initial footer state. | ||
| var footerStatus = App.WaitForElement("TestLabel").GetText(); |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[major] Regression Prevention — This change makes the assertion self-fulfilling: the expected text is derived from the state the app currently reports, so the test now passes for either toggle direction. The previous version pinned the outcome ("Footer is now hidden"), which is what made it a regression guard for #32586 — a fix that leaves the footer in the wrong state after the safe-area cycle would still satisfy the new assertion. This PR is also flagged by regression-check as REVERT (it removes lines added by #34024 in MauiView.cs, MauiScrollView.cs, and SafeAreaPadding.cs), and the A/B gate could not establish a without-fix baseline because the reshaped ISafeAreaElement breaks compilation of the test project. Weakening the only executable guard for #32586 in the same PR removes the last independent signal. Please restore a deterministic expectation (drive the fixture to a known state first, then assert the specific resulting text).
| /// <inheritdoc cref="ISafeAreaView2.GetSafeAreaRegionsForEdge"/> | ||
| SafeAreaRegions ISafeAreaView2.GetSafeAreaRegionsForEdge(int edge) | ||
| /// <inheritdoc cref="ISafeAreaElement.SafeAreaEdges"/> | ||
| SafeAreaEdges ISafeAreaElement.SafeAreaEdges |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Public API Surface / Cross-Platform Consistency — ISafeAreaElement.SafeAreaEdges on ContentPage deliberately returns a value different from the public SafeAreaEdges property: when the property is unset on iOS/MacCatalyst it reports SafeAreaEdges.Container (from legacy IgnoreSafeArea) while page.SafeAreaEdges reports None. Because ISafeAreaElement is now public, third-party code reading ((ISafeAreaElement)page).SafeAreaEdges or the public SafeAreaElementExtensions.GetEffectiveSafeAreaEdges(page) gets a value that contradicts the property it can read directly, and the divergence is platform-conditional (#if IOS || MACCATALYST) so the same code returns None on Android/Windows. If the compatibility resolution must be observable, expose it through a distinct member (e.g. only via GetEffectiveSafeAreaEdges) and let the interface property mirror the bindable value, so the public contract has one meaning per member.
| /// <see cref="HasExplicitSafeAreaEdges"/> and <see cref="GetDefaultSafeAreaEdges"/> are required because platform | ||
| /// handlers need both values to distinguish configured behavior from each control's default behavior. | ||
| /// </remarks> | ||
| public interface ISafeAreaElement |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Public API Surface — ISafeAreaElement becomes public with three required members and no default implementations, so every future addition to the safe-area contract is a binary/source breaking change for third-party implementers; consider adding default interface implementations for HasExplicitSafeAreaEdges and GetDefaultSafeAreaEdges now (returning false / SafeAreaEdges.Default) so the common case is a one-member implementation and later growth stays non-breaking. Two further parts of the contract are documented but unenforceable: the requirement to also expose a public SafeAreaEdges property backed by a public static SafeAreaEdgesProperty field (XAML addressability), and the requirement to be a BindableObject using SafeAreaElement.SafeAreaEdgesProperty — an implementer that violates the latter gets an InvalidOperationException thrown from inside the bindable-property default-value creator on first read rather than a compile-time error. An analyzer or a base type would make this diagnosable.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@kubaflo — new AI review results are available based on commit
e7d2cdc.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ❌ FAILED
Platform: IOS · Base: net11.0 · Merge base: 533bb4aa
🩺 Pre-existing build failure (not the fix) — both the without-fix baseline AND the with-fix build fail with a build error, so the PR's fix is NOT the cause. This is a broken main/merge-base or a toolchain/environment failure (e.g. an ILLink IL1012 trimmer crash). The gate cannot verify anything; investigate the build environment rather than the PR.
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(538,26): error CS0539: 'SafeAreaTests.CustomSafeAreaView.HasExplicitSafeAreaEdges' in explicit interface declaration i...
⚠️ Gate coverage limitations
- The A/B gate did not verify 1 dropped DeviceTest group(s): ViewTests (CustomViewSafeAreaEdgesReachMauiView, ChangingParentSafeAreaEdgesInvalidatesDescendants, MeasureInvalidatedParentDoesNotBlockDescendantSafeAreaInvalidation, ParentSafeAreaSuppressionDoesNotDependOnLayoutOrder, ResolvedBottomEdgeSkipsFartherAncestorKeyboardGeometry, ResidualParentInsetDoesNotSuppressChildSafeArea, ParentHandledEdgeLookupStopsWhenAllEdgesAreResolved, EmptySafeAreaSkipsParentHandledEdgeLookup, EmptyManualScrollViewSafeAreaSkipsParentHandledEdgeLookup, KeyboardSafeAreaChangesInvalidateDescendants, ParentContainerSafeAreaDoesNotSuppressChildKeyboardSafeArea, ParentAndChildKeyboardSafeAreasDoNotDoublePadArrangedChild, ParentAndChildKeyboardSafeAreasProtectOverflowingChild, HiddenKeyboardSkipsDuplicateSoftInputStrategyResolution, UnchangedKeyboardGeometryKeepsAncestorSafeAreaCache, ChangedKeyboardOverlapInvalidatesNonSoftInputDescendants, SoftInputAncestorInsideScrollViewDoesNotSuppressKeyboardAutoScroll, KeyboardFrameConvertsFromScreenToWindowCoordinates, FloatingKeyboardUsesClampedViewIntersection, DesiredSizeDrivenSoftInputViewSettlesWhileKeyboardIsVisible, NestedKeyboardSafeAreasUseCrossPlatformArrange, ParentOnlySuppressesOverlappingChildSafeAreaEdges, ParentOnlySuppressesOverlappingScrollViewSafeAreaEdges, SystemAdjustedScrollViewInsetsAreNotSuppressedByParent, ScrollViewTransitionToSystemAdjustedInsetsDropsParentSuppression, ChangingAncestorSafeAreaEdgesInvalidatesEdgeDisjointGrandchild). Deep UI Tests runs HostApp UI categories only and does not execute DeviceTests; separate device-test validation is required.
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🧪 SafeAreaTests SafeAreaTests |
🛠️ BUILD ERROR | ✅ PASS — 16s |
📄 SafeAreaEdgesTests SafeAreaEdgesTests |
🛠️ BUILD ERROR | ✅ PASS — 15s |
📄 Tests Tests |
🛠️ BUILD ERROR | ✅ PASS — 120s |
📱 PageTests (ReadingDefaultSafeAreaEdgesPreservesLegacySafeAreaFallback) Category=Page |
🛠️ BUILD ERROR | |
📱 ScrollViewHandlerTests (LegacySafeAreaViewWithoutModernContractRemainsEdgeToEdge) Category=ScrollView |
||
🖥️ Issue28986_ParentChildTest Issue28986_ParentChildTest |
❌ PASS — 347s | 🛠️ BUILD ERROR |
🖥️ Issue32586 Issue32586 |
❌ PASS — 347s | 🛠️ BUILD ERROR |
🔴 Without fix — 🧪 SafeAreaTests: 🛠️ BUILD ERROR · 16s
Error-relevant lines (filtered from the build log):
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(596,35): error CS0539: 'SafeAreaTests.DerivedSafeAreaContentPage.GetDefaultSafeAreaEdges()' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(602,26): error CS0539: 'SafeAreaTests.DerivedDefaultSafeAreaContentPage.HasExplicitSafeAreaEdges' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(603,35): error CS0539: 'SafeAreaTests.DerivedDefaultSafeAreaContentPage.GetDefaultSafeAreaEdges()' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(616,26): error CS0539: 'SafeAreaTests.CustomNoneSafeAreaView.HasExplicitSafeAreaEdges' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(618,35): error CS0539: 'SafeAreaTests.CustomNoneSafeAreaView.GetDefaultSafeAreaEdges()' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(631,26): error CS0539: 'SafeAreaTests.CustomMixedSafeAreaView.HasExplicitSafeAreaEdges' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(633,35): error CS0539: 'SafeAreaTests.CustomMixedSafeAreaView.GetDefaultSafeAreaEdges()' in explicit interface declaration is not found among members of the interface that can be implemented [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(516,43): error CS0535: 'SafeAreaTests.CustomSafeAreaView' does not implement interface member 'ISafeAreaElement.SafeAreaEdgesDefaultValueCreator()' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/SafeAreaTests.cs(543,43): error CS0535: 'SafeAreaTests.CustomSafeAreaPage' does not implement interface member 'ISafeAreaElement.SafeAreaEdgesDefaultValueCreator()' [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
This Gate section was shortened to keep every required review section visible. Full details remain available in the pipeline build artifacts.
📋 Pre-Flight — Context & Validation
PR #37750 Pre-Flight
Scope
- PR: #37750,
[net11.0] Expose safe area contract for custom views - Issue: #37384, requesting a public per-edge safe-area contract and reusable bindable-property plumbing for third-party views and native hosts.
- Review branch:
pr-review-37750 - Materialized PR commit:
132954fc3c523c030b15820a17819d694734b45c(PR #37750 squashed for review) - PR parent / gate merge base:
533bb4aaef6b78d2e3d9db4a5ece6cd04c8ea220 - Canonical diff:
HEAD^..HEAD. The localorigin/main...HEADrange is not a valid representation of this materialized PR because the review branch ancestry includes unrelated target-branch movement. - Patch size: 58 files, 3,265 insertions, 538 deletions.
Existing implementation
The PR replaces the internal numbered ISafeAreaView2 contract with a public capability-oriented ISafeAreaElement contract. It exposes SafeAreaEdges, explicit-value state, control-specific defaults, a public effective-value resolver, and the shared Controls bindable property. Built-in controls retain an internal strategy layer for legacy/default compatibility. Android and Apple handlers resolve all modern and legacy inputs through that shared strategy.
The Apple implementation substantially rewrites ancestor suppression and invalidation. MauiView and MauiScrollView resolve safe-area regions per edge, classify nonzero physical insets at device-pixel resolution, cache handled ancestor edges, invalidate descendants when geometry or strategy changes, and calculate nested keyboard overlap from window-relative frames. SafeAreaPadding adds reusable pixel-level equality and zero checks.
The patch also changes bindable-property specificity notifications, updates every affected public API baseline and AOT profile, adds extensive unit/XAML/device coverage, and adjusts two historical HostApp fixtures to make their state and orientation independent.
Direct diff observations
- Public API is centered on
src/Core/src/Core/ISafeAreaElement.cs; built-in compatibility and legacy precedence are centralized in the newsrc/Core/src/Core/ISafeAreaViewStrategy.cs. - Shared bindable-property creation and explicitness detection are in
src/Controls/src/Core/SafeAreaElement.cs. - The highest-risk runtime changes are in:
src/Core/src/Platform/iOS/MauiView.cssrc/Core/src/Platform/iOS/MauiScrollView.cssrc/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cssrc/Core/src/Platform/iOS/SafeAreaPadding.cs
- Regression cross-reference found removed lines previously introduced by #34024 in
MauiView.cs,MauiScrollView.cs, andSafeAreaPadding.cs. The removed nullable parent-state cache and direct pixel comparison are replaced by per-edge ancestor state and shared pixel helpers, so historical behavior must be demonstrated rather than inferred. - The PR adds two production files:
ISafeAreaInsets.csandISafeAreaViewStrategy.cs. The try-fix baseline contract requires an attempt to reportBlockedbefore editing ifEstablishBrokenBaseline.ps1records either as an unsafeNewFilesentry.
Gate evidence
The existing gate is definitive FAILED; it must not be rerun or overwritten.
- With the PR applied, focused
SafeAreaTestspassed 78/78 andSafeAreaEdgesTestspassed 15/15.
This pre-flight section was shortened to keep every required review section visible. Full details remain available in the pipeline build artifacts.
🔬 Code Review — Deep Analysis
Expert PR Evaluation — dotnet/maui #37750
PR: [net11.0] Expose safe area contract for custom views · Issue #37384
Materialized commit: 132954fc3c (PR #37750 squashed for review) · parent 533bb4aaef
Canonical diff: HEAD^..HEAD — 58 files, +3,265 / −538
Scope of this pass: raw submitted PR fix only. Read-only. No product-code edits, no candidate patch, no gate rerun, no GitHub posting.
Primary artifact: CustomAgentLogsTmp/PRState/37750/PRAgent/inline-findings.json (12 findings, all on added RIGHT-side lines, machine-verified against git diff -U0).
1. Independent assessment (formed from the diff before reading pipeline narrative)
The PR does four separable things:
-
Contract reshape (Core). The internal numbered interface
ISafeAreaView2is deleted and split into three pieces:public interface ISafeAreaElement(SafeAreaEdges,HasExplicitSafeAreaEdges,GetDefaultSafeAreaEdges()) — the capability-oriented public contract requested by #37384, replacing the previously-internalISafeAreaElement.SafeAreaEdgesDefaultValueCreator().internal interface ISafeAreaViewStrategy+internal static class SafeAreaViewStrategy— built-in-control compatibility/legacy resolution (GetSafeAreaRegionsForEdge,TryGetSafeAreaEdges,ResolveVirtualView,IsModernSafeAreaView).internal interface ISafeAreaInsets— the write-back of rawSafeAreaInsetstoPage.
This is the right decomposition and directly satisfies the repo's own guidance ("prefer a capability-oriented contract such asISafeAreaElementover publishing a numbered interface"). Resolution precedence is centralized in exactly one place (SafeAreaViewStrategy.TryGetSafeAreaEdges: strategy → element → legacy), which removes the duplicated per-controlif (region == Default)ladders inBorder,ContentView,ContentPage,Layout,ScrollView. Per-control default semantics are preserved (Border/ContentView/ContentPage→None,Layout→Container,ScrollView→ unresolvedDefaultviaresolveUnspecifiedDefault: false), andLayoutkeepsIgnoreSafeAreawinning over an explicitSafeAreaEdges, matching the pre-PR ordering. I verified each of these equivalences line-by-line against the deleted code; I found no semantic drift in the Controls-layer refactor.
-
Controls plumbing.
SafeAreaElementbecomespublic staticand exposes the sharedSafeAreaEdgesPropertyplusIsSafeAreaEdgesSet(BindableObject). A newBindableProperty.UpdateHandlerOnSpecificityChangeflag threads aspecificityChangedargument throughBindableObject.ClearValueCore/SetValueActual→OnBindablePropertySet→Element.UpdateHandlerValue, so a style/binding specificity change that leaves the value equal still re-runs the mapper. The specificity capture points are correct (original.Keycaptured beforeValues.Remove;originalSpecificitycaptured beforeValues.SetValue), and the flag is opt-in and currently set on exactly one property, so blast radius is contained.Element.OnBindablePropertySetre-testsproperty.UpdateHandlerOnSpecificityChangeredundantly (already folded intospecificityChanged) — harmless. -
Apple runtime rewrite (the actual risk).
MauiView/MauiScrollViewreplace the boolean_parentHandlesSafeAreawith per-edgeSafeAreaEdges? _parentHandledSafeAreaEdges; suppression moves out of_appliesSafeAreaAdjustmentsand into the_safeAreavalue itself (ExcludeParentHandledSafeAreaEdges); the ancestor walk classifies an edge as handled by physical nonzero inset at device-pixel resolution rather than by region equality; keyboard overlap becomes frame-relative (TryGetSoftInputBottomOverlap, window-coordinate conversion,Math.Clamp); and a new recursiveInvalidateSafeArea(UIView)/InvalidateDescendantSafeAreas()pushes invalidation down the native subtree.SafeAreaPaddinggains scale-parameterized pixel helpers. -
Housekeeping. Public API baselines for 7+8 TFM folders, AOT profiles, ~2,500 lines of new unit/XAML/device tests, and edits to two existing HostApp UI regression tests.
My independent read is that (1) and (2) are well-executed and land the requested feature; (3) is a substantial behavioral rewrite whose correctness argument is carried mostly by inline comments plus new device tests that the pipeline could not execute; and (4) contains a build-breaking mistake.
2. Findings
Twelve findings written to inline-findings.json. Summary by severity:
Critical (2) — build break, unrelated to the feature
-
src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt:8-12andsrc/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt:8-11re-addMicrosoft.Maui.StatusBarTheme(+ members, +IWindow.StatusBarTheme.getin thenetfile) that already exist later in the same files (net: lines 26-30; ns2.0: lines 25-28). Verified mechanically:$ sort src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt | uniq -d Microsoft.Maui.IWindow.StatusBarTheme.get -> Microsoft.Maui.StatusBarTheme Microsoft.Maui.StatusBarTheme Microsoft.Maui.StatusBarTheme.Dark = 2 -> ... Microsoft.Maui.StatusBarTheme.Default = 0 -> ... Microsoft.Maui.StatusBarTheme.Light = 1 -> ...and the pre-PR file already contained those five lines (at 15-19). RS0025 (
Do not duplicate symbols in public API files) fails theMicrosoft.Mauibuild. This is the direct cause of the gate's with-fixBUILD ERRORon the two HostApp legs (Issue28986_ParentChildTest,Issue32586), which the pre-flight recorded as an "unrelated duplicateIWindow.StatusBarTheme" problem — it is not unrelated to this PR: the PR introduces the duplicates. Trivial to fix; must be fixed before merge.
Major (4)
MauiView.cs:553— ancestor walk recomputes each ancestor's full adjusted safe area (interface dispatch +SafeAreaInsets+ coordinate conversions) instead of reading the ancestor's cached_safeArea; O(depth) per view per invalidation, no sharing between siblings.
This code-review section was shortened to keep every required review section visible. Full details remain available in the pipeline build artifacts.
🛠️ Try-Fix — Analysis & Comparison
FINAL STEP 5a — Try-Fix Candidates (PR #37750)
Status: Bounded two-candidate set complete. Candidate 1: Blocked. Candidate 2: Blocked. No further candidate is authorized or pending.
Materialized PR: 132954fc3c523c030b15820a17819d694734b45c · canonical diff HEAD^..HEAD · Platform: iOS.
Aggregate conclusion
Neither alternative could be implemented or empirically tested because the mandatory try-fix baseline failed before producing an edit allow-list. Both candidates independently invoked EstablishBrokenBaseline.ps1; both received the same dirty-worktree abort against 83 pre-existing harness-owned paths, and neither invocation created .github/.baseline-state.json. Independently, the PR adds src/Core/src/Core/ISafeAreaInsets.cs and src/Core/src/Core/ISafeAreaViewStrategy.cs; even on a clean tree those would make baseline NewFiles non-empty and force Blocked under the skill's restore-safety rule.
Both candidates obeyed the boundary: empty candidate diffs, no tests, inline self-review with 0 findings, script-only -Restore returning the accepted no-state result (Restored False, No baseline state found), zero src/ drift, and all 83 pre-existing paths preserved. Consequently there is no empirical winner and neither design should be represented as validated. The surviving review signal is that the PR's without-fix gate leg does not compile because ISafeAreaElement was reshaped (SafeAreaEdgesDefaultValueCreator() versus HasExplicitSafeAreaEdges/GetDefaultSafeAreaEdges()), which is concrete source-compatibility evidence and also prevents a meaningful A/B behavioral baseline.
Candidate 1 — Blocked
Artifacts: CustomAgentLogsTmp/PRState/37750/PRAgent/try-fix/attempt-1/
Full narrative: CustomAgentLogsTmp/PRState/37750/PRAgent/try-fix-1/content.md
Approach designed (not implemented)
UIKit-owned inset subtraction via AdditionalSafeAreaInsets, plus a non-breaking additive public capability shim. When a MAUI container consumes a safe-area edge, write the consumed amount into the native view's AdditionalSafeAreaInsets as a negative per-edge offset. UIKit then propagates already-netted SafeAreaInsets and descendant callbacks, allowing each MauiView/MauiScrollView to read only its own inset. Expose the third-party capability through an attached bindable property and public static effective-value resolver while leaving built-in legacy/default semantics in the pre-existing ISafeAreaView compatibility path.
Prior approach avoided and mechanism difference
PR #37750 and predecessor #34024 both assume MAUI must maintain a managed mirror of ancestor safe-area consumption. #34024 used a nullable whole-view flag; #37750 generalizes it into per-edge ancestor caches, explicit descendant invalidation, pixel-tolerant comparisons, and window-relative keyboard residual calculations. Their shared vulnerability is cache coherency across geometry, strategy, orientation, keyboard, and reparenting changes.
Candidate 1 would subtract consumption at the UIKit producer. UIKit would own propagation, eliminating rather than relocating the managed cache/invalidation class. Its additive API shim would avoid reshaping the existing interface and therefore avoid the gate's source break.
Exact diff and validation
Candidate diff: empty. fix.diff and reviewer-findings.diff are 0 bytes.
- Baseline: exit 1, dirty worktree; no baseline state.
- Primary focused unit test: not run because no edit was permitted.
- All 13 HostApp regressions: not run; gated behind primary success.
- Inline self-review: 0 findings.
- Restore: exit 0,
Restored False/No baseline state found. - Post-restore: 83 pre-existing status paths, 0
src/changes.
Candidate 1 result
Blocked, not a design failure. Both the absent RevertedFiles allow-list and the PR's two added production files independently require this result. Candidate 1 was completed once and was never reopened, rerun, edited, or otherwise disturbed by Candidate 2.
Candidate 2 — Blocked
Artifacts: CustomAgentLogsTmp/PRState/37750/PRAgent/try-fix/attempt-2/
Full narrative: CustomAgentLogsTmp/PRState/37750/PRAgent/try-fix-2/content.md
Approach designed (not implemented)
This try-fix section was shortened to keep every required review section visible. Full details remain available in the pipeline build artifacts.
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Winner: pr-plus-reviewer. It is the only candidate that removes the submitted PR's confirmed build break and then passes the complete bounded validation contract. The submitted pr must incorporate pr-plus-reviewer/reviewer.patch; the trusted Gate remains failed, so the raw PR cannot be approved.
Candidate ranking
| Rank | Candidate | Implementation | Focused unit result | Required iOS regression result | Assessment |
|---|---|---|---|---|---|
| 1 | pr-plus-reviewer |
Raw PR plus a 5-file reviewer patch | PASS — 78/78 | PASS — all 13 invocations (34 test executions) | Winner. Fixes RS0025 and uses the active window's display scale without disturbing the submitted runtime design. |
| 2 | pr |
Submitted 58-file safe-area contract/runtime change | PASS — 78/78 SafeAreaTests; 15/15 SafeAreaEdgesTests in Gate | FAILED/BLOCKED — sampled with-fix HostApp runs stopped at RS0025 duplicate API entries | Strong feature implementation, but it does not build through the required regression path as submitted. Per the ranking rule, it is below the passing candidate. |
| 3 | try-fix-1 |
Proposed UIKit-owned AdditionalSafeAreaInsets subtraction and additive attached API |
NOT RUN | NOT RUN | Blocked before editing by the baseline harness; empty diff. Conceptually narrower than candidate 2 but entirely unvalidated. |
| 4 | try-fix-2 |
Proposed ephemeral top-down geometric safe-area budget | NOT RUN | NOT RUN | Blocked before editing by the same harness boundary; empty diff. It is the largest architectural departure and has no implementation evidence. |
The two STEP 5a alternatives are not failed designs; they are blocked, non-materialized proposals. Neither can outrank a candidate with a reviewable diff and passing regressions. They also cannot supply a non-empty winning diff.
Why pr-plus-reviewer wins
The expert review identified a certain, mechanically verified defect: the raw PR re-adds StatusBarTheme API entries already present in both Core baselines. That produces RS0025 and is exactly why the raw PR's with-fix Issue28986_ParentChildTest and Issue32586 Gate legs ended at build time. Removing those duplicates allowed every required HostApp regression to execute and pass.
The same patch resolves the concrete screen-scale inconsistency in the Apple safe-area comparison path. Ancestor inset classification already uses view.Window?.Screen.Scale; MauiView and MauiScrollView now use that same scale when deciding whether applied insets changed. This is a localized correctness fix for external displays and Mac Catalyst windows.
The candidate retained the PR's deliberate order-independent Issue32586 logic. Its expected value is the opposite of the observed known state, so a no-op toggle still fails; it is not a self-fulfilling assertion. Three independent candidate invocations passed all five Issue32586 tests.
Expert-review reconciliation
| Expert feedback | Disposition |
|---|---|
| Duplicate Core PublicAPI entries | Confirmed and fixed. Zero duplicate lines remain in either affected baseline. |
| Main-screen versus window-screen pixel scale | Confirmed and fixed. Callers now provide the current window scale. |
Issue32586 dynamic expected footer state |
Not accepted as a defect. The assertion checks an opposite-state transition and avoids dependence on earlier ordered tests. |
This report section was shortened to keep every required review section visible. Full details remain available in the pipeline build artifacts.
🔗 Regression Cross-Reference
🔍 Regression Cross-Reference
✗ Revert risks detected — this PR removes 3 line(s) previously added by labeled bug-fix PRs.
| File | Fix PR | Fixed issue(s) | Risk | Reverted line |
|---|---|---|---|---|
src/Core/src/Platform/iOS/MauiScrollView.cs |
#34024 | #32586, #33934, #33595, #34042 | ✗ REVERT | bool? _parentHandlesSafeArea; |
src/Core/src/Platform/iOS/MauiView.cs |
#34024 | #32586, #33934, #33595, #34042 | ✗ REVERT | bool? _parentHandlesSafeArea; |
src/Core/src/Platform/iOS/SafeAreaPadding.cs |
#34024 | #32586, #33934, #33595, #34042 | ✗ REVERT | return RoundToPixel(Left, scale) == RoundToPixel(other.Left, scale) |
Action required: Verify that issues #32586, #33595, #33934, #34042 do not re-regress before merging.
🧪 Regression Tests to Verify
These tests were added by the fix PRs being reverted. They must still pass:
| Fix PR | Type | Test | Filter |
|---|---|---|---|
| #34024 | UITest | Issue28986_ParentChildTest | Issue28986_ParentChildTest |
| #34024 | UITest | Issue32586 | Issue32586 |
| #34024 | UITest | Issue33595 | Issue33595 |
| #34024 | UITest | Issue33934 | Issue33934 |
| #34024 | UITest | Issue28986_ParentChildTest | Issue28986_ParentChildTest |
| #34024 | UITest | Issue32586 | Issue32586 |
| #34024 | UITest | Issue33595 | Issue33595 |
| #34024 | UITest | Issue33934 | Issue33934 |
| #34024 | UITest | Issue28986_ParentChildTest | Issue28986_ParentChildTest |
| #34024 | UITest | Issue32586 | Issue32586 |
| #34024 | UITest | Issue33595 | Issue33595 |
| #34024 | UITest | Issue33934 | Issue33934 |
🧪 Regression Test Results
❌ FAILED — 0 passed, 13 failed, 0 skipped
| Fix PR | Test | Type | Result |
|---|---|---|---|
| #35916 | Issue35756 | UITest | ❌ FAILED |
| #34024 | Issue28986_ParentChildTest | UITest | ❌ FAILED |
| #34024 | Issue32586 | UITest | ❌ FAILED |
| #34024 | Issue33595 | UITest | ❌ FAILED |
| #34024 | Issue33934 | UITest | ❌ FAILED |
| #34024 | Issue28986_ParentChildTest | UITest | ❌ FAILED |
| #34024 | Issue32586 | UITest | ❌ FAILED |
| #34024 | Issue33595 | UITest | ❌ FAILED |
| #34024 | Issue33934 | UITest | ❌ FAILED |
| #34024 | Issue28986_ParentChildTest | UITest | ❌ FAILED |
| #34024 | Issue32586 | UITest | ❌ FAILED |
| #34024 | Issue33595 | UITest | ❌ FAILED |
| #34024 | Issue33934 | UITest | ❌ FAILED |
📱 UI Tests — Border,Layout,Page,SafeAreaEdges,ScrollView,ViewBaseTests
Detected UI test categories: Border,Layout,Page,SafeAreaEdges,ScrollView,ViewBaseTests
Border, Layout, Page, SafeAreaEdges, ScrollView, ViewBaseTests), so those deep UI tests could not run. The compiler reported: error RS0025: The symbol 'Microsoft.Maui.IWindow.StatusBarTheme.get -> Microsoft.Maui.StatusBarTheme' appears more than once in the public API files (https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/PublicApiAnalyzers/PublicAp…. This is a compile error introduced by this PR — src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt is one of the files this PR changes. Fix the build error, then re-comment /review to run the deep tests.
🧭 Next Steps — reviewer changes required
The reviewer-enhanced candidate identified changes that are not yet in the submitted PR.
Why: pr-plus-reviewer fixes the raw PR's confirmed RS0025 duplicate-PublicAPI build break and aligns pixel comparisons with the active window scale. It then passes 78 focused unit tests and all 13 required iOS HostApp regression invocations, while both try-fix alternatives remain blocked with empty diffs.
Address the actionable findings in this review before merging.
kubaflo
left a comment
There was a problem hiding this comment.
Code review findings from the MAUI expert review.
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!
Summary
ISafeAreaElementthe public per-edge safe-area contract for custom views and native hostsHasExplicitSafeAreaEdgesandGetDefaultSafeAreaEdges()so platform code can preserve control defaults and distinguish an explicit value from a default-created valueGetEffectiveSafeAreaEdges()so public native hosts read the same effective strategy as MAUI handlers, including built-in controls that intentionally preserve an explicitDefaultSafeAreaElement.SafeAreaEdgesPropertyandSafeAreaElement.IsSafeAreaEdgesSet(BindableObject)helper for customBindableObjectimplementationsISafeAreaViewcontract unchanged as a compatible legacy fallbackThis targets
net11.0because #37384 is an API request for .NET 11.Public API and compatibility
The new public surface is added to every applicable Core and Controls API baseline:
ISafeAreaElement.SafeAreaEdgesISafeAreaElement.HasExplicitSafeAreaEdgesISafeAreaElement.GetDefaultSafeAreaEdges()SafeAreaElementExtensions.GetEffectiveSafeAreaEdges(ISafeAreaElement)SafeAreaElement.SafeAreaEdgesPropertySafeAreaElement.IsSafeAreaEdgesSet(BindableObject)ISafeAreaViewremains unchanged because it is already shipped and implemented by external controls. Built-in controls use an internal strategy for their existing legacy/default semantics; third-party controls only implementISafeAreaElement.Leaving
ContentPage.SafeAreaEdgesunset preserves its existing platform/legacy default. Explicit values remain explicit, including full and partialDefaultregions, so setting the shipped named default does not become edge-to-edge.GetEffectiveSafeAreaEdges()delegates to the same strategy resolver as the handlers, preventing public native hosts from interpreting those values differently.Validation
The broad focused build, API, unit, XAML, AOT, and platform validation below was completed through product head
777f65e227af9af1a0148a55223317a59ec94a0a. Commitsc32e41e882e0b6baa9da3b830a2840262e015c2eand310d7e93c0fd3280aba2833ef1191b54afd51a41harden nested BottomSoftInputresidual handling and its geometry-sensitive coverage. Commitc265a307d821eea36c61116b1a549fdf7a9e03f6adds pixel-gated overlap caching, screen-to-window keyboard conversion, active-ancestor checks, descendant convergence invalidation, a real cross-platform arrange regression, and reusable bindable-property specificity metadata. Commit104f8146610f38465118de78bdd2c2f9336e4751compares absolute overlap values in device-pixel buckets so cumulative sub-pixel movement cannot be ignored indefinitely. Commit79cdc7408d6140335f5fa27a9aeb999897cfb0f9adds two-dimensional floating-keyboard intersection and clamping, uses the owning window's screen scale, preserves UIKit-applied scroll insets, verifies specificity-only/no-op updates, and removes avoidable ancestor work without making suppression depend on layout order.Current PR head
6a01b3521f7adfeb1da45393434ba449ee985303contains the reviewed safe-area tree from7efb2686323f82301bf2846cb573f943b0b07a9band normally merges concurrent follow-up01770ad87f1cdc4d6169ebc8757e0241d618d4aa. Commit3d3c42bd7d6ff08fb7d38fbc7f9896af6a108915adds a keyboard-hidden strategy-resolution fast path with show/hide/show lifecycle coverage, strengthens the system-adjustedMauiScrollViewgeometry andSizeThatFitsregression, documents compatibility-resolved interface values, and aligns Android/iOS safe-area mapper guard ordering. Commitac8d98c01fa8b5802e4b9111252a9b3446bfe13fapplies the justified exact-head reviewer refinements: it restores the unrelated Android event hookup to the target-branch form and documents effective-value, UIKit-inset, and keyboard-resolution semantics. Commit92f72f9dcf73753b229a79d90045ef9ad3331d15documents why specificity/default members are required, why invalidation must cross unchanged intermediate native views, how nested keyboard residuals settle, and how customPagesubclasses inherit the public contract. The final tree addsClearValuespecificity coverage, distinguishes resolved handler input from final platform geometry, documents physical-inset ancestor suppression, and makes the two UI fixtures exposed by the review filters independent of predecessor state and orientation.The screenshots and videos were captured at
f5a35e4a729a7875b26e2474e4fd90c1a1af0099. The later commits repair Android AOT profile encoding, clarify compatibility documentation, and harden nested keyboard behavior; they do not change the capturedContainer → None → bottom-only Container → Containerprobe flow. That flow and the keyboard regressions were rebuilt and revalidated in the final platform suites.SafeAreaTests:77/77SafeAreaTestsplus bindable-object selection at merged head:174/174SafeAreaEdgesTests:15/15across runtime, XamlC, and source-generator paths, including a third-party control using the public shared propertyMicrosoft.Maui.BuildTasks.slnf: succeeded withPublicApiType=Validatenetstandard2.0, iOS, Mac Catalyst, and AndroidThe platform-handler implementation was exercised at
f6db02a3ad6cb67b3e555085ca03eb33997f2b98; the only later commit adds the public resolver, its documentation/API baselines, and focused tests. Exact-head platform libraries and both empirical apps were rebuilt, and the new resolver itself is displayed in the iOS and Android evidence below.ViewPageScrollViewScrollViewHandler63/635/512passed,1ignored57passed,1ignored63/635/512passed,1ignored52passed,6ignoredView)53/5316/1612/126a01b3521f7adfeb1da45393434ba449ee985303is tree-identical to the locally reviewed and empirically validated7efb2686323f82301bf2846cb573f943b0b07a9b: iOS63/63, Mac Catalyst63/63, Android Release53/53, and focused units78/78FloatingKeyboardUsesClampedViewIntersectioncovers a laterally disjoint floating keyboard and an oversized frame; restoring the old Y-only overlap produced the sole iOS failure (61/62)SystemAdjustedScrollViewInsetsAreNotSuppressedByParentpreserves the full viewport inset that UIKit already applies; applying ancestor suppression to that UIKit-owned inset produced the sole iOS failure (62/63, expected viewport height60, mutated result70)62/63, expected one safe-area strategy read, actual two)60/62)61/62)_safeAreaInvalidatedsubtree early exit produced the sole iOS failure (61/62), proving that measure-invalidated parents can still have descendants requiring safe-area invalidation76/77)SoftInput: a correctly arranged child does not double-pad, while an overflowing child retains its positive frame-relative residual; transformed geometry is recomputed without requiring another keyboard notification, keyboard hide clears the residual, and a nestedMauiScrollViewstill suppresses its raw/system Bottom insetGridmeasure/arrange path instead of assigning native frames manuallySoftInputguard produced50/51, with only the overflowing-child regression failing50/51, with the transformed child retaining stale height50instead of the expected100MauiScrollView's raw/system Bottom inset as a computed keyboard residual produced50/51, with only the nested scroll-view suppression regression failing55/56, with only the stable-geometry cache regression failing (expected0ancestor reads, actual4)55/56, with only the strengthened cache regression failing because two individually sub-pixel moves crossed a cumulative device-pixel boundary55/56, with only the nonzero-window-origin regression failing (expected X0, actual137)SoftInputancestor underUIScrollViewas active produced55/56, with only the fallback-auto-scroll regression failing55/56, with only the non-SoftInputdescendant convergence regression failing (expected height70, actual100)51/53, failing exactly the listener attach/detach regressions; the restored APK passed53/53Invalid userId -2; the same rebuilt APK passed53/53when instrumentation explicitly targeted emulator owner user012/12;Issue32586.VerifyRuntimeSafeAreaEdgesChangenow derives the expected post-tap footer state instead of assuming ordered test 2 ran firstSafeAreaEdgescases pass109/109on the final tree;Issue28986_ParentChildTestfirst establishes and observes settled portrait geometry, so preceding orientation-changing fixtures can no longer contaminate its initial bounds, and the complete fixture also passes4/4in isolationOnBindablePropertySetentriesMicrosoft.Maui.SafeAreaViewStrategytype, one Android-reachableTryGetSafeAreaEdgesmethod, no leading-dot type, and no linker-unreachableGetSafeAreaRegionsForEdgeentrymaui: 38 modules / 1,814 types / 8,632 methods;maui-sc: 49 / 2,264 / 10,963;maui-blazor: 43 / 2,186 / 8,568110/110assemblies; the unstripped output contains the nativeMicrosoft_Maui_SafeAreaViewStrategy_TryGetSafeAreaEdges_object_Microsoft_Maui_SafeAreaEdges__boolbodyContentPage.Default, specificity-only assignments, Android exact inset consumption, nested/disjoint Apple edges, child keyboard overlap beyond a parent container inset, complete descendant invalidation, legacyMauiScrollViewbehavior, residual sub-pixel ancestor insets, completed ancestor traversal, and stale five-parameter AOT signaturesCompleted public build
1567759uses merge commit30ce3756e59cf4d10e60ea9c6ce9f5e916746767, whose second parent is PR head490a33f8dc17a653823d181f844aacd41b2e87fc. Every integration-test job succeeded, including Android runtime, six iOS CoreCLR/NativeAOT configurations, AOT/build, samples, Blazor, multi-project, and Windows template/build coverage.Replacement build
1567853uses merge commitcdb262e0517e81025f2038574b3a1bd9da829515, with target parent4695c95801e0b6764beb83f314c62141ee9c7f2eand PR parent310d7e93c0fd3280aba2833ef1191b54afd51a41. Its final raw timeline contains 24 successful jobs and only two failed jobs: Windows Debug and Release. Every failed task/job/phase log was downloaded and inspected without deduplication; both build tasks report only the target branch's fourCS0103errors for missingAssertEventuallyatTabbedPageTests.Windows.cslines 141 and 155 across the two Windows TFMs. Both Windows Helix jobs succeeded. Target commitc127c3f3503e06a347c0f100504911659f6154c1fixes that compile error and is included in current head92f72f9dcf73753b229a79d90045ef9ad3331d15.Build
1568885was audited from every failed raw phase/job/task log and all 16 Helix work-item details and console logs, preserving repeated lines. Every test process passed with zero failures and exited0; Windows Helix reported exit-4only when publishing results failed withTF10216: Azure DevOps services are currently unavailableor one Azure request-read timeout. This build contains no product or test failure.Public
maui-prrun1569748succeeded for synthetic merge1ae4d8c234, whose parents are targetec79089f65and PR head92f72f9dcf. All27/27jobs succeeded: Windows/macOS Debug and Release builds, both package jobs, Helix units, Android runtime, all iOS CoreCLR and NativeAOT configurations, AOT, samples, Blazor, multi-project, and Windows-template integration tests. The raw final timeline contained no failed or partially successful record. Its only annotations were expected empty-result publisher warnings in four build jobs and preview Android-manifest package-signing warnings; all corresponding tasks and jobs completed successfully.Review run
15111758covered stale head79cdc7408d6140335f5fa27a9aeb999897cfb0f9, as its published warning states. Its deep UI stage passed660tests, skipped6, and reported oneEntriesScrollingPageTestgeometry assertion. Raw teardown evidence shows the compared keyboard frame was parked below the screen: Entry14 retained its idle center Y869, while the invisible keyboard began at Y829in a375×812window and only the 44-point accessory toolbar remained visible. The tested hierarchy does not opt intoSoftInput, so the PR's parent-soft-input suppression path is inactive. On current head, all four local executions that reached and completed this exact test body passed; separate failed attempts were Appium/WebDriverAgent crashes or lost sessions before a geometry result.Review run
15114354covered head3d3c42bd7d6ff08fb7d38fbc7f9896af6a108915before the final documentation-only follow-ups. Its raw timeline completed successfully. The A/B gate passed focused units77/77, focused XAML15/15, and the broad XAML suite2115/2123with8skips; its DeviceTest comparisons were inconclusive only because XHarness did not produce fresh results. The independent platform-pool stage passed all six detected iOS categories:661passed,0failed,6skipped, includingSafeAreaEdges 109/109andLayout 194/199with the five expected skips. All13/13historical safe-area regression invocations passed. The review's justified documentation and unrelated-syntax recommendations are incorporated inac8d98c01fand92f72f9dcf; the proposed system-inset suppression and subtree pruning remain rejected by focused mutation evidence.Review run
15115319covered head92f72f9dcf73753b229a79d90045ef9ad3331d15and completed successfully in the raw timeline. Its independent iOS pool passed661, failed0, and skipped6: Border58/58, Layout194/199with five expected skips, Page26/26, SafeAreaEdges109/109, ScrollView162/163with one expected skip, and ViewBaseTests112/112. All13/13historical regressions for issues #35756, #28986, #32586, #33595, and #33934 passed. The gate was inconclusive only because its XHarness DeviceTest path produced no fresh result. Its twelve findings were individually adjudicated: the actionable public-doc, explicitness-test, helper-name, and invariant-comment refinements are in the final tree; the runtime proposals are rejected by focused device and mutation evidence.Claude Opus 5 independently reviewed the safe-area hot paths and rejected both applied-state ancestor caching and
_safeAreaInvalidatedsubtree pruning as layout-order correctness regressions. Its topology-independent optimizations are in79cdc7408d. A separate GPT-5.6 Terra exact-diff review reported no significant issues. A later Claude Opus 5 exact-follow-up review found no significant issue in3d3c42bd7d, and an independent multimodal audit classified the stale-head deep-UI result above as a parked-keyboard test race rather than a product regression. On head92f72f9dcf, Claude Opus 5 reviewed the complete 56-file target diff and reported no significant issue; GPT-5.6 Terra decoded both final proof videos and reviewed all six screenshots/contact sheets, finding the iOS and Android evidence coherent and sufficient. On the exact final tree, Claude Opus 5 reviewed the API/runtime refinements and GPT-5.6 Terra reviewed the UI-order fixes; both reported no actionable finding. All47/47inline review threads have evidence-backed dispositions and are resolved.Empirical evidence
A temporary
SafeAreaProbe : TemplatedView, ISafeAreaElementimplemented only the new public contract, reused the public shared bindable property, and displayedGetEffectiveSafeAreaEdges()asPublic host: .... At the capture head it was advanced live through all-edgeContainer,None, bottom-onlyContainer, and back to all-edgeContainer. The probe was removed after capture.Both videos are H.264/yuv420p at a constant 30 fps and contain only the ordered runtime states
1 → 2 → 3 → 1; sampled-frame review found no blank, splash, crash, or stale-state frames. On iOS, Appium taps drove the live property changes deterministically.iOS — iPhone 11 Pro simulator
T44/B34)T0/B0)T0/B34)Video — live runtime transitions:
ios-safe-area-demo-f5a.mp4
Android — API 34 arm64 emulator
The probe theme leaves the Android system bars opaque. Edge-to-edge is demonstrated by the
SAFE CONTENTmarkers moving beneath those bars (and therefore disappearing), while bottom-only restores only the bottom marker; the background cannot show through the opaque bars.Video — live runtime transitions:
android-safe-area-demo-f5a.mp4
MauiBot follow-up
Defaultresolution, explicit shared-property misuse, and the public CLR-property pattern required by XAMLContentPage.Defaultregions while retaining the unset edge-to-edge defaultSoftInputMauiViewcompute its own residual even when an ancestor also declaresSoftInput: an arranged child falls back to ordinary ancestor suppression, while an overflowing child retains only its positive live overlapSoftInputgeometry during layout so transforms cannot preserve stale keyboard overlap; mutation testing makes the transformed-child assertion fail without the refreshSoftInputancestor to respond to safe area before it can suppress keyboard auto-scrollGridElementsafe-area identity special case with reusable internal bindable-property specificity metadataMauiScrollViewdeliberately keeps ordinary suppression for raw/system insets, with a bottom-edge regression that fails if the keyboard exemption is applied thereSystemAdjustedContentInsetvalues while keeping per-edge ancestor suppression for manually computed scroll insets_safeAreaInvalidatedcannot represent descendant state; a persistent latch is also unsound across same-window reparenting of genericUIViewsubtreesIScrollViewimplementationsGetEffectiveSafeAreaEdges()returns resolved handler input rather than final platform-applied geometrySafeAreaEdgesvalue still notifies the handler when explicitness changesExisting PR comparison
I searched the open pull requests for #37384 and equivalent safe-area API titles. No competing implementation exists, so there was no alternative change set to compare.
Fixes #37384