Effective Debugging in ASP.NET
Introduction
Effective debugging is a key part of effective software development. If you do not realize this statement or even do not appreciate this axiom in software development, this article would not benefit you much. If you are still reading, this article aims to provide a simple but powerful approach (not ready solution) for debugging contents of objects in ASP.NET. Actually you could use this approach for any other language or .NET area by simply using another type of control/debugging logic.
Background
Often in the code, you have an object having contents you would like to see at a specific run time or when the page is loaded. Often you do think that some data structures held specific values yet your program behaves in a way telling you that your assumptions were wrong, but you could not see it because you did not have a proper means for seeing what was in those data structures.
The Approach
The approach consists in using a simple control which renders the contents of a string
, which happen to be nicely formatted HTML string
, produced by dedicated debugger classes, which contain the logic of converting the contents of custom objects (DataSets, DataReaders, YourFacyCoolTypes) to a simple HTML user-friendly rendering string
.
The Code
The code consists of only one simple control you would simply copy paste to your App_Code folder (and probably rename the namespaces ;)). Here it is:
Comments