8

While debugging VS2012 I have found that I can no longer access variable values:

  • The Locals window does not show anything (pictured below).
  • The Watch window tells me "Unable to evaluate the expression" for any expression (also pictured below). My personal favourite is that it cannot evaluate true.
  • And mousing-over any variable does not show any values tool-tip.

Image showing no locals

What I've tried:

Restarting Visual Studio

Restarting my computer

Checking that the loaded modules shows debug symbols are loaded

Uninstalling the TeamCity plugin that I installed yesterday

Looking under Tools/Options/Debugging for anything obvious (and disabling other extensions that had been working fine)

EDIT: I've also tried creating a new solution.

I've also noticed that the call stack shows several blank lines where I presume there are supposed to be external method names (pictured above) - I'm not sure if this is relevant, but it is worth mentioning.

Jonny
  • 2,509
  • 23
  • 42

6 Answers6

9

I will add this answer as I had the same problem with a different resolution.

I had mistakenly closed the locals window and could not find it as it was not with other windows under the VIEW menu. I found it under the DEBUG menu Windows option.

or Optionally:

Ctrl+Alt+V, L

Thronk
  • 624
  • 14
  • 37
6

I've eventually managed to sort this out by myself - so I'll give my solution here in case anyone else has the same problem:

I found that in Tools->Options->Debugging->Symbols was pointing to an old NuGet symbol server. Somehow a wrong symbol server looked like it was taking down the entire Locals and Immediate Window systems.

Updating the symbol server fixed my problems.

Jonny
  • 2,509
  • 23
  • 42
3

I will add this answer as I had the same problem with a different resolution.

I got this too in a Web project. Neither restarting Visual Studio or any other solution in this thread sovled it.

My solution was to restart IIS. After that I rebuilt the project and started it and got locals to work again.

Robert
  • 2,357
  • 4
  • 25
  • 46
  • Not sure why this got down voted, this fixed my problem. I'm assuming restarting the machine would have also worked. – GambitSunob Jul 31 '14 at 18:29
3

Please check the answer here.

In a nutshell, you need to open: Tools > Options > Debugger > General, and enable the flag [Use Managed Compatibility Mode] at the end of the list.

Community
  • 1
  • 1
mohaghighat
  • 1,293
  • 17
  • 29
2

That happens sometime when your Optimize Code box is ticked in project properties under Build section.

Anwar Ul-haq
  • 1,851
  • 1
  • 16
  • 28
  • I've checked that I'm not optimising the code for this project, but thanks – Jonny Jan 09 '14 at 15:25
  • 1
    These are both 'Variable out of scope' errors. I'm getting 'Unable to evaluate the expression' errors. And besides, `true` should never be out of scope – Jonny Jan 09 '14 at 16:32
  • this helped to see unused variables in Locals window – schmidt9 Aug 27 '20 at 16:52
0

I had the same problem with Visual Studio 2013 Update 5 on Windows 10 while using remote debugging.

According to another SO question the locals/variables are broken in the remote debugging tools.

I haven't found a solution yet, but I'm going to switch to Visual Studio 2015 so I haven't really been looking for it either...

Community
  • 1
  • 1
Sam Debruyn
  • 928
  • 1
  • 8
  • 22