This is a migrated thread and some comments may be shown as answers.

Error in Scheduler (IComparer)

7 Answers 185 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Adam Corriher
Top achievements
Rank 1
Adam Corriher asked on 04 Mar 2014, 01:35 PM
I am getting the following error message sometimes when my scheduler is trying to display.  I am feeding it a dataset with start and end dates that traverse anywhere from one day to many weeks.  All of the data looks good and no end dates are less than the start dates.  Are there any quick things I could check to fix this.

I have implemented a custom appointment comparing class and when I use this the scheduler does initially display all values, but once I click to access anything else I get the error below.

Please help when you can.

Error:
Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'Telerik.Web.UI.AppointmentComparer'.

Type:
System.ArgumentException

Stack Trace:
at System.Collections.Generic.IntrospectiveSortUtilities.ThrowOrIgnoreBadComparer(Object comparer)
at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)
at Telerik.Web.UI.Scheduler.Views.Month.Model.CreateDaySlot(DateTime dayStart, DateTime dayEnd, Int32 dayIndex, DateTime weekStart, IList`1 trimmedAppointments)
at Telerik.Web.UI.Scheduler.Views.Month.Model.DataBind(AppointmentCollection appointments)
at Telerik.Web.UI.RadScheduler.CreateContent()
at Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource)
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

7 Answers, 1 is accepted

Sort by
0
Adam Corriher
Top achievements
Rank 1
answered on 04 Mar 2014, 06:40 PM
I created a simple example using the data I would use to populate the scheduler in my application.  I sorted it one way based my application and it gave me the error above.  I took out all sorting so it is in a different random order and it displayed correctly.  The data set only contains 4 columns including a Start date and end date.  The example I created also does not have a custom appointment comparing class.
0
Nencho
Telerik team
answered on 07 Mar 2014, 11:58 AM
Hello Adam,

I am sending you a sample project, demonstrating the custom implementation of Comparing, that we suggest to use. Please give it a try at your end and let us know if further questions on the implementation arise.

Regards,
Nencho
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Matthew
Top achievements
Rank 1
answered on 18 Nov 2016, 06:52 PM

Nencho,

Could you please post the custom implementation that you gave Adam? We're also running into this issue and need it fixed.

Thanks,

Matthew

0
Nencho
Telerik team
answered on 21 Nov 2016, 09:22 AM
Hello Matthew,

You can find the sample attached to this reply.

Regards,
Nencho
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
0
Matthew
Top achievements
Rank 1
answered on 21 Nov 2016, 03:20 PM
Awesome, perfect! Thank you, Nencho
0
Trevor
Top achievements
Rank 1
answered on 17 May 2017, 12:53 PM

I'm also having exactly the same issue. However, I downloaded the sample application and implemented the Comparer code in exactly the same way (I copied and pasted it) and I still have the same problem with one particular set of data.  The custom comparer code we have, has been in place for nearly 3 years and this is the first time we have encountered this issue.  We're using RadScheduler and there are 17 appointments for the same day. If I change one of the appointments so that the start date lands on a different day, it works fine. Just like in the post above, the calendar for the current month is initially shown without any problem. However, if the user then clicks to navigate forward or back one month, I get the same error referenced above. I even hard-coded the Compare method to always return 0 as a test and that didn't work either. I also tried removing the custom comparer altogether and it seems that whatever default sorting that RadScheduler does causes the same exception to be thrown but on the initial load so that even the current month's calendar will not be shown.

Is anyone else running into this?

Thanks

0
Trevor
Top achievements
Rank 1
answered on 17 May 2017, 04:15 PM
This definitely seems to be a bug in at least the older version of this component. I upgraded to the trial version of the latest RadScheduler and it does not have this problem. However, what I really need is a workaround if at all possible for the version I'm on which is 2013.2.717.45 .  Thanks!
Tags
Scheduler
Asked by
Adam Corriher
Top achievements
Rank 1
Answers by
Adam Corriher
Top achievements
Rank 1
Nencho
Telerik team
Matthew
Top achievements
Rank 1
Trevor
Top achievements
Rank 1
Share this question
or