View .NET collections with the new IEnumerable Debugger Visualizer

Harshada Hole

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. 

IEnumerable Table Visualizer

IEnumerable Visualizer

 

 

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. 

IEnumerable Table Visualizer - Columns

Hide/Expand Columns

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.

IEnumerable Table Visualizer - Multiple IEnumerable 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). 

IEnumerable Table Visualizer - Export

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.

 

 

 

24 comments

Leave a comment

  • MgSam

    Glad to see you guys working on Visualizers again.

    I had made an extension several years back that was a superior Visualizer for DataTables than the built-in DataSet one. It offered Searching/Filtering using both plain text and a simple OData dialect. It was also non-modal so you could continue debugging while using it. Unfortunately, breaking changes in Visual Studio’s extension API broke the extension and I haven’t picked it up since. It was also quite difficult to make since the Visualizer API is totally separate from the Extension API and there is no built-in functionality for making Visualizers non-modal. I’d really like to see the two APIs unified which would definitely make me take a look at reviving my extension.

    I think what you’ve built here is a good start but the ability to search/filter is critical for these sorts of tools. I also thinking making it non-modal is essential.

    • Harshada HoleMicrosoft employee

      Apologies, you had an issue with your extension. We will work with the extension team to understand the problem with both APIs.
      Search/filtering is on the to-do list, so we will have that in upcoming releases.

  • Per-Erik Kristensson

    Wow! I did suggest exactly this feature a few years ago, never expected it to be implemented :-). Well done! I did find a minor issue when exporting to Excel. Some characters (like Å) are not properly shown in Excel, it looks like some UTF-8 encoding issue.

    As MgSam suggested, some basic filtering would be nice. But I’m more than happy doing this in Excel.

    Thank you!

    • Harshada HoleMicrosoft employee

      We are glad this is helpful. Thank you so much for trying it and bringing up the export issue, we will look into that.
      We are working on improving this feature and adding new capabilities; search/filtering is on the to-do list as well.

  • Francesco Luderin

    That’s fantastic! Debugging long enumerables of complex objects just got a big upgrade. I was waiting for this implementation since I joined the preview program. Thank you!

  • Rand Random

    Sure hope the design-team will have a look at it before the final release.
    The UI just screams Windows 98 era to the addition of no dark-theme in a visual studio that has dark-theme enabled.

    Does export to excel work when there is no excel installed on the machine?
    Did you consider export to csv?

  • Vaclav Elias

    Finally, why it took you so long? I found it essential in my debugging. I don’t have to maintain my extension anymore 🤣https://github.com/codecapital/EnumerableVisualizer, maybe you could add search on the top as well?

    Thank you so much!

    • Harshada HoleMicrosoft employee

      Thanks a lot for the wonderful extension, hope this new update will be helpful as well.
      Yes, this is just the first version of the visualizer. we have many more enhancements on the roadmap including Search/Filtering.