c# - 为什么断点条件执行失败?

标签 c# debugging visual-studio-2013 conditional-breakpoint

我想在短时间内暂时禁用断点,所以我设置了一个条件断点,条件如下:

(global::System.DateTime.Now<new global::System.DateTime(2014,03,28,11,0,0))

当遇到这个断点时,会弹出一个对话框,说

The condition for a breakpoint failed to execute. The condition was 
'(global::System.DateTime.Now<new
global::System.DateTime(2014,03,28,11,0,0))'. The error returned was
'The runtime has refused to evaluate the expression at this time.'. Click
OK to stop at this breakpoint.

为什么运行时拒绝计算表达式?

如何在不修改调试源代码的情况下获得所需的行为?

最佳答案

从 VS2012 开始,您必须切换到托管兼容模式,才能使用条件断点。为什么(抱歉,由于该链接已损坏,不再有来自 MS 的原因。我添加了指向 archive.org 的链接)以及此处的描述方式:

switching-to-managed-compatibility-mode-in-visual-studio-2013

old Microsoft link, now dead

the original Microsoft article on archive.org

关于c# - 为什么断点条件执行失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22709169/

相关文章:

c# - IoC - 控制 "Invert"到哪里去了? (它去哪里?)

c# - 无法将文件上传到 Google 云端硬盘

c# - 如何在 Visual Studio 中查找对给定类型变量的所有引用?

linux - http ://ftp. gnu.org/gnu/gdb/gdb-7.9.tar.gz 中缺少 gdbserver 7.9

visual-studio - AlternateContent 标签会导致 IDE 出现问题,但不会导致编译器出现问题

c# - "Property set method not found"反射时出错

c# - 如何轻松地从编译中排除某些代码行?

c# - 在C#中收集X项时使用SpeedBoost

visual-studio - 在 Visual Studio 中查找和替换不替换所有事件

java - WebLogic 的默认调试端口是什么?