Reputation: 1483
When a program is running under the control of the debugger in the Delphi IDE, it is possible to detect this because the variable "DebugHook" is set to a value <> 0.
Is there an equally easy way to check for the debugger when debugging a .NET program in Visual Studio?
Upvotes: 1
Views: 221
Reputation: 1483
To achieve the same in .NET reference "System.Diagnostics" and add this code
if (System.Diagnostics.Debugger.IsAttached) then
// Program is running under the control of the debugger
Upvotes: 1