I am debugging a Service Fabric application and need to use a conditional breakpoint based on the value of the id of an object. So I placed a conditional breakpoint to the effect of
c.id == "43rregfjlh32";
However, when the breakpoint is hit by the debugger, I get the following message:
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.
I've looked online and tried enabling things like Managed Compatibility Mode as was suggested in some posts. However, this does not work.
This looks like this issue: Debugger error when comparing strings (.NET Core). According to that page, it has been fixed in Visual Studio 2017 version 15.9.5.
I worked around it by using string.Equals
, e.g. string.Equals(c.id, "43rregfjlh32")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With