From 95ad1bf44b9107ab85a22447074e12e9c66b5d7b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:49:50 +0100 Subject: [PATCH] Suppress startup task check exception https://github.com/seerge/g-helper/issues/3480 --- app/Helpers/Startup.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Helpers/Startup.cs b/app/Helpers/Startup.cs index 8c216134..4d150e3e 100644 --- a/app/Helpers/Startup.cs +++ b/app/Helpers/Startup.cs @@ -11,8 +11,16 @@ public class Startup public static bool IsScheduled() { - using (TaskService taskService = new TaskService()) - return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName)); + try + { + using (TaskService taskService = new TaskService()) + return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName)); + } + catch (Exception e) + { + Logger.WriteLine("Can't check startup task status: " + e.Message); + return false; + } } public static void ReScheduleAdmin()