Skip to content

[WASM] Two ItemsRepeaters with UniformGridLayout throw LayoutCycleException forever and the app never renders #24447

Closed

Description

@MartinZikmund

Current behavior

On net10.0-browserwasm, a page with two ItemsRepeaters that use UniformGridLayout, both with items, never completes its first layout. The app stays on the splash screen, and LayoutCycleException is thrown on every tick, forever:

fail: Uno.UI.Dispatching.NativeDispatcher[0]
      NativeDispatcher unhandled exception
Microsoft.UI.Xaml.LayoutCycleException: Layout cycle detected. For more information, see https://aka.platform.uno/layout-cycle
   at Microsoft.UI.Xaml.UIElement.UpdateLayout() in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.cs:line 922
   at Uno.UI.Xaml.Core.CoreServices.OnTick() in C:\a\1\s\src\Uno.UI\UI\Xaml\Internal\CoreServices.cs:line 115
   at Uno.UI.Xaml.Core.CoreServices.<>c.<RequestAdditionalFrame>b__13_0() in C:\a\1\s\src\Uno.UI\UI\Xaml\Internal\CoreServices.cs:line 73
   at Uno.UI.Dispatching.NativeDispatcher.RunAction(NativeDispatcher dispatcher, Action action) in C:\a\1\s\src\Uno.UI.Dispatching\Native\NativeDispatcher.cs:line 192

The retry loop saturates the WASM main thread. Measured from Playwright against the running app, page.evaluate(() => 40 + 2) round-trips in:

page contents round-trip
one ItemsRepeater with items 4 ms — page renders normally
two ItemsRepeaters with items 3 457 – 9 834 ms — page never paints

One repeater is fine; adding a second visible one with items is enough to break it.

Expected behavior

Both repeaters lay out and the page renders, as the same XAML does on WinUI.

How to reproduce

dotnet new unoapp -n RepeaterLayoutLoop --preset blank --platforms wasm, replace MainPage, dotnet run -f net10.0-browserwasm.

MainPage.xaml:

<Page x:Class="RepeaterLayoutLoop.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:RepeaterLayoutLoop"
      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  <Page.Resources>
    <DataTemplate x:Key="CardTemplate" x:DataType="x:String">
      <Border Height="80" Margin="4" Background="LightSteelBlue" CornerRadius="8">
        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding}" />
      </Border>
    </DataTemplate>
  </Page.Resources>

  <StackPanel>
    <TextBlock Text="If you can read this, the page rendered." />

    <ItemsRepeater ItemTemplate="{StaticResource CardTemplate}" ItemsSource="{x:Bind ItemsA}">
      <ItemsRepeater.Layout>
        <UniformGridLayout MinItemWidth="240" MinColumnSpacing="8" MinRowSpacing="8" />
      </ItemsRepeater.Layout>
    </ItemsRepeater>

    <!-- Remove this second repeater (or its items) and the page renders. -->
    <ItemsRepeater ItemTemplate="{StaticResource CardTemplate}" ItemsSource="{x:Bind ItemsB}">
      <ItemsRepeater.Layout>
        <UniformGridLayout MinItemWidth="240" MinColumnSpacing="8" MinRowSpacing="8" />
      </ItemsRepeater.Layout>
    </ItemsRepeater>
  </StackPanel>
</Page>

MainPage.xaml.cs:

using System.Collections.ObjectModel;

namespace RepeaterLayoutLoop;

public sealed partial class MainPage : Page
{
    public MainPage() => this.InitializeComponent();

    public ObservableCollection<string> ItemsA { get; } = ["A1", "A2", "A3"];
    public ObservableCollection<string> ItemsB { get; } = ["B1", "B2", "B3"];
}

Result: the splash never goes away, and the console fills with LayoutCycleException.

Workaround

None found. In the real app where this was first hit, none of these made any difference:

  • moving each repeater's Visibility binding onto a wrapping Grid
  • ItemsStretch="Fill" → ItemsStretch="None"
  • removing the surrounding ScrollViewer (so it is not viewport- or scroll-related)
  • a viewport tall enough that nothing scrolls (so it is not scrollbar oscillation)
  • whether or not the two repeaters contain equal items

Only reducing the page to a single visible repeater avoids it.

Works on which platforms?

  • WebAssembly (net10.0-browserwasm): broken
  • WinUI (Windows App SDK): works

Reproduces identically in a Debug dotnet run build and in a trimmed dotnet publish -c Release build, so it is unrelated to trimming. Not yet verified on net10.0-desktop.

Environment

  • Uno.Sdk 6.7.22, Uno.WinUI runtime Skia WebAssembly 6.8.0-dev.149
  • .NET SDK 10.0.400, net10.0-browserwasm, SkiaRenderer, single-threaded
  • Windows 11, Chromium (Playwright)

Note

Real-world impact: in a gallery-style page (recently used / favorites / new) the app becomes unlaunchable as soon as a second section has content, with no visible error in a Release build — the LayoutCycleException is only surfaced with Debug-level logging.

Possibly related to the ongoing repeater/layout resync work: #22907, #22910.

Activity

  1. Jen-Uno commented on Sep 30, 2026

    @Jen-Uno
    Contributor

    QA: closing out without a manual pass. This was fixed by #23406, the same PR as #22908, and that PR ships with automated tests (ItemsViewSummaryPage.xaml, AspectRatioRespectingControl.cs, FlowLayoutCollectionChangeTests.mux.cs and 8 more) that exercise the change.

    If you still see this behaviour on a build that includes that PR, please reopen or comment here.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions