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

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

5 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Parameswari
Top achievements
Rank 1
Parameswari asked on 02 Aug 2018, 11:53 AM

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

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Aug 2018, 09:57 AM
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.
0
Uma
Top achievements
Rank 1
answered on 18 Jun 2019, 01:35 PM

Hi Team,

We have prepared a sample for the DefeRefresh issue

0
Uma
Top achievements
Rank 1
answered on 18 Jun 2019, 02:07 PM

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

0
Uma
Top achievements
Rank 1
answered on 18 Jun 2019, 02:12 PM

Sample:

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

0
Vladimir Stoyanov
Telerik team
answered on 21 Jun 2019, 11:18 AM
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.
Tags
General Discussions
Asked by
Parameswari
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Uma
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or