Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug large lists of strings and multidimensional arrays of numbers?

I often use C# to work with large datasets, which take the form of very large lists of strings, or large 2 or 3 dimensional arrays of numbers. The latter especially is very easy to visualize in Matlab, a functionality I often miss with C#.

VS2012 has very nice debugging functions which allow you to stop execution and inspect different variables in various ways. It will also highlight variables that change with red.

Unfortunately, for lists and matrices this is useless. By default, lists will not be expanded, and if you do expand them the values of individual entries will not be visible unless you expand every single one individually. The layout is uneconomical with space, so you can see few entries at one time. With larger 2D arrays, the way the entries are arranged makes interpreting the array at a glance a nightmare.

For datasets, there is a great visualization tool that automatically shows up when you click the magnifying glass in debug mode. Unfortunately, I can't find anything similar to it for lists of strings, string arrays, or 2D arrays of numbers.

Is there an extension or hidden feature for viewing such data structures when execution is paused? If no, how can I make my own?

like image 786
Superbest Avatar asked Feb 04 '13 02:02

Superbest


1 Answers

You can write your own custom Visualizer.

  • Walkthrough: Writing a Visualizer in C#
  • How to: Install a Visualizer

There is also this:

  • Array Visualizer

Array Visualizer is a free, open source extension for visual studio. It is designed to display 2D, 3D and 4D arrays while debugging an application.

like image 175
Mitch Wheat Avatar answered Oct 18 '22 22:10

Mitch Wheat