• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.UnhandledExceptionEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.UnhandledExceptionEventArgs的典型用法代码示例。如果您正苦于以下问题:C# UnhandledExceptionEventArgs类的具体用法?C# UnhandledExceptionEventArgs怎么用?C# UnhandledExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnhandledExceptionEventArgs类属于System命名空间,在下文中一共展示了UnhandledExceptionEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: CurrentDomain_UnhandledException

 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     FormError error = new FormError();
     error.Exception = e.ExceptionObject as Exception;
     error.Text = "Unexpected exception";
     error.ShowDialog();
 }
开发者ID:rfrfrf,项目名称:SokoSolve-Sokoban,代码行数:7,代码来源:Program.cs


示例17: CurrentDomain_UnhandledException

        //集約エラーハンドラ
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("ERROR THROWN:");
            System.Diagnostics.Debug.WriteLine(e.ExceptionObject);
            StringBuilder body = new StringBuilder();
            body.AppendLine("********************************************************************************");
            body.AppendLine(" ERROR TRACE: " + DateTime.Now.ToString());
            body.AppendLine("********************************************************************************");
            body.AppendLine(e.ExceptionObject.ToString());
            body.AppendLine();
            body.AppendLine("MEMORY USAGE:");
            var cp = System.Diagnostics.Process.GetCurrentProcess();
            body.AppendLine("paged:" + cp.PagedMemorySize64 + " / peak-virtual:" + cp.PeakVirtualMemorySize64);
            body.AppendLine(Environment.OSVersion.VersionString + " (is64?" + (IntPtr.Size == 8).ToString() + ")");
            body.AppendLine(Define.GetFormattedVersion() + " @" + Define.ExeFilePath);

            #region Freezable Bug 対策

            var argexcp = e.ExceptionObject as ArgumentException;
            if (argexcp != null && argexcp.Message.Contains("Freezable") && argexcp.ParamName == "context")
            {
                try
                {
                    body.AppendLine("FREEZABLE***************************************************");
                    body.AppendLine("Source:" + argexcp.Source);
                    body.AppendLine("FREEZABLE END************************************************");
                }
                catch { }
            }

            #endregion

            if (Define.IsOperatingSystemSupported)
            {
                var tpath = Path.GetTempFileName();
                using (var sw = new StreamWriter(tpath))
                {
                    sw.WriteLine(body.ToString());
                }
                var apppath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
                System.Diagnostics.Process.Start(Path.Combine(apppath, Define.FeedbackAppName), tpath);
                Environment.Exit(1);
            }
            else
            {
                // WinXPでβ以上の場合は何も吐かずに落ちる
                if (Define.IsNightlyVersion)
                {
                    /*
                    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "krile_trace_" + Path.GetRandomFileName() + ".txt");
                    using (var sw = new StreamWriter(path))
                    {
                        sw.WriteLine(body.ToString());
                    }
                    */
                    MessageBox.Show("エラーが発生し、Krileの動作を継続できなくなりました。",
                            "サポート対象外のOS", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
开发者ID:runceel,项目名称:Mystique,代码行数:61,代码来源:App.xaml.cs


示例18: CurrentDomain_UnhandledException

        /// <summary>
        /// Callback that handles update checking.
        /// </summary>
        /* static void UpdateManager_CheckCompleted(object sender, UpdateCheckCompletedEventArgs e)
        {
            if (e.Success && e.Information != null)
            {
                if (e.Information.IsNewVersion)
                {
                    Update.ConfirmAndInstall();
                }
            }
            else
            {
                Console.Error.WriteLine("Failed to check updates. {0}", e.Error);
            }
        }*/
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string dump = string.Format("preseriapreview-dump-{0}{1}{2}{3}{4}.txt",
                DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
                DateTime.Now.Hour, DateTime.Now.Minute);
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), dump);

            using (var s = new FileStream(path, FileMode.Create))
            {
                using (var sw = new StreamWriter(s))
                {
                    sw.WriteLine("Preseria-Preview Dump file");
                    sw.WriteLine("This file has been created because Preseria-Preview crashed.");
                    sw.WriteLine("Please send it to [email protected] to help fix the bug that caused the crash.");
                    sw.WriteLine();
                    sw.WriteLine("Last exception:");
                    sw.WriteLine(e.ExceptionObject.ToString());
                    sw.WriteLine();
                    sw.WriteLine("Preseria-Preview v. {0}", Assembly.GetEntryAssembly().GetName().Version);
                    sw.WriteLine("OS: {0}", Environment.OSVersion.ToString());
                    sw.WriteLine(".NET: {0}", Environment.Version.ToString());
                    sw.WriteLine("Aero DWM: {0}", WindowsFormsAero.OsSupport.IsCompositionEnabled);
                    sw.WriteLine("Launch command: {0}", Environment.CommandLine);
                    sw.WriteLine("UTC time: {0} {1}", DateTime.UtcNow.ToShortDateString(), DateTime.UtcNow.ToShortTimeString());
                }
            }
        }
开发者ID:daghendrik,项目名称:preseria-preview,代码行数:44,代码来源:Program.cs


示例19: OnAppDomainUnhandledException

 /// <summary>
 /// The handler of the unhandled exception.
 /// </summary>
 /// <param name="sender">The sender of the Exception.</param>
 /// <param name="e">The Exception event arguments.</param>
 public void OnAppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (showExceptions)
     {
         DialogResult result = DialogResult.Cancel;
         try
         {
             result = this.ShowThreadExceptionDialog(e.ExceptionObject as Exception);
         }
         catch
         {
             try
             {
                 MessageBox.Show("Fatal Error",
                     "Fatal Error",
                     MessageBoxButtons.AbortRetryIgnore,
                     MessageBoxIcon.Stop);
             }
             finally
             {
                 Application.Exit();
             }
         }
         if (result == DialogResult.Abort)
             Application.Exit();
     }
 }
开发者ID:ewcasas,项目名称:DVTK,代码行数:32,代码来源:CustomExceptionHandler.cs


示例20: HandleAppDomainUnhandleException

		private static void HandleAppDomainUnhandleException(object sender, UnhandledExceptionEventArgs args)
		{
			Exception e = (Exception)args.ExceptionObject;
			Logger.Instance.Log(e);
			System.Windows.MessageBox.Show("An unexpected error occured. Please send the 'errors.log' file accessible from settings." + Environment.NewLine
				+ "Message Error : " + Environment.NewLine + e.Message, "Error");
		}
开发者ID:Calak,项目名称:CSGO-Demos-Manager,代码行数:7,代码来源:App.xaml.cs



注:本文中的System.UnhandledExceptionEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Uri类代码示例发布时间:2022-05-26
下一篇:
C# System.UIntPtr类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap