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

Randomly getting exception in RadTreeView.InheritTreeProperties

6 Answers 104 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
rubenhak
Top achievements
Rank 1
rubenhak asked on 03 Nov 2011, 12:46 AM
Hi,

I'm using WPF controls version 2011.2.712.35.
Randomly getting following exception below.

If there is a workaround to this exception please let me know.

Thanks,
Ruben

at Telerik.Windows.Controls.RadTreeView.InheritTreeProperties(RadTreeViewItem treeViewItem) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\RadTreeView.CommonItemContainer.cs:line 600
at Telerik.Windows.Controls.RadTreeView.PrepareContainerForDescendant(DependencyObject element, Object item, ItemsControl owner) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\RadTreeView.CommonItemContainer.cs:line 152
at Telerik.Windows.Controls.RadTreeViewItem.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\RadTreeViewItem.cs:line 1513
at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
at Telerik.Windows.Controls.TreeView.TreeViewPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\Virtualization\TreeViewPanel.cs:line 2257
at Telerik.Windows.Controls.TreeView.TreeViewPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\Virtualization\TreeViewPanel.cs:line 2309
at Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size constraint) in c:\TB\101\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TreeView\Virtualization\TreeViewPanel.cs:line 1454
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
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, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, 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, Boolean ignoreSyncCtx)
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, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
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()

6 Answers, 1 is accepted

Sort by
0
rubenhak
Top achievements
Rank 1
answered on 03 Nov 2011, 01:43 AM
Looks like the exception happens in a newly added subroutine:
private void InheritTreeProperties(RadTreeViewItem treeViewItem)
{
    treeViewItem.ExpanderStyleInherited = (treeViewItem.ParentItem != null) ? treeViewItem.ParentItem.ExpanderStyleFinal : treeViewItem.ParentTreeView.ExpanderStyle;
}

0
Petar Mladenov
Telerik team
answered on 07 Nov 2011, 01:56 PM
Hi Rubenhak,

 Could you please elaborate more on your scenario and especially the steps you perform to reproduce this exception? This way we would be better able to investigate this and advice you.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
rubenhak
Top achievements
Rank 1
answered on 07 Nov 2011, 07:44 PM
Petar,

I'm using data bound TreeView control, changed item template and item container styles.
During operations I alternate items in the tree by removing/adding items.

The exception gives an exact line when the null pointer exception happened. I've noticed
with Reflector that this particular chunk of code was introduced in recent version of controls.
Also didn't notice this kind of problem in earlier releases.

Cheers,
Ruben
0
Petar Mladenov
Telerik team
answered on 10 Nov 2011, 01:20 PM
Hello Rubenhak,

Unfortunately, we are not aware of such or similar issue in the RadTreeView which was recently introduced.
We will need your cooperation in order to detect this better. From the StackTrace you provided , we cannot see the type of Exception, is it NullReferenceException or something else ? Is it possible for you to capture a video showing how you use the RadTreeView, especially the exact steps you make which lead to the exception ? Any sample code would also be highly appreciated. Thank you in advance.

Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
rubenhak
Top achievements
Rank 1
answered on 10 Nov 2011, 07:25 PM
Hi Petar,

Yes, I was getting NullReferenceException. You can see that it provides a line number into that function.

Actually, because of this issue I downgraded to version 2010.3.1110.35 which does not have this problem. It will take some time to upgrade it back to latest version and make a screen grab, but I can assure that there is a hidden problem in TreeView control.

One more hint. Most of the time it happen when children are added/removed in node, and afterwards that particular node is getting expanded.

Cheers,
Ruben
0
Petar Mladenov
Telerik team
answered on 15 Nov 2011, 04:19 PM
Hi Rubenhak,

 We investigated this and we tried to reproduce such exception but we did not manage. We will need a runnable sample so that we could debug it and detect the problem successfully. Thank you for your understanding.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeView
Asked by
rubenhak
Top achievements
Rank 1
Answers by
rubenhak
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or