Click here to Skip to main content
15,896,730 members
Articles / Programming Languages / C#
Article

Enhanced QuickWatch

Rate me:
Please Sign up or sign in to vote.
3.00/5 (4 votes)
7 Apr 2006CPOL3 min read 49.4K   202   19   13
A Visual Studio .NET 2003 add-in to view XML, Datasets and Exceptions
Sample Image - DebugViewerImg.jpg

Introduction

I finally found time to post the Enhanced QuickWatch add-in for VS.NET 2003. About a year ago, I developed the Add-In using the basic concept and code from a few posts and added several other useful features that are of immense help when trying to visualize XML Serializable Objects, DataSets, XML Documents and Strings, Exception Stacks, etc. Just as I was planning to upgrade to VS.NET 2005, I decided to make an effort to post the Add-In for VS.NET 2003.

Several people need to be thanked for ideas, code and implementations. I can't remember all the sources but the basic concept and code was from a couple of developers, Mohammed Barqawi and Matt Simner amongst others. I also used XmlVisualizer.UI.ScintillaControls.dll, one of the Wrapper controls for Scintilla Editor.

What It Does?

The Enhanced QuickWatch provides visualization of the following.

Usage

  • Right click on the variable in debug mode and click the Enhanced QuickWatch menu item. If this fails to select the right variable , you can try selecting the whole variable and try the same. The rule is written such that if no selection, it uses the TextSelection classes method WordRight() and WordLeft() to determine the variables length. You can view the selected variable in the code as it is highlighted.
  • You can continue using the QuickWatch even after the debugging session ends as the window will remain open. You can also right click and launch the add-in in the source code in Visual Studio or launch it from the tools menu when not in debug mode, which is helpful for loading XML files to visualize as datasets and/or use the XML viewer.
  • DataSets, strongly typed DataSets, DataTables and DataRows.
  • XML representation of the DataSets and its XmlSchema are retrieved by GetXml() and GetXmlSchema() methods.
  • The DataSets tables are displayed in separate tables and two tabs are used to display the list of Tables and Relationships in the DataSet.
  • When visualizing a DataTable or DataRow, the tab will be auto selected.
  • Ensure that when viewing DataTable Or DataRow that they are part of a DataSet, because the QuickWatch rebuilds the dataset from the evaluations of GetXml() and GetXmlSchema() calls on the DataTable/DataRow's associated Dataset.
  • XmlDocument, XML strings, Objects that have ToXml() methods.
  • When viewing XmlDocuments or XML string, the XML will be loaded into a dataset and displayed in the appropriate Tab to provide alternate visualization.
  • Exceptions can be viewed in the exception viewer control and clicking the appropriate line in the stack trace will open the code file and highlight the line the exception occurred.
  • A Row Filter can be established for active or deleted rows, using standard row filter expressions.
  • There is no need to select the whole variable to view, only right clicking on the variable name and clicking the Quickwatch from the menu will do the trick.
  • If any unsupported type is found, the default ToString() representation of the object is displayed.
  • Separate Tab is used to display any errors occurring during parsing and/or display .
  • Load XML Files from the file menu in order to check the dataset representation of the XML files.

Using the Code

I got a request for the source code, so I removed customizations that I was using specifically for my projects, but there might still be some unimplemented menu items that might be disabled or invisible.

I believe the source code is self documenting, but I'd mention that I have separated the major features into separate projects. The main solution DebugViewer.sln is in the DebugViewer folder. There are several test projects I created for testing individual components and zipped up the whole project folder structure so you might find unnecessary files.

I only spent limited time on this project and haven't had the time to refactor it once it got stabilized. I did encounter a couple of issues (I use it daily and have had about 2-3 issues in the past year) and didn't investigate into the root cause. Please feel free to enhance, add features or fix bugs if encountered.

History

  • 7th April, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionexp.Value is not complete but truncated.... Pin
anupam45615-Apr-09 23:27
anupam45615-Apr-09 23:27 
Generalplease help me make this work for VS 2003. Pin
TCDooM30-Jun-07 19:59
TCDooM30-Jun-07 19:59 
AnswerRe: please help me make this work for VS 2003. Pin
icedragon12-Jul-07 3:06
icedragon12-Jul-07 3:06 
GeneralRe: please help me make this work for VS 2003. Pin
BirgerD1-Aug-07 21:05
BirgerD1-Aug-07 21:05 
GeneralDoesn't work for me Pin
emunews22-Oct-06 7:00
emunews22-Oct-06 7:00 
GeneralNothing happens... Pin
Przemyslaw Wlodarczak14-Apr-06 3:14
Przemyslaw Wlodarczak14-Apr-06 3:14 
Generalnot working for me... Pin
travislaborde11-Apr-06 2:53
travislaborde11-Apr-06 2:53 
GeneralRe: not working for me... Pin
Sudhin Devarachetty11-Apr-06 5:14
Sudhin Devarachetty11-Apr-06 5:14 
hmmm... try selecting the whole variable and do the same ... looks like it cannot evaluate the variable ..

-- modified at 23:00 Tuesday 11th April, 2006
Also make sure that the DataTable is part of a DataSet because the quickwatch rebuilds the dataset from the GetXml() and GetXmlSchema() calls on the DataTable/DataRow's associated Dataset .



QuestionVS2005? Pin
FinishedOnTime10-Apr-06 8:35
FinishedOnTime10-Apr-06 8:35 
AnswerRe: VS2005? Pin
Sudhin Devarachetty11-Apr-06 5:22
Sudhin Devarachetty11-Apr-06 5:22 
GeneralSource Code Pin
Paul Farry7-Apr-06 18:17
professionalPaul Farry7-Apr-06 18:17 
GeneralRe: Source Code Pin
Sudhin Devarachetty8-Apr-06 17:33
Sudhin Devarachetty8-Apr-06 17:33 
GeneralRe: Source Code Pin
Paul Farry9-Apr-06 12:37
professionalPaul Farry9-Apr-06 12:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.