Exemple #1
0
    void RunResumedSession()
    {
        // send 1st exception which should include session info
        Bugsnag.StartSession();
        Bugsnag.Notify(new System.Exception("First Error"));

        // send 2nd exception after resuming a session
        Bugsnag.StopSession();
        Bugsnag.ResumeSession();
        Bugsnag.Notify(new System.Exception("Second Error"));
    }
Exemple #2
0
    void RunNewSession()
    {
        // send 1st exception which should include session info
        Bugsnag.StartSession();
        Bugsnag.Notify(new System.Exception("First Error"));

        // stop tracking the existing session
        Bugsnag.StopSession();
        Bugsnag.StartSession();

        // send 2nd exception which should contain new session info
        Bugsnag.Notify(new System.Exception("Second Error"));
    }
Exemple #3
0
    void LoadScenario()
    {
        var scenario = Environment.GetEnvironmentVariable("BUGSNAG_SCENARIO");

        switch (scenario)
        {
        case "LogExceptionOutsideNotifyReleaseStages":
            Bugsnag.Configuration.ReleaseStage        = "dev";
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "production" };
            DoLogUnthrown();
            break;

        case "NotifyOutsideNotifyReleaseStages":
            Bugsnag.Configuration.ReleaseStage        = "dev";
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "production" };
            DoNotify();
            break;

        case "NativeCrashOutsideNotifyReleaseStages":
            Bugsnag.Configuration.ReleaseStage        = "dev";
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "production" };
            crashy_signal_runner(8);
            break;

        case "UncaughtExceptionOutsideNotifyReleaseStages":
            Bugsnag.Configuration.ReleaseStage        = "dev";
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "production" };
            DoUnhandledException(0);
            break;

        case "DebugLogBreadcrumbNotify":
            LogLowLevelMessageAndNotify();
            break;

        case "ComplexBreadcrumbNotify":
            LeaveComplexBreadcrumbAndNotify();
            break;

        case "DoubleNotify":
            NotifyTwice();
            break;

        case "MessageBreadcrumbNotify":
            LeaveMessageBreadcrumbAndNotify();
            break;

        case "Notify":
            DoNotify();
            break;

        case "NotifyBackground":
            new System.Threading.Thread(() => DoNotify()).Start();
            break;

        case "NotifyCallback":
            DoNotifyWithCallback();
            break;

        case "NotifySeverity":
            DoNotifyWithSeverity();
            break;

        case "LogUnthrown":
            DoLogUnthrown();
            break;

        case "UncaughtException":
            DoUnhandledException(0);
            break;

        case "AssertionFailure":
            MakeAssertionFailure(4);
            break;

        case "UncaughtExceptionAsUnhandled":
            UncaughtExceptionAsUnhandled();
            break;

        case "LogUnthrownAsUnhandled":
            DoLogUnthrownAsUnhandled();
            break;

        case "ReportLoggedWarningThreaded":
            new System.Threading.Thread(() => DoLogWarning()).Start();
            break;

        case "ReportLoggedWarning":
            DoLogWarning();
            break;

        case "ReportLoggedError":
            DoLogError();
            break;

        case "ReportLoggedWarningWithHandledConfig":
            DoLogWarningWithHandledConfig();
            break;

        case "ManualSession":
            Bugsnag.StartSession();
            break;

        case "ManualSessionCrash":
            Bugsnag.StartSession();
            UncaughtExceptionAsUnhandled();
            break;

        case "ManualSessionNotify":
            Bugsnag.StartSession();
            DoNotify();
            break;

        case "AutoSessionInNotifyReleaseStages":
            Bugsnag.Configuration.ReleaseStage        = "production";
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "production" };
            break;

        case "ManualSessionInNotifyReleaseStages":
            Bugsnag.Configuration.ReleaseStage        = "production";
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "production" };
            Bugsnag.StartSession();
            break;

        case "AutoSessionNotInNotifyReleaseStages":
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "no-op" };
            break;

        case "ManualSessionNotInNotifyReleaseStages":
            Bugsnag.Configuration.NotifyReleaseStages = new [] { "no-op" };
            Bugsnag.StartSession();
            break;

        case "ManualSessionMixedEvents":
            Bugsnag.StartSession();
            DoNotify();
            DoLogWarning();
            UncaughtExceptionAsUnhandled();
            break;

        case "StoppedSession":
            Bugsnag.StartSession();
            Bugsnag.StopSession();
            DoNotify();
            break;

        case "ResumedSession":
            RunResumedSession();
            break;

        case "NewSession":
            RunNewSession();
            break;

        case "NativeCrash":
            crashy_signal_runner(8);
            break;

        case "UncaughtExceptionWithoutAutoNotify":
            Bugsnag.Configuration.AutoNotify = false;
            DoUnhandledException(0);
            break;

        case "NotifyWithoutAutoNotify":
            Bugsnag.Configuration.AutoNotify = false;
            DoNotify();
            break;

        case "LoggedExceptionWithoutAutoNotify":
            Bugsnag.Configuration.AutoNotify = false;
            DoLogUnthrownAsUnhandled();
            break;

        case "NativeCrashWithoutAutoNotify":
            Bugsnag.Configuration.AutoNotify = false;
            crashy_signal_runner(8);
            break;

        case "NativeCrashReEnableAutoNotify":
            Bugsnag.Configuration.AutoNotify = false;
            Bugsnag.Configuration.AutoNotify = true;
            crashy_signal_runner(8);
            break;

        case "AutoSessionNativeCrash":
            new Thread(() => {
                Thread.Sleep(900);
                crashy_signal_runner(8);
            }).Start();
            break;
        }
    }