“Internal error in the expression evaluator” in Visual Studio 2013/2015

I’ve been having some trouble debugging in Visual Studio 2015. I’m getting the following messages in the Watch window when trying to evaluate a variable for example:

  • Condition for breakpoint cannot be evaluated
  • Internal error in the expression evaluator

According to the Microsoft employee who replied inย this post on Stackoverflow this seems to be a bug in the evaluator and to fix this do the following:

  • Go toย Tools => Options
  • Select “Debugging” section in left panel

There are two solutions to this problem:

  1. Either check “Use Managed Compatibility Mode” in “General” tab
  2. Or check “Use the legacy C# and VB expression evaluators” in “General” tab so you can use Edit and Continue as well as other features added within the last few releases.