Debugger Tips, Tricks and Tools #5

Enhanced DataTips have a context menu

Because of the transient nature of DataTips inside Visual Studio 2005, you may not be aware that there useful operations you can perform on selected item within a datatip by opening a context menu on it. 

Datatip Context Menu

In the above example, the cursor has been hovered to the m_strTitle member of pDoc->m_strTitle and the right mouse button was clicked. This invokes the context menu for the item and your presented with a set of operations you can perform on it. 

  • Copy - Copies both the name and the value of the item.
  • Copy Expression - Copies just the expression portion of the item.
  • Copy Value - Copies just the value portion of the item.
  • Edit Value - If the item is not read-only you can edit the value. The same can be done by left-clicking the mouse once, or pressing F2.
  • Add Watch - Adds the item as a top-level watch item. 
  • Hexadecimal Display - Toggles the debugger's numeric base for displaying integer values.
  • When debugging C# or J# you're presented with another operation -- "Make Object Id". In a future tip, I will discuss that particular feature.

My biggest complaint about this feature? I wish that I had had time to add the "Copy Expression" and "Copy Value" commands to the watch window. :)