简体   繁体   中英

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:

旧的和良好的行为

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.

Essentially, it seems for VS2015 they did this: Flatten inherited members in Visual Studio's Watch window? 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.

I didn't see anything that obviously controls this behavior in the General Debugging settings, is there any other way to switch the behavior?

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

The debugger will use the Visual Studio 2013 C#/VB expression evaluators instead of the Visual Studio 2015 Roslyn-based expression evaluators.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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