EDDiscovery / EDDiscovery

Captains log and 3d star map for Elite Dangerous
Apache License 2.0
769 stars 171 forks source link

[Linux] UI exception #3442

Closed S-K-Tiger closed 1 year ago

S-K-Tiger commented 1 year ago

Description

Attempting to move entries of my CMDR linked to my old name to the new name.

Additional Information

OS: Linux Mint 21.2 Cinnamon

Exception Details:

EDDiscovery v16.1.2.0 There was an unhandled UI exception.

==== BEGIN ====
System.InvalidCastException: Specified cast is not valid.
 at ExtendedControls.ExtPanelDataGridViewScroll.Wheel (System.Object sender, System.Windows.Forms.MouseEventArgs e) [0x0005c] in /home/lars/EDDiscovery/ExtendedControls/ExtendedControls/Controls/PanelDataGridViewScroll.cs:295 
 at System.Windows.Forms.Control.OnMouseWheel (System.Windows.Forms.MouseEventArgs e) [0x00019] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.DataGridView.OnMouseWheel (System.Windows.Forms.MouseEventArgs e) [0x00000] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.Control.WmMouseWheel (System.Windows.Forms.Message& m) [0x0005a] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00204] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
 at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <25c2bdf9d79a43a599eb46bd15cd77fb>:0 
===== END =====
robbyxp1 commented 1 year ago

This is a mono issue, as the cast works in windows, as per the comment. All we probably can do is to check if the event actually is HandledMouseEventArgs, to screen out the error. But that means its not cancelling the event.

klightspeed commented 1 year ago

Instead of assuming that the passed MouseEventArgs is in fact a HandledMouseEventArgs:

                ((HandledMouseEventArgs)e).Handled = true;      // we are actually passed this class, cast to it and set we handled it.

perhaps it should check if it's actually the specified type:

                if (e is HandledMouseEventArgs ha)
                    ha.Handled = true;
robbyxp1 commented 1 year ago

I've done that in my local copy, thanks. I think I put the code in to prevent double scrolling of the panel due to wheel action, so no idea what it will do.

Be in next major version, out soon