Exception Hunter 1.0
Build Bug-free .NET Applications
By Anand Narayanaswamy
Building a software or Web application requires the effort of many developers and it is the responsibility of the concerned developer to handle exceptions during the coding phase. Otherwise, runtime errors will occur and it will affect the credibility of not only the product but also of the company that developed it. It is not necessary to handle all exceptions that may be thrown by the application being developed but there are some hidden exceptions that might occur without your knowledge, thus resulting in an application crash. For instance, if you develop a program that attempts to connect to a SQL database, then you may not know that if one of the SQL libraries that relies on reading information from the computer registry fails, the application will throw an IOException resulting in fatal errors. As a developer, you should handle these kinds of exceptions; for this purpose you need a reliable tool to analyze the application.
UK-based Red Gate Software s Exception Hunter rapidly scans a .NET runtime assembly file and lists in a meaningful manner all possible exceptions that can target the functions used. Even though the product pinpoints all unhandled exceptions, it is up to you as a developer to decide which to handle and which to not handle. A fully functional trial version of Exception Hunter can be downloaded from the Red Gate Web site after completing a simple registration process (http://www.red-gate.com/products/exception_hunter/index.htm). I found the installation file of another product inside the downloaded package. I guess it was included as part of the .NET bundle, but I d prefer to download each product separately. I recommend that Red Gate distribute the installation packages separately and as a .NET bundle so users can download the required product(s) according to their tastes and preferences.
To work with Exception Hunter you first must locate the .NET assembly file and add it by clicking the Add Assembly option on the toolbar.
Figure 1: Adding assemblies.
Then you can either search for a method or navigate through to view all namespaces, classes, and their methods.
Figure 2: Navigating methods.
The final step is to view the stack trace by selecting a specific exception class.
Figure 3: Viewing the stack trace.
The product highlights the specific line in the code file on which the exception will probably be thrown. You can then directly open Visual Studio 2005 from within the interface of the product and write the specific code to handle the required exception. However, this feature will be available only if the assembly has an associated PDB file. A notable feature of the product is that it is compatible with .NET Framework 1.1, 2.0, 3.0, and 3.5 (the default is 2.0). The versions can easily be modified from the Tools menu. Red Gate is planning to add Intermediate Language (IL) view inside the product for the benefit of advanced developers.
Exception Hunter includes a powerful AJAX-based search functionality that you can use to locate a specific class or method. I feel this feature will be very useful for developers who analyze large applications. Moreover, the product enables you to perform all the tasks from the command line. I feel the information you gather from this tool will be extremely useful because Visual Studio 2005 doesn t have any tool similar to Exception Hunter.
Red Gate provides Web-based documentation, which can be accessed by hitting the F1 key after the launch of the product. The help file is also available CHM format from http://www.red-gate.com/support/Exception_Hunter/index.htm. A detailed step-by-step walkthrough with relevant screenshots and explanations can be viewed at http://www.red-gate.com/products/exception_hunter/walkthrough.htm. Alternatively, you can also watch an online audio-enabled demonstration at http://www.red-gate.com/products/exception_hunter/video.htm. I was able to understand the core features and the working of the product within minutes of installation after I watched the demo video.
Red Gate has developed the product for the benefit of both Windows and ASP.NET developers. But as compilation is dynamic from .NET Framework 2.0 onwards, you must locate the DLL file from the Temporary ASP.NET files folder. I suggest you pre-compile the ASP.NET code into a free-standing DLL, but it will be a complicated process as you must make use of the command-line options. I suggest that Red Gate develop a tool to simplify this step in the next build of the product.
I found that the initial loading time of Exception Hunter is slow, even though I tested it on a system with 512 MB RAM. Red Gate recommends 1 GB, but it is not always possible for all developers to have a system with this much memory. I hope they ll look into this aspect during the release of the next build of the product.
Exception Hunter will be useful for software testers, engineers, and quality assurance managers, as it will help them immensely toward their quest to build bug-free .NET applications for their customers.
Anand Narayanaswamy, a Microsoft Most Valuable Professional (MVP), works as an independent consultant based in Trivandrum, India. Anand also works as chief technical editor for http://ASPAlliance.com. He is the author of Community Server Quickly (http://www.packtpub.com/community-server/book). He runs http://www.learnxpress.com, http://www.dotnetalbum.com/, http://www.csharpfaq.com, http://www.computerbookreviews.org, and http://www.devreviews.com. Find out more about him at http://www.visualanand.net. He can be reached at mailto:[email protected].