question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Win32Exception on closing window

See original GitHub issue

I have reports of a bug in our app similar to https://github.com/ControlzEx/ControlzEx/issues/13 :

UnhandledException System.ComponentModel.Win32Exception (0x80004005): The parameter is incorrect
at Microsoft.Windows.Shell.WindowChromeWorker._HandleMoveForRealSize(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled) in d:\projects\git\MahApps.Metro\MahApps.Metro\Microsoft.Windows.Shell\WindowChromeWorker.cs:line 1160
at Microsoft.Windows.Shell.WindowChromeWorker._WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in d:\projects\git\MahApps.Metro\MahApps.Metro\Microsoft.Windows.Shell\WindowChromeWorker.cs:line 613
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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

@batzen May you write, please, how have you reproduced the bug for the ControlzEx? May the same fix be applied to the MahApps, too? Thanks.

Environment

  • MahApps.Metro v1.3.0
  • Visual Studio 2015

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
xmedekocommented, Jan 6, 2017

I would like to have full stacktrace, but we use CSharpAnalytics and it’s bug 39 cuts the stacktrace. (We should switch to some other, maintained project.)

Since the source code of MahApps and ControlzEx seems similar to me in the Microsoft.Windows.Shell namespace, and I have spotted ControlzEx/ControlzEx#13 and that the fix ControlzEx/ControlzEx@ea4c41c0fdc428269cbea981eedf7a60a836cabd is not in the MahApps, I thought that MahApps contains same bug as ControlzEx before the fix.

Now, it seems the bug is not exactly the same, so I will try to get more information about it.

0reactions
xmedekocommented, Feb 14, 2017

I’ve probably found the problem. We have the MetroWindow shown fullscreen without decorations:

window.WindowState = WindowState.Maximized;
window.IgnoreTaskbarOnMaximize = true;
window.IsWindowDraggable = false;
window.ShowTitleBar = false;
window.ShowCloseButton = false;
window.ShowMaxRestoreButton = false;
window.ShowMinButton = false;

The user can switch off the fullscreen:

window.IgnoreTaskbarOnMaximize = false;
window.IsWindowDraggable = true;
window.ShowTitleBar = true;
window.ShowCloseButton = true;
window.ShowMaxRestoreButton = true;
window.ShowMinButton = true;

However, during this fullscreen switch off the window is first time a little bit smaller than maximized and in a moment it enlarges to the maximized size. A kind if a transition state. When the user clicks the close button in this transition state, then the exception occurs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - DisplayAlert throws win32 exception after closing new ...
So it seems to be MAUI bug. I use new page instead of new window, that works fine but it's not ideal from...
Read more >
Closing multi-window app results in unhandled win32 ...
Run app targeting .net6.0-windows platform · Click on the button multiple times to open multiple windows (say 10 windows) · Start closing the ......
Read more >
First chance exception Win32Exception when closing ...
Win32Exception occures in debugging, when new modal window is opened in TableView.RowDoubleClick event and this window is closed by clicking ...
Read more >
Error 'An Unhandled win32 exception ERROR' while ...
Everytime I close Microsoft Excel, the Visual Studio Just-In-Time Debugger dialog window pops up with: "An unhandled win32 exception ...
Read more >
Win32Exception Class (System.ComponentModel)
Initializes a new instance of the Win32Exception class with the specified detailed description and the specified exception. Properties. Data. Gets a collection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found