Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow Exception #164

Open
EgilSandfeld opened this issue Sep 5, 2022 · 3 comments
Open

Overflow Exception #164

EgilSandfeld opened this issue Sep 5, 2022 · 3 comments

Comments

@EgilSandfeld
Copy link

Had a crash from one end-user of my app:
Any ideas how this was caused?

.NET Framework 4.8 app

Arithmetic operation resulted in an overflow,

   at System.IntPtr.op_Explicit(IntPtr value)
   at Gma.System.MouseKeyHook.KeyEventArgsExt.FromRawDataGlobal(CallbackData data)
   at Gma.System.MouseKeyHook.Implementation.GlobalKeyListener.GetDownUpEventArgs(CallbackData data)
   at Gma.System.MouseKeyHook.Implementation.KeyListener.Callback(CallbackData data)
   at Gma.System.MouseKeyHook.WinApi.HookHelper.HookProcedure(Int32 nCode, IntPtr wParam, IntPtr lParam, Callback callback)
   at Gma.System.MouseKeyHook.WinApi.HookHelper.<>c__DisplayClass7_0.<HookGlobal>b__0(Int32 code, IntPtr param, IntPtr lParam)

"targetSite": "Int32 op_Explicit(IntPtr)"
"type": "System.OverflowException"
@EgilSandfeld
Copy link
Author

The crash log above happened within 1 second of the app starting up, however I just received one now, with the similar stacktrace happened 34170 seconds into the app session..

Calling code to set up subscribers:

private void SubscribeKeyboard()
        {
            try
            {
                if (_appKeyboard == null)
                {
                    _appKeyboard = Hook.AppEvents();
                    _appKeyboard.KeyDown += AppKeyboardDown;
                }

                if (_keyboard == null)
                {
                    _keyboard = Hook.GlobalEvents();
                    _keyboard.KeyPress += KeyboardKeyPress;
                    _keyboard.KeyDown += (sender, args) => Core.Dispatcher.OnKeyboardDown?.Invoke(sender, args);
                    _keyboard.KeyUp += (sender, args) => Core.Dispatcher.OnKeyboardUp?.Invoke(sender, args);
                }
            }
            catch (Exception ex)
            {
                DB.AddBugInfo(ex);
            }
        }

I believe Hook.GlobalEvents(); call is the one facilitating the later crashes.

@EgilSandfeld
Copy link
Author

Can a missing System.Reactive.dll be the cause of this? So when the user presses a key, the missing dll causes the above stack?

EgilSandfeld added a commit to EgilSandfeld/globalmousekeyhook that referenced this issue Sep 8, 2022
@EgilSandfeld
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant