Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

In older versions of VS, the locals/watch/autos/etc windows would reflect the inheritance tree of whatever you were looking at:

Old and good behavior

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:

New way

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?

like image 214
whatsisname Avatar asked Nov 19 '15 00:11

whatsisname


People also ask

What is the difference between the Locals and Autos Windows?

The Autos and Locals windows show variable values while you are debugging. The windows are only available during a debugging session. The Autos window shows variables used around the current breakpoint. The Locals window shows variables defined in the local scope, which is usually the current function or method.

How to see Locals window in Visual Studio?

To open the Locals window, while debugging, select Debug > Windows > Locals, or press Alt+4. This topic applies to Visual Studio on Windows.


1 Answers

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();
        }
    }
}

enter image description here

enter image description here

enter image description here

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.

like image 150
Ivan Stoev Avatar answered Sep 29 '22 05:09

Ivan Stoev