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

ArgumentException when running FindTask function

Sep 7, 2011 at 3:08 PM
Edited Sep 7, 2011 at 3:11 PM

Hi,

I got the following exception when I tried to run the FindTask function:

System.ArgumentException: Value does not fall within the expected range.   

at Microsoft.Win32.TaskScheduler.TaskFolderCollection.CopyTo(TaskFolder[] array, Int32 arrayIndex)   at Microsoft.Win32.TaskScheduler.TaskFolderCollection.GetEnumerator()   at Microsoft.Win32.TaskScheduler.TaskService.FindTaskInFolder(TaskFolder fld, Regex taskName, Boolean recurse)   at Microsoft.Win32.TaskScheduler.TaskService.FindTask(String name, Boolean searchAllFolders)

 

This is the code I used to run that function:

                TaskService taskService = new TaskService();
                var existingTask = taskService.FindTask("TestTask");

 

 

I'm using the 1.6.0 version of TaskScheduler.

The TaskScheduler worked perfectly until today, on all sort of operation systems. This is the first time we got this exception and its consistent.

the operation system is: Windows Server 2003 R2 Standard Ed. SP2

 

Please let me know if you have any ideas.

Thanks in advanced,

Lidan.

Sep 7, 2011 at 8:08 PM

There was a bug fix submitted Apr 13, 2011 and released in version 1.6.1 for this specific problem of enumerating subfolders on systems earlier than Vista/Server 2008.

Sep 8, 2011 at 6:39 PM

Hi Dahall, thank you for the quick answer.

I'm very happy to hear that this issue is solved!

I sent the latest DLL to the client that got the exception. I'll report when I'll receive their confirmation.

Thanks for your help! This project is awesome :-) 

Sep 9, 2011 at 2:46 PM
Edited Sep 9, 2011 at 2:46 PM

Hi Dahall,

I just got a confirmation from the client that got the exception that the latest version helped him! as you said :)

Thank you again,

Lidan.