当前位置: 首页>>代码示例>>C#>>正文


C# UnobservedTaskExceptionEventArgs.SetObserved方法代码示例

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


在下文中一共展示了UnobservedTaskExceptionEventArgs.SetObserved方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: TaskScheduler_UnobservedTaskException

 private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     if (handleUnobserved)
     {
         e.SetObserved();
         Console.WriteLine("Unobserved exception logged and set to observed in TaskScheduler_UnobservedTaskException, Exception is: {0}", e.Exception);
     }
     else
         Console.WriteLine("Unobserved exception logged - process WILL BE KILLED because we are running .NET 4.0, Exception is: {0}",
             e.Exception);
 }
开发者ID:emretiryaki,项目名称:Blog,代码行数:11,代码来源:Program.cs

示例11: OnTaskSchedulerUnobservedTaskException

 // Ensure unobserved task exceptions (unawaited async methods returning Task or Task<T>) are handled
 // Example: Call this method without 'await'
 // private async Task<string> TestStringTask()
 // {
 //    throw new Exception("TestStringTaskException");
 // }
 private void OnTaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     if (e.Exception != null)
     {
         var isHandled = this.HandleException(e.Exception);
         if (isHandled)
         {
             e.SetObserved();
         }
     }
 }
开发者ID:thomasgalliker,项目名称:CrossPlatformLibrary,代码行数:17,代码来源:ExceptionHandlerBase.cs

示例12: TaskSchedulerOnUnobservedTaskException

 private void TaskSchedulerOnUnobservedTaskException(object sender,
                                                     UnobservedTaskExceptionEventArgs
                                                         unobservedTaskExceptionEventArgs)
 {
     if (Debugger.IsAttached)
         Debug.WriteLine(unobservedTaskExceptionEventArgs.Exception.Message);
     else
     {
         MessageBox.Show(unobservedTaskExceptionEventArgs.Exception.Message);
     }
     unobservedTaskExceptionEventArgs.SetObserved();
 }
开发者ID:modulexcite,项目名称:JabbR.WPF,代码行数:12,代码来源:App.xaml.cs

示例13: TaskScheduler_UnobservedTaskException

        private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            if (!e.Observed)
            {
                e.SetObserved();

                Error error;
                lock (_syncRoot)
                {
                    error = new Error(e.Exception)
                    {
                        HostName = _prototype.HostName,
                        User = _prototype.User,
                    };
                    error.ServerVariables.Add(_prototype.ServerVariables);
                    error.QueryString.Add(_prototype.QueryString);
                    error.Cookies.Add(_prototype.Cookies);
                    error.Form.Add(_prototype.Form);
                }
                ErrorLog.GetDefault(null).Log(error);
            }
        }
开发者ID:nebtrx,项目名称:roz,代码行数:22,代码来源:LoggingHttpModule.cs

示例14: TaskScheduler_UnobservedTaskException

 private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     e.SetObserved();
     HandleException(e.Exception);
 }
开发者ID:hawkwork,项目名称:CasualMeter,代码行数:5,代码来源:App.xaml.cs

示例15: OnUnobservedTaskException

 private static void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     Console.WriteLine(e.Exception.GetBaseException());
     e.SetObserved();
 }
开发者ID:fmsaraujo,项目名称:crank,代码行数:5,代码来源:Program.cs


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