Skip to content

Infinite Measure Looping on iOS (we missed at lest one) #37892

Closed

Description

@JohnTraDolta

Description

Earlier this year i reported #34042 - it was fixed.

I have now found another one of those Infinite looping bugs, one we initial missed.

I have updated the sample repo with a new example and updated the maui nuget version to 10.0.100.

Note that i ran the issue on a iOS simulator (iPhone 16 Pro - iOS 18.6). The issue is not limited to this device. We have seen the bug/issue on devices with iOS version 18 and 26. More on 18 than 26, and what fails on one model does not on another.

Due to the "randomness" of this error we have decided to implement a circuit breaker in the ViewHandler.ViewMapper. We have added a MeasureCounter attached property and subscribe to the SizeChangedEvent and set View.HeightRequest to the View.Height if the MeasureCounter is > 100 iterations. 🤮

For Example 4 i have extracted the failing code and removed parts that did not contribute to the looping. If you want i can provide more examples/samples. Please do not hesitate

Steps to Reproduce

pull the code from the repo, run the code on iOS simulator (iPhone 16 Pro - iOS 18.6).
press "Example 4" and wait for the quick and dirty loop detector to stop the loop (stopping after 500 size changed)
The app is unresponsive while the loop is running.

Link to public reproduction project repository

https://github.com/JohnTraDolta/MauiInfiniteMeasureLoopingBug

Version with bug

10.0.100

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.120 SR12

Affected platforms

iOS

Affected platform versions

iOS 18 and 26.

Did you find any workaround?

Yes here it is

        ViewHandler.ViewMapper.AppendToMapping("MeasureCounterFallbackHandler", (handler, iView) =>
        {
            if (iView is View view)
            {
                view.SizeChanged += ViewOnSizeChanged;
                view.Unloaded += ViewOnUnloaded;

                void ViewOnUnloaded(object? sender, EventArgs e)
                {
                    if (sender is not View v)
                        return;

                    (sender as View).Unloaded -= ViewOnUnloaded;
                    v.SizeChanged -= ViewOnSizeChanged;
                }

                void ViewOnSizeChanged(object? sender, EventArgs e)
                {
                    if (MeasureCounter.IsGreaterThanX(view, 100))
                    {
                        view.HeightRequest = view.Height;
                        return;
                    }
                    
                    MeasureCounter.IncrementCount(view);
                    Debug.WriteLine($"[MeasureCounter:] {MeasureCounter.GetCount(view)}");
                }
            }
        });
public class MeasureCounter
{
 
    public static readonly BindableProperty CountProperty = BindableProperty.CreateAttached("Count", typeof(int), typeof(MeasureCounter), 0);
    public static int GetCount(BindableObject bindable) => (int)bindable.GetValue(CountProperty);
    public static void SetCount(BindableObject bindable, int value) => bindable.SetValue(CountProperty, value);
    
    public static void IncrementCount(BindableObject bindable) => SetCount(bindable, GetCount(bindable) + 1);
    public static bool IsGreaterThanX(BindableObject bindable, int x) => GetCount(bindable) > x;
}

Relevant log output

Activity

  1. added
    t/bug
    on Aug 27, 2026
  2. added
    area-layout
    on Aug 27, 2026
  3. TamilarasanSF4853 commented on Aug 27, 2026

    @TamilarasanSF4853
    Contributor

    This issue has been validated in Visual Studio Code 1.135.0 with .NET MAUI versions 9.0.120, 10.0.0 and 10.0.100. It can be reproduced on the iOS platform from version 10.0.0.

    net10.mov
    net9.mov
  4. added
    s/verified
    s/triaged
    i/regression
    on Aug 27, 2026
  5. added
    partner/syncfusion
    on Aug 28, 2026
  6. added this to the .NET 11.0-rc1 milestone on Sep 3, 2026
  7. added a commit that references this issue on Sep 11, 2026
    360c206
  8. added 2 commits that reference this issue on Sep 15, 2026
    bfc442d
    89eedb9
  9. 2 remaining items

  10. added 6 commits that reference this issue on Sep 27, 2026
    fc695b5
    e84d438
    ab05d52
    5484c37
    45092a5
    ad4842f
  11. kubaflo commented on Oct 10, 2026

    @kubaflo
    Contributor

    Thank you for the report and the investigation details. We are closing this as completed: the iOS ScrollView measure-loop correction uses pixel-aware adjusted-inset comparisons and normalizes effectively empty insets, addressing the reported Example 4 boundary loop.

    Supporting evidence: #38197 (merged into inflight/current).

    This records the merged source change; it does not imply that the fix is present in every released .NET MAUI package.

    If you can still reproduce the reported behavior in a build that includes the linked change, please comment here with the exact version and reproduction details so we can reopen and investigate. The existing reproduction and discussion remain available; a new issue is not required.

  12. added 6 commits that reference this issue on Oct 13, 2026
    95830ec
    4b446f8
    923fa8c
    d40101c
    5290b4f
    af0ad51
  13. locked and limited conversation to collaborators on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-layouti/regressionpartner/syncfusionplatform/iosregressed-in-10-preview1s/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions