A simple crash report?

I am studying the implementation of a simple crash report in my application, which will ask the user whether he wants to or not to send us an emergency log.

I haven’t done a crash report before, what I used was an attempt / trick storing errors in a log file.

  • What is the correct way to implement a crash reporting system?

  • How do you run a crash report to open and send a dump when the application crashes or the correct approach for sending data?

I think these are my biggest doubts about how this works or should work ... I'm not quite sure if the crash report will be a try / catchs interaction with an external application that fires when it happens or what happens will be correct a way to follow him.

I do not have SQL Server, so what I planned to use would be a simple script loading, which the dump report application would use to send data.

Excuse me for not knowing how the crash report works, and I hope the community helps me better understand it.

I searched around the crash report and saw how most things go around Crystal Report, ready to go to libraries, etc., but I would like to start it small so that I can better understand it before breaking into some kind of a large library or other solution, if available at my end.

+5
source share
4 answers

Much depends on the application and (in particular) the expected privacy issues of your users.

, , , "", , , .

, , .

, , , ,

  • ( --), , " "
  • ( --)
  • , ( ..).

, , , , . " , , . , , , ?"

+3

Windows?

- Winqual , , . , , .

:

  • Winqual. , , - Winqual , VeriSign ID.

• ; VeriSign ID ( Authenticode). • Winqual , .

  • Windows.

  • Winqual.

  • " Windows".

: WinForms

+6

. program.cs. .

using System;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Threading; 

namespace ExceptionHandlerTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);

            // Your designer generated commands.
        }

        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) 
        {

            var fromAddress = new MailAddress("your Gmail address", "Your name");
            var toAddress = new MailAddress("email address where you want to receive reports", "Your name");
            const string fromPassword = "your password";
            const string subject = "exception report";
            Exception exception = e.Exception;
            string body = exception.Message + "\n" + exception.Data + "\n" + exception.StackTrace + "\n" + exception.Source;

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                //You can also use SendAsync method instead of Send so your application begin invoking instead of waiting for send mail to complete. SendAsync(MailMessage, Object) :- Sends the specified e-mail message to an SMTP server for delivery. This method does not block the calling thread and allows the caller to pass an object to the method that is invoked when the operation completes. 
                smtp.Send(message);
            }
        }
    }
}

, https://crashreporterdotnet.codeplex.com

+4
source

Try using AppDomain.UnHandledException and / or AppDomain.ThreadException

+1
source

All Articles