Bug Report T293144
Visible to All Users

NullReferenceException is raised in Dock Layout Manager when a panel is removed in the DockItemEndDocking event handler

created 9 years ago

Hi, Dear DevExpress Support:

Out team updated the version of  DevExpress from 11.2.14 to 15.1.6.0, and we found a new problem  in  the DockLayoutManager.

Firstly, please check the ticket  "T219581  The CPU usage is greater on mouse over if the DockLayoutManager is used".  Finally , we got a workaround [dxSample.zip]  from Andrey Marten, which resovled our problem successfully. But now, after updated to 15.1.6.0, a error happened when I want to drag and drop the top-left  tab in the DockLayout.

The  codes are:

C#
void RootUIElementMouseMove(object sender, MouseEventArgs e) { if(DockPane.GetHitTestType(e.OriginalSource as DependencyObject) != DevExpress.Xpf.Docking.Base.HitTestType.ControlBox) return; OnMouseMove(EventArgsHelper.Convert(RootUIElement, e)); }

And the error info is:

System.NullReferenceException: Object reference not set to an instance of an object.
   at DevExpress.Xpf.Docking.Platform.TabHeaderInsertHelper.GetIntervals(ILayoutContainer container)
   at DevExpress.Xpf.Docking.Platform.TabHeaderInsertHelper…ctor(IDockLayoutContainer container, Point point, Boolean canInsertAfterAll)
   at DevExpress.Xpf.Docking.Platform.LayoutViewReorderingListener.InsertionHelper.Update(DockLayoutElementDragInfo dragInfo, Boolean isStartedAsReordering)
   at DevExpress.Xpf.Docking.Platform.LayoutViewReorderingListener.InsertTabPageCore(DockLayoutElementDragInfo dragInfo)
   at DevExpress.Xpf.Docking.Platform.LayoutViewReorderingListener.OnDragging(Point point, ILayoutElement element)
   at DevExpress.Xpf.Layout.Core.Dragging.DragServiceState.DoDragging(IView view, Point point, OperationType type)
   at DevExpress.Xpf.Layout.Core.Dragging.DragServiceState.DoDragging(IView view, Point point)
   at DevExpress.Xpf.Layout.Core.Dragging.ReorderingDragServiceState.ProcessMouseMove(IView view, Point point)
   at DevExpress.Xpf.Layout.Core.Dragging.DragService.ProcessMouseCore(IView processor, Point screenPoint, MouseEventType eventType, MouseEventArgs e)
   at DevExpress.Xpf.Layout.Core.Dragging.DragService.ProcessMouseOverride(IView view, MouseEventType eventType, MouseEventArgs ea)
   at DevExpress.Xpf.Layout.Core.UIService.ProcessMouse(IView view, MouseEventType eventType, MouseEventArgs ea)
   at DevExpress.Xpf.Layout.Core.Platform.ViewAdapter.ProcessMouseEvent(IView view, MouseEventType eventType, MouseEventArgs ea)
   at DevExpress.Xpf.Layout.Core.Platform.BaseView.OnMouseMove(MouseEventArgs ea)
   at CFETS.NTP.CLT.Infrastructure.Presentation.Workspace.Subscriber.RootUIElementMouseMove(Object sender, MouseEventArgs e)

Could you kindly check this for me? Thank you very much.

Show previous comments (6)
Alexander Russkov (DevExpress) 9 years ago

    Thank you for your sample project, Li. I have passed this ticket to our developers for further research. In the meantime, as a solution, you can use the BeginInvoke method in the following manner:

    C#
    Dispatcher.BeginInvoke(new Action(() => { _documentGroup.Remove(_pnlNewPanel); _documentGroup.Add(_pnlNewPanel); }));

    Thanks,
    Alexander

      Hi,Alexander Rus:
      Your solution is cool. Now the project worked with no exceptions.
      Thank you very much.

      Alexander Russkov (DevExpress) 9 years ago

        You are always welcome, Li

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Additional information:

        We've fixed this exception. However, DockItemEndDocking is raised before an item is actually docked to the corresponding group. So, to execute your code correctly, you need to use the Dispatcher.BeginInvoke method.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.