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

TriggerCollection.Contains() always returns False in case Monthly Trigger.

Topics: Errors
Apr 26, 2017 at 11:10 AM

I am not able to understand why TriggerCollection.Contains() always returns False in case Monthly Trigger even if the trigger is present. In other trigger types the collection returns correct value.

Please see the following code used by me to determine the correctness.
DateTime dt = new DateTime(1992, 06, 19, 00, 00, 00);
            TaskService ts = new TaskService();
            TaskDefinition td = ts.NewTask();

            td.Triggers.Add(new TimeTrigger(dt));// Time Trigger
            if (td.Triggers.Contains(td.Triggers[0]))
                Console.WriteLine("Returns Time TRigger");

            td.Triggers.Add(new MonthlyTrigger { StartBoundary = dt, DaysOfMonth = new[] { 1} });// Time Trigger
            if (td.Triggers.Contains(td.Triggers[1]))
                Console.WriteLine("Returns Monthly Trigger");

Returns Time TRigger
It should return True in the case of Monthly Trigger also.

Please reply if i am missing anything or a way to solve this.
May 1, 2017 at 11:21 PM
You found a bug in how I'm comparing MonthlyTrigger. Thank you. I have fixed it and it will be in the next release.
May 2, 2017 at 11:15 AM
When is the next release scheduled ?
Can you please suggest a kind of workaround of this situation. It's a production issue and needs to provide some fix.
May 3, 2017 at 2:51 AM
I just pushed version 2.5.24 that contains the fix.
Marked as answer by dahall on 5/2/2017 at 6:51 PM