Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 Conditional Breakpoints - "Evaluation of native methods in this context is not supported"

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.

like image 392
Mark Micallef Avatar asked Nov 04 '18 07:11

Mark Micallef


1 Answers

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")

like image 160
kristianp Avatar answered Nov 09 '22 15:11

kristianp