当前位置: 首页>>代码示例>>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;未经允许,请勿转载。