DebuggerDisplay Doesn't Work

snarfblam

Ultimate Contributor
Joined
Jun 10, 2003
Messages
2,097
Location
USA
I can't get the DebuggerDisplay attribute to work in C# express. It works just fine in VB. I searched google and it seems like I'm the only person who has this problem. I can't find any relevant settings or anything.

Visual Basic:
Module Module1
    Sub Main()
        Dim var As New X 'Displays "Test" in the debugger.
    End Sub
End Module
 
<DebuggerDisplay("Test")> _
Class X
End Class

[CS]
class Program
{
static void Main(string[] args) {
X var = new X(); // Displays "{ConsoleApplication2.X}" in debugger
}
}
[DebuggerDisplay("Test")]
class X {}
[/CS]
Anyone have any ideas?
 
I've been perplexed by this in the past. Mine is working now and i can't remember exactly which debugger options i had to change. I think you need to ToString() evaluation and JustMyCode enabled, give it a try.
 
I found that if I disable "Unwind the call stack on unhandled exceptions" the debugger display attribute works correctly, along with a number of other minor problems (including the occasional inability to view instance members after an exception because the "this" pointer is not available). I think that this puts certain limitations on when you can edit and continue.
 
Back
Top