Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a keyboard shortcut to evaluate an expression in the Watch window in Visual Studio?

If you use a method call in an expression in the Watch Window, Visual Studio does not constantly evaluate the expression all the time and instead says

This expression causes side effects and will not be evaluated

I appreciate the necessity for this, but every time that I do want to evaluate the expression, the only ways I’ve found so far are:

  • Click the re-evaluate button — requires grabbing the mouse, yuck
  • Edit the expression by adding a trailing space — clunky workaround

I already looked through the list of commands that I can assign keyboard shortcuts to, and the only relevant I found is Debug.EvaluateStatement, which sounds like it’s exactly what I need, but it doesn’t appear to have any effect.

Is there a keyboard-assignable command to evaluate expressions in the Watch window?

like image 921
Timwi Avatar asked Jan 25 '11 21:01

Timwi


People also ask

How do I use F12 in Visual Studio?

If you've installed Visual Studio 2013, there's a new keyboard shortcut -- Alt+F12 -- that will give you a preview of the method being called inline. You can use the Esc key to close the preview.


1 Answers

The keyboard shortcut required is Space. It is not a customisable command though.

like image 182
Timwi Avatar answered Nov 16 '22 12:11

Timwi