我如何获得DebuggerBrowsable RootHidden工作? [英] How do I get DebuggerBrowsable RootHidden to work?

查看:198
本文介绍了我如何获得DebuggerBrowsable RootHidden工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了一下DebuggerBrowsable昨日属性,这听起来很棒,但是当我试图把它的测试工作,它似乎没有任何区别。我使用VS 2008 9.0.30729版本1的SP,.NET 3.5 SP1,MSTest的框架

I read about the DebuggerBrowsable attribute yesterday, and it sounded great, however when I tried to get it to work in a test, It doesn't seem to make any difference. I am using VS 2008 version 9.0.30729 1 SP, .Net 3.5 SP1, MSTest framework

    [TestClass]
    public class TestingDebuggerBrowsable
    {
        [TestMethod]
        public void JustToDemonstrateDebugging()
        {
            var foo = new MyExposedClass();
            foo.ToString(); // I put a breakpoint here, and debugged the test
        }

    }

    public class MyExposedClass
    {
        public MyExposedClass()
        {
            ShouldBeSeeingThisInMyDebugger = new List<string> {"foo", "bar"};
        }

        [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
        public IList<string> ShouldBeSeeingThisInMyDebugger { get; set; }
    }

当我在富悬停,我得到的名单,在那里我有向下钻取几级去的元素通常的回复presentation,比如果没有不同的我忽略的属性。

When I hover over foo, I get the usual Representation of List , where I have to drill down a few levels to get to the elements, no different than if I omitted the attribute.

我希望悬停我把鼠标移到ShouldBeSeeingThisInMyDebugger财产,并查看集合中的元素。

I was hoping to just hover my mouse over the ShouldBeSeeingThisInMyDebugger property, and see the elements of the collection.

编辑: 看来,这是工作在吉荣的机器,但不是我的,虽然使用相同的IDE和框架。我很有兴趣听到的话,任何人有同样的问题,因为我的。

It seems that this is working on Jeroen's machine, but not mine, despite using the same IDE and framework. I'd be interested to hear if anyone else has the same problem as me.

推荐答案

通过属性加你:

foo                                               {Sample.MyExposedClass}
    [0]                                           "foo"
    [1]                                           "bar"
  Raw View

如果没有你得到的属性:

Without the attribute you get:

foo                                               {Sample.MyExposedClass}
    ShouldBeSeeingThisInMyDebugger                Count = 2
        [0]                                       "foo"
        [1]                                       "bar"
  Raw View

因此​​,与属性 ShouldBeSeeingThisInMyDebugger 被省略(根是隐藏的)。正如属性说。

So with the attribute ShouldBeSeeingThisInMyDebugger is omitted (the root is hidden). Just as the attribute says.

这篇关于我如何获得DebuggerBrowsable RootHidden工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆