We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

System.InvalidOperationException: Sequence contains no elements - SfSchedule

Thread ID:

Created:

Updated:

Platform:

Replies:

150006 Dec 17,2019 03:23 PM UTC Mar 23,2020 12:26 PM UTC Xamarin.Forms 4
loading
Tags: SfSchedule
Elias P
Asked On December 17, 2019 03:32 PM UTC

Update: Tested with 17.4.0.39, issue still occurs.

I am getting an intermittent issue with SfSchedule on Xamarin Forms - Android.

For some reason, the SfSchedule sometimes throws the following exception (on Android only):

Thread started: #16
12-17 10:17:00.243 I/MonoDroid(27268): UNHANDLED EXCEPTION:
12-17 10:17:00.256 I/MonoDroid(27268): System.InvalidOperationException: Sequence contains no elements
12-17 10:17:00.256 I/MonoDroid(27268):   at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00010] in <10a59ea148cd4c6face8252c32c5e77b>:0
12-17 10:17:00.256 I/MonoDroid(27268):   at Com.Syncfusion.Schedule.AppointmentEngine.GetVisibleAppointments (System.Collections.ObjectModel.ObservableCollection`1[T] visibleDateRange, Com.Syncfusion.Schedule.ScheduleAppointmentCollection appointments, System.Boolean isTimelineView) [0x0000e] in :0
12-17 10:17:00.256 I/MonoDroid(27268):   at Com.Syncfusion.Schedule.SfSchedule.b__319_0 () [0x00035] in :0
12-17 10:17:00.256 I/MonoDroid(27268):   at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <46c2fa109b574c7ea6739f9fe2350976>:0
12-17 10:17:00.256 I/MonoDroid(27268):   at System.Threading.Tasks.Task.Execute () [0x00000] in <46c2fa109b574c7ea6739f9fe2350976>:0
12-17 10:17:00.256 I/MonoDroid(27268): --- End of stack trace from previous location where exception was thrown ---
12-17 10:17:00.256 I/MonoDroid(27268):
12-17 10:17:00.256 I/MonoDroid(27268):   at Com.Syncfusion.Schedule.SfSchedule.UpdateResourceAppointments (System.Collections.ObjectModel.ObservableCollection`1[T] resourceIDColl) [0x000ac] in :0
12-17 10:17:00.256 I/MonoDroid(27268):   at System.Runtime.CompilerServices.AsyncMethodBuilderCore <>c.b__7_0 (System.Object state) [0x00000] in <46c2fa109b574c7ea6739f9fe2350976>:0
12-17 10:17:00.256 I/MonoDroid(27268):   at Android.App.SyncContext <>c__DisplayClass2_0.b__0 () [0x00000] in <8c07a09624c14764b43f6b946a5a1f23>:0
12-17 10:17:00.256 I/MonoDroid(27268):   at Java.Lang.Thread RunnableImplementor.Run () [0x00008] in <8c07a09624c14764b43f6b946a5a1f23>:0
12-17 10:17:00.256 I/MonoDroid(27268):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <8c07a09624c14764b43f6b946a5a1f23>:0
12-17 10:17:00.256 I/MonoDroid(27268):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.79(intptr,intptr)

The code I use to set the ScheduleResources, DataSource, and SelectedResources:


            this.schedule.ScheduleResources = this.VM.Resources;
            this.schedule.DataSource = this.VM.Sessions;
            this.schedule.SelectedResources = this.VM.SelectedResources;

Where this.schedule is an SfSchedule on a XAML page. VM.Resources is an ObservableCollection<object>, same with SelectedResources, and Sessions is a ScheduleAppointmentCollection.

Any guidance would be appreciated. This is a show-stopper for us.


Elias P
Replied On December 17, 2019 05:58 PM UTC

Update: I decided to try the following sequence:

            this.schedule.SuspendAppointmentUpdate();
            this.schedule.DataSource = this.VM.Sessions;
            this.schedule.ScheduleResources = this.VM.Resources;
            this.schedule.SelectedResources = this.VM.SelectedResources;
            this.schedule.ResumeAppointmentUpdate();

At the moment this seems to have resolved the issue. I am continuing to investigate.

Indumathi Ravichandran [Syncfusion]
Replied On December 18, 2019 12:51 PM UTC

Hi Elias, 
 
Thank you for contacting Syncfusion support. 
 
Based on the last update, we hope that issue has been resolved at you end.  In the meantime, we are validating the root cause for the mentioned exception in source level. We will wait to hear from you after the investigation. 
 
Please get in touch with us if you would require any further assistance. 
 
Regards, 
Indumathi R 


Alessandro Bellotti
Replied On March 20, 2020 10:03 PM UTC

Update: I decided to try the following sequence:

            this.schedule.SuspendAppointmentUpdate();
            this.schedule.DataSource = this.VM.Sessions;
            this.schedule.ScheduleResources = this.VM.Resources;
            this.schedule.SelectedResources = this.VM.SelectedResources;
            this.schedule.ResumeAppointmentUpdate();

At the moment this seems to have resolved the issue. I am continuing to investigate.

Hello,
this workaround don't work for me.
There is any update about this issue ?
 

SaiGanesh Sakthivel [Syncfusion]
Replied On March 23, 2020 12:26 PM UTC

Hi Alessandro, 
 
Thank you for the update. 
 
We have checked the reported issueSystem.InvalidOperationException from our end. We regret to inform that the issue is not replicated from our side. We have attached the test sample in the following link. 
 
 
let us know it you still facing the same issue. If not, could you please share the following details which would be helpful for us to check on it and provide you the solution at the earliest.  
 
·       Modify our sample / Share layouts used in Xaml page 
·       Synfusion and Xamarin Forms updated version 
 
Regards, 
SaiGanesh Sakthivel 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon