However, the current RadGridView doesn't seems to be happy with it, the first item appears fine, but then it throws the usual "wrong thread" exception for the second item.
When will the new BindingOperations.EnableCollectionSynchronization be supported in the Telerik items controls?
19 Answers, 1 is accepted
We do not have any official .NET 4.5 builds and that is why we cannot support this feature with our current assemblies. We will do our best to provide support for BindingOperations.EnableCollectionSynchronization most probably after our Q3 2012 (Nov - Dec 2012).
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I am using the latest internal build 1224, but EnableCollectionSynchronization still doesn't seem to work...
When will this be supported?
We have made some test changes in our source code so that when the source collection is updated from another thread as in your case, we will dispatch everything to the UI thread using the UI Thread SynchronizationContext.
I am attaching a sample project with the updated binaries for testing purposes. We took the sample project from here. Can you please check it out and see whether the updated DLL's can successfully fit in your exact scenario. If you send us a small sample project for testing, we would be very grateful. We would like to test the changes that we have made in as many scenarios as possible before checking them in source control.
Looking forward to hearing from you.
Kind regards,
Rossen Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Your example works, but it doesn't seem to be making use of the new BindingOperations.EnableCollectionSynchronization in .NET 4.5, because it still works when the line is commented out...
Yes we've decided to implement this in a bit different way no matter the framework version.
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for the clarification. It is good that it can support .NET 4 and 4.5, but would there be any negative performance impact comparing to the default WPF implementation?
With this approach there will be no negative performance.
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
This is already part of our internal build.
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
when will be the next production release?
The next official release is Q1 2013 (the end of February).
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Seems like the FilterDescriptor is still expecting to be executed from the GUI thread:
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=The calling thread cannot access this object because a different thread owns it.
Source=WindowsBase
StackTrace:
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at Telerik.Windows.Data.FilterDescriptor`1.get_FilteringExpression()
at Telerik.Windows.Data.FilterDescriptor`1.CreateFilterExpression(ParameterExpression parameterExpression)
at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
at Telerik.Windows.Data.Expressions.FilterExpressionBuilder.CreateFilterExpression()
at Telerik.Windows.Data.QueryableExtensions.Where(IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
at Telerik.Windows.Data.QueryableCollectionView.CreateView()
at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()
at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
at Telerik.Windows.Data.QueryableCollectionView.IndexOf(Object item)
at Telerik.Windows.Data.QueryableCollectionView.AdjustCollectionChangedIndex(Object item, Int32 index)
at Telerik.Windows.Data.QueryableCollectionView.AdjustOldIndices(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
at System.Collections.ObjectModel.Collection`1.Add(T item)
at Novatech.MDLBuilder.TelerikMDIParentWindow.UpdateStatusHistory(String message, Object source, MessageLevel level) in C:\Users\john.kesselman\Source\Repos\MDLBuilder.15\CDBVisualizer\MainWindow\Messages.cs:line 578
at Novatech.MDLBuilder.TelerikMDIParentWindow.ProcessMDLExecutionMessage(String msg, UInt32 line, MessageLevel level, String errorSource, List`1& buildErrors, Boolean& errorRunningMDL, Boolean& messageCreated) in C:\Users\john.kesselman\Source\Repos\MDLBuilder.15\CDBVisualizer\MainWindow\Messages.cs:line 435
at Novatech.MDLBuilder.TelerikMDIParentWindow.<>c__DisplayClass14_2.<performBuild>b__4(String msg, UInt32 line, MessageLevel level) in C:\Users\john.kesselman\Source\Repos\MDLBuilder.15\CDBVisualizer\MainWindow\Messages.cs:line 176
at MDLBuilder.BuildFacility.ModelFileBuilder.BuildModelFile(String pcmName, String fileToCheck, Action`1 logProgress, Action`3 logMessage, Action`2 visualizeProgress, Func`1 checkIfStopped, Boolean remote) in C:\Users\john.kesselman\Source\Repos\MDLBuilder.15\MDLBuilder.BuildFacility\ModelFileBuilder.cs:line 139
at Novatech.MDLBuilder.FileConversionHelper.BuildModelFile(String name, String fileToCheck, Action`1 logProgress, Action`3 logMessage, Action`2 visualizeProgress, Func`1 checkIfStopped, Boolean remote) in C:\Users\john.kesselman\Source\Repos\MDLBuilder.15\CDBVisualizer\FileConversionHelper.cs:line 247
at Novatech.MDLBuilder.TelerikMDIParentWindow.<>c__DisplayClass14_0.<performBuild>b__1() in C:\Users\john.kesselman\Source\Repos\MDLBuilder.15\CDBVisualizer\MainWindow\Messages.cs:line 201
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
InnerException:
The code in question adds an item to an ObservableCollection<Message> from non-GUI thread. The grid, however, has a following filter:
new
FilterDescriptor<Message>()
{
FilteringExpression = m =>
(errorToggleButton.IsChecked.HasValue && errorToggleButton.IsChecked.Value && m.Level == MessageLevel.Error)
|| (warningToggleButton.IsChecked.HasValue && warningToggleButton.IsChecked.Value && m.Level == MessageLevel.Warning)
|| (infoToggleButton.IsChecked.HasValue && infoToggleButton.IsChecked.Value && m.Level == MessageLevel.Info)
});
Any ideas?
There are a few different possible invocation paths when filter descriptors are concerned. This one seems to be related to CompositeFilterDescriptor. I did not manage to reproduce it on my side, but we will try to include a "blind" fix in the next internal build. We won't be able to include in this weeks SP though. Here is the public item in our issue tracking system.
Regards,
Ivan Ivanov
Telerik by Progress
WPF UI 2016.3.1024.45
The issue marked as resolved, but I'm getting an exception anyway, this time from a different area. The observable collection is created on the UI Thread but populated in a Task. BindingOperations.EnableCollectionSynchronization is executed on it prior to use:
[1] Unhandled exception System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at Telerik.Windows.Data.SortDescriptorBase.get_SortDirection()
at Telerik.Windows.Data.Expressions.SortDescriptorCollectionExpressionBuilder.Sort()
at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, IEnumerable`1 sortDescriptors)
at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, SortDescriptorCollection sortDescriptors)
at Telerik.Windows.Data.QueryableCollectionView.Sort(IQueryable queryable)
at Telerik.Windows.Data.QueryableCollectionView.CreateView()
at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()
at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
at Telerik.Windows.Data.QueryableCollectionView.IndexOf(Object item)
at Telerik.Windows.Data.QueryableCollectionView.AdjustCollectionChangedIndex(Object item, Int32 index)
at Telerik.Windows.Data.QueryableCollectionView.AdjustOldIndices(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
at System.Collections.ObjectModel.Collection`1.Add(T item)
at System.Collections.ObjectModel.CollectionExtensions.AddRange[T](Collection`1 collection, IEnumerable`1 items)
It seems that this is another similar issue. I logged it in our system. I am adding 1000 telerik points to your account. You can track our progress with the issue by following this item.
Regards,
Ivan Ivanov
Telerik by Progress
Found this: https://feedback.telerik.com/wpf/1354157-gridview-cross-thread-exception-in-queryablecollectionview-sort
I guess this is the ticket. Approved now. When can we expect a resolution?
John
https://feedback.telerik.com/wpf/1354157-gridview-cross-thread-exception-in-queryablecollectionview-sort
Any word on when it will be resolved?
I can't give you a timeframe for fixing the issue. However, I could recommend you to follow the feedback item. This way you will get notified as soon as its status changes.
Regards,
Martin Ivanov
Progress Telerik