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

Q1 2013: problem with ColumnSortDescriptor

3 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 27 Feb 2013, 09:25 AM
Hello,
I have a problem with the Q1 2013 version that was not in the previous, Q3 2012 SP1, version.
In my application, I have a list of rankings in a TabItem (Microsoft, not Telerik). When I double-click on a ranking, the details of the ranking are displayed in a new TabItem. Now, if I close the tab item with the ranking details, I have the following error:

Error message= Error: Unhandled Error in Silverlight Application
Code: 4004    
Category: ManagedRuntimeError       
Message: System.ArgumentNullException: Column cannot be null
Parameter name: newColumn
   at Telerik.Windows.Controls.GridView.ColumnSortDescriptor.OnColumnChanged(GridViewColumn oldColumn, GridViewColumn newColumn)
   at Telerik.Windows.Controls.GridView.ColumnSortDescriptor.OnColumnPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
   at Telerik.Windows.PropertyMetadata.PropertyChangeHook.OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
   at System.Windows.Data.BindingExpression.SendDataToTarget()
   at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)
   at System.Windows.PropertyPathListener.ReconnectPath()
   at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source)
   at System.Windows.IndexerPathStep.RaisePropertyPathStepChanged(PropertyListener source)
   at System.Windows.IndexerListener.SourcePropertyChanged(Object sender, PropertyChangedEventArgs args)
   at System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(Object sender, PropertyChangedEventArgs args)
   at System.Collections.ObjectModel.ObservableCollection`1.OnPropertyChanged(PropertyChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.ClearItems()
   at Telerik.Windows.Controls.GridViewColumnCollectionInternal.ClearItems()
   at System.Collections.ObjectModel.Collection`1.Clear()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.TotalColumnRefresh()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)


I've look at what can cause this error and found that the following XAML code, in the list of rankings, is the cause of the error:
<tk:GridView.SortDescriptors>
  <tk:ColumnSortDescriptor Column="{Binding Columns[LastChangeDT], ElementName=GridView}" SortDirection="Descending" />
</tk:GridView.SortDescriptors>

If I comment out this code or replace it with a normal SortDescriptor, the error is gone.

I've also found other problems with ColumnSortDescriptor, where the column is not found (even if it exists) and the application crash.
Perhaps a check for null for the column in your code would avoid many crashes.

Patrick

3 Answers, 1 is accepted

Sort by
0
Vera
Telerik team
answered on 27 Feb 2013, 09:37 AM
Hello Patrick,

 
This issue has already been resolved and the fix is available with our Latest Internal Build. Please download it and give it a try.

Let us know in case you experience any other problems.

Greetings,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 27 Feb 2013, 12:33 PM
Vera,
after installing the .225 version, I have the following error, using the same scenario:

Error message= Error: Unhandled Error in Silverlight Application
Code: 4004    
Category: ManagedRuntimeError       
Message: System.ArgumentException: At least one object must implement IComparable.
   at System.Collections.Comparer.Compare(Object a, Object b)
   at System.Collections.Generic.ObjectComparer`1.Compare(T x, T y)
   at System.Linq.EnumerableSorter`2.CompareKeys(Int32 index1, Int32 index2)
   at System.Linq.EnumerableSorter`1.QuickSort(Int32[] map, Int32 left, Int32 right)
   at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
   at lambda_method(Closure )
   at System.Linq.EnumerableExecutor`1.Execute()
   at System.Linq.EnumerableExecutor`1.ExecuteBoxed()
   at System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute(Expression expression)
   at Telerik.Windows.Data.QueryableExtensions.Count(IQueryable source)
   at Telerik.Windows.Data.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
   at Telerik.Windows.Controls.GridViewColumnCollectionInternal.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at Telerik.Windows.Controls.GridViewColumnCollectionInternal.InsertItem(Int32 index, GridViewColumn item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Telerik.Windows.Data.CollectionExtensions.AddRange[T](ICollection`1 collection, IEnumerable`1 items)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.TotalColumnRefresh()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

That's not really an amelioration.

Patrick
0
Vera
Telerik team
answered on 27 Feb 2013, 01:47 PM
Hello Patrick,

 
Unfortunately, we were not able to reproduce the exception using the provided details. Will it be possible for you to isolate the problem in a sample project so we can debug it on our side? You can send the project by opening a support ticket.

Thank you in advance.

All the best,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Vera
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or