2

I am trying to delete all the triggers that have expired because Quartz.NET crashes when it faces triggers that will never be fired. So I would like to know the next fire time of my triggers and if they do not have any, then they are expired and should be removed. But now I am seeing that even a trigger that is in the future returns a null for its next fire time:

string expression = "0 26 13 17 10 ? 2015";
DateTimeOffset? nextFireTimeUtc = TriggerBuilder.Create().WithCronSchedule(expression).Build().GetNextFireTimeUtc();

As can be seen my cron expression is for 2015. But nextFireTimeUtc returns null.

1

1 Answer 1

6

Just ran into this myself. Per Trigger.GetNextFireTimeUtc Method, "The value returned is not guaranteed to be valid until after the Trigger has been added to the scheduler."

So make sure you call ScheduleJob(...) prior to executing `GetNextFireTimeUtc()'.

Not the answer you're looking for? Browse other questions tagged or ask your own question.