當前位置: 首頁>>代碼示例>>C#>>正文


C# System.UnhandledExceptionEventArgs類代碼示例

本文整理匯總了C#中System.UnhandledExceptionEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# UnhandledExceptionEventArgs類的具體用法?C# UnhandledExceptionEventArgs怎麽用?C# UnhandledExceptionEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnhandledExceptionEventArgs類屬於System命名空間,在下文中一共展示了UnhandledExceptionEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CurrentDomain_UnhandledException

 private static void CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e)
 {
     if (e != null && e.ExceptionObject != null)
     {
         log.Error("Error: " + e.ExceptionObject);
     }
 }
開發者ID:knarf7112,項目名稱:SocketServer,代碼行數:7,代碼來源:Program.cs

示例2: Application_UnhandledException

 private static void Application_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject != null) {
         Exception ex = (Exception)e.ExceptionObject;
         MessageBox.Show(ex.Message, "Application exception");
     }
 }
開發者ID:hacksur,項目名稱:GcodeSender,代碼行數:7,代碼來源:Form1.cs

示例3: CurrentDomain_UnhandledException

        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception error = e.ExceptionObject as Exception;

            string errorMessage = string.Format("An unhandled exception occurred: {0}", error);
            MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
        }
開發者ID:gest01,項目名稱:BetterStorageExplorer,代碼行數:7,代碼來源:App.xaml.cs

示例4: CurrentDomain_UnhandledException

 void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (m_Log != null)
     {
         m_Log.Error("The process crashed for an unhandled exception!", (Exception)e.ExceptionObject);
     }
 }
開發者ID:iraychen,項目名稱:SuperSocket,代碼行數:7,代碼來源:ManagedAppAgent.cs

示例5: CurrentDomain_UnhandledException

        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Tracer.Fatal(e.ExceptionObject);

            try
            {
                string timeStamp = GetTimeStamp();
                string fileName = String.Format("Crash {0}.log", timeStamp);

                string root = GetRoot();
                string filePath = Combine(root, fileName);

                using (StreamWriter writer = new StreamWriter(filePath))
                {
                    Version version = Assembly.GetEntryAssembly().GetName().Version;

                    writer.WriteLine("Crash Report");
                    writer.WriteLine("===================");
                    writer.WriteLine();
                    writer.WriteLine("Version {0}.{1}, Build {2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
                    writer.WriteLine("Operating System: {0}", Environment.OSVersion);
                    writer.WriteLine(".NET Framework: {0}", Environment.Version);
                    writer.WriteLine("Time: {0}", DateTime.Now);
                    writer.WriteLine();
                    writer.WriteLine("Trace Message:");
                    writer.WriteLine(e.ExceptionObject);
                    writer.WriteLine();
                }
            }
            catch { } //Swallow it.
        }
開發者ID:jeffboulanger,項目名稱:connectuo,代碼行數:31,代碼來源:UnhandledExceptionListener.cs

示例6: CurrentDomain_UnhandledException

 /// <summary>
 /// Handles unhandled exceptions within the application.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The event arguments.</param>
 public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         Exception ex = e.ExceptionObject as Exception;
         DialogResult result = MessageBox.Show(Strings_General.BugReportRequest, "Doh!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
         if (result == DialogResult.Yes)
         {
             ErrorLog log = new ErrorLog(ex);
             XmlSerializer serializer = new XmlSerializer(typeof(ErrorLog));
             using (TextWriter writer = new StringWriter())
             {
                 serializer.Serialize(writer, log);
                 PostErrorLog(writer.ToString());
             }
         }
     }
     catch (Exception)
     {
     }
     finally
     {
         Environment.Exit(1);
     }
 }
開發者ID:rastating,項目名稱:yaircc,代碼行數:30,代碼來源:Program.cs

示例7: CurrentDomain_UnhandledException

 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     var ex = (Exception)e.ExceptionObject;
     var message = ex.Message + Environment.NewLine + ex.Source + Environment.NewLine + ex.StackTrace
                   + Environment.NewLine + ex.InnerException;
     new Error().Add(message);
 }
開發者ID:Alchemy86,項目名稱:GD_BackOrders,代碼行數:7,代碼來源:Program.cs

示例8: CurrentDomain_UnhandledException

        public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                Exception ex = (Exception)e.ExceptionObject;
                string errorMsg = "Alkalmazás hiba, kérem indítsa újra az alkalmazást vagy forduljon a Support-hoz " +
                    "a következő adatokkal:\n\n";

                // Since we can't prevent the app from terminating, log this to the event log.
                DEFS.ExLog(errorMsg + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace);
                MessageBox.Show(errorMsg, "E-Cafe rendszer", MessageBoxButtons.AbortRetryIgnore,
                                MessageBoxIcon.Stop);
            }
            catch (Exception exc)
            {
                try
                {
                    MessageBox.Show("Fatal Non-UI Error",
                        "Fatal Non-UI Error. Could not write the error to the event log. Reason: "
                        + exc.Message, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }
        }
開發者ID:hayrettinbebek,項目名稱:e-cafe,代碼行數:27,代碼來源:Program.cs

示例9: CurrentDomain_UnhandledException

 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Log.LogError("CurrentDomain_UnhandledException");
     Log.LogError(e.ExceptionObject.ToString());
     MessageBox.Show("A fatal error has occurred and the application must shut down", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     Application.Exit();
 }
開發者ID:PosauneMaster,項目名稱:RecipeMaster_v3,代碼行數:7,代碼來源:Program.cs

示例10: CurrentDomain_UnhandledException

 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject is Exception)
         HandleException(e.ExceptionObject as Exception);
     else
         HandleException(null);
 }
開發者ID:Zorro666,項目名稱:renderdoc,代碼行數:7,代碼來源:AppMain.cs

示例11: OnUnhandledException

        void OnUnhandledException(object o, UnhandledExceptionEventArgs e) {
            // Let this occur one time for each AppDomain.
            if (Interlocked.Exchange(ref _unhandledExceptionCount, 1) != 0)
                return;

            StringBuilder message = new StringBuilder("\r\n\r\nUnhandledException logged by UnhandledExceptionModule.dll:\r\n\r\nappId=");

            string appId = (string) AppDomain.CurrentDomain.GetData(".appId");
            if (appId != null) {
                message.Append(appId);
            }
            

            Exception currentException = null;
            for (currentException = (Exception)e.ExceptionObject; currentException != null; currentException = currentException.InnerException) {
                message.AppendFormat("\r\n\r\ntype={0}\r\n\r\nmessage={1}\r\n\r\nstack=\r\n{2}\r\n\r\n",
                                     currentException.GetType().FullName, 
                                     currentException.Message,
                                     currentException.StackTrace);
            }           

            EventLog Log = new EventLog();
            Log.Source = _sourceName;
            Log.WriteEntry(message.ToString(), EventLogEntryType.Error);
        }
開發者ID:dblock,項目名稱:sncore,代碼行數:25,代碼來源:UnhandledExceptionModule.cs

示例12: CurrentDomainOnUnhandledException

 /// <summary>
 /// Handles the UnhandledException event of the CurrentDomain control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.UnhandledExceptionEventArgs"/> instance containing the event data.</param>
 private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (!e.IsTerminating)
     {
         Logger.Current.Error("Unhandled exception", e.ExceptionObject as Exception);
     }
 }
開發者ID:WrongDog,項目名稱:Sequence,代碼行數:12,代碼來源:Program.cs

示例13: CurrentDomainOnUnhandledException

		private static void CurrentDomainOnUnhandledException(object sender,
			UnhandledExceptionEventArgs unhandledExceptionEventArgs)
		{
			var newExc = new Exception("CurrentDomainOnUnhandledException",
				unhandledExceptionEventArgs.ExceptionObject as Exception);
			LogUnhandledException(newExc);
		}  
開發者ID:P3PPP,項目名稱:XFAedSearch,代碼行數:7,代碼來源:MainActivity.cs

示例14: UncaughtThreadException

		private void UncaughtThreadException(object sender, UnhandledExceptionEventArgs e)
		{
			if(_isUncaughtUiThreadException)
				return;
			var exception = e.ExceptionObject as Exception;
			_logger.Fatal(exception);
		}
開發者ID:alphapapa,項目名稱:DayZCommander,代碼行數:7,代碼來源:App.xaml.cs

示例15: globalException

 static void globalException(object sender, UnhandledExceptionEventArgs args)
 {
     Exception e = (Exception)args.ExceptionObject;
     Console.WriteLine("UnhandledException:\n\n" + e);
     MessageBox.Show("UnhandledException:\n\n" + e, "Updater Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     Environment.Exit(0);
 }
開發者ID:PinEvil,項目名稱:MCForge-Vanilla,代碼行數:7,代碼來源:Program.cs


注:本文中的System.UnhandledExceptionEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。