Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send error reports from a .net error dialog?

In 2008 Jeff wrote a post on crashing responsibly. In that spirit, I'm trying to add a "send bug report" button to my crash error dialog. The idea is that the user can easily send a full bug report which already includes version information, OS info, stack trace... This information should be put in the message body or in attachment files.

Unfortunately, sending such an email from a .NET application appears to be non-trivial:

  • System.Net.Mail is not what I am looking for: I can't be sure that a connection to an SMTP server can be made in all environments, and I don't want to put the burden of configuring the local SMTP hostname and port on my users. Instead, I just want to launch the existing email software on the system with a precomposed message.
  • Using the OS to open a "mailto:" URL works, but there are annoying restrictions to the amount of data that can be passed this way. Also, it appears that attachments are not really supported by the mailto spec.
  • mapi.dll would probably do what I want as illustrated by this codeproject article, but I read elsewhere that mapi.dll is fundamentally incompatible with .NET causing random crashes.

Has anyone out there found a safe and reliable solution to do this?

like image 493
Wim Coenen Avatar asked Dec 21 '10 14:12

Wim Coenen


2 Answers

We have solved this by creating a simple WCF web service that takes the stack trace, zipped logs etc, which the client posts to it and then let the web service server send the email. This way you don't have to have the SMTP authentication information on the client side, nor do you have to rely on the user to submit the error report via their email client.

We're now even zipping and submitting client side logs periodically to the backend server via this webservice and analyze those logs to preemptively detect any client side issues before they become problematic to the client

like image 114
TJF Avatar answered Sep 30 '22 13:09

TJF


A quick way would be to set up your server to receive the information via PHP f.e. . Create an ErrorReport.php and try to call it with every information you have wrapped in a base64 package.

This 'only' needs Internet-Access on Port 80, which is most likely available. From there you can process the information and pass it on into a database f.e. .

like image 33
Bobby Avatar answered Sep 30 '22 11:09

Bobby