Skip to content

Bug: Resizing the app with the settings pane open causes a crash #17090

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

Open
Lamparter opened this issue May 2, 2025 · 2 comments
Open

Bug: Resizing the app with the settings pane open causes a crash #17090

Lamparter opened this issue May 2, 2025 · 2 comments
Labels
crash Bug reports involving a crash

Comments

@Lamparter
Copy link
Contributor

Description

I was resizing the app window while the settings pane was open (shrinking it horizontally) and noticed that this caused a crash.

Looking at the stack trace in the debug window, it appears this is being caused by the following line of code:

Image

MainSettingsNavigationView.PaneDisplayMode = MainWindow.Instance.Bounds.Width < 700 ? NavigationViewPaneDisplayMode.LeftCompact : NavigationViewPaneDisplayMode.Left;

...where a divide-by-zero exception occurs.

See crashed window

Image

Steps To Reproduce

  1. Open Files
  2. Open the settings pane
  3. Resize the app's width to a (smaller) value
  4. See the app unrecoverably crash

Files Version

3.9.8.0 built from source c7ab0f4

Windows Version

10.0.26100.0

User ID

75d1523b-d990-4a32-9fd3-e2b5519bbd65

Log File

Stack trace

2025-05-02 18:55:05.6865|Error|System.DivideByZeroException: Attempted to divide by zero.
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Size availableSize)
   at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(IntPtr thisPtr, Size availableSize, Size* result)
--- End of stack trace from previous location ---
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
   at ABI.Microsoft.UI.Xaml.Controls.INavigationView2Methods.set_PaneDisplayMode(IObjectReference _obj, NavigationViewPaneDisplayMode value)
   at Microsoft.UI.Xaml.Controls.NavigationView.set_PaneDisplayMode(NavigationViewPaneDisplayMode value)
   at Files.App.Dialogs.SettingsDialog.UpdateDialogLayout()
   at Files.App.Dialogs.SettingsDialog.Current_SizeChanged(Object sender, WindowSizeChangedEventArgs e)
   at WinRT.GenericTypeInstantiations.Windows_Foundation_TypedEventHandler_2_object__Microsoft_UI_Xaml_WindowSizeChangedEventArgs.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr args)

Debug trace

Exception thrown at 0x00007FFD8E05A3BA in Files.exe: Microsoft C++ exception: long at memory location 0x000000FF781F3DDC.
Exception thrown at 0x00007FFBE74B09D9 (Microsoft.UI.Xaml.Controls.dll) in Files.exe: 0xC0000094: Integer division by zero.
Exception thrown: 'System.DivideByZeroException' in Microsoft.WinUI.dll
Exception thrown at 0x00007FFD8E05A3BA (KernelBase.dll) in Files.exe: WinRT originate error - 0x80020012 : 'Attempted to divide by zero.'.
Microsoft.UI.Xaml.dll!00007FFBE9783C11: 80020012 - Deling door nul
Exception thrown at 0x00007FFD8E05A3BA in Files.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000FF781E9980.

@yaira2
Copy link
Member

yaira2 commented May 2, 2025

Can you repro this in ya/SettingsPage?

@Josh65-2201 Josh65-2201 added the crash Bug reports involving a crash label May 2, 2025
@Lamparter
Copy link
Contributor Author

Nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Bug reports involving a crash
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants