Skip to content

Making window fullscreen crashes the application when using .NET 5 #120

@punker76

Description

@punker76

Transfered from MahApps #3852 reported by @DaveSenn

Describe the bug

Making window fullscreen crashes the application when using .NET 5

Steps to reproduce

  1. Compile any WPF application using MahApps Metro with .NET 5
  2. Try to make your MetroWindow fullscreen by clicking the Maximize button in the upper right corner
  3. The application will crash with the following error: Win32Exception The parameter is incorrect.

Expected behavior

Application should not crash.

Actual behavior

Application crashes. Stacktrace:

System.ComponentModel.Win32Exception
  HResult=0x80004005
  Message=The parameter is incorrect.
  Source=ControlzEx
  StackTrace:
   at ControlzEx.Standard.NativeMethods.GetMonitorInfoW(IntPtr hMonitor)
   at ControlzEx.Behaviors.WindowChromeBehavior._HandleMOVEForRealSize(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at ControlzEx.Behaviors.WindowChromeBehavior.WindowProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Environment

MahApps.Metro version: v2.0.0
Windows build number: Win10 2004
Visual Studio: 2019 16.6.0
Target Framework: .NET 5 preview 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions