Skip to content

Commit b27bd41

Browse files
committed
Added README.md
1 parent 3aac5c1 commit b27bd41

File tree

7 files changed

+109
-6
lines changed

7 files changed

+109
-6
lines changed

CrashReporter.NET/..svnbridge/CrashReporter.NET.pfx

Lines changed: 0 additions & 1 deletion
This file was deleted.

CrashReporter.NET/Resources/..svnbridge/ajax-loader.gif

Lines changed: 0 additions & 1 deletion
This file was deleted.

CrashReporter.NET/Resources/..svnbridge/email_go.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

CrashReporter.NET/Resources/..svnbridge/save_as.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

CrashReporter.NET/Resources/..svnbridge/stop.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

CrashReporter.NET/Resources/..svnbridge/warning_64.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# CrashReporter.NET
2+
Send crash reports of your classic desktop application developed using .NET Framework directly to your mail's inbox with full exception report, stack trace and screenshot.
3+
4+
## The nuget package [![NuGet](https://img.shields.io/nuget/v/CrashReporter.NET.Official.svg)](https://www.nuget.org/packages/CrashReporter.NET.Official/)
5+
https://www.nuget.org/packages/CrashReporter.NET.Official/
6+
7+
PM> Install-Package CrashReporter.NET.Official
8+
9+
## How it works
10+
11+
CrashReporter.NET uses the exception information like stack trace, exception type, message, source, .NET CLR version, OS version and application version to generate the crash report and send it to developer using email. It uses DoctorDump service (http://drdump.com) to send email to developer. Developers can use their SMTP server to send email too.
12+
13+
## Using the code
14+
15+
First thing you need to do is subscribe to Application.ThreadException and AppDomain.CurrentDomain.UnhandledException in your Program.cs file as shown below.
16+
17+
````csharp
18+
internal static class Program
19+
{
20+
/// <summary>
21+
/// The main entry point for the application.
22+
/// </summary>
23+
[STAThread]
24+
private static void Main()
25+
{
26+
Application.ThreadException += ApplicationThreadException;
27+
28+
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
29+
30+
Application.EnableVisualStyles();
31+
Application.SetCompatibleTextRenderingDefault(false);
32+
Application.Run(new FormMain());
33+
}
34+
35+
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
36+
{
37+
ReportCrash((Exception)unhandledExceptionEventArgs.ExceptionObject);
38+
Environment.Exit(0);
39+
}
40+
41+
private static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
42+
{
43+
ReportCrash(e.Exception);
44+
}
45+
46+
public static void ReportCrash(Exception exception, string developerMessage = "")
47+
{
48+
var reportCrash = new ReportCrash
49+
{
50+
DeveloperMessage = developerMessage,
51+
ToEmail = "Email address where you want to receive crash reports"
52+
};
53+
54+
reportCrash.Send(exception);
55+
}
56+
}
57+
````
58+
59+
Just set the ToEmail in above example with your email to start receiving crash reports.
60+
61+
If you want to handle exception report for individual exception with special message you can do it like shown below.
62+
63+
````csharp
64+
const string path = "test.txt";
65+
try
66+
{
67+
if (!File.Exists(path))
68+
{
69+
throw new FileNotFoundException(
70+
"File Not found when trying to write argument exception to the file", argumentException);
71+
}
72+
}
73+
catch (Exception exception)
74+
{
75+
Program.ReportCrash(exception, "Value of path variable is " + path);
76+
}
77+
````
78+
79+
## Configuration Options
80+
### Change Language
81+
82+
You can change the language of the crash report dialog by adding following line in ReportCrash method of Program.cs file.
83+
84+
````csharp
85+
reportCrash.CurrentCulture = CultureInfo.CreateSpecificCulture("ru");
86+
````
87+
88+
In above example CrashReporter.NET will show crash report dialog in russian language.
89+
90+
### Send reports to your DrDump account
91+
92+
You can send crash report to you doctor dump account by adding following line in ReportCrash method of Program.cs file.
93+
94+
````csharp
95+
reportCrash.DoctorDumpSettings = new DoctorDumpSettings
96+
{
97+
ApplicationID = new Guid("Application ID you received from DrDump.com"),
98+
};
99+
````
100+
101+
Just set the ApplicationID to ID you received from DrDump.com.
102+
103+
### Capture whole screen instead of Application screen
104+
105+
You can take screenshot of whole screen instead of only application when application crashes by adding following line in ReportCrash method of Program.cs file.
106+
107+
````csharp
108+
reportCrash.CaptureScreen = true;
109+
````

0 commit comments

Comments
 (0)