Contributing Quick Fixes

Thomas Ardal, December 13, 2016

You have probably seen the new Fix tab on elmah.io. If not, check out the We don't just log your errors. We help you fix them! blog post. The Fix tab helps you fix errors fast, by providing quick fixes known from Visual Studio and relevant answers from Stack Overflow. The number of quick fixes are still limited, but that's something we want to change. We constantly look through the errors in our own logs and evaluate if any of those errors could need a quick fix.

Chances are that you experience other errors than we do. With the recent release on elmah.io, we support custom quick fixes through the new Elmah.Io.QuickFixes repository on GitHub. By forking this repository, you will be able to create custom quick fixes, which will show up in the elmah.io UI.

Creating a new quick fix requires nothing more than a bit of C#:

public class ImATeapotDocumentationQuickFix : QuickFixBase
{
    public ImATeapotDocumentationQuickFix()
    {
        Icon = "fa-coffee";
        Url = new Uri("https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol");
        Text = "One does not simply brew a cup of tea";
    }

    public override bool CanFix(Message message)
    {
        return message.StatusCode.HasValue && message.StatusCode.Value == 418;
    }
}

In this example, we create a new quick fix with a link to the Coffee Pot Control Protocol on Wikipedia on all errors with a status code of 418.

To get started creating quick fixes for elmah.io, fork the Elmah.Io.QuickFixes repository and add a new C# class. Additional documentation and examples are available in the repository as well.


This post was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening and help you fix errors fast.

Monitor your website



Comments