October 20, 2018, 04:41:14 AM

See more Support incidents in our old archived forum.

Author Topic: "Maximum search effort must be a positive TimeSpan."  (Read 832 times)

sean.worlock

  • Customers
  • Newbie
  • *
  • Posts: 1
"Maximum search effort must be a positive TimeSpan."
« on: May 24, 2017, 01:17:22 PM »
Silverlight Gantt assembly version 6.0.5.1

We experience the above error (line 70 in WorkTimeSchedule.cs) when rebinding the gantt which is required when adding a new resource to the gantt after the initial binding. ie

Users.Add(opResource); //resource collection already bound to the gantt
ganttControl.ItemsSource = null;
ganttControl.ItemsSource = App.ConfigOptions.Tasks.OrderBy(t => t.SortOrder);

It always seems to be related to milestones and predecessors but is difficult to pinpoint exactly.
Ie by trial and error if a specific predecessor is removed then the error no longer occurs.

We have implemented a fix but wanted to run the fix by you before we implement as the fix is to your code and we are uncertain of any possible ramifications regarding the fix.

We traced the issue back as far as line 542 of BaseGanttModel.cs in method ComputeEffort which for us looks like this.

public TimeSpan ComputeEffort(IActivity activity, DateTime suggestedEndTime)
        {
            DateTime startTime = activity.StartTime;

            // Dont bother with this setting, as its quite probably just intermediate.
            if (startTime == DateTime.MinValue || startTime == DateTime.MaxValue)
                return TimeSpan.Zero;

Sometimes suggestedEndTime < startTime which results in the error.

We have modified it to

if (startTime == DateTime.MinValue || startTime == DateTime.MaxValue || suggestedEndTime < startTime)
                return TimeSpan.Zero;

note the additional clause to prevent a negative timespan.

please could you advise if this fix is likely to cause any other issues? Or alternatively advise why a suggested end time for a milestone will ever be less than it's actual start time.

Regards,
Sean.

Rajagopal

  • RQ Members
  • Jr. Member
  • *
  • Posts: 99
Re: "Maximum search effort must be a positive TimeSpan."
« Reply #1 on: May 25, 2017, 02:19:00 PM »
Sean,

The changes you have made is looks correct. We will test with your changes and make sure everything is fine. And we will share the updated assembly soon.

Thanks
Raja