为什么断点的条件无法执行?

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

(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开始,您必须切换到托管兼容模式,以使用条件断点。 为什么以及如何描述:

切换到管理兼容模式function于视觉工作室2013

据我所知,这是不可能的。 你可以做的是使用HitCount

或者用C#代码中的计时器(如你所愿)进行硬编码

 #if DEBUG if(System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break(); #endif