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.
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:
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.
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.
First version of this code released on Feb 4th 2008.
I will come back soon with improvements.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.