locked
Detect when a debugger attaches RRS feed

  • Question

  • Does the CLR or even Win32 provide any kind of event or interrupt that's triggered when a debugger attaches to a process? I know that running code can check to see if on is attached but not sure if there's any notification mechanism for detecting when one attaches.

    Thx

    Monday, September 4, 2017 8:29 PM

All replies

  • Hi Korporal Kernel,

    Thank you for posting here.

    If you want some kind of event or interrupt that's triggered when a debugger attached to a process, you could use Debugger.Break Method

    If a debugger is attached, the debugger is signaled with a user breakpoint event, and the debugger suspends execution of the process just as if a debugger breakpoint had been hit.

    >>I know that running code can check to see if on is attached but not sure if there's any notification mechanism for detecting when one attaches.

    If you want to detect when a debugger attaches using code, you could try the Debugger.IsAttached Property. It will return true or false for notification. If a debugger is attached, it will return true; otherwise, false.

    What do you wan to do for triggered when a debugger attaches to process? More details would be helpful. We are waiting for your update.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, September 6, 2017 6:04 AM