Thursday, April 8, 2021

Improve lists debugging in Visual Studio

How many times we needed to debug code related to lists?  Visual Studio watches and inspect end up showing us this kind of information (ie data types).  We then end up having to expand each element to analyze its contents.


It would help that instead of showing the data type the user gets presented with some meaningful information.  To override this information a developer can make use of DebuggerDisplay attribute and include any custom information that he would like to see.


During debugging the developer will be shown this information.  Should the user view all the properties within the element, he can then expand as per normal procedure.


We can further improve the above by removing the quotation marks.  This can be achieved by including the following.








No comments: