Sunday, April 5, 2009

Oops.NET

I think the world needs another error-handling module for .NET applications.

My experience working in the IT departments of big companies suggests that most .NET applications do not behave well under exceptional circumstances. Sometimes programmers ignore exceptions and allow their programs to corrupt data. More often, our apps lose valuable diagnostic information during crashes. Occasionally, while attempting to preserve diagnostic details, our programs cause cascading failures that overshadow the original!

So, contrary to my first impression, even very simple error-handling code in thoroughly mundane programs is not too trivial share.

Before writing yet-another error handling module, I searched for something to reuse.

Microsoft's Enterprise Library has an exception handling module. In the old days, one reason to avoid it was because of its restrictive license; these days it is offered under the permissive MS-PL. But, it's still not right for most of the (small) apps I encounter, because its purpose is to provide high-level abstractions for conditions throughout an application.

ELMAH is aimed at ASP.NET specifically, but it wants to do data access and logging on its own. I do recognize the irony in launching competition for ELMAH due to ELMAH's tendency to reinvent the wheel, but I strongly value small sharp tools.

So I'm making something new.

It's conceptually based on the "oops page" I wrote for Tyco Healthcare iDeal many years ago. iDeal was an ASP.NET app that helped salespersons develop contracts; the Oops page gave our users an easy way to file bugs so that we wouldn't have to decipher vague phone messages and partial screenshots of ASP.NET default backtraces any more.

At Anheuser-Busch, our Enterprise Architecture group used to hand out sample code to illustrate our policies about how .NET apps (ASP.NET apps in particular) should crash. The sample could only be obtained by asking for it, which effectively encouraged teams to guess about its contents. The sample tried to show a few variations on its theme, but its presentation confused many teams, who either copied redundant code or omitted crucial details. We needed production-quality reusable code rather than sketches that wound up being reused by copy-and-paste. Because iDeal Oops was proprietary, and because it didn't address console apps, WinForms, Web Services, etc., I had to rewrite it for A-B.

Now I find myself back at the company formerly known as Tyco Healthcare, and I see apps that would benefit from Oops. I could extract Oops from iDeal, package it as nicely as the code I wrote for A-B... But I'm afraid I might wind up working on .NET at some other company, and I never want to have to rewrite this code again. And, it's clearly worth sharing.

So, I'm finally publishing Oops.NET. Coming soon: log4net integration demo, bugzilla integration demo, and support for WinForms, System.Web.Services, System.ServiceModel, and WPF.

No comments:

Post a Comment