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

C# Tasks.UnobservedTaskExceptionEventArgs类代码示例

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

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



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

示例1: TaskScheduler_UnobservedTaskException

        void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            try
            {
                Exception ex = (Exception)e.Exception;
                string LogFile = Logger.LogError(ex);

                MessageBox.Show(
                    "The application encountered a fatal error and must exit. This error has been logged and should be reported using the Error Report utility.\n\n" +
                        "Error:\n" +
                        ex.Message +
                        "\n\nStack Trace:\n" +
                        ex.StackTrace,
                    "Fatal Error");

                Process proc = new Process();
                proc.EnableRaisingEvents = false;
                proc.StartInfo.FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ErrorReport.exe");
                proc.StartInfo.Arguments = LogFile;
                proc.Start();
            }
            finally
            {
                System.Environment.Exit(1);
            }
        }
开发者ID:Slashka-DK,项目名称:BlitzChat,代码行数:26,代码来源:App.xaml.cs


示例2: HandleTaskException

        private static void HandleTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            var exception = e.Exception;

            Console.WriteLine("Task Error: {0}", exception);
            Logger.Error("Task Error: " + exception.Message, exception);
        }
开发者ID:Djohnnie,项目名称:Sonarr,代码行数:7,代码来源:GlobalExceptionHandlers.cs


示例3: OnUnobservedTaskException

		protected override void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
		{
			logger.Error(e.Exception);
			e.SetObserved();

			base.OnUnobservedTaskException(sender, e);
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:7,代码来源:TestExceptionHandler.cs


示例4: HandleTaskSchedulerException

 static void HandleTaskSchedulerException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     var exception = e != null
         ? (e.Exception ?? new Exception ("Unhandled Task exception (null Exception)."))
         : new Exception ("Unhandled Task exception (null UnobservedTaskExceptionEventArgs).");
     HandleException (exception, fatal: false);
 }
开发者ID:patridge,项目名称:xamarin-forms-value-converters,代码行数:7,代码来源:AppDelegate.cs


示例5: AudioPlayer_UnobservedException

        void AudioPlayer_UnobservedException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            Debug.WriteLine("AudioPlayer UnobservedException {0}", e.Exception.Message);

            if (Debugger.IsAttached)
                Debugger.Break();
        }
开发者ID:henricj,项目名称:phonesm,代码行数:7,代码来源:AudioPlayer.cs


示例6: TaskScheduler_UnobservedTaskException

 private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     //var client = new Microsoft.ApplicationInsights.TelemetryClient();
     //client.TrackException(e.Exception);
     _logger.Error(e.Exception);
     e.SetObserved();
 }
开发者ID:ChinaRAUnion,项目名称:RedAlertPlus,代码行数:7,代码来源:App.xaml.cs


示例7: TaskScheduler_UnobservedTaskException

 private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     var exception = e.Exception;
     var baseException = e.Exception.GetBaseException();
     Logger.ErrorException("An unobserved task exception occured.", exception);
     e.SetObserved();
 }
开发者ID:IngageNetworks,项目名称:IN.Chat,代码行数:7,代码来源:RegisterErrorHandling.cs


示例8: TaskSchedulerOnUnobservedTaskException

		private static void TaskSchedulerOnUnobservedTaskException(object sender,
			UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
		{
			var newExc = new Exception("TaskSchedulerOnUnobservedTaskException",
				unobservedTaskExceptionEventArgs.Exception);
			LogUnhandledException(newExc);
		}  
开发者ID:P3PPP,项目名称:XFAedSearch,代码行数:7,代码来源:MainActivity.cs


示例9: InternalUnobservedTaskExceptionHandler

        private static void InternalUnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs e)
        {
            var aggrException = e.Exception;
            var baseException = aggrException.GetBaseException();
            var tplTask = (Task)sender;
            var contextObj = tplTask.AsyncState;
            var context = contextObj as ISchedulingContext;

            try
            {
                if (unobservedExceptionHandler != null)
                {
                    unobservedExceptionHandler(context, baseException);
                }
            }
            finally
            {
                if (e.Observed)
                {
                    logger.Info(ErrorCode.Runtime_Error_100311, "UnobservedExceptionsHandlerClass caught an UnobservedTaskException which was successfully observed and recovered from. BaseException = {0}. Exception = {1}",
                            baseException.Message, LogFormatter.PrintException(aggrException));
                }
                else
                {
                    var errorStr = String.Format("UnobservedExceptionsHandlerClass Caught an UnobservedTaskException event sent by {0}. Exception = {1}",
                            OrleansTaskExtentions.ToString((Task)sender), LogFormatter.PrintException(aggrException));
                    logger.Error(ErrorCode.Runtime_Error_100005, errorStr);
                    logger.Error(ErrorCode.Runtime_Error_100006, "Exception remained UnObserved!!! The subsequent behavior depends on the ThrowUnobservedTaskExceptions setting in app config and .NET version.");
                }
            }
        }
开发者ID:Rejendo,项目名称:orleans,代码行数:31,代码来源:UnobservedExceptionsHandlerClass.cs


示例10: OnUnobservedTaskException

 private static void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     Tracer.Get(typeof(Program)).Error(e.Exception.Flatten(), "Unexpected exception");
     Console.WriteLine(e.Exception.Flatten().ToString());
     Console.WriteLine("Press [Enter] to exit.");
     Console.ReadLine();
     Process.GetCurrentProcess().Kill();
 }
开发者ID:kzu,项目名称:OctoFlow,代码行数:8,代码来源:Program.cs


示例11: TaskScheduler_UnobservedTaskException

        static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            e.SetObserved();

            var exception = e.Exception.Flatten();

            Logger.Error(exception);
        }
开发者ID:ganesum,项目名称:Naru,代码行数:8,代码来源:UnhandledExceptionHandler.cs


示例12: UnobservedTaskExceptionHandler

		private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs args) {
			if (args?.Exception == null) {
				Logging.LogNullError(nameof(args) + " || " + nameof(args.Exception));
				return;
			}

			Logging.LogFatalException(args.Exception);
		}
开发者ID:Kasp42,项目名称:ArchiSteamFarm,代码行数:8,代码来源:Program.cs


示例13: TaskScheduler_UnobservedTaskException

 private void TaskScheduler_UnobservedTaskException (object sender, UnobservedTaskExceptionEventArgs args)
 {
     args.Exception.Flatten();
     var excArgs = new UnhandledExceptionsEventArgs(args.Exception.InnerExceptions, UnhandledExceptionSource.TaskScheduler);
     OnUnhandledException(excArgs);
     if (excArgs.Handled)
         args.SetObserved();
 }
开发者ID:binki,项目名称:Alba.Framework,代码行数:8,代码来源:UnhandledExceptionsHandler.cs


示例14: UnobservedException

 static void UnobservedException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     if (Debugger.IsAttached)
     {
         // An unobserved exception has occurred; break into the debugger
         Debugger.Break();
     }
 }
开发者ID:henricj,项目名称:HttpClientBackgroundAudio,代码行数:8,代码来源:AudioPlayer.cs


示例15: OnUnhandledExceptionRaised

        private void OnUnhandledExceptionRaised( object sender, UnobservedTaskExceptionEventArgs e )
        {
            var handler = this.ExceptionCaught;
            if( handler.NotNullReference() )
                handler(e.Exception);

            e.SetObserved();
        }
开发者ID:MechanicalMen,项目名称:Mechanical2,代码行数:8,代码来源:UnobservedTaskExceptionSource.cs


示例16: taskSchedulerUnobservedTaskException

 void taskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     e.SetObserved();
     e.Exception.Flatten().Handle(ex =>
     {
         AppMessenger.Messenger.NotifyColleagues("ShowLog", ex.Message);
         return true;
     });
 }
开发者ID:SingleBamboo,项目名称:GitHubFolderDownloader,代码行数:9,代码来源:App.xaml.cs


示例17: OnTaskSchedulerUnobservedTaskException

        private void OnTaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            LogException(e.Exception);

            foreach (var exception in e.Exception.InnerExceptions)
            {
                LogException(exception);
            }
        }
开发者ID:NightyCode,项目名称:GoHome,代码行数:9,代码来源:App.xaml.cs


示例18: handleUnObservedExceptions

 public static void handleUnObservedExceptions(object sender, UnobservedTaskExceptionEventArgs eventArgs)
 {
     eventArgs.SetObserved();
     ((AggregateException)eventArgs.Exception).Handle(ex =>
     {
         Console.WriteLine("Unobserved exception type: [{0}] Message[{1}] ", ex.GetType(), ex.Message);
         return true;
     });
 }
开发者ID:hpatel98,项目名称:SCAMP,代码行数:9,代码来源:Program.cs


示例19: TaskSchedulerUnobservedTaskException

 static void TaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     foreach (var ex in e.Exception.InnerExceptions)
     {
         // NOTE: Should not observe the msg here, let the client of this library deal with that since there could be 
         // other TPL Task created by the developers
         
         DefaultWatcher.Error(ex);
     }
 }
开发者ID:sovanesyan,项目名称:Burrow.NET,代码行数:10,代码来源:Global.cs


示例20: Tasks_UnobservedTaskException

        private static void Tasks_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            e.SetObserved();

            var logger = ServiceLocator.Current.GetInstance<ILog>();

            logger.Error(
                $"An unobserved task exception occures! Sender was {(sender != null ? sender.GetType().FullName : "(not set!)")}.",
                e.Exception);
        }
开发者ID:SeriousM,项目名称:BugTracker,代码行数:10,代码来源:GlobalErrorLogger.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Test.ParallelStateTest类代码示例发布时间:2022-05-26
下一篇:
C# Tasks.TaskScheduler类代码示例发布时间: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