This project has moved and is read-only. For the latest updates, please go here.

ArguementException: Trigger.Repetition.Interval Must be less than trigger.Repetition

Topics: Errors
Mar 12, 2014 at 3:11 PM
Hi i Have a problem used the task scheduler managed wrapper an i really like it a lot my app works fine on win7 and server 2008 but it throws an error on Win server 2003 it says
ArguementException: Trigger.Repetition.Interval Must be less than trigger.Repetition.Duration under task scheduler 1.0
at Microsoft win32. TaskScheduler.Trigger.SetV1TriggerData()
at Microsoft win32. TaskScheduler.RepetitionPattern.Bind()
at Microsoft win32. TaskScheduler.Repetition.set_Interval(TimeSpan value)
at ConfugApp.Form.scheduleTask()

Here is my code below
                    TaskDefinition td = ts.NewTask();

                    td.RegistrationInfo.Description = "POSClientRealtimeUpdate";
                    td.Principal.LogonType = TaskLogonType.InteractiveToken;
                    DailyTrigger dt = (DailyTrigger)td.Triggers.Add(new DailyTrigger { DaysInterval = 1 });
                    dt.Repetition.Interval = TimeSpan.FromMinutes(5);

                    td.Actions.Add(new ExecAction(txtschedulePosclient.Text, null));

                    td.Settings.ExecutionTimeLimit = TimeSpan.FromHours(1);
                    td.Settings.IdleSettings.RestartOnIdle = false;
                    td.Settings.IdleSettings.StopOnIdleEnd = false;
                    td.Settings.IdleSettings.WaitTimeout = TimeSpan.FromMinutes(10);

                    const string taskName = "POSClientRealtimeUpdate";
                    ts.RootFolder.RegisterTaskDefinition(taskName, td, TaskCreation.Create, "SYSTEM", null, TaskLogonType.ServiceAccount);
                    label6.Visible = true;
                    label6.Text = "Posclient Realtime...scheduled";

Can you please Help
Mar 12, 2014 at 4:09 PM
The error is exactly as described in the exception: Under XP an WS2K3, you are using the Task Scheduler 1.0 library which demands that "Trigger.Repetition.Interval must be less than Trigger.Repetition.Duration under Task Scheduler 1.0". You set the variable "dt.Repetition.Interval" to 5 minutes. You must therefore set "dt.Repetition.Duration" to something greater than 5 minutes before registering the task.
Marked as answer by dahall on 4/3/2014 at 11:07 AM
Mar 13, 2014 at 8:28 AM
Thank you very much you helped me a lot. I appreciate it, it works like a bomb