Skip to content

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

Closed
@Lamparter

Description

@Lamparter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashBug reports involving a crash

    Type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions