Edit

Kongsi melalui


Tabular visualizers in Visual Studio

While you are debugging in Visual Studio, you can view large collection objects with the built-in tabular visualizers. The visualizer shows data in a tabular view with one row per object and sortable columns for each field and property.

There are two types of tabular visualizers. The DataSet visualizer allows you to view the contents of a DataSet, DataTable, DataView, or DataViewManager. The IEnumerable visualizer allows you to view objects such as Arrays, List, etc.

Open the visualizer

To open the visualizer, you must be paused during debugging.

You can access the visualizer by clicking on the magnifying glass icon that appears next to the Value for one of those objects VisualizerIcon in a debugger variables window or in a DataTip.

Screenshot of Open an IEnumerable visualizer.

DataSet visualizer

The DataSet Visualizer allows you to view the contents of a DataSet, DataTable, DataView, or DataViewManager object.

Screenshot of View the DataSet visualizer data.

IEnumerable visualizer

Starting in Visual Studio 2022, you can view IEnumerable collections in a tabular view.

The IEnumerable visualizer helps explore large collection objects in a more streamlined way. The visualizer supports IEnumerable collections where the object type (T) can be simple types or complex types like dictionaries.

Screenshot of View the IEnumerable visualizer data.

You can use the right-click context menu to customize the view:

  • Select Hide Column to hide duplicate data.
  • Select Expand Column to see more details items in the complex data.
  • Select Hide Children to get a more concise view of your data.

Modify the expression in the IEnumerable visualizer

Starting in Visual Studio 2022 version 17.11, you can directly change the Expression textbox for the IEnumerable visualizer with a modified LINQ expression. The visualizer data gets updated, reflecting the data change resulting from your new query.

Screenshot of view the visualizer data and edit the expression.

Starting in Visual Studio 2022 version 17.12 Preview 3, you get IntelliSense support to help you edit the expression.

Starting in Visual Studio 2022 version 17.12 Preview 2, you can get AI assistance to edit the LINQ expression. If you have Copilot activated, click the GitHub Copilot icon to open Copilot Chat.

Screenshot of Copilot button to get help to edit the expression.

In the Copilot Chat, you see LINQ syntax examples. Additionally, you can describe your query in natural language, and GitHub Copilot will generate the corresponding LINQ query. To apply LINQ query filtering to the visualizer, use the Show in Visualizer button in the chat.

Screenshot of Show in Visualizer button in Copilot Chat.

Filter, sort, and export visualizer data

  • Both DataSet and IEnumerable support filtering, sorting, and exporting of visualizer data.
  • You can sort the visualizer columns in ascending/descending order by clicking on the column name.
  • You also can filter visualizer data based on a filter string. Enter the string in the filter box in the upper right corner and press Enter. The Visualizer returns all the rows that contain a value that matches the filter string.
  • You can export the data from IEnumerable visualizers in CSV/Excel format using the dropdown on the top right corner.
  • You can also export the filtered and sorted results in CSV/Excel format.

Screenshot of View the visualizer data filter.