【发布时间】:2016-04-23 20:12:04
【问题描述】:
在 VS2013 中,我们可以通过检查名为 $ReturnValue 的 Watch 窗口条目来查看方法的返回值。这似乎在 VS2015 中不起作用。
例如我制作了一个新的控制台应用程序,包含以下代码:
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;
}
}
}
如果我在//A 行设置断点,那么一旦断点,F10 进入//B 行,监视窗口中的$ReturnValue 项在 VS2013 中显示“1042”,但在 VS2015 中显示此:
error CS0103: The name '$ReturnValue' does not exist in the current context
请注意,Autos 和 Locals 窗口正确地说明了这一点:
ReturnInspector.Program.Method2 returned 1042
有谁知道在 VS2015 中监视窗口功能中的$ReturnValue 是否已被删除?
【问题讨论】:
标签: c# visual-studio-2015 watch