ravibpatel / CrashReporter.NET

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.
MIT License
185 stars 74 forks source link

Silent crash not send #18

Closed Maesetsure closed 5 years ago

Maesetsure commented 6 years ago

Hi. I'm trying to report in silence mode. But email no arrive. Code i'm using is next.

Thanks in advance

[STAThread] static void Main() { Application.ThreadException += ApplicationThreadException;

        AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

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

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

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

    public static void SendReport(Exception exception, string developerMessage = "", bool silent = false)
    {
        var reportCrash = new ReportCrash("email@email.com")
        {
            DeveloperMessage = developerMessage
        };
        //reportCrash.Silent = silent;
        reportCrash.Silent = true;
        reportCrash.CaptureScreen = true;
        reportCrash.Send(exception);
    }
ravibpatel commented 6 years ago

@Maesetsure Try using the SendSilently method instead of the Send method.

Maesetsure commented 6 years ago

Problem continue.

public static void SendReport(Exception exception, string developerMessage = "", bool silent = false) { var reportCrash = new ReportCrash("email@email.com") { DeveloperMessage = developerMessage }; //reportCrash.Silent = silent; reportCrash.Silent = true; reportCrash.CaptureScreen = true; reportCrash.SendSilently(exception); }

ravibpatel commented 6 years ago

@Maesetsure Tried it in the Demo project and it works perfectly fine for me. Are you replacing email@email.com with your real email? Also, does it work with Silent = false?

Maesetsure commented 6 years ago

Hi.

-I realized that report most of exceptions, but the first one i tried it continue failing.

Thanks for all.

ravibpatel commented 5 years ago

@Maesetsure If it works should I close the issue?

gorvinsky commented 5 years ago

I am having this issue as well. I'm using a real email with the latest version 1.5.6.

ravibpatel commented 5 years ago

@gorvinsky Did you use the same code as demo version? Do you use WinForms or WPF?

gorvinsky commented 5 years ago

@gorvinsky Did you use the same code as demo version? Do you use WinForms or WPF?

Not exactly. I'm using WPF. Here's the code written in App.xaml.cs:

private void Application_Startup(object sender, StartupEventArgs e)
{
    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
    Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
    TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
}

private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    SendReport((Exception)e.ExceptionObject);
    Environment.Exit(0);
}

private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
    SendReport(e.Exception);
    Environment.Exit(0);
}

private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
    SendReport(e.Exception);
    Environment.Exit(0);
}

private void SendReport(Exception exception, string developerMessage = "", bool silent = true)
{
    var reportCrash = new ReportCrash("A real email")
    {
        DeveloperMessage = developerMessage
    };
    reportCrash.CaptureScreen = true;
    reportCrash.Silent = silent;
    //reportCrash.SendSilently(exception);
    reportCrash.Send(exception);
}
gorvinsky commented 5 years ago

@ravibpatel Any update on this? Could you reopen this issue?

ravibpatel commented 5 years ago

@gorvinsky I need to reproduce the issue before I can reopen it. I will look further into it.

NextAlexM commented 5 years ago

Have been getting the same issue