[FIX] Attempted fix for #1
This commit is contained in:
parent
ba88ef438a
commit
82bbf70525
2 changed files with 17 additions and 2 deletions
|
|
@ -255,7 +255,22 @@ public static class UniversalExtensions
|
|||
task.Start();
|
||||
});
|
||||
|
||||
registeredScheduledTasks.Add(UID, new taskInfo { tokenSource = CancellationToken, customId = CustomId, runTime = runTime});
|
||||
if (registeredScheduledTasks is null)
|
||||
registeredScheduledTasks = new();
|
||||
|
||||
try
|
||||
{
|
||||
registeredScheduledTasks.Add(UID, new taskInfo { tokenSource = CancellationToken, customId = CustomId, runTime = runTime });
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
registeredScheduledTasks = new();
|
||||
registeredScheduledTasks.Add(UID, new taskInfo { tokenSource = CancellationToken, customId = CustomId, runTime = runTime });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return UID;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue