DebuggerDisplay attribute does not work as expected!
- by mark
Dear ladies and sirs.
I know that this attribute should work in C# and yet, in my case it does not.
I have a class with a lazy property Children. Accessing this property may have a side effect of roundtripping to the server. So, naturally, I do not want this to happen when I just watch it in the debugger watch window.
Omitting all the irrelevant details the source looks pretty ordinary:
[DebuggerDisplay("(Frozen) {m_children}")]
public IList<IEntityBase> Children
{
get
{
if (m_children == null)
{
m_children = FetchChildrenFromDB(this);
}
return m_children;
}
}
And yet, when I watch the object and expand this in the watch window I do not see (Frozen) in the display, meaning the debugger simply ignores the attribute.
Provided the image link is still valid it should be visible below:
http://i28.tinypic.com/2zxo9s5.jpg
The attribute is really there, according to Reflector. I use VS2008.
Any ideas?