Skip to content

(Marquee) When Behavior="Looping" and Direction is set to vertical, it causes “Layout cycle detected. Layout could not complete.” #755

Open

Description

@lgztx96

Describe the bug

<Setter Property="VerticalAlignment" Value="Top" />

private void Container_SizeChanged(object sender, SizeChangedEventArgs e)

_segment2.Visibility = IsLooping ? Visibility.Visible : Visibility.Collapsed;

_segment2.Visibility = Visibility.Collapsed;

I noticed that the Marquee control crashes. After debugging, I believe the SizeChanged event causes the visibility of segment2 to change. Since the control’s default vertical alignment is set to Top, this triggers another SizeChanged event, resulting in an infinite loop.
Setting VerticalAlignment="Stretch" allows it to work correctly, but this is not a real solution.

In addition, I noticed that _marqueeContainer is repeatedly subscribing to the SizeChanged event.

_marqueeContainer.SizeChanged += Container_SizeChanged;

_marqueeContainer.SizeChanged += Container_SizeChanged;

Steps to reproduce

<labs:Marquee
     Behavior="Looping"
     Content="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
     Direction="Down"
     FontSize="18"
     RepeatBehavior="Forever"
     Speed="200" />


Just setting Behavior="Looping" is enough to trigger the crash.

Expected behavior

This shouldn't cause the program to crash.

Screenshots

Image

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

No response

Activity

  1. added
    bug 🐛
    on Oct 18, 2025
  2. changed the title [-]Mqrquee Loop Mode Layout cycle detected. Layout could not complete.[/-] [+]When Behavior="Looping" and Direction is set to vertical, it causes “Layout cycle detected. Layout could not complete.”[/+] on Oct 18, 2025
  3. changed the title [-]When Behavior="Looping" and Direction is set to vertical, it causes “Layout cycle detected. Layout could not complete.”[/-] [+](Marquee) When Behavior="Looping" and Direction is set to vertical, it causes “Layout cycle detected. Layout could not complete.”[/+] on Oct 18, 2025
  4. Avid29 commented on Oct 18, 2025

    @Avid29
    Member

    Okay. I pretty heavily refactored the event flow of this behavior in #735. I'll take a look at if this still happens with those changes.

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

    bug 🐛

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions