I have a class with a property of standard type. In debugger I would like to see this particular property in some specific format. I'm using attribute DebuggerDisplay on that particular property, but in debugger's Watch window I see it applied to entire class, but not to target property. What am I missing?
class Transaction : ITransaction
{
[DebuggerDisplay("{DateAsDebugString}")]
public DateTime Date
{
get;set;
}
string DateAsDebugString
{
get
{
var res = Date.ToShortDateString();
if (Date.TimeOfDay != TimeSpan.Parse("00:00"))
res += " " + Date.TimeOfDay.ToString();
return res;
}
}
}

How to apply property level debugger formatting/visualizing rules?
This seems to be a bug in Visual Studio 2015, as documented here. Unfortunately it doesn't seem to have ever been fixed.
The same code in Visual Studio 2013 produces the expected results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With