You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running WinUI3 applications with deeply nested layout can cause a crash due to "Unspecified Error" with type Microsoft.UI.Xaml.UnhandledExceptionEventArgs.
This occurs in our application intermittently. Using more streamlined layout (for example, Panel types instead of ItemsControl types) has been found to mitigate the issue.
We are able to reproduce the issue easily with a tiny example WinUI3 application with 300 nested Grids. Although this is not a likely real-world scenario, this appears to be the same crash that occurs in our application when a reasonable amount of styled containers are nested within each other.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace winui_crash;
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
}
private void LayoutRoot_OnLoaded(object sender, RoutedEventArgs e)
{
Grid grid = new Grid();
Grid parent = null;
LayoutRoot.Children.Add(grid);
for (int i = 0; i < 300; i++)
{
parent = grid;
grid = new Grid();
parent.Children.Add(grid);
}
}
}
Run the application.
Expected behavior
This crash occurs well before any noticeable performance hit. When nesting a slightly smaller amount of Grids, the application launches instantly with no measurable performance problem.
Expected that no crash would occur when performance is not stressed.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007
Windows version
Windows 11 (22H2): Build 22621
Additional context
Windows 11 Build 22631.
Microsoft.WindowsAppSDK 1.6.240829007
The text was updated successfully, but these errors were encountered:
Can confirm this is an issue, this was never as much of an issue in version 1.5 of the Windows App SDK. But it could still occur from time to time. Now with 1.6 even the slightest nesting causes this exception to be thrown.
The exact exception message is, with no additional forwarded details:
"The text associated with this error code could not be found.
Layout cycle detected. Layout could not complete."
This is critical for us, as we can have some pretty deeply nested drill-down views to represent nested JSON objects. And to build some form of navigation for this would hamper the user experience.
It feels like with every release more and more regressions occur...
nkovner-v
changed the title
Deeply Nested Layout causes Unspecified Error Crash
Nested Layout causes Unspecified Error Crash
Oct 8, 2024
This is a hard crash, 3rd party verified as common in end-products, with a reproducible set of simple steps that has been stuck in triage for 30 days. Please move this ticket forward and communicate with us on this issue.
Describe the bug
Running WinUI3 applications with deeply nested layout can cause a crash due to "Unspecified Error" with type Microsoft.UI.Xaml.UnhandledExceptionEventArgs.
This occurs in our application intermittently. Using more streamlined layout (for example, Panel types instead of ItemsControl types) has been found to mitigate the issue.
We are able to reproduce the issue easily with a tiny example WinUI3 application with 300 nested Grids. Although this is not a likely real-world scenario, this appears to be the same crash that occurs in our application when a reasonable amount of styled containers are nested within each other.
Steps to reproduce the bug
MainWindow.xaml
MainWindow.xaml.cs
Expected behavior
This crash occurs well before any noticeable performance hit. When nesting a slightly smaller amount of Grids, the application launches instantly with no measurable performance problem.
Expected that no crash would occur when performance is not stressed.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007
Windows version
Windows 11 (22H2): Build 22621
Additional context
Windows 11 Build 22631.
Microsoft.WindowsAppSDK 1.6.240829007
The text was updated successfully, but these errors were encountered: