Is there a chance to determine in an C# application whether it is currently being debugged? The idea is to ignore eg timeouts, or to provide additional information.
Just to make this clear, I am not talking about the conditional compiler flag DEBUG
. This allows me to decide how the code shall be compiled. It gives no information about whether it is run in a debugger or not.
I need to decide at runtime, not at compile time.
您可以使用Debugger.IsAttached
标志来确定这一点。
System.Diagnostics.Debugger.IsAttached?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.