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; }
}
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.
I was hoping to just hover my mouse over the ShouldBeSeeingThisInMyDebugger property, and see the elements of the collection.
EDIT: 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.