How to view a DataTable while debugging

With a break point set, after the DataTable or DataSet is populated, you can see a magnifying glass if you hover over the variable. If you click on it, it will bring up the DataTable Visualizer, which you can read about here.

In this image you see below, dt is my DataTable variable and the breakpoint was hit a few lines below allowing me to hover over this value. Using Visual Studio 2008.

alt text

DataTable Visualizer (image credit):
alt text


set the break point on the dataset/datatable(f9 shortcut key for break point) and run your application (f5 is the shortcutkey ) When the break point comes mouse hover the dataset/datatable click on the glass shown in the hover image in visual studio .

Note : check compilation debug="true" is true in web config .Else visual studio wont go for debugging .


I added two lines into my app inside a class named after the outermost class:

public MyClass()
    {
      // The following (2) lines are used for testing only.  Remove comments to debug.
      System.Diagnostics.Debugger.Launch();
      System.Diagnostics.Debugger.Break();
    }

This should stop the app and bring it up in debug mode. Then you can step through it and look at the values in your objects as you hover over them.