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

CrossAppDomainMarshaledException when changing SortDescriptors

1 Answer 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 06 May 2010, 11:29 AM
Hello,

We are required to restore the sorting order that was entered by the user. To accomplish this, we are currently saving the sortdescriptors of the grid to a database and loading them when the page is opened. This persistence works fine, but when attempting to restore the sortdescriptors on the grid at runtime, we receive the following error:

System.CrossAppDomainMarshaledException was unhandled
Message: System.NullReferenceException: Object reference not set to an instance of an object.
   at FleetFence2.App.Application_UnhandledException(Object sender, ApplicationUnhandledExceptionEventArgs e)
   at MS.Internal.Error.CallApplicationUEHandler(Exception e)
   at MS.Internal.Error.CallAUEHandler(UInt32 hr, UInt32& bIsHandled)

This error is thrown asynchronously (so not while on a certain line), but only occurs when the descriptors have been changed by the following piece of code:

Dim descriptor = New Telerik.Windows.Data.SortDescriptor() 
Dim datamember = DirectCast(column, GridViewDataColumn).DataMemberBinding.Path.Path 
descriptor.Member = datamember 
descriptor.SortDirection = If(lSortingState = Telerik.Windows.Controls.SortingState.Ascending, ListSortDirection.Ascending, ListSortDirection.Descending) 
grid.SortDescriptors.Add(descriptor)

This piece of code is executed for each column that was marked to be sorted. The data that is used to instantiate the SortDescriptor is correct: the fields exists and the sortorder is valid.

Have you got any idea what can cause this error? The grid itself is bound to the Data property of a DomainDataSource control, using WCF Ria Services and LINQ To SQL.

Hoping you can help,
Dominiek


1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 12 May 2010, 08:12 AM
Hello Dominiek,

We are not aware what may have caused this. The exception stack trace is not telling anything useful. Can you try to add the SortDescriptors directly to the DomainDataSource.SortDescriptors instead of adding them to the GridView.

Best wishes,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or