TolikPylypchuk / SharpHook

SharpHook provides a cross-platform global keyboard and mouse hook, event simulation, and text entry simulation for .NET
https://sharphook.tolik.io
MIT License
342 stars 32 forks source link

Events from the mouse or keyboard occur with a huge delay when debugging the breakpoint #68

Closed magals closed 1 year ago

magals commented 1 year ago

The library works well. But if you debug (in VisualStudio 2022 Windows) the breakpoint in any part of the program, events from the mouse or keyboard occur with a huge delay (2-4 seconds). I tested this phenomenon on a computer and on a laptop, and the delay occurs in all variants. And the whole difficulty is that it is problematic to leave visual studio due to the delay

please tell me, have you observed such a phenomenon, if so, how do you maintain the convenience of debugging?

I got exactly the same phenomenon when using the LowLevelKeyboardListener object (I think you came across it, a well-known extension for capturing keys for Windows), when writing a Console / Asp net project

image

TolikPylypchuk commented 1 year ago

Hi! Thanks for asking! Unfortunately, this is just the way global hooks work on Windows - it's not specific to SharpHook. There's nothing I can really do about it. Instead of putting breakpoints and freezing your system for a couple seconds, it's better to use Debug.WriteLine or tracepoints instead.

Issue #37 is the same issue, so I'm going to close this one as a duplicate.