问题
Related questions:
- Unable to debug managed code using visual studio 2013 ("Cannot evaluate expression" error - am using debug build) (Note that VS 2012 works)
- VS2013 Debugger + Entity Framework: "runtime has refused to evaluate the expression", crashes
I am facing a problem with conditional breakpoints in Visual Studio 2013 Professional. The breakpoint condition is referring to a local variable (tagString
), which is declared and initialized in the line of code immediately preceding the breakpoint. Upon encountering the breakpoint, the debugger claims that…
The condition for a breakpoint failed to execute. The condition was
tagString.Contains("…")
. The error returned was 'tagString
is not declared. It may be inaccessible due to its protection level.'
This error message does not appear to make any sense, because the variable is declared and accessible:
I am running a Debug build of this code. Why does the debugger claim that the local variable is not defined, and how can I resolve this issue?
P.S.: I've just realised that the conditional breakpoint not working is only a small part of a larger problem: The debugger also cannot Watch that variable, nor will it be displayed in the Locals window.
P.P.S: I've tried the recommendations given in Rick Strahl's blog post, "Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality", to no avail.
来源:https://stackoverflow.com/questions/27033786/condition-for-a-breakpoint-failed-to-execute-variable-not-declared-it-may-b