View .NET collections with the new IEnumerable Debugger Visualizer
While debugging .NET code, inspecting a large and complex collection object can be tedious and difficult. Hence, starting from Visual Studio 17.2. Preview 2, we are introducing a new Visualizer, which will help you view IEnumerable objects such as Arrays, List, etc. in a customized tabular view.
The IEnumerable visualizer will display collections of objects in a table with a row per object and sortable columns for each field and property.
Visualize data with IEnumerable Visualizer
The IEnumerable Visualizer is an extension to the existing Dataset Visualizer Dialog Box – Visual Studio (Windows) | Microsoft Docs. You can access this visualizer by clicking on the magnifying glass icon next to the Value in a debugger variables window or in a DataTips. The icon is available for suitable IEnumerable<T> implementations where T can be simple types like List or Arrays or complex types like dictionaries, encapsulated, etc.
In the case of complex objects where object properties can be another object, the IEnumerable visualizer will show just the immediate object properties. To view all child properties of the object in a table cell, you can use the “Expand Column” option from the column header’s right-click context menu. If you want to focus on specific columns, you can use the “Hide Column” option or the “Hide Children” option to hide all expanded properties.
If the object being visualized has multiple implementations of IEnumerable, the Visualizer will show the first implementation of the object by default. You can use the drop-down on the top to explore members and fields provided by each implementation.
Multiple IEnumerable Implementation
Sorting and Export
The visualizer also supports column sorting in ascending or descending order. Just click on the column title to sort it.
Finally, if you are interested in exporting the data from the visualizer, you can use the Export button in the top-right corner. It will open the data in Excel (with more options such as exporting to CSV coming in future releases).
Export & Sort
Let us know what you think!
This is the first step toward creating a streaming data visualization experience while debugging. We are constantly working on improving this feature and adding new capabilities in upcoming releases. We appreciate you taking the time to try our latest features and hope you will provide honest feedback by taking this brief survey.