-
Notifications
You must be signed in to change notification settings - Fork 501
Consider adding DebuggerDisplayAttribute to classes #466
Comments
I had a look at what this would mean, and it will require a slightly more careful implementation. We could add attributes to most types, but is this really needed? We could probably follow the rest of .NET conventions, such as making the structs and other simple types override the For the debugger attribute, we need to remember that this will get evaluated multiple times and we do not want to sacrifice any performance just to get a pretty picture. We can do this selectively, but at the same time be consistent and helpful. We can do I think if we can maybe suggest particular types that need to be more debugger friendly, and then address that type directly and access if the similar/related types also need attributes. Here are some more docs: https://docs.microsoft.com/en-us/visualstudio/debugger/using-the-debuggerdisplay-attribute |
I agree here with Matthew as if there is a specific reason and type that needs this then I could justify the additional work, but I don't see any benefit today. |
I was specifically looking at the structs for which I would like to not have them expand in the debugger to see all values of the underlying quaternion/float3 etc. I did not take a look at the .net framework source, but it is used thoroughly in Xamarin Forms. While overriding ToString is preferable, the static classes with properties could be enhanced with this a bit. A joint approach with ToString and the Attribute would probably be the best. What we would also need to consider is that enum values are currently bugged in the c# expression evaluator, which in turn limits the scope of classes where we can add this attribute. |
Seems like we want to override ToString on any struct or class to display information. I don't think any additional DebuggerDisplayAttribute would add anything here. |
Closing as we are now overriding ToString where necessary. |
Description
We should consider adding the DebuggerDisplayAttirbute to classes which can be inspected for debugging. This should ease debugging experience as more information is available easily without navigating in the debugger.
https://docs.microsoft.com/en-us/dotnet/framework/debug-trace-profile/enhancing-debugging-with-the-debugger-display-attributes
XF also uses this for types like Thickness. we should also inspect which types could benefit.
The text was updated successfully, but these errors were encountered: