Free Support Forum -

Exception "Index was out of range"


I’m trying to run the Aspose.Recurrence.Demos.Vb.Simple porject, but in this line (line 49)…

recur.DaysOfWeek(System.DayOfWeek.Monday) = True

… I get an exception:

"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

I have applied the 1.1 hotfix.

Any idea?



Hi Morajo,

I’ve traced this down to VB demo code getting out of sync with original C# demo code. You need to change those three lines to:

recur.DaysOfWeek.SetDayOn(System.DayOfWeek.Monday, True)
recur.DaysOfWeek.SetDayOn(System.DayOfWeek.Wednesday, True)
recur.DaysOfWeek.SetDayOn(System.DayOfWeek.Friday, True)

Same applies to Aspose.Recurrence.Demos.VB.WinForms project.

This is only a problem in VB demo code, not in the component itself so applying a hotfix will not help because it just replaces the component dll.

I’ve updated Aspose.Recurrence to 1.1.3. Please download it from It contains the fix for VB demos.