Skip to content

System.ComponentModel.Win32Exception: The parameter is incorrect #134

@iXab3r

Description

@iXab3r

Describe the bug

4.3.2 didn't help with System.ComponentModel.Win32Exception: The parameter is incorrect #126

Still getting the same error on the latest version.

This fix (iXab3r@f7768f6) helps with the crash and in my case everything works correctly, but as @punker76 mentioned, it is not fully correct in other cases.

Steps to reproduce

  1. Open window
  2. Maximize window

Expected behavior

Window is maximized

Actual behavior

Exception is thrown

System.ComponentModel.Win32Exception (87): The parameter is incorrect.
   at ControlzEx.Standard.NativeMethods.GetMonitorInfo(IntPtr hMonitor)
   at ControlzEx.Behaviors.WindowChromeBehavior._SetRegion(Nullable`1 wp)
   at ControlzEx.Behaviors.WindowChromeBehavior._HandleWINDOWPOSCHANGED(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)

Environment

ControlzEx version: v4.3.2.7
Windows build number: Microsoft Windows NT 10.0.19041.0
JetBrains Rider 2020 
Target Framework: .NET 5.0.0-preview.5.20278.1
  • OS: { OSVersion = Microsoft Windows NT 10.0.19041.0, Is64BitProcess = True, Is64BitOperatingSystem = True })
  • Runtime: { FrameworkDescription = .NET 5.0.0-preview.5.20278.1, OSDescription = Microsoft Windows 10.0.19041 }
  • Culture: en-US, UICulture: en-US

Loaded assemblies:

- {"FullName":"ControlzEx, Version=4.0.0.0, Culture=neutral, PublicKeyToken=69f1c32f803d307e","FileVersion":"4.3.2.7","ProductVersion":"4.3.2-rc.7+Branch.main.Sha.529527c3c3f8069f9a9142f877a30e79cc6bf1a4.529527c3c3f8069f9a9142f877a30e79cc6bf1a4"}
- {"FullName":"MahApps.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=51482d6f650b2b3f","FileVersion":"2.2.0.37","ProductVersion":"2.2.0-rc.37+Branch.main.Sha.828fee0772295550e33fc3bd43c815dcdc7a69cf.828fee0772295550e33fc3bd43c815dcdc7a69cf"}
- {"FullName":"Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","FileVersion":"1.1.19.35512","ProductVersion":"1.1.19+b88a49dfad"}

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