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

1

12

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.

Lauralee answered 4/11, 2018 at 7:57 Comment(4)
if possible, could you please share a simple sample using one drive, I will help you debug it on my side, so we could know that whether it is related to the VS versions or it really has a limitation for it. If you could share it, please also tell me where and how you set the condition break point.Gamal
Have you had any luck resolving this?Wembley
Haven't tried it in a while but in a word, no :)Lauralee
Same here.. worked around by putting an if statement directly in code.. not ideal but it worksHachure
S
3

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

Stimulant answered 25/3, 2019 at 1:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.