Full CrashReporter.NET API documentation is here.

CrashReporter.NET was integrated with free Doctor Dump crash reporting service for you. With Doctor Dump enabled you will get following benefits:

  • You don't need to setup SMTP stuff and insert e-mail password to your application 
  • Similar crash reports will be grouped together
  • You will not be annoyed with one stack trace hundreds of times
  • You will not be annoyed with problems that you fixed or want to ignore
  • You can provide your users with solutions/workarounds for their problem

To setup CrashReporter.NET follow guide below. It’s a three step process and you are one minute away from your first crash report.

Step - 1

In context menu of your project click on Manage NuGet Packages... menu:

Manage NuGet packages menu

Step - 2

Find CrashReporter.NET package and click Install button: 

Install CrashReporter.NET package

If you don't want use NuGet you should download CrashReporter.NET.dll assembly or CrashReporter source code.

For assembly choose in context menu of your project Add/Reference... item. In Reference Manager click browse and find CrashReporter.NET.dll.

For source code add CrashReporter.NET.csproj to your solution. In context menu of your project choose Add/Reference... item. In Reference Manager select Solution tab, find CrashReporter.NET in Projects list, set check against it and click OK.

Step - 3

Now add following lines in your application’s Program.cs file if you want to report all unhandled exceptions.

using System;
using System.Threading;
using System.Windows.Forms;
using CrashReporterDotNET;

namespace Right_Click_Shortcuts_Creator
{
    internal static class Program
    {
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.ThreadException += ApplicationThreadException;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }

        private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
        {
            ReportCrash((Exception)unhandledExceptionEventArgs.ExceptionObject);
            Environment.Exit(0);
        }

        private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
        {
            ReportCrash(e.Exception);
        }

        private static void ReportCrash(Exception exception)
        {
            var reportCrash = new ReportCrash
            {
                ToEmail = "Email address where you want to receive crash reports"
            };

            reportCrash.Send(exception);
        }
    }
}

If you want to handle exception reporting for individual exception use following code.

using System;
using System.Windows.Forms;
using System.IO;
using CrashReporterDotNET;

namespace CrashReporterTest
{
    public partial class FormMain : Form
    {
        private static void ReportCrash(Exception exception)
        {
            var reportCrash = new ReportCrash
            {
                ToEmail = "Email address where you want to receive crash reports"
            };

            reportCrash.Send(exception);
        }

        public FormMain()
        {
           InitializeComponent();
        }

        private void ButtonTestClick(object sender, EventArgs e)
        {
           try
           {
              File.Copy("Test.txt", "Error.txt");
           }
           catch (Exception exception)
           {
              ReportCrash(exception);
           }
        }
    }
} 

Make sure you use tools like Eazfusctor.NET or any other obfuscation software for .NET framework to protect your email and password from being seen. Also create new gmail account with random password that doesn’t contain secondary email or mobile to use Gmail as a smtp server. This class library is under development and will get many more features in near future. You can use your own SMTP server to send crash reports.

Last edited Sep 27 at 10:24 PM by DoctorDump, version 12

Comments

No comments yet.