[英]Visual Studio and .net, any way to perform an action in code - only if debugging?
I'm aware of the #debug directives, but this is used when you are compiling code in debug mode. 我知道#debug指令,但是在调试模式下编译代码时会用到它。
Is there a way to detect if the code is being debugged using standard .net debuggers and create some logic around this? 有没有一种方法可以检测是否正在使用标准.net调试器调试代码并围绕此创建一些逻辑?
for example 例如
if (isDebugging)
{
//change value of variable
}
thanks in advance. 提前致谢。
EDIT : Failing this I guess the next logical approach would to build a plugin, but I'm just checking the obvious / easier route first. 编辑:失败了,我想下一个逻辑方法是构建一个插件,但是我只是先检查明显的/更简单的路由。
Debugger.IsAttached达到了目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.