A cool attribute to save some debugging time is DebuggerTypeProxy (Namespace: System.Diagnostics). Using this attribute, you can write your own logic to interpret the object at debug time. Meaning, if you have a list of class objects then you can project on certain properties and force debugger to show the value off of this proxy class. This attribute is applicable to Structures, Classes and Assemblies.
A very cool attribute to save some debugging time is DebuggerTypeProxy (Namespace: System.Diagnostics). Using this attribute, you can write your own logic to interpret the object at debug time. Thus, if you have a list of class objects, then you can project on certain properties and force the debugger to show the value of this proxy class. This attribute is applicable to Structures, Classes, and Assemblies.
Below is the example where I have created a dummy model class. Using DebuggerTypeProxy attribute on this class, I am forcing the debugger to display the value of a property of the proxy class, which is DebuggerProxyForTestDebuggerProxy class.
Proxy classA proxy class must have a constructor that accepts an argument of the class type to which attribute is applied.
Now, let's create an object of type TestDebuggerProxy in the main method.
Now, run the application in debug mode and hover your mouse over the object "obj". You should see something like below.
Note that how debugger is displaying the value of the object. It is actually showing the property of the proxy class and not the actual class. You can view the actual properties of the class by expanding the Raw View. This is a really simple implementation of how it works but it can be very useful in legacy applications where you have complex objects and you need to check certain properties only while debugging the issue(s).
If you have any idea(s) to make it better, feel free to leave your suggestions/comments/questions.
Pro WPF: Windows Presentation Foundation in .NET 3.0