“Condition for a breakpoint failed to execute… 'variable' not declared. It may be inaccessible…” Why?

你离开我真会死。 提交于 2019-12-10 14:58:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!