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

Sorting throws exception after upgrading to latest

5 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 01 Sep 2009, 03:39 PM
I'm trying to update my project to use the latest release (2009.2 813), but when I sort on any column, I get this exception:

{"Invalid property or field - 'colDescription' for type: Object"}

   at Telerik.Windows.Data.Expressions.MemberAccessTokenExtensions.CreateMemberAccessExpression(IMemberAccessToken token, Expression instance)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Boolean liftMemberAccessToNull)
   at Telerik.Windows.Data.Expressions.PropertyAccessExpressionBuilder.CreateMemberAccessExpression()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateLambdaExpression()
   at Telerik.Windows.Data.SortDescriptorCollectionExpressionBuilder.Sort()
   at Telerik.Windows.Data.SortDescriptorCollection.Sort(IQueryable queryable)
   at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, SortDescriptorCollection sortDescriptors)
   at Telerik.Windows.Data.QueryableCollectionView.CreateView()
   at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
   at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
   at Telerik.Windows.Data.QueryableCollectionView.GetEnumerator()
   at Telerik.Windows.Data.RecordFactory.<CreateRecordsForGroupRecord>d__0.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PopulateRecords()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.LoadData()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.RefreshAndRaiseCollectionChanged(NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.Refresh()
   at Telerik.Windows.Data.QueryableCollectionView.EndDefer()
   at Telerik.Windows.Data.QueryableCollectionView.DeferHelper.Dispose()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.SyncSortDescriptors(IEnumerable`1 removedDescriptors, IEnumerable`1 addedDescriptors)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformSorting(String propertyName, Boolean addSortDescription)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass2d.<Sort>b__2c()
   at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.Sort(GridViewDataColumn column, Boolean appendToExisting)
   at Telerik.Windows.Controls.GridView.GridViewHeaderCell.RequestSort(Boolean appendToExisting)
   at Telerik.Windows.Controls.GridView.GridViewHeaderCell.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at WpfApplicationTemplate.App.Main() in C:\Temp\User_InteractionDesktopApplication\obj\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 02 Sep 2009, 05:41 AM
Hi Gary,

Can you send us small example which demonstrates your scenario and this issue can be reproduced?

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gary
Top achievements
Rank 1
answered on 02 Sep 2009, 08:54 PM
Here's a simple page and code behind which demonstrates the problem.  Our application defines an empty datasource, which is then populated by application code when a button is clicked.  The problem seems to be that with the latest telerik version, an empty initial datasource causes issues with sorting.  Here's the xaml for the test page:

<Window x:Class="SortRepro.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <telerik:RadGridView x:Name="SortTestGrid" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Click To Sort" DataMemberPath="TestCol"></telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

Here's the code behind.  When you bring up the window, sort on the column, you should get an exception.  Note the commented out line in GetDS, if you uncomment this, sorting will work as expected.  This same code works with previous versions of the grid:

using System;
using System.Windows;
using System.Data;

namespace SortRepro
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            this.SortTestGrid.ItemsSource = this.GetDS();
            this.Loaded += new RoutedEventHandler(Window1_Loaded);
        }

        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            DataView dv = this.SortTestGrid.ItemsSource as DataView;
            dv.Table.Rows.Add(new Object[] { "bar" });
        }

        private DataView GetDS()
        {
            DataSet ds = new DataSet();
            DataTable dt = new DataTable();

            DataColumn col1 = new DataColumn();
            col1.Caption = "TestCol";
            col1.ColumnName = "TestCol";

            dt.Columns.Add(col1);

            ds.Tables.Add(dt);

            //if you uncomment this line, sorting works
            //dt.Rows.Add(new Object[] { "foo" });

            return dt.DefaultView;
        }
    }
}

Thanks for your help.
0
Vlad
Telerik team
answered on 03 Sep 2009, 08:16 AM
Hi Gary,

The issue is already fixed and the fix will be available in our latest internal build (this Friday). I've attached small demo application demonstrating your case with our latest binaries.

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gary
Top achievements
Rank 1
answered on 03 Sep 2009, 03:58 PM
We build our own telerik binaries from your source (we've made some modifications).  Is there anyway to get internal build sources, I only see the option to download binaries.  Or perhaps there's a workaround I can apply until the next official release?
0
Hristo
Telerik team
answered on 04 Sep 2009, 03:46 PM
Hi Gary,

I transferred your forum post to a regular support ticket. You can download the source code for our latest internal (2009_2_904) from Your Account-> Downloads->RadControls for WPF->Latest internal builds->RadControls_2009_2_904_Source.zip. Download it, give it a try and let me know how it goes.

Please not that the source code will be available till Monday (Sept 7).

Sincerely yours,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Gary
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Gary
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or