Debugging - Data Visualizations

PDF for offline use
Related Articles:
Related Recipes:

Let us know how you feel about this

Translation Quality


0/250

last updated: 2017-03

Debugging is a common, and necessary, part of programming. As a mature IDE, Xamarin Studio contains a whole suite of features to make debugging easy. This article looks at the different data visualizations that can be viewed when inspecting objects in the debugger.

Data Visualizations

Xamarin Studio 5.9 includes new UI support for the debugger allowing visualizations of the values of a variable, field or property while debugging. These data visualizers show an extended version of the data and allow developers to inspect known structures, for example showing the color of a color struct.

Visualizers in the debug Local pad can be displayed by clicking on the preview icon that appears to the right of the value, when the user hovers over the row:

The list below looks at many of the new visualizations available when debugging in Xamarin Studio.

Point

A Point/PointF, or CGPoint in iOS and Mac, will render as a tuple showing the X and Y values in the debug pad:

Size

A Size/SizeF, or CGSize in iOS and Mac, will render as a rectangle. It is drawn to scale until a dimension grows past 250px, at which point it will scale the rectangle with the largest dimension as 250px:

Rectangle

A Rectangle/RectangleF, or CGRect in iOS and Mac, will display the dimensions and origin. Similar to Size, it is drawn to scale, until a dimension grows past 250px:

Coordinate

Coordinates are plotted on a map, with the location pinned to the center:

Color

This will display UIColor, CGColor, and Color properties, depicting the color preview, RGBA components, Hue-Staturation-Lightness values, and the hex value of the color:

Images

Images will be rendered to scale, up to a maximum dimension of 250px, and will be scaled to fit when the image exceeds 250px:

Bezier Curves

The visualizer will display an NSBezierPath:

String

A string will be displayed of less than 100 characters will be displayed in full, without a preview. Longer strings will be displayed in full in the preview. Strings are editable, and the visualizer is accompanied by an edit button allowing the string value to be edited either in the preview or in the String Value Editor, shown beneath.

Small Strings:

Medium-length Strings (anything <>, Dictionary<,> as these have their own debugger visualizers.

Some other types that also have their own inline visualizers are listed below:

  • Unevaluated Value
  • Primitives
    • This will show the raw value of the primitive type.
  • Enum
    • This will display the field value without the enum Type qualifier.
  • Tuple
    • Displayed in the format (,)
  • Null
    • Shows "null" value.
  • URL
    • This will display a clickable hyperlink.
  • IntPtr
    • This will display a hexadecimal representation of the IntPtr.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.