$ ReturnValue in viewport not working in VS2015

In VS2013, we could view the return value of a method by looking at a Watch window entry called $ReturnValue . This does not work in VS2015.

eg. I created a new console application containing the following code:

 using System; namespace ReturnInspector { public class Program { public static void Main(string[] args) { Console.WriteLine("Number: {0}", Method1()); } public static int Method1() { return Method2(1000); //A } //B private static int Method2(int i) { return i + 42; } } } 

If I put a breakpoint on line //A , then as soon as it breaks, F10 goes to line //B , the $ReturnValue element in the viewport displays โ€œ1042โ€ in VS2013, but in VS2015 it shows this

 error CS0103: The name '$ReturnValue' does not exist in the current context 

Note that the Autos and Locals windows correctly say this:

 ReturnInspector.Program.Method2 returned 1042 

Does anyone know if the $ReturnValue function in the Clock window was disabled in VS2015?

+7
c # visual-studio-2015 watch
source share
1 answer

Make sure that you have in Tools โ†’ Options โ†’ Debugging โ†’ Use the deprecated evaluators option of C # and VB expressions .

From MSDN :

You must have the deprecated expression evaluation method enabled for $ ReturnValue recognition (Tools / Options / Debugging / Using deprecated C # and VB expression evaluators). Otherwise, you can use $ ReturnValue1.

+8
source share

All Articles