-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix: Fixed crash that would sometimes occur when resizing the window #17893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix: Fixed crash that would sometimes occur when resizing the window #17893
Conversation
…h multiple panes aligned vertically
|
Thank you for the PR. Can you please provide some details on why you went with this approach? Ideally the minimum size wouldn't have to change, and we would instead fix the underlying cause. |
|
@yaira2 In fact, the same issue happens even when using a single pane but the crash threshold is much lower (nearly 0px) compared to the original default size set by the code (316×416). With dual panes, the crash occurs around 700-850px width. So setting MinWidth = 850 and MinHeight = 646 on the main window itself prevents users from resizing below the threshold before WinUI's layout engine runs, avoiding the crash condition entirely. If you don't want to set the size explicitly, we need to spend more time on research to find out why the internal Microsoft component fails, find out if there is a way to handle the validation ourselves, and confirm whether it's a Microsoft bug and report it accordingly. Furthermore, we can enhance my previous fix to set the minimum size dynamically based on whether multiple panes are enabled. Please let me know how you’d like to proceed. |
… the min size requirements from the MainWindow
|
With further investigation, the DivideByZeroException occurs because the restored pane has no navigation parameters, leaving it uninitialized. When WinUI's layout engine attempts to measure and arrange the empty pane, it encounters invalid state, which can lead to a division-by-zero error during its dimension calculations. I fixed the issue by saving the navigation parameters and restoring them when the pane is shown again. |
|
@workbysaran I don't recall the original behavior (maybe @winston-de or @gave92 remembers) but the other option is to use 'home' when adding back the second pane. Does anyone have a preference? |
Resolved / Related Issues
Fixed a crash (DivideByZeroException) that occurred when resizing the window with multiple panes split vertically.
Closes #17739
Steps used to test these changes