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

Hundreds of InvalidCastExceptions to type 'Telerik.Windows.Data.IGroup'

1 Answer 179 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Russell
Top achievements
Rank 1
Russell asked on 28 May 2015, 02:00 PM

Hi there,

 

I have a Grid which is bound to an ObservableCollection<Record>.  This grid is using a custom GroupHeaderTemplate.  When I open the screen containing the grid whilst running with a VS2013 debugger attached, I see lots of exceptions being reported in the output window.  It also takes a long time (1-2 mins) to display the grid that used to display in a few seconds.  This exception is obviously happening on a background thread or being caught somewhere as it doesn't ever get displayed to the user or cause the application to crash.  I can turn on exception breaks in VS2013 when the exception is thrown and I can see details about it, but nothing that would point to a fix.  It appears to be happening as part of a layout pass.  The exception is...

 

System.InvalidCastException

Unable to cast object of type 'MyNamespace.Record' to type 'Telerik.Windows.Data.IGroup'.

CallStack:

    Telerik.Windows.Data.dll!Telerik.Windows.Data.FuncExtensions.ToUntypedFunc<Telerik.Windows.Data.IGroup,object>.AnonymousMethod__0(object item)    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.KeyedCollection.GetKeyByItem(object value)    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.KeyedCollection.AddRange(System.Collections.IEnumerable items)    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.PopulateInternalList(System.Linq.IQueryable view)    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.InternalList.get()    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.EnsureRootGroup()    Unknown
     Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.RootQCVGGroup.get()    Unknown
     Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.Rows.CalculateRowCount()    Unknown
     Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.CalculateAllRowsCount()    Unknown
     Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.EnsureIndexStorage()    Unknown
     Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.MeasureOverride(System.Windows.Size availableSize)    Unknown
     Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(System.Windows.Size availableSize)    Unknown
     PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize)    Unknown
     PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize)    Unknown
     PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout()    Unknown
     PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg)    Unknown
     PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()    Unknown
     PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget)    Unknown
     PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget)    Unknown
     WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)    Unknown
     WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler)    Unknown
     WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()    Unknown
     mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)    Unknown
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)    Unknown
     mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)    Unknown
     WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()    Unknown
     WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()    Unknown
     WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)    Unknown
     WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)    Unknown
     WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)    Unknown
     WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)    Unknown
     WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler)    Unknown
     WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)    Unknown
     WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)    Unknown
     [Native to Managed Transition]    
     [Managed to Native Transition]    
     WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)    Unknown
     PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)    Unknown
     PresentationFramework.dll!System.Windows.Application.Run()    Unknown
     MyApplication.dll!MyApplication.MyApplicationView.Start() Line 57    C#
     MyApplication.dll!MyApplication.Modularity.MyBootstrapper.Run() Line 249    C#
     MyHost.exe!MyHost.MyStartup.Main() Line 63    C#

I'm running .Net 4.5 and Telerik 2015.1 noxaml binaries.

Any idea what could be causing this and if there's a simple fix?

Thanks

Russell

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 29 May 2015, 03:52 PM
Hi Russell,

As it turns out we are not aware of such an issue and I am also not able to reproduce it at our end with the latest binaries. Would you confirm you are using the latest version? What is the result if you remove the custom GroupHeaderTemplate?
Would you share some more information like how is RadGridView defined? Have you configured GroupRenderMode="Flat"?

Regards,
Dimitrina
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Russell
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or