Telerik.Windows.Controls.ScheduleView : System.InvalidOperationException:at System.Windows.Data.CollectionView.DeferRefresh

6 posts, 0 answers
  1. Parameswari
    Parameswari avatar
    1 posts
    Member since:
    Aug 2018

    Posted 02 Aug 2018 Link to this post

    Hi Team,

    We are facing the below exception when scheduling an appointment. we are using "2017.2.503.45" version of Telerik.Windows.Controls and VS 2017.

    System.InvalidOperationException:

       at System.Windows.Data.CollectionView.DeferRefresh (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at Telerik.Windows.Controls.ScheduleView.ScheduleViewDataConnection.SetGroupingAndFiltering (Telerik.Windows.Controls.ScheduleView, Version=2017.2.503.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7)
       at Telerik.Windows.Controls.ScheduleViewBase.RegenerateGroupHeaders (Telerik.Windows.Controls.ScheduleView, Version=2017.2.503.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7)
       at Telerik.Windows.Controls.ScheduleViewBase.OnResourceTypesSourcePropertyChanged (Telerik.Windows.Controls.ScheduleView, Version=2017.2.503.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7)
       at System.Windows.DependencyObject.OnPropertyChanged (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.FrameworkElement.OnPropertyChanged (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.DependencyObject.NotifyPropertyChange (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.DependencyObject.UpdateEffectiveValue (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.DependencyObject.InvalidateProperty (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.Data.BindingExpressionBase.Invalidate (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.Data.BindingExpression.TransferValue (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged (PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.WeakEventManager+ListenerList`1.DeliverEvent (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.Windows.WeakEventManager.DeliverEventToList (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at ViewModel.WorkerCompleted (SampleModules.Test, Version=2.132.18145.3, Culture=neutral, PublicKeyToken=null)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen (WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

    Please suggest as to handle this issue.

     

    Thanks,

    Parameswari

  2. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 07 Aug 2018 Link to this post

    Hello Parameswari,

    Thanks for the StackTrace provided.

    For the time being I cannot relate this exception to any known issue of the control. Can you please share some additional details on the exact steps to reproduce it? Generally, any information that you consider as relevant might be helpful.

    Thank you in advance for your cooperation.

    Regards,
    Stefan
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Uma
    Uma avatar
    11 posts
    Member since:
    May 2011

    Posted 18 Jun 2019 in reply to Stefan Link to this post

    Hi Team,

    We have prepared a sample for the DefeRefresh issue

  4. Uma
    Uma avatar
    11 posts
    Member since:
    May 2011

    Posted 18 Jun 2019 in reply to Uma Link to this post

    Hi Team,

    We have prepared a sample for DeferRefresh issue. While creating a Appointment, changing the currentdate(View Refresh) for scheduler, it is thrown "Deferrefresh is not allowed during an addnew or edit item transaction" exception. 

    In our application, we have refresh the scheduler view (Changing current date) continuously through bindable property and immediately creating the appointment. Here we are getting this exception.



    Please suggest how to handle this issue?

    And the previous post can't delete from our side.


    Thanks,
    Srinivas

  5. Uma
    Uma avatar
    11 posts
    Member since:
    May 2011

    Posted 18 Jun 2019 in reply to Uma Link to this post

    Sample:

    https://drive.google.com/file/d/1IL_fqyugJDj2VMX7lqxGXbro1rtRU7sM/view?usp=sharing

  6. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    679 posts

    Posted 21 Jun 2019 Link to this post

    Hello Uma,

    Thank you for the update and the provided sample project. 

    I investigated the described scenario and as it turns out it is not recommended to change the CurrentDate during the creation of an appointment. Here are my findings:

    Basically, when a new appointment is being created, the AddNew method of the IEditableCollectionView representing the data in the RadScheduleView is called. On the other hand, when the CurrentDate is changed, the GroupDescriptions of the CollectionView have to be refreshed. That is why the DeferRefresh method is called, however that leads to the observed exception, since the DeferRefresh cannot be called while an AddNew transaction is in progress. 

    In order to avoid this scenario, I can suggest adding an additional boolean property in the viewmodel, which would track whether the CurrentDate can be changed. It would be set to false in the AppointmentCreating event and returned to true in the AppointmentCreated event. Then in the setter of the CurrentDate property, you can delay the raising of a property changed notification until the AppointmentCreated event is thrown. 

    I am attaching the sample project modified to demonstrate what I have in mind. Please, check it out and let me know, if you find it helpful.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top