InfoQ

News

Review: Exception Hunter

Posted by Jonathan Allen on Apr 14, 2008 06:50 AM

Community
.NET
Topics
Debugging
Tags
Static Analysis

Unhandled exceptions are the bane of any application, especially those that run without user interaction. Ideally, the compiler would detect and alert developers to these potential issues, but current .NET compilers cannot even determine which exceptions might be thrown.

To address this Red Gate has released Exception Hunter. This tool analyzes methods to determine which exceptions they can throw. The reports can be viewed interactively or chained to an automated build process like CruiseControl.

Like most Red Gate software, Exception Hunter has a simple and straightforward interface. But unfortunately, simplicity does not always translate into ease of use. While the tool is capable of generating reports, it can only do so from the command line. This simple task isn't to be found anywhere in the GUI.

More frustrating is that the method list does not indicate which methods actually throw exceptions. Some methods are in bold, but that just means the method is not inherited form a base class. The user has to drill into each method separately.

All this could be overlooked except for one thing, the number of false positive is ridiculously high. Consider this simple VB application

Source Code

The exceptions these few lines can throw include:

  • ArgumentException 6
  • ArgumentNullException 4, 6
  • ArgumentOutOfRangeException 4, 5, 6
  • FormatException 4, 6
  • IndexOutOfRangeException 6
  • InvalidCastException 6
  • InvalidOperationException 6
  • ObjectDisposedException 6
  • IO.PathTooLongException 6
  • NotSupportedException 6
  • NullReferenceException 6
  • OutOfMemoryException 4, 5, 6

One could only imagine the noise a non-trivial application would generate.

While effective exception analysis would be a boon to the industry, Red Gate's Exception Hunter demonstrates that we just are not to that point yet. And one has to wonder if this is even a solvable problem.

1 comment

Reply

Reflector Add-In by Jason Bock Posted Apr 16, 2008 5:53 PM
  1. Back to top

    Reflector Add-In

    Apr 16, 2008 5:53 PM by Jason Bock

    I've been working on a Reflector add-in that does something similar to this tool. It's on CodePlex: http://www.codeplex.com/ExFinderReflector

Exclusive Content

Rationalizing the Presentation Tier

Thin client paradigm characterized by web applications is a kludge that needs to be repudiated. Old compromises are no longer needed and it's time to move the presentation tier to where it belongs.

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.