示例#1
0
        private static async void HandleUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
        {
            IOException ioex;
            Exception   ex;

            ErrorReport   report;
            StringBuilder sb;

            //
            ioex = e.Exception as IOException;
            ex   = e.Exception as Exception;
            if (ioex != null)
            {
                report = new ErrorReport("Unhandled Native Exception", ioex);
            }
            else if (ex != null)
            {
                report = new ErrorReport("Unhandled Managed Exception", ex);
            }
            else
            {
                report = new ErrorReport("Unhandled Unrecognised Exception", e.ToString());
            }
            // Make a record of the state of the data when the error occurred.
            sb = new StringBuilder();
            sb.AppendLine("LoGTrace at Crash:");
            sb.AppendLine();
            sb.AppendLine(AppContext.AppContext.LogDetails.ToString());
            // sb.AppendLine("Case Data:");
            //sb.AppendLine(AppData.ViewModel.CaseDataJson);
            //sb.AppendLine();
            //sb.AppendLine("Case List:");
            //sb.AppendLine(AppData.ViewModel.CaseList.ToJson());
            //sb.AppendLine();
            //sb.AppendLine("Case Mappings:");
            //sb.AppendLine(AppData.ViewModel.CaseMappings.ToJson());
            report.AddFurtherInfo(sb.ToString());
            Task task = new Task(delegate { writingfile(report); });

            task.Start();
            task.Wait(1000);
        }
示例#2
0
 /// <summary>
 /// Occures when the application encounters an unhandled exception. The applicatoin is unloaded and all resources released
 /// </summary>
 /// <param name="sender">The source that caused the exception</param>
 /// <param name="e">The exception object entry</param>
 private void Application_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     RobotController.SetRobotStatus(RobotStatus.Exception);
     NetworkUtils.LogNetwork(e.ToString(), MessageType.Exception);
     Current.Exit();
 }
示例#3
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     throw new Exception("UNHANDLED: " + e.ToString());
 }
示例#4
0
 private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     Analytics.TrackEvent("Unhandled Exception", new Dictionary <string, string> {
         { "Type", e.GetType().ToString() }, { "Message", e.Message }, { "Stack Trace", e.ToString() }
     });
 }
示例#5
0
 private async void App_UnhandledExceptionAsync(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     await new Windows.UI.Popups.MessageDialog(e.ToString(), "UnhandledException").ShowAsync();
 }