Click here to Skip to main content
15,867,568 members
Articles / Web Development / ASP.NET
Article

Session Vizualizer for Visual Studio 2005

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
29 Nov 2008CPOL2 min read 25K   208   26  
Debug tool for analyzing Session content in web applications.

Introduction

The purpose of this tool is to let developers easily analyze Session content during debugging and also browse stored objects. For this, a simple interface was built, and a PropertyGrid control is used. In large web applications, there are situations when developers leave old objects stored in the Session, and these are disposed only when the session in ended. Using this tool, it is easy to see the Session content and improve the code that manages Session content.

Background

Visualizers are a new feature in Visual Studio 2005, and allow developers to inspect values at debug time using a graphical interface. These components can be integrated with Visual Studio, and provide extra performance in debugging specific data types.

Built-in visualizers are available for:

  • XML/HTML/Text
  • DataSet/DataTable/DataView

Using the Code

There are three main parts in writing a visualizer:

  • One that implements the IDebugVisualizer interface and runs inside the debugger process.
  • The debugee side that serializes the .NET type to be copied from the debugee process to the debugger process.
  • And, the user interface for showing the debugged object in a nice way.

printscr.jpg

For installing the visualizer, this line can be used:

copy "$(TargetPath)" "$(HOMEDRIVE)$(HOMEPATH)\
                        My Documents\Visual Studio 2005\Visualizers"

This is also used as a post-build event in the attached code to install it automatically after the project is built.

After installing, in order to use it, add the Session object in the Watch window, and click the magnifier icon.

The Session visualizer at this moment has a major drawback: the objects stored in the Session need to be serializable in order to be copied from the application process to the debugger process. Most of the websites use InProc sessions, and objects stored are not always serializable. I think I can improve this in a future version. If you have any idea for improvements, please contact me.

History

First version of this code released on Feb 4th 2008.

I will come back soon with improvements.

License

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


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

Comments and Discussions

 
-- There are no messages in this forum --