-
Notifications
You must be signed in to change notification settings - Fork 32
Sending a Report
Silent sending of a report is done asynchronously and the events of success/failure can be subscribed to (on the sending thread) by passing an implementation of IReportSendEvent
. For example:
...
class MySendEvents : IReportSendEvent
{
public void Completed(bool success)
{
Console.WriteLine("Exception Report send completed: " + success);
}
public void ShowError(string message, Exception exception)
{
Console.WriteLine("Exception Report fail: " + message + Environment.NewLine + exception);
}
}
...
var er = new ExceptionReporter
{
Config =
{
AppName = "PhotoFuzz",
SendMethod = ReportSendMethod.WebService,
WebServiceUrl = "http://photofuzz/apiv1"
}
}
er.Send(new MySendEvents(), exception);
When the option to Show a dialog is set, there are 3 ways for the user to send a report:
Copy to clipboard (then send it manually eg via chat/email)
The user will be prompted to select the location and name of the file to save
Sends a report to an Email address or WebService.
-
The button will say "Send" if
SendReportMethod
isWebService
otherwise "Email" -
Attachments will include all configured files (see
FilesToAttach
) and ifTakeScreenshot
is true, the screenshot JPEG file -
For both Email types (
SMTP
andSimpleMAPI
) files are attached to the email in a single compressed ZIP file. If any of the files to be attached are already zip files (ie end in ".zip") they will be added as separate attachments (just to avoid Russian Dolls with zip files)
Send via 3 methods (see config property SendMethod
):
-
SMTP: an e-mail is sent to the email address configured (
EmailReportAddress
). For SMTP settings see config propertiesSmtpServer
,SmtpFromAddress
, and where necessary,SmtpUsername
andSmtpPassword
. AlsoSmtpUseSsl
SmtpMailPriority
-
SmtpPort
and -
SmtpUseDefaultCredentials
etc
-
Simple MAPI: the user's email client will be launched and a new message automatically created and populated with an exception report. The subject, body and recipient are populated from the relevant config properties
- NB For Simple MAPI to work, the user must have a suitable email client installed (eg Outlook, Windows Mail). This is somewhat of a risk, however, I have found almost all professional/corporate users have no issues with this, so might be a reasonable option for some products
-
WebService: A JSON packet is sent via HTTP POST to a RESTful URL (
WebServiceUrl
)- A .NET Core project demonstrating the requirements is in the main solution - WebService.ExceptionReporter