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

Null reference exception on window maximize

6 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 1
Dean asked on 08 Dec 2009, 11:01 PM
I'm getting strange results with the gridview when I maximize my window and the Gridview has data.  I can't figure out why it's happening (because sometimes maximizing the window works just fine and sometimes it doesn't).  Here's the stack trace:

System.NullReferenceException was unhandled  
  Message="Object reference not set to an instance of an object." 
  Source="Telerik.Windows.Controls.GridView" 
  StackTrace:  
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.ArrangeChild(UIElement child, Int32 displayIndex, ArrangeState arrangeState) in c:\Builds\WPF_Scrum\GridView_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 1599  
       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.ArrangeOverride(Size arrangeSize) in c:\Builds\WPF_Scrum\GridView_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewCellsPanel.cs:line 1536  
       at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)  
       at System.Windows.UIElement.Arrange(Rect finalRect)  
       at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)  
       at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize)  
       at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)  
       at System.Windows.UIElement.Arrange(Rect finalRect)  
       at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)  
       at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)  
       at System.Windows.UIElement.Arrange(Rect finalRect)  
       at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)  
       at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)  
       at System.Windows.UIElement.Arrange(Rect finalRect)  
       at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)  
       at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)  
       at System.Windows.UIElement.Arrange(Rect finalRect)  
       at System.Windows.ContextLayoutManager.UpdateLayout()  
       at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)  
       at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()  
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()  
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)  
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)  
       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.DispatcherOperation.InvokeImpl()  
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)  
       at System.Threading.ExecutionContext.runTryCode(Object userData)  
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)  
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)  
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)  
       at System.Windows.Threading.DispatcherOperation.Invoke()  
       at System.Windows.Threading.Dispatcher.ProcessQueue()  
       at System.Windows.Threading.Dispatcher.WndProcHook(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 Tracker.App.Main() in C:\_projects\R2C\Tracker\Tracker\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()  
  InnerException:   
 

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Dec 2009, 06:52 AM
Hello,

 Can you send us an example (via support ticket) where we can reproduce and debug this? Please post also more info about your grid version.


Regards,
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
Dean
Top achievements
Rank 1
answered on 09 Dec 2009, 06:18 PM
Yeah I can try to work up a test project and send it to you.  Oddly it hasn't been happening now so I have no way to reproduce it with consistency (it must have something to do with specific state on the gridview like a sort or something... I'll track it down and let you know).
0
udit handa
Top achievements
Rank 1
answered on 12 Dec 2009, 11:27 AM
I get exactly the same exception. From my observation I found that this happens when the grid has a scrollbar i.e more items than what can be accommodate. If we scroll all items and then maximize it works fine otherwise it throws a null reference exception.
I am sure it has something to do with virtualization.
0
udit handa
Top achievements
Rank 1
answered on 12 Dec 2009, 11:35 AM
And here is a not so good fix guys
set these properties for the RADGrid to false
  EnableColumnVirtualization="False" EnableRowVirtualization="False"

Dont know whether there is a problem with the RADGrid implementation or our code.

0
Dean
Top achievements
Rank 1
answered on 13 Dec 2009, 09:26 PM
Well, disabling row/column virtualization isn't an option for me because it kills performance on the grid (because having to render every row/column on data context changed versus rendering visible rows/columns is a pretty intense task if you have a huge datatable).
0
udit handa
Top achievements
Rank 1
answered on 14 Dec 2009, 06:59 AM
Yeah! not good for a huge data. Hope telerik guys have sometime to look into this post.
Tags
GridView
Asked by
Dean
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Dean
Top achievements
Rank 1
udit handa
Top achievements
Rank 1
Share this question
or