Last week I blogged about Visual Studio 2005's Debugger Visualizers, and mentioned K. Scott Allen's control hierarchy visualizer,one of many free, community-driven visualizers that you can download and plug into Visual Studio 2005 today. I've been tinkering around with Scott's and others' visualizers over the weekend and decided to write an article on 4Guys about debugger visualizers: Improved Debugging with Visual Studio 2005's Debugger Visualizers.
In the article I present my first from scratch visualizer, one that applies to the System.Web.UI.Page data type and, when utilized, shows the server variables collection in a ListView. It's pretty trivial but provides a good starting point for those who are interested in creating their own custom visualizers. You can download the code from the article or from the My Code Projects page. Enjoy!
(I banged my head against a wall for several hours this weekend trying to get a visualizer to display the rendered contents of a control at any point in the page lifecycle. I know that Brett Johnsonoffers such a visualizer, but this control simply calls the RenderControl() method of the specified control, which carries with it some baggage. It's a technique I've discussed before, in Emailing the Rendered Output of an ASP.NET Web Control.Some potential issues with RenderControl()in ASP.NET 2.0 arise if you try to render a Web Form, since it tries to add the hidden input field to register events validation script. Of course this blows up because the Page will only happily do this if we're in the render phase of the page lifecycle. Similarly, if a user wants to render a TextBox directly, it'll complain that it's not within a Web Form.I tried to work around this by creating a faux Page class that overrode the VerifyRenderingInServerForm() method and EnableEventValidation property, but there are still some spots incertain controls that blindly reference the page's HttpContext object, which doesn'texist in the faux Page class. Urg.
If you have any ideas/workaround/solutions, I'd be delighted to hear them. Thanks!)