Raygun support for .Net2.0

Jason FauchelleProvider Updates1 Comment

Today we have released a new version of the Raygun4Net provider to support desktop and web projects that target .Net2.0. This has been included in the existing NuGet package, and all the source code is available on GitHub. This single package gives you error reporting for console applications, WinForms and ASP.Net projects. It only takes a few minutes to setup, and then your application will automatically send error reports to your Raygun.io account. All the error reporting information available in the modern .Net Raygun support is available in the .Net2.0 provider. This includes all the stack trace information, application version, details about the environment such as operating system and available memory, and even request and response information if it’s a web application.

Now that we have .Net2.0 support, We’ll be able to write providers for Unity3D – a multi-platform video game framework. Support for Unity3D coming soon!

Raygun support for .Net2.0 and Unity

How to send all unhandled exceptions

First, install Raygun4Net into your project. We recommend using NuGet to do this – right click the project and select Manage NuGet Packages, search for Raygun4Net and install. Note that for all the code examples seen below, the API key is given to you when you create a new application on Raygun.io.

Console application

If you have a console application, hook an event handler to AppDomain.CurrentDomain.UnhandledException. In the event handler, create a new instance of RaygunClient using your api key and then send the exception.


Setting up Raygun in WinForms is similar to a console application, but it’s also a good idea to listen to Application.ThreadException. Also, make sure to attach the event handlers before the Run method is called!


For an ASP.Net project, Raygun can be setup entirely within Web.Config. First, add the following line within the configSelections tag:

Next, add the RaygunSettings block somewhere within the configuration tag:

This is enough to setup Raygun and start sending exceptions in code via the Send or SendInBackground methods. By taking one more step, we can setup Raygun to automatically send all unhandled exceptions. Simply add the following code to the system.webServer tag:

And that’s it! The RaygunSettings configuration block has additional options such as excludeHttpStatusCodes to specify exceptions to ignore such as 404s, ignoreFormDataNames to prevent raygun sending sensitive http form values, and excludeErrorsFromLocal to disable Raygun when debugging on your local machine.

No matter which platform you are using, you can also use the Send or SendInBackground methods on the RaygunClient to send exceptions manually. This is especially useful for sending handled exceptions – ones that don’t crash the application, but you still want to know about them. Other features you may be interested in is sending custom data, a list of tags, or specifying a user identity string so that you can see how many people an error is affecting. Find out more in the documentation.

If you have any questions or suggestions, we’d love to hear from you. Try the free 30 day trial to start blasting away your errors today. No credit card required.

Next level software intelligence across your entire stack.

One Comment on “Raygun support for .Net2.0”

Leave a Reply

Your email address will not be published. Required fields are marked *