private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            FormattedListBoxItem selectedItem = listBox.SelectedItem as FormattedListBoxItem;

            if (selectedItem == null)
            {
                buttonDeleteIncident.IsEnabled = false;
                return;
            }
            buttonDeleteIncident.IsEnabled = true;
            ClearException();
            CrashIncident crashIncident = selectedItem.ReferenceObject as CrashIncident;
            CrashReport   crashReport   = CrashReport.Get(crashIncident.TopLevelCrashReportId);

            while (crashReport != null)
            {
                PrintCrashReport(crashReport);
                PrintLine("");
                if (crashReport.InnerExceptionCrashReportId == null)
                {
                    break;
                }
                crashReport = CrashReport.Get(crashReport.InnerExceptionCrashReportId.Value);
            }
        }
Exemple #2
0
        private static void ShowCrashReport(Exception exception)
        {
            var crashReport = new CrashReport(exception);

            MessageBox.Show(crashReport.Report);
            Environment.Exit(110);
        }
Exemple #3
0
        public ActionResult Statistics()
        {
            var statsModel = new CrashReport();

            statsModel.Id = (db.CrashReports).Count();
            return(View(statsModel));
        }
Exemple #4
0
        public void CrashHasExpectedDataTest()
        {
            // Crash the app
            TestHelpers.StartApp();
            TestHelpers.LogUnhandledException();
            // Restart the app
            TestHelpers.StartApp();
            CrashReport crashReport = TestHelpers.DequeueMessageType(typeof(CrashReport)) as CrashReport;

            Trace.WriteLine("crashReport.crash.name == " + crashReport.crash.name);
            Trace.WriteLine("crashReport.crash.reason == " + crashReport.crash.reason);
            Trace.WriteLine("crashReport.crash.stack_trace.Count == " + crashReport.crash.stack_trace.Count);
            Trace.WriteLine("crashReport.crash.stack_trace[0] == " + crashReport.crash.stack_trace[0]);
            Trace.WriteLine("crashReport.platform.device_id == " + crashReport.platform.device_id);
            Trace.WriteLine("crashReport.platform.device_model == " + crashReport.platform.device_model);
            Trace.WriteLine("crashReport.platform.os_name == " + crashReport.platform.os_name);
            Assert.AreEqual(crashReport.app_id, TestHelpers.VALID_APPID);
            Assert.AreEqual(crashReport.crash.name, "System.DivideByZeroException");
            Assert.AreEqual(crashReport.crash.reason, "Attempted to divide by zero.");
            // NOTE: crashReport.crash.stack_trace.Count is smaller in "Release" build.
            Assert.IsTrue(crashReport.crash.stack_trace.Count <= 3);
            Assert.IsTrue(crashReport.crash.stack_trace.Count >= 2);
            Assert.IsTrue(crashReport.crash.stack_trace[0].IndexOf("System.DivideByZeroException") >= 0);
            Assert.IsTrue(crashReport.crash.stack_trace[0].IndexOf("Attempted to divide by zero.") >= 0);
            Assert.IsNotNull(crashReport.platform.device_id);
            Assert.AreEqual(crashReport.platform.device_model, "Windows PC");
            Assert.AreEqual(crashReport.platform.os_name, Crittercism.OSName);
        }
Exemple #5
0
        public async Task <string?> UploadAsync(CrashReport crashReport)
        {
            var assembly      = Assembly.GetExecutingAssembly();
            var uploadUrlAttr = assembly.GetCustomAttributes <AssemblyMetadataAttribute>().FirstOrDefault(a => a.Key == "BUTRUploadUrl");

            if (uploadUrlAttr is null)
            {
                return(null);
            }

            var htmlReport = HtmlBuilder.Build(crashReport);
            var data       = Encoding.UTF8.GetBytes(htmlReport);

            var httpWebRequest = WebRequest.CreateHttp($"{uploadUrlAttr.Value}");

            httpWebRequest.Method        = "POST";
            httpWebRequest.ContentType   = "text/html";
            httpWebRequest.ContentLength = data.Length;
            httpWebRequest.UserAgent     = $"ButterLib CrashUploader v{assembly.GetName().Version}";

            using var requestStream = await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false);

            await requestStream.WriteAsync(data, 0, data.Length).ConfigureAwait(false);

            if (await httpWebRequest.GetResponseAsync().ConfigureAwait(false) is HttpWebResponse {
                StatusCode : HttpStatusCode.OK
            } response&& response.GetResponseStream() is { } stream)
            {
                using var responseReader = new StreamReader(stream);
                return(await responseReader.ReadLineAsync().ConfigureAwait(false));
            }

            return(null);
        }
Exemple #6
0
        private void OnStartup(object sender, StartupEventArgs ea)
        {
            CrashReport.Initialize(this);
            InitializeSettings();

            if (UserSettings == null || AlreadyEditingFile())
            {
                Shutdown();
                return;
            }

            Activated       += OnActivated;
            _spellingService = new SpellingService();
            var spellCheckProvider      = new SpellCheckProvider(_spellingService);
            var snippetManager          = new SnippetManager();
            var mainWindow              = new MainWindow(spellCheckProvider, snippetManager);
            var windowPlacementSettings = mainWindow.GetWindowPlacementSettings();

            if (windowPlacementSettings.UpgradeSettings)
            {
                windowPlacementSettings.Upgrade();
                windowPlacementSettings.UpgradeSettings = false;
                windowPlacementSettings.Save();
            }

            MainWindow = mainWindow;
            MainWindow.Show();
        }
Exemple #7
0
        public static bool Retry(Func <int, bool> action, int retries = App.RetryCount)
        {
            do
            {
                try
                {
                    if (action(retries))
                    {
                        return(true);
                    }
                }
                // 디스크 공간 부족
                catch (IOException ex) when(ex.HResult == HR_ERROR_DISK_FULL || ex.HResult == HR_ERROR_HANDLE_DISK_FULL)
                {
                    MainWindow.Instance.ShowNotEnoughDiskSpace();
                }
                catch (SocketException)
                {
                }
                catch (Exception ex)
                {
                    CrashReport.Error(ex);
                }

                Thread.Sleep(1000);
            } while (--retries > 0);

            return(false);
        }
        public static void SendEmail(CrashReport report, String attachment)
        {
            if (!Settings.CrashReportEmailEnabled)
            {
                return;
            }

            if (String.IsNullOrEmpty(Settings.CrashReportEmailAddress))
            {
                return;
            }

            var email = new MailMessage {
                Sender = new MailAddress(CreateSenderEmailAddress())
            };

            email.To.Add(Settings.CrashReportEmailAddress);
            email.Subject    = report.Title;
            email.Body       = report.Body;
            email.IsBodyHtml = true;

            if (attachment != null)
            {
                email.Attachments.Add(new Attachment(attachment));
            }

            var smtp = new SmtpClient();

            smtp.Send(email);
        }
Exemple #9
0
        public static void SaveCrashInfo(Exception exception)
        {
            CrashReport report = CrashReport.Generate(exception);

            report.TrySave();
            report.RestartToCrashReport();
        }
        private static String SaveCrashReport(CrashReport report, String action)
        {
            string _currMethod = _currTypeName + ".SaveCrashReport() ";

            String path = String.Empty;

            try
            {
                path = CreateFilePath(action);

                String directory = Path.GetDirectoryName(path);
                if (directory != null && !Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                File.WriteAllText(path, report.Body);
                return(path);
            }
            catch (Exception ex)
            {
                _logger.Error(_currMethod + ex.Message + " path={0}".Args(path));
                _logger.Error(_currMethod + "crashreport.exception={0}".Args(report.Exception));
                _logger.Error(_currMethod + "crashreport.body={0}".Args(report.Body));
            }
            return(null);
        }
Exemple #11
0
        private static void SetReportData(CrashReport report, long duplicateId)
        {
            report.DuplicateOfId = duplicateId;

            if (report.State != ReportState.Closed)
            {
                report.State = ReportState.Duplicate;
            }

            var automaticText = GetAutomaticText(duplicateId);

            if (report.Description == null)
            {
                report.Description = automaticText;
            }
            else if (!report.Description.Contains(automaticText))
            {
                if (string.IsNullOrWhiteSpace(report.Description))
                {
                    report.Description += automaticText;
                }
                else
                {
                    report.Description += "\n" + automaticText;
                }
            }

            // Edited by system
            report.DescriptionLastEditedById = null;
            report.DescriptionLastEdited     = DateTime.UtcNow;

            report.BumpUpdatedAt();
        }
 private void PrintCrashReport(CrashReport crashReport)
 {
     PrintLine("Exception: " + crashReport.ExceptionName);
     PrintLine("Message: " + crashReport.ExceptionMessage);
     PrintLine("StackTrace:");
     PrintLine(crashReport.StackTrace, new Thickness(10, 0, 10, 0));
 }
 public CrashData(CrashReport report)
 {
     m_time       = report.time.ToString(TIME_FORMAT);
     m_summary    = report.text.Split(new [] { NL }, StringSplitOptions.None).FirstOrDefault();
     m_text       = report.text;
     m_listText   = $"{m_time}: {m_summary}";
     m_detailText = $"{m_time}{NL} {NL}{m_text}";
 }
        public void NotifyAboutNewCrashReport(CrashReport report, Uri baseUrl)
        {
            var infoUrl = CrashReportUrl(baseUrl, report.Id);

            jobClient.Enqueue <SendDiscordWebhookMessageJob>(x => x.Execute("CrashReportNotification",
                                                                            $"New crash report (id: {report.Id}) created for {report.StoreOrVersion} on {report.Platform} {infoUrl}",
                                                                            CancellationToken.None));
        }
Exemple #15
0
    //we should send error info to server and save to local file system.
    public void report()
    {
        // tell user to send to the server

        // save to local file system
        // and use Thread-Pool
        AsyncTask.RunAsync(() => CrashReport.getReport(Message.ToString()).record(Core.DPM));
    }
Exemple #16
0
    static int Remove(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        CrashReport obj = LuaScriptMgr.GetNetObject <CrashReport>(L, 1);

        obj.Remove();
        return(0);
    }
Exemple #17
0
        public void RecoverDocuments()
        {
            MainWindow window = MainWindow.CreateWithDocuments(CrashReport.RecoverDocuments());

            Application.Current.MainWindow = window;
            window.Show();
            hasRecoveredDocuments = false;
        }
        public void NotifyCrashReportStateChanged(CrashReport report, Uri baseUrl)
        {
            var infoUrl = CrashReportUrl(baseUrl, report.Id);

            jobClient.Enqueue <SendDiscordWebhookMessageJob>(x => x.Execute("CrashReportNotification",
                                                                            $"Crash report {report.Id} is now in state {report.State} {infoUrl}",
                                                                            CancellationToken.None));
        }
Exemple #19
0
        public ActionResult DeleteConfirmed(int id)
        {
            CrashReport crashReport = db.CrashReports.Find(id);

            db.CrashReports.Remove(crashReport);
            db.SaveChanges();
            this.AddToastMessage("Success.", "You have successfully deleted this entry!", ToastType.Success);
            return(RedirectToAction("Index"));
        }
            public CrashData(CrashReport report)
            {
                var text = report.text;

                Time       = report.time.ToString(TIME_FORMAT);
                Summary    = text.Split(new[] { NL }, StringSplitOptions.None).FirstOrDefault();
                ListText   = $"{Time}: {Summary}";
                DetailText = $"{Time}{NL} {NL}{text}";
            }
Exemple #21
0
    public static CrashReport getReport(string error)
    {
        CrashReport report = new CrashReport();

        report.errorInfo = error;
        //collect information
        //.. to do ...
        return(report);
    }
Exemple #22
0
        private static void UnhandledException(object sender, Eto.UnhandledExceptionEventArgs e)
        {
            var info = new CrashReport(mainForm.extensionManager, e.ExceptionObject as Exception);

            crashReporter.Report(info);

            ExceptionQuit = true;
            Process.Start(Assembly.GetEntryAssembly().Location);
            Environment.Exit(-1);
        }
        private void ProcessException(Exception e)
        {
            Window main = null;

            if (Application.Current != null && Application.Current.MainWindow != null)
            {
                main = Application.Current.MainWindow;
            }
            CrashReport.ShowBox(e, main, "Multi Comm Dashboards");
            Application.Current.Shutdown();
        }
Exemple #24
0
        public CrashReportViewModel(CrashReport report)
        {
            SetIsDebug();

            CrashReport   = report;
            ReportText    = report.ReportText;
            DocumentCount = report.GetDocumentCount();
            OpenSendCrashReportCommand = new(() => new SendCrashReportWindow(CrashReport).Show());
            RecoverDocumentsCommand    = new(RecoverDocuments, () => hasRecoveredDocuments, false);
            AttachDebuggerCommand      = new(AttachDebugger);
        }
Exemple #25
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description,Created,Creator,ProductName,Os,CrsdhDetails,Status")] CrashReport crashReport)
 {
     if (ModelState.IsValid)
     {
         db.Entry(crashReport).State = EntityState.Modified;
         db.SaveChanges();
         this.AddToastMessage("Congratulations", "You have successfully edited crash Report!", ToastType.Success);
         return(RedirectToAction("Index"));
     }
     this.AddToastMessage("Warning!", "You must enter all field correctly!", ToastType.Error);
     return(View(crashReport));
 }
Exemple #26
0
        public MainWindow()
        {
            Instance = this;

            this.InitializeComponent();

            CrashReport.Init();
            this.DataContext     = ConfigManager.Instance;
            this.TaskbarItemInfo = new TaskbarItemInfo();

            this.m_dragDropAdorner = new DragDropAdorner(this.ctlTab, (Brush)this.FindResource("AccentColorBrush3"));
        }
Exemple #27
0
        protected override void OnLoad(EventArgs e)
        {
            // This is the base page from which my custom error pages inherit. If an unhandled exception occurs here then
            // my custom error page is not displayed to the user. Instead, the user sees the default ASP.NET Server Error
            // page (the "Yellow Screen of Death"). In effect, if an unhandled exception occurs in the error page, then all
            // my custom error handling is overridden, and the original exception details are lost.

            // throw new DemoException("What happens to an unhandled exception in the custom error page?");

            base.OnLoad(e);

            _httpStatusCode     = 500;         //Int32.Parse(StatusCode.Value);
            Response.StatusCode = _httpStatusCode;
            if (!IsPostBack)
            {
                Form.Action = Request.Url.PathAndQuery;

                if (_model.HttpStatusCode == 404)
                {
                    _model.CrashReportTitle = "Page Not Found";
                    _model.CrashReportBody  = String.Empty;

                    _model.ReportTitle = "Page Not Found";
                    _model.ReportBody  = String.Empty;
                }
                else
                {
                    _model.ReportTitle = "Unhandled Exception";
                    _model.ReportBody  = String.Empty;

                    var report = HttpContext.Current.Cache[AppErrorModule.Settings.Names.CrashReportKey] as CrashReport;
                    if (report == null)
                    {
                        Exception ex = HttpContext.Current.Server.GetLastError() ?? new HttpUnhandledException("Server Error");
                        report = new CrashReport(ex);
                    }

                    _model.CrashReportTitle = report.Title;
                    _model.CrashReportBody  = report.Body;
                    _model.ReportTitle      = report.Title;
                    _model.ReportBody       = report.Body;
                    _model.NextSteps.EnableTechnicalInformation = true;
                }

                _model.BrokenUrl = GetBrokenUrl();
            }
            else
            {
                // If this is a postback then we're OK -- the user is submitting a quick question from the error page.
                Response.StatusCode = 200;
            }
        }
 private static void ManageImageManager(ImageManager im)
 {
     try {
         UIConsole.Debug($"Processing folder {im.Folder}");
         im.RunningSingleThread = true;
         im.SingleThreadRun();
         Thread.Sleep(200);
     } catch (Exception e) {
         UIConsole.Error($"Error processing image manager single thread: {e}");
         CrashReport.Report(e);
         throw;
     }
 }
Exemple #29
0
        public async Task <HttpResponseMessage> Post([FromBody] CrashReport report)
        {
            var ip = WebApiApplication.GetClientIp();

            if (!RequestProtection.AddRequest(ip, RequestType.CrashReport))
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden, "Usage limit exceeded"));
            }

            var issueId = await GitHubReporter.CreateIssue(ip, report);

            return(MailReporter.SendMail(ip, report, issueId) ? Request.CreateResponse(HttpStatusCode.OK, "Success") : Request.CreateResponse(HttpStatusCode.InternalServerError, "Error sending message"));
        }
        public async Task <IActionResult> CreateCrashReport([FromBody] CrashReport request)
        {
            Logger.LogInformation("Receiving crash report (standard logger)");

            Exception exception;
            int       statusCode;

            try
            {
                var s3BucketName   = Configuration.GetValue <string>("S3BucketName");
                var s3BucketRegion = Configuration.GetValue <string>("S3BucketRegion");

                var client = new AmazonS3Client(RegionEndpoint.GetBySystemName(s3BucketRegion));

                // Ensure that each crash report has an ID
                request.CrashReportId ??= Guid.NewGuid().ToString();
                request.Source ??= "CrashReport";
                request.Timestamp ??= DateTimeOffset.UtcNow;
                var filename = $"{request.Source}-{request.Timestamp.Value.ToFileTime()}-{request.CrashReportId}.json";

                var s3Request = new PutObjectRequest
                {
                    BucketName  = s3BucketName,
                    Key         = $"crash-reports/{filename}",
                    ContentType = "application/json",
                    ContentBody = JsonConvert.SerializeObject(request),
                };
                var s3Response = await client.PutObjectAsync(s3Request);

                Logger.LogInformation($"Crash report created: {request.CrashReportId}");

                return(Accepted(request));
            }
            catch (AmazonS3Exception e)
            {
                exception  = e;
                statusCode = (int)e.StatusCode;
            }
            catch (Exception e)
            {
                exception  = e;
                statusCode = 500;
            }

            Logger.LogException(exception, $"{exception.GetType().Name} occurred during S3 upload");
            Logger.LogError(exception.Message);
            Logger.LogError(exception.StackTrace);

            return(StatusCode(statusCode, new { message = exception.Message }));
        }
Exemple #31
0
        internal CrashReportView(CrashReport report, DownloaderWorker worker)
        {
            _report = report;
            _worker = worker;
            InitializeComponent();

            lblBuildType.Text = report.BuildType;
            lblGuid.Text = report.Guid.ToString();
            lblVersion.Text = report.Version.ToString(3);
            lblDate.Text = report.Timestamp.ToString("d MMM yy");

            if (report.StackTrace != null)
            {
                lblExceptionGuess.Text = GuessStack(_report.StackTrace);
                lblExceptionGuess.Visible = true;
            }
            report.ProgressChanged += (s, e) => OnProgressChanged(_report.Progress);
            OnProgressChanged(_report.Progress);
        }
Exemple #32
0
 public static void Report(string PROGRAM, string username, string password, string data, Exception ex,AssemblaTicketWindow.LoginSucceedDel success,bool pause,string desc)
 {
     CrashReport cr = new CrashReport(PROGRAM, username, password, ex,data,desc);
     if (success!=null)
         cr.TicketSucceed+=new AssemblaTicketWindow.LoginSucceedDel(success);
     if (pause)
         cr.ShowDialog();
     else
         cr.Show();
 }