我正在调试 Service Fabric 应用程序,需要使用基于对象 ID 值的条件断点。所以我设置了条件断点,达到的效果
c.id == "43rregfjlh32";
但是,当调试器命中断点时,我收到以下消息:
The condition for a breakpoint failed to execute. The condition was
c.id == "43rregfjlh32"
. The error returned was `Evaluation of method System.String.op_Equality() calls into native method System.Environment.FailFast(). Evaluation of native methods in this context is not supported. Click OK to stop at this breakpoint.
我在网上查看并尝试启用诸如某些帖子中建议的托管兼容模式之类的功能。然而,这不起作用。
最佳答案
这看起来像这个问题:Debugger error when comparing strings (.NET Core) 。根据该页面,该问题已在 Visual Studio 2017 版本 15.9.5 中修复。
我通过使用string.Equals
解决了这个问题,例如string.Equals(c.id, "43rregfjlh32")
关于debugging - VS2017 条件断点 - "Evaluation of native methods in this context is not supported",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53138819/