private void TrackUnhandledExceptions() { var reporter = new ExceptionReporter(); reporter.Config.AppName = ToolkitConstants.ToolkitName; reporter.Config.AppVersion = ToolkitConstants.Version; reporter.Config.CompanyName = "Particular Software"; reporter.Config.ContactEmail = "*****@*****.**"; reporter.Config.EmailReportAddress = "*****@*****.**"; reporter.Config.WebUrl = "http://particular.net"; reporter.Config.TitleText = "ServiceMatrix - Unexpected error"; reporter.Config.ShowFullDetail = false; reporter.Config.ShowLessMoreDetailButton = true; reporter.Config.ContactMessageTop = "[ServiceMatrix] Exception Report"; var type = typeof(TraceSourceExtensions); var field = type.GetField("ShowExceptionAction", BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { field.SetValue(null, new Action <string, Exception>((s, e) => { #if DEBUG if (Debugger.IsAttached) { Debugger.Break(); return; } #endif var customMessage = ""; if (File.Exists(StatisticsManager.LoggingFile)) { using (var fileStream = new FileStream(StatisticsManager.LoggingFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var textReader = new StreamReader(fileStream)) { customMessage = textReader.ReadToEnd(); } } if (!(e is ElementAlreadyExistsException)) { if (string.IsNullOrEmpty(customMessage)) { reporter.Show(e); } else { reporter.Show(e.Message + Environment.NewLine + Environment.NewLine + "Additional Log:" + Environment.NewLine + customMessage, e); } } })); } }
public void ApplicationThreadException(object sender, ThreadExceptionEventArgs e) { reporter.Show(e.Exception); if (!string.IsNullOrEmpty(reporter.Config.WebReportUrl)) { if (CheckForInternetConnection()) { reporter.Send(SharkErrorReporter.Core.ExceptionReportInfo.SendMethod.WebPage, e.Exception); } } }
private static void HandleException(Exception e) { if (CurrentProject != null) { if (!Directory.Exists("recovery")) { Directory.CreateDirectory("recovery"); } string filePath = "recovery/" + (CurrentProject.Name ?? "project.tlpx"); using (FileStream fstr = File.OpenWrite(filePath)) { CurrentProject.Save(fstr, new FileProjectResolver(filePath)); } } ExceptionReporter reporter = new ExceptionReporter(); reporter.Config.ShowSysInfoTab = false; reporter.Config.ShowConfigTab = false; reporter.Config.EmailReportAddress = "*****@*****.**"; reporter.Config.TitleText = "Treefrog Crash"; reporter.Config.UserExplanationLabel = "Enter a brief description leading up to the crash. Your project has been saved to /recovery."; reporter.Show(e); Application.Exit(); }
protected override void OnNavigate(string obj) { base.OnNavigate(obj); try { _warehouseInventoryViewModel.Refresh(_cacheService.GetWarehouses().First().Id); } catch (Exception e) { var exceptionMessage = new StringBuilder(Resources.InventoryCalculationError); var requiredRecipes = _inventoryService.GetRequiredRecipesForSales().ToList(); if (requiredRecipes.Any()) { exceptionMessage.AppendLine(" "); foreach (var requiredRecipe in requiredRecipes) { exceptionMessage.AppendLine(requiredRecipe); } } var list = new List <Exception> { new Exception(exceptionMessage.ToString()), e }; ExceptionReporter.Show(list.ToArray()); } }
public static void ManualLocalizationTest(string languageTag) { var thread = new Thread(() => { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfoByIetfLanguageTag(languageTag); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfoByIetfLanguageTag(languageTag); var er = new ExceptionReporter { Config = { // test that this style of initialization (settings properties directly on config) remains possible //TitleText = "=_=", AppName = "PhotoFuzz", AppVersion = "1.0", CompanyName = "photofuzz", SendMethod = ReportSendMethod.SimpleMAPI, EmailReportAddress = "*****@*****.**", //RegionInfo = "Region", //ShowButtonIcons = true, ShowLessDetailButton = true, TakeScreenshot = true, ReportTemplateFormat = TemplateFormat.Markdown, ReportCustomTemplate = "Done!", AttachmentFilename = $"{DateTime.UtcNow.ToString("dd-MM-yy_HH-mm")}_report", FilesToAttach = new[] { "app.log" } } }; var ex = new Exception("Test Exception"); er.Show(ex); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); }
// Creates the error message and displays it. internal static void ReportException(Exception ex) { var emailPassword = Environment.GetEnvironmentVariable("spytify_email_support_password", EnvironmentVariableTarget.Machine); ExceptionReporter er = new ExceptionReporter() { Config = { AppName = Application.ProductName, CompanyName = Application.CompanyName, TitleText = "Error Report", TakeScreenshot = true, SendMethod = ReportSendMethod.SMTP, SmtpServer = "smtp.gmail.com", SmtpUseDefaultCredentials = false, SmtpPort = 587, TopMost = true, ShowFlatButtons = true, ShowLessDetailButton = true, SmtpUseSsl = true, ReportTemplateFormat = TemplateFormat.Markdown, EmailReportAddress = "*****@*****.**", SmtpFromAddress = "*****@*****.**", SmtpUsername = "******", SmtpPassword = emailPassword, }, }; er.Show(ex); }
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { ExceptionReporter er = new ExceptionReporter(); er.Config.ShowButtonIcons = true; er.Show(e.Exception); }
static void ThrowAndShowExceptionReporter(bool detailView = false) { try { SomeMethodThatThrows(); } catch (Exception exception) { var er = new ExceptionReporter { Config = { SendMethod = ReportSendMethod.SimpleMAPI, EmailReportAddress = "*****@*****.**", CompanyName = "Acme", // this goes alongside email button text TitleText = "Acme Error Report", // er.Config.ShowFullDetail = false; ShowLessDetailButton = true, ReportTemplateFormat = TemplateFormat.Text, EmailReportSubject = "サブジェクト" } }; // er.Config.ShowEmailButton = false; // just for testing that removing email button works er.Config.ReportTemplateFormat = TemplateFormat.Text; er.Show(exception); } }
private void commandLink7_Click(object sender, EventArgs e) { try { var exception = new IOException( "Unable to establish a connection with the Foo bank account service. The error number is #FFF474678.", new Exception( "This is an Inner Exception message - with a message that is not too small but perhaps it should be smaller")); throw exception; } catch (Exception exception) { var exceptionReporter = new ExceptionReporter(); exceptionReporter.Config.ShowConfigTab = false; exceptionReporter.Config.ShowAssembliesTab = false; exceptionReporter.Config.MailMethod = ExceptionReportInfo.EmailMethod.SimpleMAPI; exceptionReporter.Config.EmailReportAddress = "*****@*****.**"; exceptionReporter.Config.ShowSysInfoTab = false; exceptionReporter.Config.ShowExceptionsTab = false; exceptionReporter.Show(exception); } }
public void DomainUnhandledException(object sender, UnhandledExceptionEventArgs e) { ExceptionReporter reporter = new ExceptionReporter(); reporter.Show((Exception)e.ExceptionObject); // reporter.Send((Exception)e.ExceptionObject); // send these silently (ie without showing dialog) }
public static void ShowError(Exception ex) { //TODO: add a better error manager //MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); ExceptionReporter er = new ExceptionReporter(); Exception[] exceptions = new Exception[] { ex }; er.Show(exceptions); }
public bool Can_Prevent_Showing_If_Null_Exception(params Exception[] exceptions) { var er = new ExceptionReporter { ViewMaker = new Mock <IViewMaker>().Object }; return(er.Show(exceptions)); }
public void Can_Not_Show_If_No_Exception() { var er = new ExceptionReporter { ViewMaker = new Mock <IViewMaker>().Object }; Assert.That(er.Show(), Is.False); }
private static void HandleException(Exception ex) { if (ex == null) { return; } ExceptionReporter.Show(ex); Environment.Exit(1); }
private void HandleException(Exception ex) { if (ex == null) { return; } ExceptionReporter.Show(new Exception[] { ex }); Environment.Exit(1); }
private static void Dispatcher_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { var reporter = new ExceptionReporter(); reporter.Config.EmailReportAddress = "*****@*****.**"; reporter.Config.ShowButtonIcons = false; reporter.Show(e.Exception); Environment.Exit(1); }
private static void HandleException(Exception ex) { if (ex == null) { return; } ExceptionPolicy.HandleException(ex, "Policy"); //MessageBox.Show(Localization.Properties.Resources.UnhandledExceptionErrorMessage, Localization.Properties.Resources.Warning); ExceptionReporter.Show(ex); Environment.Exit(1); }
private static void UnhandledException(object sender, UnhandledExceptionEventArgs e) { log.Fatal("Unhandled exception to toplevel.", (Exception)e.ExceptionObject); FlushLogBuffers(); Properties.Settings.Default.Crashed = true; Properties.Settings.Default.Save(); ExceptionReporter reporter = new ExceptionReporter(); reporter.Show((Exception)e.ExceptionObject); }
private static void ThreadException(object sender, ThreadExceptionEventArgs e) { log.Fatal("Unhandled thread exception.", e.Exception); FlushLogBuffers(); Properties.Settings.Default.Crashed = true; Properties.Settings.Default.Save(); ExceptionReporter reporter = new ExceptionReporter(); reporter.Show(e.Exception); }
/// <summary> /// Handles the provided exception by showing it to the end-user /// </summary> /// <param name="ex"> /// The exception that is being handled /// </param> private static void HandleException(Exception ex) { logger.Error(ex); var thread = new Thread(() => { var exceptionReporter = new ExceptionReporter(); exceptionReporter.Show(ex); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
public void Can_Show() { var viewMock = new Mock <IViewMaker>(); viewMock.Setup(v => v.Create()).Returns(new Mock <IExceptionReportView>().Object); var er = new ExceptionReporter { ViewMaker = viewMock.Object }; Assert.That(er.Show(new TestException()), Is.True); }
public static void LaunchExceptionReporter(Exception e) { ExceptionReporter reporter = new ExceptionReporter(); reporter.Config.AppAssembly = System.Reflection.Assembly.GetCallingAssembly(); reporter.Config.AppName = AppInfo.AssemblyInfo.Name; reporter.Config.AppVersion = AppInfo.AssemblyInfo.VersionString; reporter.Config.TitleText = "NoPeekCloud Exception Report"; reporter.Config.EmailReportAddress = "*****@*****.**"; //reporter.Config.FilesToAttach = new[] { LogHandler.LogFileName(LogFile.Exception), LogHandler.LogFileName(LogFile.Debug) }; reporter.Config.ShowConfigTab = false; reporter.Show(e); }
/// <summary> /// Method yang mengubah exception default menjadi ExceptionReporter /// </summary> /// <param name="e">Exception EventArgs</param> public static void ReportCrash(object sender, ThreadExceptionEventArgs e) { var reporter = new ExceptionReporter(); reporter.Config.ShowLessDetailButton = true; var productName = Application.ProductName; var productVersion = Application.ProductVersion; // Title form ExceptionReporter reporter.Config.TitleText = $"{productName} {productVersion} Exception Report"; reporter.Show(e.Exception); }
/// <summary> /// Handles the provided exception by showing it to the end-user /// </summary> /// <param name="ex">The exception that is being handled</param> private static void HandleException(Exception ex) { if (ex == null) { return; } logger.Error(ex); var exceptionReporter = new ExceptionReporter(); exceptionReporter.Show(ex); Environment.Exit(1); }
/// <summary> /// This is a demonstration of using a custom dialog/view - which implements IExceptionReportView /// And how the IViewReportMaker interface is used to set the custom view as the one to be instantiated /// </summary> void UseCustomReportView() { try { SomeMethodThatThrows(); } catch (Exception exception) { var er = new ExceptionReporter { ViewMaker = new YourCustomViewMaker() }; ConfigureWebService(er.Config); er.Show(exception); } }
public void Can_Init_Config_Using_Object_Initializer() { var er = new ExceptionReporter { Config = { // test that this style of initialization (settings properties directly on config) remains possible AppName = "PhotoFuzz", AppVersion = "1.0", CompanyName = "photofuzz", SendMethod = ReportSendMethod.WebService, WebServiceUrl = "http://photofuzz/apiv1", FilesToAttach = new[] { "app.log" } } }; er.Show(); }
static void CatchUnhandledException(object sender, Exception e, string message, bool showExceptionReporter = true) { try { LoaderForm?.TryClose(); } catch (Exception ex) { Logger.LogWarn(ex, message, sender); } if (e is LicenseException) { Logger.LogWarn(e); return; } Logger.LogError(e); if (!showExceptionReporter || DisableExceptionReporter || ExceptionReporter == null || !Application.MessageLoop) { return; } #if DEBUG if (Debugger.IsAttached) { Debugger.Break(); } #endif try { TakeScreenshot(ExceptionReporter); if (!SaveErrorReportToFile($"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}report_{DateTime.Now.ToString("dd_MM_yyyy")}_{Guid.NewGuid()}.txt", ExceptionReporter.Config)) { SaveErrorReportToFile(Path.GetTempFileName(), ExceptionReporter.Config); } ExceptionReporter.Show(e); } catch (Exception exception) { Logger.LogError(exception); } }
static void ThrowAndShowExceptionReporter(bool detailView = false) { try { SomeMethodThatThrows(); } catch (Exception exception) { var exceptionReporter = new ExceptionReporter(); if (detailView) { exceptionReporter.Config.ShowFullDetail = false; exceptionReporter.Config.ShowLessMoreDetailButton = true; // exceptionReporter.Config.ShowEmailButton = false; // just for testing that removing email button works well positioning etc } exceptionReporter.Show(exception); } }
public static void ReportException(Exception ex, string strMessage = null) { Log.Instance.Fatal(ex, strMessage == null ? $"{new StackTrace(ex).GetFrame(0).GetMethod().Name} has thrown: " : strMessage.Trim()); ExceptionReporter reporter = new ExceptionReporter(); reporter.Config.AppName = "Elucidate"; reporter.Config.CompanyName = "Elucidate"; reporter.Config.TitleText = "Elucidate Error Report"; reporter.Config.ShowEmailButton = false; reporter.Config.ShowSysInfoTab = true; // all tabs are shown by default reporter.Config.ShowFlatButtons = true; // this particular config is code-only reporter.Config.TakeScreenshot = false; // attached if sending email reporter.Show(ex); }
private void button4_Click(object sender, EventArgs e) { if (lvwBlackList.Items.Count > 0) // && lstMembers2.Columns[0].ToString != "none") { Stream tstream; saveFileDialog1.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; saveFileDialog1.FilterIndex = 1; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { try { if ((tstream = saveFileDialog1.OpenFile()) != null) { StreamWriter SW = new StreamWriter(tstream); string parcelname = client.Network.CurrentSim.ToString() + "/" + txtParcelname.Text.Replace(",", " "); SW.WriteLine("Land: " + parcelname + ",List Type: Blacklist,Ttl avatars: " + lvwBlackList.Items.Count.ToString(CultureInfo.CurrentCulture)); SW.WriteLine(",,"); SW.WriteLine("Name,UUID,"); for (int i = 0; i < lvwBlackList.Items.Count; i++) { ParcelManager.ParcelAccessEntry person = (ParcelManager.ParcelAccessEntry)lvwBlackList.Items[i].Tag; string personame = lvwBlackList.Items[i].Text; string line = personame + "," + person.AgentID.ToString() + ","; SW.WriteLine(line); } SW.Close(); } } catch (Exception ex) { //MessageBox.Show(ex.Message); reporter.Show(ex); } } } }