Exemplo n.º 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"));
    }
Exemplo n.º 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"));
    }
 // Use this for initialization
 void Start()
 {
     Bugsnag.Context      = null;
     Bugsnag.ReleaseStage = null;
     Bugsnag.AddToTab(null, null, null);
     Bugsnag.AddToTab("My Data", "myKey", "myValue");
     Bugsnag.ClearTab(null);
     Bugsnag.SetUser("user-id", "User Name", "*****@*****.**");
     Bugsnag.ReleaseStage = "staging";
     Bugsnag.AppVersion   = "1.2.3-alpha";
     Bugsnag.NotifyLevel  = Bugsnag.LogSeverity.Warning;
     Bugsnag.SessionUrl   = "http://127.0.0.1:8092";
     Bugsnag.StartSession();
     Bugsnag.SetAutoCaptureSessions(true);
 }
Exemplo n.º 4
0
    void LoadScenario()
    {
        var scenario = Environment.GetEnvironmentVariable("BUGSNAG_SCENARIO");

        switch (scenario)
        {
        case "DebugLogBreadcrumbNotify":
            LogLowLevelMessageAndNotify();
            break;

        case "ComplexBreadcrumbNotify":
            LeaveComplexBreadcrumbAndNotify();
            break;

        case "DoubleNotify":
            NotifyTwice();
            break;

        case "MessageBreadcrumbNotify":
            LeaveMessageBreadcrumbAndNotify();
            break;

        case "Notify":
            DoNotify();
            break;

        case "LogUnthrown":
            DoLogUnthrown();
            break;

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

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

        case "UncaughtExceptionAsUnhandled":
            UncaughtExceptionAsUnhandled();
            break;

        case "LogUnthrownAsUnhandled":
            DoLogUnthrownAsUnhandled();
            break;

        case "ReportLoggedWarning":
            DoLogWarning();
            break;

        case "ReportLoggedWarningWithHandledConfig":
            DoLogWarningWithHandledConfig();
            break;

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

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

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

        case "ManualSessionMixedEvents":
            Bugsnag.StartSession();
            DoNotify();
            DoLogWarning();
            UncaughtExceptionAsUnhandled();
            break;
        }
    }
Exemplo n.º 5
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;
        }
    }