dahall / TaskScheduler

Provides a .NET wrapper for the Windows Task Scheduler. It aggregates the multiple versions, provides an editor and allows for localization.
MIT License
1.2k stars 191 forks source link

Getting Unhandled Exception: System.ArgumentException: Value does not fall within the expected range. #906

Closed wmortume closed 2 years ago

wmortume commented 2 years ago

Trying to create a simple task but getting this error. Followed the examples step-by-step too, what could I be missing?

image

TaskDefinition task = TaskService.Instance.NewTask();
task.RegistrationInfo.Description = "Net Console Testings";
DailyTrigger trigger = new DailyTrigger() { StartBoundary = DateTime.Today.AddHours(13).AddMinutes(20) }; //1:20pm
//DateTime.SpecifyKind(DateTime.Today.AddHours(hour).AddMinutes(min), DateTimeKind.Utc)
task.Triggers.Add(trigger);
task.Actions.Add(new ExecAction(@"C:\Users\Test\Downloads\audio.mp3"));
TaskService.Instance.RootFolder.RegisterTaskDefinition(Directory.GetCurrentDirectory(), task);