Bug 36858 - "Layout cycle detected. Layout could not complete." on Windows 8.1 RT
Summary: "Layout cycle detected. Layout could not complete." on Windows 8.1 RT
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-12-10 23:16 UTC by John Hardman
Modified: 2016-04-13 18:51 UTC (History)
3 users (show)

Tags: Windows RT Layout Cycle Detected ScrollView StackLayout
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description John Hardman 2015-12-10 23:16:27 UTC
Whilst using slightly modified Xamarin-supplied code from bug 34909 to build a repro for 36651, I hit "Layout cycle detected". To reproduce, simply build for Windows 8.1 RT and run (I'm actually running on Windows 10). Hit the "Add item" button multiple times. After about 10 or so button presses, the Layout cycle detected is reported.

using System;

using Xamarin.Forms;

namespace ZyaMusic_ScrollViewBug
    public class LandingPage : ContentPage
        private static int numberOfButtons = 3;
        StackLayout layout;
        Button addItem, removeItem;
        ScrollView scrollView;

        public LandingPage()
            layout = new StackLayout();
            for (var i = 0; i < 10; i++)
                layout.Children.Add(new Button { Text = "This is a button" });

            addItem = new Button { Text = "Add Item" };
            removeItem = new Button { Text = "Remove Item" };
            scrollView = new ScrollView { Content = layout };

            Content = new StackLayout
                Children = { scrollView, addItem, removeItem }

            addItem.Clicked += (object sender, EventArgs e) =>
                Button lastButton = null;
                for (int i = 0; i < numberOfButtons; ++i)
                    lastButton = new Button
                        Text = String.Format("This is button #{0}", i)

            scrollView.ScrollToAsync(lastButton, ScrollToPosition.End, false);
            removeItem.Clicked += (object sender, EventArgs e) =>
                if (layout.Children.Count != 0)
                    layout.Children.RemoveAt(layout.Children.Count - 1);
Comment 1 John Miller [MSFT] 2016-01-04 18:26:18 UTC
I was unable to reproduce this issue. I pressed the Add Item about 50 times and I did not notice an issue with XF 2.0. Could you upload a project that reproduces this?

You might also consider using a ListView for controls that need to have long scrollable lists of content. The performance should be better.
Comment 2 Samantha Houts [MSFT] 2016-04-13 18:51:14 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team