ELMAH Code Snippets for Visual Studio

Ever used Code Snippets in Visual Studio? Code Snippets is a great way to reduce keyboard input and help you be more productive by automating typing common lines of code.

At elmah.io we love ELMAH (big surprise). That's why we have decided to open-source the code snippets that we use internally to automate writing code against the ELMAH libraries. The snippets can be found at our organization on GitHub:

https://github.com/elmahio/ELMAHCodeSnippets

Let's look at an example to see what the possibilities are using these snippets. Ever been frustrated doing manual logging to your ELMAH log using the ErrorSignal type? Not anymore with the tryraise snippet:

tryraise

When hitting the Tab key, the following code is generated:

tryraise Result

Pretty sweet, right? tryraise is one of 6 snippets available, but more will come. We also accept pull requests, so please send us your favorite ELMAH snippets or improve the ones already there.

To install the snippets, simply clone (or download) the git repository and import the snippets in the Code Snippet Manager from within Visual Studio.

But wait there's more! You don't even have to install the snippets manually. Our elmah.io extension for Visual Studio already ships with all of the snippets, making it super easy to install them using the Extensions and Updates feature:

Install elmah.io VS extension

elmah.io: Error logging and Uptime Monitoring for your web apps

This blog post is brought to you by elmah.io. elmah.io is error logging, uptime monitoring, deployment tracking, and service heartbeats for your .NET and JavaScript applications. Stop relying on your users to notify you when something is wrong or dig through hundreds of megabytes of log files spread across servers. With elmah.io, we store all of your log messages, notify you through popular channels like email, Slack, and Microsoft Teams, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website