Home
Do you use the best exception handling library?
  v6.0 Posted at 8/09/2014 11:01 AM by Drew Robson

​​When developing software, exceptions are a fact-of-life you will need to deal with. Don't reinvent the wheel, use an existing exception handling library or service.

​​​The best exception handling service is Application Insights for ​Visual Studio Online​, but if you can't use that, then use ELMAH​.

Your users should never see the “yellow screen of death” in ASP.NET, or the “unhandled exception” message in a Windows application. Errors should always be caught and logged – preferably in a SQL database.​


At SSW we use Application Insights for Visual Studio Online.

Application Insights will tell you if your application goes down or runs slowly under load. If there are any uncaught exceptions, you’ll be able to drill into the code to pinpoint the problem. You can also find out what your users are doing with the application so that you can tune it to their needs in each development cycle.  

If Application Insights for Visual Studio Online is not available we use ELMAH when developing web applications. From its NuGet page:

ELMAH with initial configuration for getting started quickly. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.

If you are still developing Windows applications, then SSW Exception Logger is the one to use. Read SSW .NET Toolkit – LadyLog User Guide.

ELMAH can be easily added to your application from NuGet, and it configures itself.

2014-09-08_10-56-57-compressor.png
Figure: Add ELMAH to your web application from NuGet

See also Do you use the best middle tier .Net libraries?

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments:

    Note: Social Media login for Yotpo is not working in IE or Safari, please use Chrome. We are waiting for Yotpo to fix it.