In VS2013 we could view the return value of a method by examining a Watch window entry called $ReturnValue
. This doesn't seem to work in VS2015.
e.g. I made a new console app, 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 once it breaks, F10 to step to line //B
, the $ReturnValue
item in the Watch window shows "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 whether $ReturnValue
in the Watch window feature was dropped in VS2015?
Make sure that you have in Tools >> Options >> Debugging >> Use the legacy C# and VB expression evaluators option checked.
From MSDN:
You must have the legacy expression evaluators turned on for $ReturnValue to be recognized (Tools / Options / Debugging / Use the legacy C# and VB expression evaluators). Otherwise, you can use $ReturnValue1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With