Bug Report T377712
Visible to All Users

NullReferenceException when clicking a custom group located in QAT after resetting all customizations

created 9 years ago (modified 9 years ago)

We get an exception in our program that we were able to reproduce using the DevExpress DemoCenter 15.1. Please regard these steps to reproduce the issue:

* Open Sample Applications|Ribbon and Menu|Ribbon Simple Pad
* Switch style to e.g. "Office 2010"
* Open ribbon customize dialog and create a custom tab with a custom group
* Add a command to the new group (e.g. 'Save') and close customize dialog with OK
* Switch to the new ribbon tab and add the complete new _group_ to the quick access toolbar (QAT)
* Open the customize dialog again and "Reset all Customizations"
=> the custom ribbon page/group dissapear from the ribbon control but not from the QAT
=> If one now clicks the remaining group in the QAT an exception is thrown (see below)

How could we workaround this issue? I would prefer to get some code snippets from you. We work already with derived DevExpress classes so it won't be a problem to overwrite some methods if possible. We currently do not have the option to integrate a new Build of XtraBars Suite.

Regards,
Sven

************* Ausnahmetext **************
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei DevExpress.XtraBars.Ribbon.RibbonPageGroup.ShowContentDropDownCore(RibbonPageGroupViewInfo groupInfo, RibbonToolbarPopupItemLink toolbarLink)
   bei DevExpress.XtraBars.Ribbon.RibbonPageGroup.OnToolbarContentButtonClick(Object sender, ItemClickEventArgs e)
   bei DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
   bei DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
   bei DevExpress.XtraBars.BarButtonItem.OnClick(BarItemLink link)
   bei DevExpress.XtraBars.Ribbon.Internal.RibbonToolbarPopupItem.OnClick(BarItemLink link)
   bei DevExpress.XtraBars.BarItemLink.OnLinkClick()
   bei DevExpress.XtraBars.BarButtonItemLink.OnLinkClick()
   bei DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   bei DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   bei DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
   bei DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
   bei DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
   bei DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPressItem(DXMouseEventArgs e, RibbonHitInfo hitInfo)
   bei DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPress(DXMouseEventArgs e, RibbonHitInfo hitInfo)
   bei DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnMouseUp(DXMouseEventArgs e)
   bei DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnMouseUp(DXMouseEventArgs e)
   bei DevExpress.XtraBars.Ribbon.RibbonControl.OnMouseUp(MouseEventArgs e)
   bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
   bei DevExpress.XtraBars.Ribbon.RibbonControl.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Comments (1)
DevExpress Support Team 9 years ago

    Hi Sven,

    I have reproduced this behavior. I am forwarding this issue to our developers for further processing. You will receive an automatic message once the status of this ticket is changed.

    BTW, would you mind making this ticket public so that it can be available for other customers?

    Answers approved by DevExpress Support

    created 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.

      Comments (1)
      DevExpress Support Team 9 years ago

        Additional information:
        The fix for this issue will be applied in v15.2.10 of our components. If you are using earlier versions (e.g., v15.1), you can workaround this issue by creating a custom RibbonControl descendant and overriding the ApplyCustomizationSettings method as follows:

        C#
        public class MyRibbonControl : RibbonControl { protected override void ApplyCustomizationSettings(RibbonCustomizationModel model) { base.ApplyCustomizationSettings(model); CheckToolbar(); } void CheckToolbar() { if(SourceToolbar.ItemLinks.Count == 0) return; RibbonToolbarPopupItemLink[] groupLinks = Toolbar.ItemLinks.OfType<RibbonToolbarPopupItemLink>().Where(x => IsCustomGroup(x)).ToArray(); if(groupLinks.Length != 0) Array.ForEach(groupLinks, x => SourceToolbar.ItemLinks.Remove(x)); } bool IsCustomGroup(RibbonToolbarPopupItemLink groupLink) { if(groupLink.PageGroup == null || groupLink.PageGroup.Ribbon != null) return false; return true; } }

        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.