Bug - Scheduler - Timeline Month - Null Reference after updating data source

I am using the scheduler component to display users, with each user having projects underneath them and then each project can have it's own events. 
I wanted to add some search criteria on for the user, I have used the SfDropdownList control in CheckBox mode to make a selector.

When the user has changed their selection from the dropdown, I fetch events using the entered search criteria,  then create a list of projects based on those events and finally I update the bound properties for Events and Projects that the scheduler is using. 

When the search criteria returns no events, the scheduler will be bound to two empty lists for both Events and Projects. On Month View, this works as expected just showing a blank schedule for each user with no project grouping. However, when Timeline Month is the active view this same scenario throws a NullReferenceException. Interestingly, if you have Month view as the active view and then switch to Timeline Month the issue does not occur and it displays correctly without issue. 

The stack trace is as follows:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.Schedule.Internal.TimelineMonthView`1.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Sample to replicate the issue attached. 

Any help appreciated, thanks in advance.

Attachment: Schedule__TimelineMonth_render_bug_b3da1873.zip

14 Replies

LS Lee Stevens March 3, 2021 10:47 AM UTC

The same issue also occurs on TimelineDay, TimelineWeek and TimelineWorkWeek:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.Schedule.Internal.TimelineView`1.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Timeline Year does not have the issue.


NR Nevitha Ravi Syncfusion Team March 3, 2021 12:02 PM UTC

Hi Lee, 

Greetings from Syncfusion Support. 

We have checked the reported issue "NullException throws in timeline view on updating data source" and could replicate the issue at our end. We confirm this as defect and logged the bug report which can be tracked through the following link. The fix will be included in our upcoming volume 1, 2021 main release. We would appreciate your patience until then. 

Note
: We will check in all the views and include the fix considering all the views. 

Regards, 
Nevitha. 



AO Andreas Oelke March 11, 2021 06:56 AM UTC

This happens in TimelineYearView too and we've reported this issue on Jan. 5th already but the fix moved from week to week.
I wonder when this will be finally fixed.


NR Nevitha Ravi Syncfusion Team March 12, 2021 12:45 PM UTC

Hi Andreas, 

Thanks for your update. 

We hope that the reported issue ‘null exception throws when resources removed dynamically’ in this thread is not related to your reported issue as you haven’t remove any resource in your application. So you can have a follow up you ticket and feedback report to track your reported issue. 

Please let us know if you have any concern. 

Regards, 
Nevitha  



NR Nevitha Ravi Syncfusion Team March 17, 2021 08:07 AM UTC

Hi Lee, 

The issue ‘Null exception throws in timeline views when updating datasource’ has been resolved in our weekly patch release v18.4.48.  Please upgrade to overcome the issue. 


Please let us know if you need any further assistance. 

Regards, 
Nevitha 



LS Lee Stevens March 17, 2021 11:02 AM UTC

I have updated our project to 18.4.48 and searching for the user "John" now works as expected, removing the grouping and showing a list of all users. . 

However, the problem still occurs when amending an event and the field used for grouping is changed. 

Editing an event and changing the subject field works fine; although I do have to explicitly call RefreshEvents on the scheduler for it to display the changes.
Editing an event and changing the project field throws an exception.

I have updated my original sample and attached it to demonstrate the issue. I tried to use the built-in EditorTemplate but it was having issues, I've added a custom dialog which is what I would be looking to do in my actual project anyway. 

Attachment: Schedule__Edit_event_render_bug_68f8c71c.zip


NR Nevitha Ravi Syncfusion Team March 18, 2021 02:06 PM UTC

Hi Lee, 

Thanks for your update. 

We have checked the reported scenario with your shared sample and found that the Id field got mismatched between dataSource provided to the DropDownList of the editor template and the resource dataSource for projects assigned after EventSaved method. Due to this, when you choose the Id which is not available in the scheduler resource list the exception throws. So we request you to assign same data for both the data source. 

 

 

Kindly try the above solution and  let us know if you need any further assistance. 

Regards, 
Nevitha 



LS Lee Stevens March 18, 2021 02:40 PM UTC

Hi Nevitha, 

In this sample, the "AllProjects" list will always have Ids 1, 2 and 3 and it is only used for the editor template. 

The "UserProjects" list has a record for each project that a user is in, this is refreshed whenever the DataSource of the scheduler is changed; either by updating the filter or after saving. 

Based on what you have described, the error would be occuring whenever the UserProjects list is changed in a way that would remove a project record. However, the issue does not occur when filtering the DataSource. Nor does it occur when updating the event purely through code behind. 

I have updated and attached the sample again:
  • The dropdown filter on the main form now has a list of projects, selecting a project updates the DataSource for the scheduler and UserProjects is adjusted accordingly. This is the same as it was before, except it is filtering on projects not workers, just in case. No exception gets thrown. 

  • I have also added a button, clicking on this button will update the event beneath the user "Matt" to a different ProjectId. It will also update the subject and project name for the event. After the event is "saved", you will see the group resource underneath Matt and the event subject change to say BUTTON. I am using the same "EventSaved" method for both the button and after saving in the edit dialog. Screenshots below demonstrate UserProjects changing correctly.

    UserProjects on startup:


    UserProjects after button click, updates scheduler correctly:


    UserProjects after saving in dialog, throws exception:




Attachment: Schedule__Edit_event_render_bug_v2_32f84ab7.zip


NR Nevitha Ravi Syncfusion Team March 19, 2021 05:03 PM UTC

Hi Lee, 

Sorry for the confusion. 

We have checked the reported scenario in the shared sample, and could replicate the issue ‘exception throws when try to add appointments when resource dynamically changed’ and confirm this as defect at our end. So we have logged the bug report which can be tracked through the below link. The issue fix will be included in our weekly patch release scheduled on first week of April, 2021 and would appreciate your patience until then. 

Regards, 
Nevitha  



LS Lee Stevens March 21, 2021 07:49 PM UTC

Thanks for the information Nevitha, can you also double check the scenario works for creating a new event on a different project? 

For example, Matt has an event on Project 1. If I double click the scheduler and add an event for Project 2, the same exception occurs. 
Updated sample attached.

Attachment: Schedule__Event_edit_create_bug_dd4a5137.zip


NR Nevitha Ravi Syncfusion Team March 22, 2021 07:32 AM UTC

Hi Lee, 

Thanks for your update. 

We have validated your reported issue and let you know that the cause for this issue is same as the previously reported issue. So this will be resolved once the issue ‘exception when try to add appointments when resource dynamically changed’. We appreciate your patience until then. 

Regards, 
Nevitha 



LS Lee Stevens April 7, 2021 11:06 AM UTC

Hi Nevitha,

I have updated to the latest version (19.1.0.55) which includes the fix for the scheduler. 

Changing the top level group id of an event is still causing an exception (In my example, the worker). Previously, changing either the worker or the project beneath them would cause an exception. I have updated my sample to demonstrate the issue, amending the worker throws the following exception:

[2021-04-07T10:53:11.773Z] Error: System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Syncfusion.Blazor.Schedule.Internal.ResourceRenderer`2.OnDropDownChange(ChangeEventArgs`2 args)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Syncfusion.Blazor.Internal.SfBaseUtils.InvokeEvent[T](Object eventFn, T eventArgs)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.InvokeChangeEvent(EventArgs args)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnChangeEvent(EventArgs args)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.SetSelectOptions(EventArgs args, KeyActions keyArgs)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.UpdateSelectItem(TItem item, EventArgs args, KeyActions keyArgs)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.PropertyChange(Dictionary`2 newProps)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnParametersSetAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

Creating an event for a new worker seems to work fine on the sample project, however in my actual project the calendar shows a wait spinner. In both cases on both projects the group resource headers are updated correctly. 

I have attached a sample to demonstrate the amend issue, I do not know why creating works on the sample but not on my actual project as the process is the same.


Attachment: Schedule__Amend_worker_bug_55a5e49c.zip


NR Nevitha Ravi Syncfusion Team April 12, 2021 12:19 PM UTC

Hi Lee, 

Sorry for the inconvenience caused. 

We have reopened the issue ‘exception throws when try to save events on resource changed dynamically’ and the fix will be included in our weekly patch release scheduled by the end of April, 2021. We appreciate your patience until then. 

Regards, 
Nevitha  



NR Nevitha Ravi Syncfusion Team May 7, 2021 10:16 AM UTC

Hi Lee, 
 
Sorry for the delay in getting back to you.

We are glad to inform you that the reported issue with changing resource dynamically when editing appointments has been resolved in our weekly patch release v19.1.58, so please upgrade your version to avail the fix. 

Regards, 
Nevitha 


Loader.
Up arrow icon