コード例 #1
0
ファイル: AudioPlayer.cs プロジェクト: henricj/phonesm
        void AudioPlayer_UnobservedException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            Debug.WriteLine("AudioPlayer UnobservedException {0}", e.Exception.Message);

            if (Debugger.IsAttached)
                Debugger.Break();
        }
コード例 #2
0
        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.");
                }
            }
        }
コード例 #3
0
		protected override void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
		{
			logger.Error(e.Exception);
			e.SetObserved();

			base.OnUnobservedTaskException(sender, e);
		}
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: ChinaRAUnion/RedAlertPlus
 private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     //var client = new Microsoft.ApplicationInsights.TelemetryClient();
     //client.TrackException(e.Exception);
     _logger.Error(e.Exception);
     e.SetObserved();
 }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: MainActivity.cs プロジェクト: P3PPP/XFAedSearch
		private static void TaskSchedulerOnUnobservedTaskException(object sender,
			UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
		{
			var newExc = new Exception("TaskSchedulerOnUnobservedTaskException",
				unobservedTaskExceptionEventArgs.Exception);
			LogUnhandledException(newExc);
		}  
コード例 #7
0
 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);
 }
コード例 #8
0
ファイル: App.xaml.cs プロジェクト: Slashka-DK/BlitzChat
        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);
            }
        }
コード例 #9
0
        private void OnUnobservedTaskException(object sender, _THREADING.UnobservedTaskExceptionEventArgs e)
        {
            // prevent exception escalation
            e.SetObserved( );

            _logger.LogError(String.Format("task Exception: '{0}'\r\nTrace:\r\n{1}", e.Exception.Message, e.Exception.StackTrace));
        }
コード例 #10
0
 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();
 }
コード例 #11
0
        private void OnUnhandledExceptionRaised( object sender, UnobservedTaskExceptionEventArgs e )
        {
            var handler = this.ExceptionCaught;
            if( handler.NotNullReference() )
                handler(e.Exception);

            e.SetObserved();
        }
コード例 #12
0
 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();
 }
コード例 #13
0
        static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            e.SetObserved();

            var exception = e.Exception.Flatten();

            Logger.Error(exception);
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: Kasp42/ArchiSteamFarm
		private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs args) {
			if (args?.Exception == null) {
				Logging.LogNullError(nameof(args) + " || " + nameof(args.Exception));
				return;
			}

			Logging.LogFatalException(args.Exception);
		}
コード例 #15
0
ファイル: Program.cs プロジェクト: kzu/OctoFlow
 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();
 }
コード例 #16
0
 static void UnobservedException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     if (Debugger.IsAttached)
     {
         // An unobserved exception has occurred; break into the debugger
         Debugger.Break();
     }
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: hpatel98/SCAMP
 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;
     });
 }
コード例 #18
0
ファイル: App.xaml.cs プロジェクト: NightyCode/GoHome
        private void OnTaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            LogException(e.Exception);

            foreach (var exception in e.Exception.InnerExceptions)
            {
                LogException(exception);
            }
        }
コード例 #19
0
 void taskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     e.SetObserved();
     e.Exception.Flatten().Handle(ex =>
     {
         AppMessenger.Messenger.NotifyColleagues("ShowLog", ex.Message);
         return true;
     });
 }
コード例 #20
0
ファイル: Global.cs プロジェクト: sovanesyan/Burrow.NET
 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);
     }
 }
コード例 #21
0
        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);
        }
コード例 #22
0
ファイル: Global.cs プロジェクト: kangkot/Burrow.NET
 static void TaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     foreach (var ex in e.Exception.InnerExceptions)
     {
         // NOTE: Should not observe the msg here, let the application developers deal with the error 
         // because there could be other TPL Task created by the developers
         
         DefaultWatcher.Error(ex);
     }
 }
コード例 #23
0
 // 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();
         }
     }
 }
コード例 #24
0
ファイル: Program.cs プロジェクト: emretiryaki/Blog
 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);
 }
コード例 #25
0
 void OnUnobservedTaskException(object sender, System.Threading.Tasks.UnobservedTaskExceptionEventArgs e)
 {
     if (System.Diagnostics.Debugger.IsAttached)
     {
         System.Diagnostics.Debugger.Break();
     }
     else
     {
         Utilities.OnException(e.Exception);
     }
 }
コード例 #26
0
ファイル: AppDelegate.cs プロジェクト: colbylwilliams/bugtrap
 static void HandleTaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     if (e.Exception != null && e.Exception.InnerExceptions != null && e.Exception.InnerExceptions.Count > 0) {
         foreach (var exception in e.Exception.InnerExceptions) {
             Console.WriteLine("TaskScheduler Unobserved Exception");
             Console.WriteLine(exception.Message);
             Console.WriteLine(exception.StackTrace);
             // Log.Error (exception, "TaskScheduler Unobserved Exception", true);
         }
     }
 }
コード例 #27
0
 /// <summary>
 /// 异步处理县城异常
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TaskScheduler_UnobservedTaskException(object sender, System.Threading.Tasks.UnobservedTaskExceptionEventArgs e)
 {
     try
     {
         ("异步处理县城异常:《" + e.Exception.ToString() + "》").WriteToLog(log4net.Core.Level.Error);
         e.SetObserved();
     }
     catch (Exception ex)
     {
         ("不可恢复的异步处理县城异常:《" + ex.ToString() + "》").WriteToLog(log4net.Core.Level.Error);
     }
 }
        private void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
        {
            WindowsServerEventSource.Log.TaskSchedulerOnUnobservedTaskException();

            var exp = new ExceptionTelemetry(unobservedTaskExceptionEventArgs.Exception)
            {
                HandledAt = ExceptionHandledAt.Unhandled,
                SeverityLevel = SeverityLevel.Critical,
            };

            this.telemetryClient.TrackException(exp);
        }
コード例 #29
0
ファイル: App.xaml.cs プロジェクト: modulexcite/JabbR.WPF
 private void TaskSchedulerOnUnobservedTaskException(object sender,
                                                     UnobservedTaskExceptionEventArgs
                                                         unobservedTaskExceptionEventArgs)
 {
     if (Debugger.IsAttached)
         Debug.WriteLine(unobservedTaskExceptionEventArgs.Exception.Message);
     else
     {
         MessageBox.Show(unobservedTaskExceptionEventArgs.Exception.Message);
     }
     unobservedTaskExceptionEventArgs.SetObserved();
 }
        private void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
        {
            WindowsServerEventSource.Log.TaskSchedulerOnUnobservedTaskException();

            var exp = new ExceptionTelemetry(unobservedTaskExceptionEventArgs.Exception)
            {
                SeverityLevel = SeverityLevel.Critical,
            };

            // TODO: what if TrackException will throw another UnobservedTaskException?
            // Either put a comment here why it will never ever happen or include a protection logic
            this.telemetryClient.TrackException(exp);
        }
コード例 #31
0
        private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            // Imlementing this feature based on this request 
            // https://support.hockeyapp.net/discussions/problems/58502-uwp-how-to-call-trackexception?mail_type=queue

            try
            {
                if (e.Exception != null)
                {
                    ITelemetry crashTelemetry = CreateCrashTelemetry(e.Exception, ExceptionHandledAt.Unhandled);
                    var client = ((HockeyClient)(HockeyClient.Current));
                    client.Track(crashTelemetry);
                    client.Flush();
                }
            }
            catch(Exception ex)
            {
                CoreEventSource.Log.LogError("An exeption occured in UnhandledExceptionTelemetryModule.TaskScheduler_UnobservedTaskException: " + ex);
            }
        }
コード例 #32
0
ファイル: LoggingHttpModule.cs プロジェクト: nebtrx/roz
        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);
            }
        }
コード例 #33
0
 static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     e.SetObserved();
 }
コード例 #34
0
        ////////////////////////////////////////////////////////////
        //
        // Internal methods
        //

        // This is called by the TaskExceptionHolder finalizer.
        internal static void PublishUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs ueea)
        {
            UnobservedTaskException?.Invoke(sender, ueea);
        }
コード例 #35
0
ファイル: Program.cs プロジェクト: ahdung/WebChecker
 private static void TaskScheduler_UnobservedTaskException(object sender, System.Threading.Tasks.UnobservedTaskExceptionEventArgs e)
 {
     Log.Fatal(e.Exception, $"{nameof(TaskScheduler_UnobservedTaskException)}发生异常!");
 }
コード例 #36
0
ファイル: App.xaml.cs プロジェクト: xyzrs/TVHelpers
 /// <summary>
 /// Invoked when the task schedule sees an exception occur
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">Details about the task exception.</param>
 private void TaskScheduler_UnobservedTaskException(object sender, System.Threading.Tasks.UnobservedTaskExceptionEventArgs e)
 {
     e.SetObserved();
     Platform.Current.AppUnhandledException(e.Exception);
 }