Skip to content

fix-27998 - [Windows] ScrollView is not scrolling to the bottom if in grid with *,auto Width#28258

Open
BrayanKhosravian wants to merge 5 commits intodotnet:mainfrom
BrayanKhosravian:fix-27998-1
Open

fix-27998 - [Windows] ScrollView is not scrolling to the bottom if in grid with *,auto Width#28258
BrayanKhosravian wants to merge 5 commits intodotnet:mainfrom
BrayanKhosravian:fix-27998-1

Conversation

@BrayanKhosravian
Copy link
Copy Markdown
Contributor

@BrayanKhosravian BrayanKhosravian commented Mar 9, 2025

fixes: #27998

Problems:
|---cell0---|
|cell1|cell2|

Problem1:
All row and column defs are either set to auto or *.
Cell2 has an absolute width set to 250.
After initialization of the cells this absolute value can be considered for the row and column defs.
Solution1:
We consider the abolsute values set for the children which have to be layouted in the column and row defs.

Problem2:
Whenever we measured we have to reconsider that the row and column defs should be adjusted.
Solution2:
Whenver we measured (which is currently after FirstMeasurePass() and SecoondMeasurePass()) we adjust the row and column defs and consider possible overflows.

@BrayanKhosravian BrayanKhosravian requested a review from a team as a code owner March 9, 2025 11:08
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Mar 9, 2025
@BrayanKhosravian
Copy link
Copy Markdown
Contributor Author

This is only my attempt of solveing it.
It is fine for me in case someone copies or cherry-picks the uitest and unittest commits and fixes it differently.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz jsuarezruiz added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter layout-grid area-controls-scrollview ScrollView platform/windows labels Mar 10, 2025
[Category(UITestCategories.Cells)]
[Category(UITestCategories.ScrollView)]
[Category(UITestCategories.Border)]
public void GridAutosStarsScollToEndDisplaysLastItem()
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.

The test is failing on Android, iOS and Mac.

Assert.That(lastItem.IsDisplayed().Equals(false), Is.True)
Expected: True
But was:  False

Could you take a look?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I will take a look.
I will also take a look for the other failing tests. (https://dev.azure.com/xamarin/public/_build/results?buildId=137350&view=ms.vss-test-web.build-test-results-tab&runId=3876168&paneView=debug&resultId=100020)
Thank you for the CI/CD test run.

I only run the uitest on windows and I think I should have run it for other platforms as well.
The initial issue mentioned that only windows is affected, but I think that this should work on other platforms as well or other platforms should not be affected by my changes when it worked properly.

For mac and ios it could take approximately a few days as I have to set up an environment for it.

Copy link
Copy Markdown
Contributor Author

@BrayanKhosravian BrayanKhosravian Mar 28, 2025

Choose a reason for hiding this comment

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

Sorry for not responding for a long while.
I have been drowning in uni activities.
But was also stuck as the compilation failed for ios when paired with a macincloud device.
I will open a discussion regarding the issue I faced.
Independently of getting a hint, I will come back to this at a later time.

But my testcase succeds now for android.

Open tasks for myself:

  • check if testcase succeeds on ios and mac
  • investigate the other failing tests

@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented May 5, 2026

🤖 AI Summary

👋 @BrayanKhosravian — new AI review results are available. Please review the latest session below.

📊 Review Sessionfb3eb02 · fix-27998 cleanup · 2026-05-05 23:18 UTC
🚦 Gate — Test Before & After Fix

Gate Result: ❌ FAILED

Platform: ANDROID · Base: main · Merge base: 1463c4c5

🩺 Regression in another test — at least one test goes FAIL→PASS (fix works there), but another test FAILs both with and without the fix. The fix breaks a pre-existing or sibling test.

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue27998 Issue27998 ✅ FAIL — 497s ❌ FAIL — 492s
🧪 GridLayoutManagerTests GridLayoutManagerTests ✅ FAIL — 16s ✅ PASS — 15s
🔴 Without fix — 🖥️ Issue27998: FAIL ✅ · 497s
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:06:33.65
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.CustomAttributes -> /home/vsts/work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /home/vsts/work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  UITest.NUnit -> /home/vsts/work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  UITest.Appium -> /home/vsts/work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  VisualTestUtils -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  VisualTestUtils.MagickNet -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.Analyzers -> /home/vsts/work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27998.cs(25,15): error MAUI0002: Test method 'GridAutosStarsScollToEndDisplaysLastItem' has 3 `[Category]` attributes but should have exactly one [/home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj]

🟢 With fix — 🖥️ Issue27998: FAIL ❌ · 492s
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:06:29.55
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  Controls.CustomAttributes -> /home/vsts/work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.70-ci+azdo.14021032
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  VisualTestUtils -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.Core -> /home/vsts/work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils.MagickNet -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.NUnit -> /home/vsts/work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  UITest.Appium -> /home/vsts/work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.Analyzers -> /home/vsts/work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
/home/vsts/work/1/s/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27998.cs(25,15): error MAUI0002: Test method 'GridAutosStarsScollToEndDisplaysLastItem' has 3 `[Category]` attributes but should have exactly one [/home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj]

🔴 Without fix — 🧪 GridLayoutManagerTests: FAIL ✅ · 16s

(truncated to last 15,000 chars)

efinitions: "100, *, 100") [1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "Auto, *, 100") [< 1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "Auto, *, Auto") [< 1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "100, *, Auto") [2 ms]
  Passed MeasureAccountsForPadding(left: 0, top: 0, right: 0, bottom: 0) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 10, top: 10, right: 10, bottom: 10) [3 ms]
  Passed MeasureAccountsForPadding(left: 0, top: 10, right: 0, bottom: 10) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 23, top: 5, right: 3, bottom: 15) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 10, top: 0, right: 10, bottom: 0) [< 1 ms]
  Passed Single star column consumes all horizontal space [5 ms]
  Passed Column spacing shouldn't affect a single-column grid [< 1 ms]
  Passed TwoAbsoluteRowsOneAutoColumn [< 1 ms]
  Passed TwoAbsoluteColumnsOneAutoRow [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100, 100", rowSpan: 2, spacing: 0, expectedHeight: 200) [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100, 100, 50", rowSpan: 3, spacing: 20, expectedHeight: 290) [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100, 100", rowSpan: 2, spacing: 10, expectedHeight: 210) [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100", rowSpan: 1, spacing: 10, expectedHeight: 100) [< 1 ms]
  Passed StarColumnsHaveChildWidthsWhenGridCentered [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: -10) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: -60) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 1) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 0.10000000000000001) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 10) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 60) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 1000) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: -0.10000000000000001) [< 1 ms]
  Passed Totally empty star columns measured at infinite width have zero width [< 1 ms]
  Passed AutoColumnIsDominatedByWidestView(unconstrainedWidth: 10, constrainedWidth: 30) [1 ms]
  Passed AutoColumnIsDominatedByWidestView(unconstrainedWidth: 50, constrainedWidth: 30) [< 1 ms]
  Passed Row spanning with row spacing [1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: True, constraint: 100) [1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: False, constraint: 100) [< 1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: True, constraint: 15) [< 1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: False, constraint: 15) [< 1 ms]
  Passed ArrangeAccountsForFill [1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 40, view0ExpectedWidth: 21, view1ExpectedX: 24) [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 37, view0ExpectedWidth: 18, view1ExpectedX: 21) [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 38, view0ExpectedWidth: 19, view1ExpectedX: 22) [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 39, view0ExpectedWidth: 20, view1ExpectedX: 23) [< 1 ms]
  Passed Simple row spanning with multiple views [< 1 ms]
  Passed We can specify fractional star sizes for rows [2 ms]
  Passed AutoColumnIntersectionWithUnconstrainedMeasure [< 1 ms]
  Passed Star columns don't appropriate column spacing during measurement [< 1 ms]
  Passed AutoStarColumnSpansDoNotAffectAutoColumnSize [< 1 ms]
  Passed MinWidthDominatesMaxWidth [< 1 ms]
  Passed Two columns should include the column spacing once [< 1 ms]
  Passed We can specify fractional star sizes for columns [1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureWidthDiffer(widthConstraint: 926, arrangedWidth: 845) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureWidthDiffer(widthConstraint: 926, arrangedWidth: 1026) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureWidthDiffer(widthConstraint: 926, arrangedWidth: 926) [< 1 ms]
  Passed Star Column Width is correct when the first child is Collapsed [3 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 39, view0ExpectedWidth: 20, view1ExpectedX: 23) [< 1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 38, view0ExpectedWidth: 19, view1ExpectedX: 22) [< 1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 40, view0ExpectedWidth: 21, view1ExpectedX: 24) [< 1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 37, view0ExpectedWidth: 18, view1ExpectedX: 21) [< 1 ms]
  Passed Row spacing shouldn't affect a single-row grid [< 1 ms]
  Passed MaxWidthDominatesWidth [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureHeightDiffer(heightConstraint: 926, arrangedHeight: 1026) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureHeightDiffer(heightConstraint: 926, arrangedHeight: 845) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureHeightDiffer(heightConstraint: 926, arrangedHeight: 926) [< 1 ms]
  Passed IgnoresCollapsedViews [3 ms]
  Passed CanSpanAbsoluteColumns [< 1 ms]
  Passed Auto rows with collapsed views should still count for row spacing [2 ms]
  Passed StarColumnExpansionWorksWithDifferingScalars [2 ms]
  Passed Row span including absolute row should not modify absolute size [< 1 ms]
  Passed Empty columns still count for column spacing [< 1 ms]
  Passed Row-spanning views smaller than the views confined to the row should not affect row size [< 1 ms]
  Passed StarRowHeightLimitedToGridHeight [< 1 ms]
  Passed Measure should include column spacing [< 1 ms]
  Passed Children of Auto columns should be measured using an infinite width [< 1 ms]
  Passed GridMeasureShouldUseExplicitHeight [2 ms]
  Passed Star Row Height is correct when the first child is Collapsed [< 1 ms]
  Passed UnconstrainedStarColumnsRetainTheirWidthsWhenArrangedAtMeasuredSize [1 ms]
  Passed AutoRowIsDominatedByTallestView(unconstrainedHeight: 40, constrainedHeight: 30) [2 ms]
  Passed AutoRowIsDominatedByTallestView(unconstrainedHeight: 10, constrainedHeight: 30) [< 1 ms]
  Passed Auto columns with collapsed views should still count for column spacing [1 ms]
  Passed DoesNotIgnoreHiddenViews [1 ms]
[xUnit.net 00:00:01.73]     AutoStarRowSpanMeasureDoesNotExceedConstraint(determinantViewHeight: 200, heightConstraint: 100) [FAIL]
[xUnit.net 00:00:01.73]       NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
[xUnit.net 00:00:01.73]       	Measure(any Double, 100)
[xUnit.net 00:00:01.73]       Actually received no matching calls.
[xUnit.net 00:00:01.73]       Received 1 non-matching call (non-matching arguments indicated with '*' characters):
[xUnit.net 00:00:01.73]       	Measure(Infinity, *200*)
[xUnit.net 00:00:01.73]       
[xUnit.net 00:00:01.73]       Stack Trace:
[xUnit.net 00:00:01.73]            at NSubstitute.Core.ReceivedCallsExceptionThrower.Throw(ICallSpecification callSpecification, IEnumerable`1 matchingCalls, IEnumerable`1 nonMatchingCalls, Quantity requiredQuantity)
[xUnit.net 00:00:01.73]            at NSubstitute.Routing.Handlers.CheckReceivedCallsHandler.Handle(ICall call)
[xUnit.net 00:00:01.73]            at NSubstitute.Routing.Route.Handle(ICall call)
[xUnit.net 00:00:01.73]            at NSubstitute.Core.CallRouter.Route(ICall call)
[xUnit.net 00:00:01.73]            at NSubstitute.Proxies.CastleDynamicProxy.CastleForwardingInterceptor.Intercept(IInvocation invocation)
[xUnit.net 00:00:01.73]            at Castle.DynamicProxy.AbstractInvocation.Proceed()
[xUnit.net 00:00:01.73]            at NSubstitute.Proxies.CastleDynamicProxy.ProxyIdInterceptor.Intercept(IInvocation invocation)
[xUnit.net 00:00:01.73]            at Castle.DynamicProxy.AbstractInvocation.Proceed()
[xUnit.net 00:00:01.73]            at Castle.Proxies.ObjectProxy_4.Measure(Double widthConstraint, Double heightConstraint)
[xUnit.net 00:00:01.73]         /_/src/Core/tests/UnitTests/Layouts/GridLayoutManagerTests.cs(2761,0): at Microsoft.Maui.UnitTests.Layouts.GridLayoutManagerTests.AutoStarRowSpanMeasureDoesNotExceedConstraint(Double determinantViewHeight, Double heightConstraint)
[xUnit.net 00:00:01.73]            at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
[xUnit.net 00:00:01.73]            at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
[xUnit.net 00:00:01.73]     AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(widthConstraint: 500, heightConstraint: 400) [FAIL]
[xUnit.net 00:00:01.73]       Assert.Equal() Failure: Values differ
[xUnit.net 00:00:01.73]       Expected: 500
[xUnit.net 00:00:01.73]       Actual:   750
[xUnit.net 00:00:01.73]       Stack Trace:
[xUnit.net 00:00:01.73]         /_/src/Core/tests/UnitTests/Layouts/GridLayoutManagerTests.cs(2786,0): at Microsoft.Maui.UnitTests.Layouts.GridLayoutManagerTests.AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(Double widthConstraint, Double heightConstraint)
[xUnit.net 00:00:01.73]            at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
[xUnit.net 00:00:01.73]            at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
[xUnit.net 00:00:01.74]     AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(widthConstraint: 1000, heightConstraint: 500) [FAIL]
[xUnit.net 00:00:01.74]       Assert.Equal() Failure: Values differ
[xUnit.net 00:00:01.74]       Expected: 1000
[xUnit.net 00:00:01.74]       Actual:   1250
[xUnit.net 00:00:01.74]       Stack Trace:
[xUnit.net 00:00:01.74]         /_/src/Core/tests/UnitTests/Layouts/GridLayoutManagerTests.cs(2786,0): at Microsoft.Maui.UnitTests.Layouts.GridLayoutManagerTests.AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(Double widthConstraint, Double heightConstraint)
[xUnit.net 00:00:01.74]            at InvokeStub_GridLayoutManagerTests.AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(Object, Span`1)
[xUnit.net 00:00:01.74]            at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  Passed Single star column with a view measured at infinite width gets width of the view [< 1 ms]
  Passed UnconstrainedStarRowsRetainTheirHeightsWhenArrangedAtMeasuredSize [2 ms]
  Passed ArrangeRespectsBounds [< 1 ms]
  Failed AutoStarRowSpanMeasureDoesNotExceedConstraint(determinantViewHeight: 200, heightConstraint: 100) [1 ms]
  Error Message:
   NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
	Measure(any Double, 100)
Actually received no matching calls.
Received 1 non-matching call (non-matching arguments indicated with '*' characters):
	Measure(Infinity, *200*)

  Stack Trace:
     at NSubstitute.Core.ReceivedCallsExceptionThrower.Throw(ICallSpecification callSpecification, IEnumerable`1 matchingCalls, IEnumerable`1 nonMatchingCalls, Quantity requiredQuantity)
   at NSubstitute.Routing.Handlers.CheckReceivedCallsHandler.Handle(ICall call)
   at NSubstitute.Routing.Route.Handle(ICall call)
   at NSubstitute.Core.CallRouter.Route(ICall call)
   at NSubstitute.Proxies.CastleDynamicProxy.CastleForwardingInterceptor.Intercept(IInvocation invocation)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at NSubstitute.Proxies.CastleDynamicProxy.ProxyIdInterceptor.Intercept(IInvocation invocation)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.ObjectProxy_4.Measure(Double widthConstraint, Double heightConstraint)
   at Microsoft.Maui.UnitTests.Layouts.GridLayoutManagerTests.AutoStarRowSpanMeasureDoesNotExceedConstraint(Double determinantViewHeight, Double heightConstraint) in /_/src/Core/tests/UnitTests/Layouts/GridLayoutManagerTests.cs:line 2761
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
  Failed AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(widthConstraint: 500, heightConstraint: 400) [2 ms]
  Error Message:
   Assert.Equal() Failure: Values differ
Expected: 500
Actual:   750
  Stack Trace:
     at Microsoft.Maui.UnitTests.Layouts.GridLayoutManagerTests.AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(Double widthConstraint, Double heightConstraint) in /_/src/Core/tests/UnitTests/Layouts/GridLayoutManagerTests.cs:line 2786
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
  Failed AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(widthConstraint: 1000, heightConstraint: 500) [1 ms]
  Error Message:
   Assert.Equal() Failure: Values differ
Expected: 1000
Actual:   1250
  Stack Trace:
     at Microsoft.Maui.UnitTests.Layouts.GridLayoutManagerTests.AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(Double widthConstraint, Double heightConstraint) in /_/src/Core/tests/UnitTests/Layouts/GridLayoutManagerTests.cs:line 2786
   at InvokeStub_GridLayoutManagerTests.AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  Passed Children of Auto rows should be measured using an infinite height [< 1 ms]
  Passed ArrangeChildren should arrange within measured size [< 1 ms]
  Passed Weighted star column gets proportional space [1 ms]
  Passed Empty absolute rows/columns still affect Grid size [< 1 ms]
  Passed StarsExpandToFixedSizes [< 1 ms]
  Passed Multiple star columns consume equal space [3 ms]
  Passed TwoAbsoluteRowsAndColumns [1 ms]
  Passed OneAutoRowOneAutoColumn [< 1 ms]
  Passed Column span including absolute column should not modify absolute size [< 1 ms]
  Passed MeasureStarAndExplicitColumnSpan [< 1 ms]
  Passed StarRowExpansionWorksWithDifferingScalars [2 ms]
  Passed AutoStarRowSpansDoNotAffectAutoRowSize [< 1 ms]
[xUnit.net 00:00:01.79]   Finished:    Microsoft.Maui.UnitTests
  Passed Simple column spanning with multiple views [< 1 ms]
  Passed MeasureAutoAndExplicitColumnSpan [15 ms]
  Passed AutoStarColumnsRespectUnconstrainedHeight [1 ms]

Test Run Failed.
Total tests: 282
     Passed: 278
     Failed: 4
 Total time: 2.9797 Seconds

🟢 With fix — 🧪 GridLayoutManagerTests: PASS ✅ · 15s

(truncated to last 15,000 chars)

ing(left: 0, top: 10, right: 0, bottom: 10) [< 1 ms]
  Passed MeasureRespectsLargestChildMinimumSize(columns: "*", rows: "*") [< 1 ms]
  Passed MeasureRespectsLargestChildMinimumSize(columns: "auto", rows: "auto") [2 ms]
  Passed Column spanning with column spacing [1 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: -0.10000000000000001) [12 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: 0.10000000000000001) [3 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: -60) [< 1 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: 10) [3 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: 1000) [< 1 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: 1) [< 1 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: 60) [2 ms]
  Passed MultipleArrangeCallsProduceConsistentResults(delta: -10) [< 1 ms]
  Passed MeasureRespectsMinWidth(minWidth: 100, viewWidth: 100, expectedWidth: 100) [< 1 ms]
  Passed MeasureRespectsMinWidth(minWidth: 50, viewWidth: 10, expectedWidth: 50) [< 1 ms]
  Passed MeasureRespectsMinWidth(minWidth: -1, viewWidth: 50, expectedWidth: 50) [1 ms]
  Passed MeasureRespectsMinWidth(minWidth: 10, viewWidth: 50, expectedWidth: 50) [< 1 ms]
  Passed SpannedColumnMeasureIncludesSpacing(columnDefinitions: "100", columnSpan: 1, spacing: 10, expectedWidth: 100) [1 ms]
  Passed SpannedColumnMeasureIncludesSpacing(columnDefinitions: "100, 100, 50", columnSpan: 3, spacing: 20, expectedWidth: 290) [< 1 ms]
  Passed SpannedColumnMeasureIncludesSpacing(columnDefinitions: "100, 100", columnSpan: 2, spacing: 10, expectedWidth: 210) [< 1 ms]
  Passed SpannedColumnMeasureIncludesSpacing(columnDefinitions: "100, 100", columnSpan: 2, spacing: 0, expectedWidth: 200) [< 1 ms]
  Passed MixStarsAndExplicitSizes [1 ms]
  Passed StarColumnsHandleGreedyMeasures(columnDefinitions: "100, *, 100") [< 1 ms]
  Passed StarColumnsHandleGreedyMeasures(columnDefinitions: "Auto, *, 100") [< 1 ms]
  Passed StarColumnsHandleGreedyMeasures(columnDefinitions: "Auto, *, Auto") [< 1 ms]
  Passed StarColumnsHandleGreedyMeasures(columnDefinitions: "100, *, Auto") [< 1 ms]
  Passed AutoStarColumnSpanMeasureDoesNotExceedConstraint(determinantViewWidth: 200, widthConstraint: 100) [1 ms]
  Passed AbsoluteRowsConstrainMeasureHeight [1 ms]
  Passed AutoStarRowsRespectUnconstrainedWidth [3 ms]
  Passed StarRowsShouldFitExplicitDimensions(verticalAlignment: Fill) [< 1 ms]
  Passed StarRowsShouldFitExplicitDimensions(verticalAlignment: End) [< 1 ms]
  Passed StarRowsShouldFitExplicitDimensions(verticalAlignment: Start) [< 1 ms]
  Passed StarRowsShouldFitExplicitDimensions(verticalAlignment: Center) [< 1 ms]
  Passed TwoAbsoluteColumnsOneAbsoluteRow [< 1 ms]
  Passed AutoStarRowSpanMeasureIsSumOfAutoAndStar(determinantViewHeight: 20, heightConstraint: 100) [1 ms]
  Passed SingleWeightedStarColumn [3 ms]
  Passed StarRowsAccountForPadding(top: 16, bottom: 0) [< 1 ms]
  Passed StarRowsAccountForPadding(top: -16, bottom: 16) [1 ms]
  Passed StarRowsAccountForPadding(top: 0, bottom: 16) [< 1 ms]
  Passed StarRowsAccountForPadding(top: -16, bottom: -16) [< 1 ms]
  Passed StarRowsAccountForPadding(top: 16, bottom: 16) [< 1 ms]
  Passed StarRowsAccountForPadding(top: 0, bottom: 0) [< 1 ms]
  Passed StarRowsAccountForPadding(top: 16, bottom: -16) [< 1 ms]
  Passed AutoStarColumnSpanMeasureIsSumOfAutoAndStar(determinantViewWidth: 20, widthConstraint: 100) [1 ms]
  Passed Single star row with a view measured at infinite height gets height of the view [< 1 ms]
  Passed Single star row consumes all vertical space [< 1 ms]
  Passed Measure should include row spacing [1 ms]
  Passed MeasureRespectsMinHeight(minHeight: 100, viewHeight: 100, expectedHeight: 100) [< 1 ms]
  Passed MeasureRespectsMinHeight(minHeight: 10, viewHeight: 50, expectedHeight: 50) [< 1 ms]
  Passed MeasureRespectsMinHeight(minHeight: 50, viewHeight: 10, expectedHeight: 50) [< 1 ms]
  Passed MeasureRespectsMinHeight(minHeight: -1, viewHeight: 50, expectedHeight: 50) [< 1 ms]
  Passed ChildInStarColumnWithInfiniteSpaceIsMeasuredWithInfinity [3 ms]
  Passed MinHeightDominatesMaxHeight [< 1 ms]
  Passed StarColumnWidthLimitedToGridWidth [1 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: -0.10000000000000001) [4 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: 1) [1 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: 60) [3 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: 1000) [< 1 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: -60) [1 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: 0.10000000000000001) [< 1 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: -10) [3 ms]
  Passed ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges(heightDelta: 10) [< 1 ms]
  Passed Star rows don't appropriate row spacing during measurement [3 ms]
  Passed MaxHeightDominatesHeight [< 1 ms]
  Passed SpannedCellMeasurementIncludesRowSpacingIssue26633 [2 ms]
  Passed FillGridArrangesStarRowToHeightConstraint(implied: False, constraint: 15) [< 1 ms]
  Passed FillGridArrangesStarRowToHeightConstraint(implied: True, constraint: 100) [3 ms]
  Passed FillGridArrangesStarRowToHeightConstraint(implied: False, constraint: 100) [< 1 ms]
  Passed FillGridArrangesStarRowToHeightConstraint(implied: True, constraint: 15) [< 1 ms]
  Passed Auto columns without content have width zero [2 ms]
  Passed AbsoluteColumnsConstrainMeasureWidth [3 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: Fill, impliedColumn: True) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: Start, impliedColumn: True) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: End, impliedColumn: True) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: Start, impliedColumn: False) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: Center, impliedColumn: False) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: End, impliedColumn: False) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: Fill, impliedColumn: False) [< 1 ms]
  Passed GridMeasuresStarColumnToChildWidth(alignment: Center, impliedColumn: True) [< 1 ms]
  Passed ChildInStarRowWithInfiniteSpaceIsMeasuredWithInfinity [< 1 ms]
  Passed GridMeasureShouldUseExplicitWidth [< 1 ms]
  Passed AutoRowIntersectionWithUnconstrainedMeasure [1 ms]
  Passed Weighted star row gets proportional space [1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "100, *, 100") [1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "Auto, *, 100") [< 1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "Auto, *, Auto") [< 1 ms]
  Passed StarRowsHandleGreedyMeasures(rowDefinitions: "100, *, Auto") [< 1 ms]
  Passed MeasureAccountsForPadding(left: 0, top: 0, right: 0, bottom: 0) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 10, top: 10, right: 10, bottom: 10) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 0, top: 10, right: 0, bottom: 10) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 23, top: 5, right: 3, bottom: 15) [< 1 ms]
  Passed MeasureAccountsForPadding(left: 10, top: 0, right: 10, bottom: 0) [< 1 ms]
  Passed Single star column consumes all horizontal space [< 1 ms]
  Passed Column spacing shouldn't affect a single-column grid [< 1 ms]
  Passed TwoAbsoluteRowsOneAutoColumn [< 1 ms]
  Passed TwoAbsoluteColumnsOneAutoRow [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100, 100", rowSpan: 2, spacing: 0, expectedHeight: 200) [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100, 100, 50", rowSpan: 3, spacing: 20, expectedHeight: 290) [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100, 100", rowSpan: 2, spacing: 10, expectedHeight: 210) [< 1 ms]
  Passed SpannedRowMeasureIncludesSpacing(rowDefinitions: "100", rowSpan: 1, spacing: 10, expectedHeight: 100) [< 1 ms]
  Passed StarColumnsHaveChildWidthsWhenGridCentered [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: -10) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: -60) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 1) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 0.10000000000000001) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 10) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 60) [< 1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: 1000) [1 ms]
  Passed ViewsInUnconstrainedStarColumnsDoNotOverlapWhenArrangeWidthChanges(widthDelta: -0.10000000000000001) [< 1 ms]
  Passed Totally empty star columns measured at infinite width have zero width [< 1 ms]
  Passed AutoColumnIsDominatedByWidestView(unconstrainedWidth: 10, constrainedWidth: 30) [1 ms]
  Passed AutoColumnIsDominatedByWidestView(unconstrainedWidth: 50, constrainedWidth: 30) [1 ms]
  Passed Row spanning with row spacing [1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: True, constraint: 100) [< 1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: False, constraint: 100) [< 1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: True, constraint: 15) [< 1 ms]
  Passed FillGridArrangesStarColumnToWidthConstraint(implied: False, constraint: 15) [< 1 ms]
  Passed ArrangeAccountsForFill [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 40, view0ExpectedWidth: 21, view1ExpectedX: 24) [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 37, view0ExpectedWidth: 18, view1ExpectedX: 21) [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 38, view0ExpectedWidth: 19, view1ExpectedX: 22) [< 1 ms]
  Passed StarRowsCalculateCorrectlyWhenGridWidthNearsMinWidth(widthConstraint: 39, view0ExpectedWidth: 20, view1ExpectedX: 23) [< 1 ms]
  Passed Simple row spanning with multiple views [4 ms]
  Passed We can specify fractional star sizes for rows [1 ms]
  Passed AutoColumnIntersectionWithUnconstrainedMeasure [< 1 ms]
  Passed Star columns don't appropriate column spacing during measurement [4 ms]
  Passed AutoStarColumnSpansDoNotAffectAutoColumnSize [1 ms]
  Passed MinWidthDominatesMaxWidth [< 1 ms]
  Passed Two columns should include the column spacing once [1 ms]
  Passed We can specify fractional star sizes for columns [2 ms]
  Passed StarsAdjustWhenArrangeAndMeasureWidthDiffer(widthConstraint: 926, arrangedWidth: 845) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureWidthDiffer(widthConstraint: 926, arrangedWidth: 1026) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureWidthDiffer(widthConstraint: 926, arrangedWidth: 926) [< 1 ms]
  Passed Star Column Width is correct when the first child is Collapsed [1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 39, view0ExpectedWidth: 20, view1ExpectedX: 23) [1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 38, view0ExpectedWidth: 19, view1ExpectedX: 22) [1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 40, view0ExpectedWidth: 21, view1ExpectedX: 24) [< 1 ms]
  Passed StarColsCalculateCorrectlyWhenGridHeightNearsMinHeight(widthConstraint: 37, view0ExpectedWidth: 18, view1ExpectedX: 21) [< 1 ms]
  Passed Row spacing shouldn't affect a single-row grid [< 1 ms]
  Passed MaxWidthDominatesWidth [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureHeightDiffer(heightConstraint: 926, arrangedHeight: 1026) [< 1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureHeightDiffer(heightConstraint: 926, arrangedHeight: 845) [1 ms]
  Passed StarsAdjustWhenArrangeAndMeasureHeightDiffer(heightConstraint: 926, arrangedHeight: 926) [< 1 ms]
  Passed IgnoresCollapsedViews [1 ms]
  Passed CanSpanAbsoluteColumns [2 ms]
  Passed Auto rows with collapsed views should still count for row spacing [1 ms]
  Passed StarColumnExpansionWorksWithDifferingScalars [2 ms]
  Passed Row span including absolute row should not modify absolute size [3 ms]
  Passed Empty columns still count for column spacing [< 1 ms]
  Passed Row-spanning views smaller than the views confined to the row should not affect row size [2 ms]
  Passed StarRowHeightLimitedToGridHeight [1 ms]
  Passed Measure should include column spacing [< 1 ms]
  Passed Children of Auto columns should be measured using an infinite width [< 1 ms]
  Passed GridMeasureShouldUseExplicitHeight [3 ms]
  Passed Star Row Height is correct when the first child is Collapsed [< 1 ms]
  Passed UnconstrainedStarColumnsRetainTheirWidthsWhenArrangedAtMeasuredSize [1 ms]
  Passed AutoRowIsDominatedByTallestView(unconstrainedHeight: 40, constrainedHeight: 30) [3 ms]
  Passed AutoRowIsDominatedByTallestView(unconstrainedHeight: 10, constrainedHeight: 30) [1 ms]
  Passed Auto columns with collapsed views should still count for column spacing [3 ms]
  Passed DoesNotIgnoreHiddenViews [1 ms]
  Passed Single star column with a view measured at infinite width gets width of the view [< 1 ms]
  Passed UnconstrainedStarRowsRetainTheirHeightsWhenArrangedAtMeasuredSize [1 ms]
  Passed ArrangeRespectsBounds [< 1 ms]
  Passed AutoStarRowSpanMeasureDoesNotExceedConstraint(determinantViewHeight: 200, heightConstraint: 100) [< 1 ms]
  Passed AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(widthConstraint: 500, heightConstraint: 400) [3 ms]
  Passed AutoStarCellsMeasureOverflowingAutoCellIsAdjusted(widthConstraint: 1000, heightConstraint: 500) [1 ms]
  Passed Children of Auto rows should be measured using an infinite height [< 1 ms]
  Passed ArrangeChildren should arrange within measured size [< 1 ms]
  Passed Weighted star column gets proportional space [1 ms]
  Passed Empty absolute rows/columns still affect Grid size [1 ms]
  Passed StarsExpandToFixedSizes [< 1 ms]
  Passed Multiple star columns consume equal space [5 ms]
  Passed TwoAbsoluteRowsAndColumns [2 ms]
  Passed OneAutoRowOneAutoColumn [< 1 ms]
  Passed Column span including absolute column should not modify absolute size [< 1 ms]
  Passed MeasureStarAndExplicitColumnSpan [< 1 ms]
  Passed StarRowExpansionWorksWithDifferingScalars [2 ms]
  Passed AutoStarRowSpansDoNotAffectAutoRowSize [2 ms]
[xUnit.net 00:00:02.00]   Finished:    Microsoft.Maui.UnitTests
  Passed Simple column spanning with multiple views [< 1 ms]
  Passed MeasureAutoAndExplicitColumnSpan [< 1 ms]
  Passed AutoStarColumnsRespectUnconstrainedHeight [54 ms]

Test Run Successful.
Total tests: 282
     Passed: 282
 Total time: 3.2928 Seconds

⚠️ Failure Details

  • Issue27998 FAILED with fix (should pass)
📁 Fix files reverted (2 files)
  • eng/pipelines/ci-copilot.yml
  • src/Core/src/Layouts/GridLayoutManager.cs

🧪 UI Tests — Category Detection

Detected UI test categories: Border,Cells,Layout,ScrollView


🔍 Regression Cross-Reference

🔍 Regression Cross-Reference

🟢 No regression risks detected. No labeled bug-fix PRs in the last 6 months touched the modified files.


🔍 Pre-Flight — Context & Validation

Issue: #27998 - [Windows] ScrollView is not scrolling to the bottom if in grid with *,auto Width
PR: #28258 - fix-27998 - [Windows] ScrollView is not scrolling to the bottom if in grid with *,auto Width
Platforms Affected: Windows (primary), Android/iOS/macOS (test coverage added)
Files Changed: 2 implementation, 3 test

Key Findings

  • Bug: In a Grid with rows Auto, * and columns *, Auto, when a child has an explicit Width (e.g., Width=50 on a Border), the Auto column's size is not correctly computed, causing the ScrollView in the * column to overflow and fail to scroll to the bottom
  • The PR adds two mechanisms: (1) pre-initialize Auto column/row sizes from children with explicit Width/Height before MeasureCells(), and (2) a new AdjustDefinitions() method called after FirstMeasurePass(), SecondMeasurePass(), and in MeasureCells() to clamp total definitions to the grid constraint
  • The test on Android/iOS currently fails because lastItem.IsDisplayed() returns false initially on those platforms (scrolling works but the assertion Assert.That(lastItem.IsDisplayed().Equals(false)) fails — it asserts last item is NOT visible before scrolling)
  • The PR author removed two [InlineData(200, 100)] test cases from existing unit tests (AutoStarColumnSpanMeasureIsSumOfAutoAndStar, AutoStarRowSpanMeasureIsSumOfAutoAndStar) — these are regressions introduced by AdjustDefinitions that change the expected behavior when child sizes exceed constraints
  • Gate: ❌ FAILED — tests did NOT behave as expected

Code Review Summary

Verdict: NEEDS_CHANGES
Confidence: high
Errors: 2 | Warnings: 5 | Suggestions: 3

Key code review findings:

  • GridLayoutManager.cs:543-553 — LINQ in measurement hot path (Sum, Where, OrderByDescending) allocates enumerators on every layout cycle; violates performance-hotpaths rule (no LINQ in layout code)
  • GridLayoutManager.cs:550 — Negative definition sizes possible: biggestDefinition.Size -= overflow has no lower bound; needs Math.Max(0, ...)
  • ⚠️ GridLayoutManager.cs:543 — Spacing/padding excluded from overflow calculation (should use SumDefinitions(definitions, spacing))
  • ⚠️ GridLayoutManager.cs:155,163 — Direct row.Size = view.Height assignment (last-write-wins); should use row.Update(view.Height) (max semantics)
  • ⚠️ GridLayoutManager.cs:147-166 — Column/row spans ignored in pre-initialization; only first column seeded for spanning cells
  • ⚠️ GridLayoutManagerTests.cs:2686,2707 — Silent deletion of [InlineData(200, 100)] covers up a behavioral regression
  • ⚠️ Issue27998.cs:38 — UI test known-broken on non-Windows platforms (Android/iOS assertion fails before scrolling)
  • 💡 GridLayoutManager.cs:150,158 — Use Dimension.IsExplicitSet(view.Height) instead of view.Height > 0
  • 💡 Issue27998.cs:2 — Unused import OpenQA.Selenium.Internal
  • 💡 Issue27998.cs:22 — Wrong category [Category(UITestCategories.Cells)]; should use only UITestCategories.ScrollView

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #28258 Pre-initialize Auto defs from child explicit sizes + AdjustDefinitions() after each measure pass ❌ FAILED (Gate) GridLayoutManager.cs Breaks existing tests; Android/iOS test assertion issue

🔬 Code Review — Deep Analysis

Code Review — PR #28258

Independent Assessment

What this changes: Adds a post-InitializeCells() loop that pre-seeds Auto row/column sizes from children's explicit Width/Height requests, then introduces an AdjustDefinitions() method that clips definition sizes to fit within the grid constraint. AdjustDefinitions() is called inside the FirstMeasurePass per-cell loop, inside SecondMeasurePass per-cell loop, and between the two passes after star resolution.

Inferred motivation: In a Grid with "*, Auto" columns where the Auto-column child has an explicit WidthRequest, the Auto column never gets its size seeded during the first measurement pass (the child is deferred to the second pass because its row height is star-dependent). This causes star resolution to assign all available width to the star column, leaving nothing for the Auto column. The pre-seeding and overflow correction work together to fix this.


Reconciliation with PR Narrative

Author claims: Two independent problems: (1) absolute Width/Height values on children not considered for Auto/Star column/row sizing at init time; (2) overflow not corrected during and after measurement passes.

Agreement: The diagnosis and the mechanism are essentially correct for the specific test scenario. The root cause (Auto column cell skipped to second pass, star resolution therefore over-allocates) is real.

Disagreement: The solution as implemented has several correctness and performance deficiencies beyond the specific test scenario (see findings below).


Findings

❌ Error — LINQ in measurement hot path

AdjustDefinitions uses definitions.Sum(d => d.Size), .Where(d => d.IsAuto || d.IsStar), and .OrderByDescending(d => d.Size).FirstOrDefault(). This method is called inside FirstMeasurePass per cell, inside SecondMeasurePass per cell, and once between passes — allocating enumerators/delegates on every layout cycle. Per performance-hotpaths.instructions.md: "No LINQ methods — use indexed for loops." (GridLayoutManager.cs:543-553)

❌ Error — Negative definition sizes possible

biggestDefinition.Size -= overflow has no lower bound guard. With 2 columns [10, 10] and a constraint of 5, overflow = 15, so the biggest definition becomes −5. Negative column/row sizes corrupt all downstream position arithmetic in LeftEdgeOfColumn/TopEdgeOfRow. Fix: Math.Max(0, biggestDefinition.Size - overflow). (GridLayoutManager.cs:550)

⚠️ Warning — Spacing and padding excluded from overflow calculation

definitions.Sum(d => d.Size) omits row/column spacing and padding. The existing SumDefinitions(definitions, spacing) helper (line 337) correctly accounts for spacing. For a grid with ColumnSpacing=10, two columns at 50 each produce a real grid width of 110, but the check sees 100, misses the overflow, and makes no correction. (GridLayoutManager.cs:543)

⚠️ Warning — Direct assignment overwrites instead of taking max

row.Size = view.Height (and column.Size = view.Width) uses last-write-wins semantics. If two views share the same Auto row/column, the last cell in _cells order wins. Every other definition update in this file uses Definition.Update(size) (max semantics). Should be row.Update(view.Height). (GridLayoutManager.cs:155, 163)

⚠️ Warning — Column/row spans ignored in pre-initialization

For cells with ColumnSpan > 1, only the first column is pre-seeded. The view's full width is assigned to one column instead of being handled via the existing TrackSpan/ResolveSpans mechanism. This works for the specific scenario (single-column Border) but is silently wrong for any spanning cell with an explicit WidthRequest/HeightRequest. (GridLayoutManager.cs:147-166)

⚠️ Warning — Removed test data documents a behavioral regression

[InlineData(200, 100)] was silently deleted from both AutoStarColumnSpanMeasureIsSumOfAutoAndStar and AutoStarRowSpanMeasureIsSumOfAutoAndStar. These verified that content larger than the constraint doesn't corrupt measurement. The deletion means the new code changes this invariant. If the change is intentional, the tests should be replaced (not deleted) with an explanation. (GridLayoutManagerTests.cs:2686, 2707)

⚠️ Warning — UI test known-broken on non-Windows platforms

TestOtherPlatforms() asserts lastItem.IsDisplayed() == true after scroll, but the reviewer jsuarezruiz flagged that on Android/iOS/Mac the assertion lastItem.IsDisplayed().Equals(false) (pre-scroll state) fails — the item is already visible before scrolling. Author acknowledged this as an open task. PR should not be merged until this is resolved. (Issue27998.cs:38)

💡 Suggestion — Use Dimension.IsExplicitSet instead of > 0

view.Height > 0 implicitly relies on Dimension.Unset == -1.0. The idiomatic check (used on line 91 of the same file) is Dimension.IsExplicitSet(view.Height). (GridLayoutManager.cs:150, 158)

💡 Suggestion — Unused import

using OpenQA.Selenium.Internal; in Issue27998.cs:2 is unused. Remove it.

💡 Suggestion — Wrong test category

[Category(UITestCategories.Cells)] is for ListView/CollectionView tests. Remove it; UITestCategories.ScrollView is already present. (Issue27998.cs:22)


Devil's Advocate

"Is AdjustDefinitions actually needed given the pre-seeding?" — Yes, partly. The pre-seeding only handles views with explicit Width/Height requests. The AdjustDefinitions correction handles the case where the auto column grew during measurement to exceed the constraint. Both are needed for the full fix.

"Could the existing ResolveStars + MinimizeStars machinery handle this without the new overflow correction?" — Probably yes, if the ordering of operations were adjusted. The real root cause is that Auto-column cells in Star rows are deferred to the second pass, so star resolution runs before the Auto column is sized. A more targeted fix might be to measure Auto-width cells in the first pass with height = +Infinity regardless of their row type. This would be a smaller, less invasive change — worth discussing.

"Are the ❌ errors showstoppers?" — The LINQ one is a definite correctness-adjacent issue for production use at scale. The negative size bug is a latent crash risk in edge cases. Both should be fixed before merge.


Verdict: NEEDS_CHANGES

Confidence: high
Summary: The approach correctly diagnoses the root cause and the fix works for the specific test scenario. However, the implementation has two ❌ errors (LINQ in hot path violating MAUI's explicit convention; potential negative sizes causing corrupt layout), plus several ⚠️ warnings (spacing/padding omission, last-write-wins semantics, span handling, removed tests indicating behavioral regression, and a known cross-platform UI test failure). The PR is a good community contribution and the core idea is sound, but it needs a cleanup pass before it's production-ready.


🔧 Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix Dimension.IsExplicitSet() pre-seeding + AdjustDefinitions once per pass (not per cell) ✅ PASS (282/282) GridLayoutManager.cs, Issue27998.cs Uses canonical MAUI dimension check; less aggressive call pattern
2 try-fix No-LINQ AdjustDefinitions with spacing + Update() semantics + Math.Max(0, ...) guard ✅ PASS (282/282) GridLayoutManager.cs, Issue27998.cs Fixes all ❌ Errors from code review; spacing included in overflow calc
3 try-fix Seed deferred Auto dims in FirstMeasurePass using +Infinity before star resolution ✅ PASS (282/282) GridLayoutManager.cs, GridLayoutManagerTests.cs, Issue27998.cs Root-cause approach; no AdjustDefinitions needed
4 try-fix Pre-seed Auto columns + pre-measure Auto-row deferred cells before star resolution ✅ PASS (282/282) GridLayoutManager.cs, Issue27998.cs Two-phase pre-fix around star resolution; no post-correction
PR PR #28258 Pre-initialize Auto defs + AdjustDefinitions() after each cell measurement ❌ FAILED (Gate) GridLayoutManager.cs, tests MAUI0002 error in UI test; LINQ in hot path

Cross-Pollination

Model Round New Ideas? Details
claude-opus-4.6 2 NO NEW IDEAS All 4 approaches converge on same categories of fix
claude-sonnet-4.6 2 NO NEW IDEAS Core patterns exhausted
gpt-5.3-codex 2 NO NEW IDEAS Root-cause and post-correction approaches both explored
claude-sonnet-4.6 2 NO NEW IDEAS Pre-seeding before star resolution fully covered

Exhausted: Yes
Selected Fix: Candidate #2 (no-LINQ AdjustDefinitions with spacing + Update() semantics + Math.Max(0, ...) guard) — it applies the exact fixes flagged by the code review reviewer (LINQ hot path, negative sizes, spacing calc, max semantics), is structurally closest to the PR's approach (easiest to review), and all 282 tests pass.


📋 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Phase Status

Phase Status Notes
Pre-Flight ✅ COMPLETE 2 impl files, 3 test files; Windows-primary bug
Code Review NEEDS_CHANGES (high) 2 errors, 5 warnings, 3 suggestions
Gate ❌ FAILED Android — MAUI0002 build error in UI test
Try-Fix ✅ COMPLETE 4 attempts, 4 passing
Report ✅ COMPLETE

Code Review Impact on Try-Fix

The code review's ❌ Error findings directly shaped the try-fix exploration. Both ❌ errors (LINQ in hot path and potential negative sizes) were addressed in attempts 1 and 2. Attempt 1 (claude-opus-4.6) addressed the Dimension.IsExplicitSet() suggestion and reduced AdjustDefinitions call frequency. Attempt 2 (claude-sonnet-4.6) implemented a complete no-LINQ rewrite with spacing included in overflow calculation and Math.Max(0, ...) guard. Attempt 3 (gpt-5.3-codex) explored the alternative the code reviewer mentioned — fixing the root cause at FirstMeasurePass rather than adding post-hoc correction. Attempt 4 took a hybrid two-phase pre-seeding approach. All 4 passed 282/282 unit tests.

Candidate Comparison

Candidate Gate/Test Code Review Errors Fixed Complexity Rank
pr ❌ FAILED (MAUI0002 + Gate) None Medium 6 (lowest)
try-fix-2 ✅ PASS (282/282) All ❌ errors + ⚠️ spacing/Update Low 1
pr-plus-reviewer ✅ PASS (282/282) All ❌ errors + ⚠️ spacing/Update Low 1 (tied)
try-fix-1 ✅ PASS (282/282) IsExplicitSet, less LINQ concern Medium 3
try-fix-3 ✅ PASS (282/282) Root-cause fix, avoids AdjustDefs Medium 3
try-fix-4 ✅ PASS (282/282) Pre-seeding, two-phase High 5

Winner: try-fix-2 — No-LINQ AdjustDefinitions with spacing correction, Update() semantics, Math.Max(0, ...) guard, MAUI0002 fix. Structurally identical to the PR's approach but with all code review errors corrected. Easiest for the community contributor to apply as a diff.

Summary

PR #28258 correctly diagnoses the root cause of issue #27998 (Auto column cells deferred to SecondMeasurePass cause star columns to over-allocate), and the AdjustDefinitions() mechanism is fundamentally sound. However, the implementation has two blocking errors (LINQ in a layout hot path and no negative-size guard) plus the UI test cannot build on Android (MAUI0002: too many [Category] attributes). The recommended fix is try-fix-2, which keeps the PR's structural approach while correcting all code review errors.

Root Cause

In a Grid with rows="Auto,*" and columns="*,Auto", a child with explicit WidthRequest in the Auto column has MeasureHeight=NaN (star row height unknown), so it is deferred to SecondMeasurePass. ResolveStarColumns() runs during FirstMeasurePass with the Auto column size still at 0, assigning all available width to the star column. This leaves the ScrollView in the star column with too much width and the Auto column's content overflows, causing layout corruption.

Fix Quality

The PR's core fix is correct for the specific scenario. The AdjustDefinitions overflow correction and pre-seeding loop are both needed. However, the implementation must be improved: replace LINQ with for loops (per MAUI layout performance rules), add a Math.Max(0, ...) lower bound guard, use Update() for max semantics in pre-initialization, include spacing in the overflow calculation, and fix the UI test's multiple [Category] attributes.


Copy link
Copy Markdown
Collaborator

@MauiBot MauiBot left a comment

Choose a reason for hiding this comment

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

🤖 Automated review — alternative fix proposed

The expert-reviewer evaluation compared the PR fix against #2 automatically generated candidates and selected try-fix-2 as the strongest fix.

Why: try-fix-2 applies all code review error fixes (no LINQ in hot path, Math.Max(0,...) negative-size guard, spacing in overflow calc, Update() max semantics) to the PR's structural approach, passes all 282 unit tests, and fixes the MAUI0002 UI test build error. The original PR fix (pr) is ranked last because its gate failed.

Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.

Candidate diff (`try-fix-2`)
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27998.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27998.cs
index 77e64e9b8c..994e4c7ac8 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27998.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27998.cs
@@ -1,5 +1,4 @@
 fusing NUnit.Framework;
-using OpenQA.Selenium.Internal;
 using UITest.Appium;
 using UITest.Core;
 
@@ -19,9 +18,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues
 		public override string Issue => "[Windows] ScrollView is not scrolling to the bottom if in grid with *,auto Width";
 
 		[Test]
-		[Category(UITestCategories.Cells)]
 		[Category(UITestCategories.ScrollView)]
-		[Category(UITestCategories.Border)]
 		public void GridAutosStarsScollToEndDisplaysLastItem()
 		{
 			TestWindows();
diff --git a/src/Core/src/Layouts/GridLayoutManager.cs b/src/Core/src/Layouts/GridLayoutManager.cs
index 42076d6829..e917bb308b 100644
--- a/src/Core/src/Layouts/GridLayoutManager.cs
+++ b/src/Core/src/Layouts/GridLayoutManager.cs
@@ -141,6 +141,31 @@ namespace Microsoft.Maui.Layouts
 
 				InitializeCells();
 
+				// Some children may have an explicit Width/Height set. Pre-seed Auto row/column sizes
+				// from those values using Update() (max semantics) so that ResolveStarColumns/Rows
+				// accounts for the Auto size before computing the star allocation.
+				for (int n = 0; n < _cells.Length; n++)
+				{
+					var cell = _cells[n];
+					var view = _childrenToLayOut[cell.ViewIndex];
+					if (cell.RowSpan == 1 && Dimension.IsExplicitSet(view.Height))
+					{
+						var row = _rows[cell.Row];
+						if (row.IsAuto)
+						{
+							row.Update(view.Height + view.Margin.VerticalThickness);
+						}
+					}
+					if (cell.ColumnSpan == 1 && Dimension.IsExplicitSet(view.Width))
+					{
+						var column = _columns[cell.Column];
+						if (column.IsAuto)
+						{
+							column.Update(view.Width + view.Margin.HorizontalThickness);
+						}
+					}
+				}
+
 				MeasureCells();
 			}
 
@@ -369,6 +394,8 @@ namespace Microsoft.Maui.Layouts
 					ResolveStarRows(_gridHeightConstraint);
 				}
 
+				AdjustDefinitions();
+
 				SecondMeasurePass();
 
 				ResolveSpans();
@@ -499,6 +526,43 @@ namespace Microsoft.Maui.Layouts
 							_rows[cell.Row].Update(measure.Height);
 						}
 					}
+
+					AdjustDefinitions();
+				}
+			}
+
+			void AdjustDefinitions()
+			{
+				AdjustDefinitions(_rows, _gridHeightConstraint, _rowSpacing, _padding.VerticalThickness);
+				AdjustDefinitions(_columns, _gridWidthConstraint, _columnSpacing, _padding.HorizontalThickness);
+			}
+
+			static void AdjustDefinitions(Definition[] definitions, double constraint, double spacing, double paddingThickness)
+			{
+				var total = SumDefinitions(definitions, spacing);
+				if (total <= constraint - paddingThickness)
+				{
+					return;
+				}
+
+				var overflow = total - (constraint - paddingThickness);
+
+				// Find the largest Auto or Star definition to absorb the overflow.
+				int biggestIndex = -1;
+				double biggestSize = 0;
+				for (int n = 0; n < definitions.Length; n++)
+				{
+					var def = definitions[n];
+					if ((def.IsAuto || def.IsStar) && def.Size > biggestSize)
+					{
+						biggestSize = def.Size;
+						biggestIndex = n;
+					}
+				}
+
+				if (biggestIndex >= 0)
+				{
+					definitions[biggestIndex].Size = Math.Max(0, definitions[biggestIndex].Size - overflow);
 				}
 			}

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels May 5, 2026
@BrayanKhosravian
Copy link
Copy Markdown
Contributor Author

What an awesome review and tooling.
Have been off here for a while.
I will have a look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-scrollview ScrollView area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter community ✨ Community Contribution layout-grid platform/windows s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] ScrollView is not scrolling to the bottom if in grid with *,auto Width

3 participants