(Marquee) When Behavior="Looping" and Direction is set to vertical, it causes “Layout cycle detected. Layout could not complete.”
还没有人认领这个 Issue。
评估
调研方向
使用提供的 Marquee 标记并设置 Behavior="Looping" 和 Direction="Down",重现该崩溃。阅读 components/Marquee/src/Marquee.xaml、Marquee.cs 的第 69、211 和 241 行,以及 Marquee.Events.cs 的第 36 和 62 行,重点关注 SizeChanged 订阅和 segment 可见性的变化。完成的标准是垂直 looping 不再导致 layout 循环或崩溃,并且 container 不会被重复订阅。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
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.
https://github.com/CommunityToolkit/Labs-Windows/blob/acda1c3df1b71dbf77bc80a0544eae7955398d49/components/Marquee/src/Marquee.cs#L69
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
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
- 主要语言
- C#
- 星标
- 485
- 派生
- 89
- 平均合并
- 19 小时 46 分钟
- 30 天内合并 PR
- 2
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CommunityToolkit/Labs-Windows 的其他 Issue
-
bug :bug:
难度 1/5 1-3 小时 新手友好度 80/100
CommunityToolkit/Labs-Windows#815 ·
-
bug :bug:
难度 4/5 3-5 天 新手友好度 38/100
CommunityToolkit/Labs-Windows#816 ·
-
bug :bug:
难度 3/5 1-2 天 新手友好度 55/100
CommunityToolkit/Labs-Windows#814 ·
-
experiment :test_tube:
难度 4/5 3-5 天 新手友好度 48/100
CommunityToolkit/Labs-Windows#812 ·
-
ux :paintbrush:
难度 3/5 1-2 天 新手友好度 52/100
CommunityToolkit/Labs-Windows#808 · 1 条评论 ·
查看 CommunityToolkit/Labs-Windows 的全部 Issue
相似的 Issue
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/microsoft-ui-xaml#12515 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
[v5-preview5] `func new` displays incorrect command in error message when project is not initialized未关闭Needs: Triage (Functions) v5 v5-preview5
难度 1/5 1 小时以内 新手友好度 85/100
Azure/azure-functions-core-tools#5838 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
customer-reported needs-team-triage question server-Azure.Mcp tools-Pricing
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100