简体   繁体   English

可以将Visual Studio 2015本地/监视/自动窗口配置为像以前的版本一样反映继承吗?

[英]Can Visual Studio 2015 locals/watch/auto window be configured to reflect inheritance like previous versions did?

In older versions of VS, the locals/watch/autos/etc windows would reflect the inheritance tree of whatever you were looking at: 在旧版本的VS中,locals / watch / autos / etc窗口将反映您正在查看的任何内容的继承树:

旧的和良好的行为

This had the benefit that you would only see up front the locally added variables to whatever you were dealing with, which is what I'm interested in nearly always. 这样做的好处是,您只能预先看到本地添加的变量,无论您处理的是什么,这几乎都是我感兴趣的。

Now, it flattens it and puts everything in one big list: 现在,它将它展平并将所有内容放在一个大的列表中:

新方法

Which, if you are dealing with anything such as Windows Forms or are subclassing anything with a deep inheritance tree, that means you constantly have to wade through a ton of garbage that is never going to be important, every single time you need to look at something. 其中,如果你正在处理任何像Windows Forms这样的东西,或者正在使用深度继承树继承任何东西,这意味着你不得不经历大量垃圾,这些垃圾永远不会很重要,每次你都需要查看一些东西。

Essentially, it seems for VS2015 they did this: Flatten inherited members in Visual Studio's Watch window? 从本质上讲,VS2015似乎是这样做的: 在Visual Studio的Watch窗口中展平继承的成员? and made it the only option, and I want to do the reverse of that. 并使它成为唯一的选择,我想做相反的事情。 Sure, occasionally it's nice to quickly dive deep in the inheritance tree, but I want to only dive shallow about 1000x as often. 当然,偶尔快速深入继承树是很好的,但我想只经常潜水浅1000倍。

I didn't see anything that obviously controls this behavior in the General Debugging settings, is there any other way to switch the behavior? 在General Debugging设置中,我没有看到任何明显控制此行为的内容,是否还有其他方法可以切换行为?

Luckily there is one. 幸运的是有一个。

namespace Test
{
    public class A
    {
        public int Foo { get; set; }
    }

    public class B : A
    {
        public int Bar { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var a = new B();
        }
    }
}

在此输入图像描述

在此输入图像描述

在此输入图像描述

Documentation (not quite useful): 文档 (不太有用):

Use the legacy C# and VB expression evaluators 使用旧版C#和VB表达式计算器

The debugger will use the Visual Studio 2013 C#/VB expression evaluators instead of the Visual Studio 2015 Roslyn-based expression evaluators. 调试器将使用Visual Studio 2013 C#/ VB表达式计算器而不是Visual Studio 2015基于Roslyn的表达式计算器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM