DebuggerDisplay attribute best practices

The DebuggerDisplayAttribute is a powerful way to customize the way values are displayed at debug time.  Instead of getting a simple type name display, interesting fields, properties or even custom strings can be surfaced to the user in useful combinations [DebuggerDisplay("Student: {FirstName} {LastName}")] public sealed class Student { public string FirstName { get; set; }…

1

Interesting Late Binding Scenario with ToString

Not to long ago I received an email from a customer who wanted to report a bug in the VB.Net debugger.  They believed that there was a bug invoking ToString on Integer types in the immediate window and provided the following sample as evidence i = 100 ? i 100 {Integer} Integer: 100 ? i.ToString("c02")…

4

Why the debugging difference between C# and VB.Net return values?

A feature which seems to be getting more requests recently is support for seeing the return value of a function in the debugger without the need to assign it into a temporary.  C++’s had this feature for some time but it’s been lacking in managed debugging scenarios.  James Manning recently dedicated a couple of blog…

0

Automatically loading DLL’s in the debugger

In a recent post I discussed the apparent flakiness of extension methods and the debugger being a result of whether or not the DLL containing the extension methods were loaded into the debugee process.  Several users asked in the comment section why we didn’t fix the issue by just loading those DLL’s when an extension…

2

Improving the display of F# seq<T>’s in the debugger

F#’s seq<T> expressions are a frustrating item to inspect at debug time.  A seq<T> value is a collection and when users inspect such a value at debug time they want to see the contents of the collection.  Instead they are often presented with a view resembling the following The reason this happens is a consequence…

0

Extension Methods and the Debugger

One source of confusion I find myself clearing up a lot is the use of evaluating extension methods in the debugger windows.  Users report evaluation as working sometimes but not others for the exact same piece of code.  Such flaky behavior can only be the result of a poorly implemented feature or subtle user error. …

6

Newlines in the immediate window

A question came up recently on stack overflow concerning the display of newlines in the immediate window.   The author noted that any .ToString method which contained a newline printed incorrectly when evaluated in the immediate window.  For example given the following ToString implementation public override string ToString() { return "Hello" + Environment.NewLine + "World"; }…

0

Why is LINQ absent from debugger windows (Part 2)?

Some readers may remember an article I published almost half a year ago about LINQ being absent from the debugger windows.  That post explored the initial design of the feature, it’s limitations and ultimately why it was absent but promised a future article on a slightly different approach.  It’s quite late but I’ve finally had…

8

Nothing is private in the debugger (part 2)

In a previous post I discussed how accessibility is ignored when evaluating expressions in the debugger and the unexpected scenarios that it creates.  One case I neglected to mention in that article is how this behavior works with the VB late binding engine.  The expression evaluator only relaxes accessibility rules when binding an expression.  This…

0

Nothing is private in the debugger

The goal of the debugger is to provide rich inspection capabilities for a process.  The main method of inspection is through the evaluation of textual expressions which is handled by a language specific component known as the expression evaluator. This component is the data provider for a good portion of the debugger windows (watch, locals,…

0