Crash during closing

Posted by: philippe.berhin on 11 August 2021, 9:44 am EST

  • Posted 11 August 2021, 9:44 am EST

    Hi

    since version 2021v1, I have users getting occasionally crash while closing screen. Some of the crash logs were referring to one Error during Icon.Dispose(). This has been solved by setting the ShowIcon to false for all forms.

    But some still got the following error during when closing the form.

    This has been observed for different forms within the application

    I saw this error also with another application that has been upgraded to 2021v1.

    There was no code changes

    Exception classes:

    System.NullReferenceException

    Exception messages:

    Object reference not set to an instance of an object.

    Stack Traces:

    at C1.Win.C1Command.MenuCommandAddIn.OnPopDown(Boolean restoreActive)

    at C1.Win.C1Command.C1CommandMenu.C1.Win.C1Command.IBarInternal.PopDown(Boolean restoreActive)

    at C1.Win.C1Command.C1DockingTab.Dispose(Boolean disposing)

    at System.ComponentModel.Component.Dispose()

    at System.Windows.Forms.Control.Dispose(Boolean disposing)

    at System.Windows.Forms.Form.Dispose(Boolean disposing)

    at C1.Win.Ribbon.C1RibbonForm.Dispose(Boolean disposing)

    at Capture.Throughput.Dispose(Boolean disposing) in C:\Users\berhipn\Documents\Visual Studio 2019\Projects\Capture - DxData\Throughput.designer.cs:line 20

    at System.Windows.Forms.Form.WmClose(Message& m)

    at C1.Win.Ribbon.C1RibbonForm.WndProc(Message& m)

    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  • Posted 12 August 2021, 1:03 am EST

    Hi,

    We have not seen this issue at our end, could you please provide the following information so that we can investigate this further at our end.

    • Are you facing this issue specifically on RibbonForms?
    • Do you face the issue on forms where you have used a specific C1 control?
    • Could you please share a stripped-down sample project where you faced this issue?

    Regards

    Avnish

  • Posted 12 August 2021, 11:01 am EST

    The issue was never seen before the 2021v1. And no new components were added. Usually use flexgrid, ribbon, splitcontainer, inputpanel, treeview, c1Checklist, flexchart, report…

    I am unfortunately not be able to give you a sample as the issue is not easy to reproduce. Personally, I only had one or two times but a few users get it quite often. This is not related to a single form.

    As mentioned previously, I had a similar error appearing when the form was closed. This one was related to an Icon.Dispose(). Changing the ShowIcon property of the form to false solved the issue. I observed the issue when the form was maximized when closed

  • Posted 13 August 2021, 12:56 am EST

    Hi,

    We have escalated this issue to the development team to get their insights into the issue.

    We will let you know when we have an update.

    [Internal Tracking ID: C1WIN-25452]

    Regards

    Avnish

  • Posted 27 September 2021, 4:46 pm EST

    It’s also happening at one of my customers as well. Always a C1RibbonForm form, always on close, always a NullReferenceException happening in the PopDown routine. Always uncaught because of course it’s not going to be caught by us, since it’s triggered from the generic Dispose routine for the form.

    Object reference not set to an instance of an object. 9/25/2021 @ 10:31 AM: By completecash\6mile @ UnhandledThreadExceptionHandler: System.NullReferenceException: Object reference not set to an instance of an object.

    at C1.Win.C1Command.MenuCommandAddIn.OnPopDown(Boolean restoreActive)

    at C1.Win.C1Command.C1CommandMenu.C1.Win.C1Command.IBarInternal.PopDown(Boolean restoreActive)

    at C1.Win.C1Command.C1ContextMenu.CloseContextMenu()

    at C1.Win.C1Command.C1DockingTab.Dispose(Boolean disposing)

    at System.ComponentModel.Component.Dispose()

    at System.Windows.Forms.Control.Dispose(Boolean disposing)

    at System.Windows.Forms.Form.Dispose(Boolean disposing)

    at C1.Win.Ribbon.C1RibbonForm.Dispose(Boolean disposing)

    at StoreFront.frmPawnLoan.Dispose(Boolean disposing) in C:\Users\TimAndrews\source\repos\completecash\StoreFront\frmPawnLoan.Designer.vb:line 13

    at System.Windows.Forms.Form.WmClose(Message& m)

    at System.Windows.Forms.Form.WndProc(Message& m)

    at C1.Win.Ribbon.C1RibbonForm.WndProc(Message& m)

    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Add me to contact for when you have an update or if you want some code to look at.

  • Posted 27 September 2021, 4:54 pm EST

    Oh, and it’s been happening to our client for over a year. Might have to remove all C1 menus to make it stop doing that, our other applications don’t use C1 menus and don’t have this issue.

  • Posted 28 September 2021, 1:02 am EST - Updated 3 October 2022, 10:50 pm EST

    Hi,

    Could you please let us know what version of C1 are you using?

    The dev team has added some additional checks for null in the 2021 v2 hotfix build. (version 520). Please update to the 21v2 HF and let us know if the issue persists.

    Please refer to the GIF attached showing how to install a hotfix update.

    Regards

    Avnish

  • Posted 28 September 2021, 4:42 am EST

    Hi

    I have installed the hotfix. Hopefully, program is not validated yet. I currently have more or less 100 beta users . I will update the setup and checks if problem still occur or not. I will let you know the outcome

    Thanks

    Note : this may be subject to another topic :

    I use some icon (in the ribbon) to indicates the current status of queries. Currently the icon is updated simply by using something like

    RBDeviceId.SmallImage = Resources.querywaiting;

    After the patch, icons are still updated but they are all black !!

  • Posted 28 September 2021, 6:47 am EST

    Ok

    Using IconSet.Clear() IconSet.Add() solves the issue

    Just wondering why the previous method is not working anymore

  • Posted 29 September 2021, 3:54 am EST

    Sorry for hijacking this thread…

    I found the NullReferenceException a few times in our bug tracker, too - thanks for the fix.

    I also found two other (similar?) crashes with “ObjectDisposedException” in “OnPopDown”. Are they fixed, too?

    first one:

    
    Exception-Type: System.ObjectDisposedException
    
    ExceptionTrace: Message: Auf das verworfene Objekt kann nicht zugegriffen werden.
    Objektname: "MenuPopup".
    
    StackTrace:
       bei System.Windows.Forms.Control.CreateHandle()
       bei System.Windows.Forms.Form.CreateHandle()
       bei C1.Win.C1Command.MenuPopup.CreateHandle()
       bei System.Windows.Forms.Control.get_Handle()
       bei System.Windows.Forms.Control.ControlAccessibleObject..ctor(Control ownerControl)
       bei C1.Win.C1Command.CommandMenuAccessibleObject..ctor(Control menuForm, IBarInternal bar)
       bei C1.Win.C1Command.MenuPopup.CreateAccessibilityInstance()
       bei System.Windows.Forms.Control.get_AccessibilityObject()
       bei C1.Win.C1Command.C1CommandStack.Pop()
       bei C1.Win.C1Command.MenuCommandAddIn.OnPopDown(Boolean restoreActive)
       bei C1.Win.C1Command.C1CommandMenu.C1.Win.C1Command.IBarInternal.PopDown(Boolean restoreActive)
       bei C1.Win.C1Command.BarAddIn.PopDownAll(Boolean restoreActive)
       bei C1.Win.C1Command.MessageHandler.HandleMessage(Message& m)
       bei C1.Win.C1Command.MessageHandler.PreFilterMessage(Message& m)
    
    

    second one:

    
    Exception-Type: System.ObjectDisposedException
    
    ExceptionTrace: Message: Auf das verworfene Objekt kann nicht zugegriffen werden.
    Objektname: "MenuPopup".
    
    StackTrace:
       bei System.Windows.Forms.Control.CreateHandle()
       bei System.Windows.Forms.Form.CreateHandle()
       bei C1.Win.C1Command.MenuPopup.CreateHandle()
       bei System.Windows.Forms.Control.get_Handle()
       bei System.Windows.Forms.Control.ControlAccessibleObject..ctor(Control ownerControl)
       bei C1.Win.C1Command.CommandMenuAccessibleObject..ctor(Control menuForm, IBarInternal bar)
       bei C1.Win.C1Command.MenuPopup.CreateAccessibilityInstance()
       bei System.Windows.Forms.Control.get_AccessibilityObject()
       bei C1.Win.C1Command.C1CommandStack.Pop()
       bei C1.Win.C1Command.MenuCommandAddIn.OnPopDown(Boolean restoreActive)
       bei C1.Win.C1Command.C1CommandMenu.C1.Win.C1Command.IBarInternal.PopDown(Boolean restoreActive)
       bei C1.Win.C1Command.C1DockingTab.Dispose(Boolean disposing)
       bei System.ComponentModel.Component.Dispose()
       bei System.Windows.Forms.Control.Dispose(Boolean disposing)
       bei System.ComponentModel.Component.Dispose()
       bei System.Windows.Forms.Control.Dispose(Boolean disposing)
       bei System.ComponentModel.Component.Dispose()
       bei System.Windows.Forms.Control.Dispose(Boolean disposing)
       bei HG.Kokos_event.PeMKBB.Gui.Termin.Produktionen.ControlProduktionBearbeiten.Dispose(Boolean disposing) in F:\PeMDispo\REL\HG.Kokos_event.PeMKBB.Gui\Termin\Produktionen\ControlProduktionBearbeiten.cs:Zeile 451.
       bei System.ComponentModel.Component.Dispose()
       bei System.Windows.Forms.Control.Dispose(Boolean disposing)
       bei System.Windows.Forms.Form.Dispose(Boolean disposing)
       bei C1.Win.C1Ribbon.C1RibbonForm.Dispose(Boolean disposing)
       bei com.hg.tools.applicationbase.Guiwin.C1RibbonWrapper.HGRibbonFormBaseEmpty.Dispose(Boolean disposing) in F:\Tools\REL\DLLs\HGApplicationBaseGuiwinCSharp\C1RibbonWrapper\HGRibbonFormBaseEmpty.cs:Zeile 412.
       bei com.hg.kokos_event.disposition.gui.RibbonFormDispoBase.Dispose(Boolean disposing) in F:\PeMDispo\REL\Dispo\DispositionCoreGUI\RibbonFormDispoBase.Designer.cs:Zeile 43.
       bei System.Windows.Forms.Form.WmClose(Message& m)
       bei com.hg.tools.applicationbase.Guiwin.C1RibbonWrapper.HGRibbonFormBaseEmpty.WndProc(Message& m) in F:\Tools\REL\DLLs\HGApplicationBaseGuiwinCSharp\C1RibbonWrapper\HGRibbonFormBaseEmpty.cs:Zeile 931.
       bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    
    

    Best regards

    Wolfgang

  • Posted 29 September 2021, 4:34 am EST

    Philippe, thanks for posting the issue with monochrome images - our app was migrated from the old ribbon and thus contains a lot of “SmallImage”/“LargeImage” calls. Fortunately, I read your post before noticing the problem. This made the shock a bit smaller ;-).

    The problem is that the property "RibbonIconItem.ShowAsMonochrome " is set to “Always” now.

    Here is a workaround:

    In “OnLoad” of the forms, call this method “WorkaroundRibbonIcons”:

    
        private void WorkaroundRibbonIcons()
        {
          C1Ribbon ribbon = this.GetRibbon();
    
          foreach (RibbonTab tab in ribbon.Tabs)
          {
            foreach (RibbonGroup group in tab.Groups)
            {
              WorkaroundRibbonIcons(group.Items);
            }
          }
    
          //application menu
          WorkaroundRibbonIcons(ribbon.ApplicationMenu.LeftPaneItems);
          WorkaroundRibbonIcons(ribbon.ApplicationMenu.RightPaneItems);
          WorkaroundRibbonIcons(ribbon.ApplicationMenu.BottomPaneItems);
    
          //Config toolbar:
          WorkaroundRibbonIcons(ribbon.ConfigToolBar.Items);
        }
    
        private void WorkaroundRibbonIcons(RibbonItemCollection _items)
        {
          foreach (RibbonItem item in _items)
          {
            if (item is RibbonIconItem itemWithIcon)
            {
              foreach (C1Icon i in itemWithIcon.IconSet)
              {
                if (i is C1BitmapIcon bicon)
                {
                  bicon.ShowAsMonochrome = ShowAsMonochrome.Never;
                }
              }
            }
    
            //Child items of menu or split button:
            if (item is RibbonDropDownBase itemDropDown)
            {
              WorkaroundRibbonIcons(itemDropDown.Items);
            }
          }
        }
    
    

    Best regards

    Wolfgang

  • Posted 29 September 2021, 10:30 am EST

    Add Wolfgang

    Thanks for the tip

    I will use it next time

    Yesterday I changed all lines control.smallImage = Resources.xx by

    control.IconSet.Clear()

    control.IconSet.Add(xxx)

    Philippe

  • Posted 30 September 2021, 3:01 am EST

    Hi Wolfgang,

    We have forwarded the stack traces you provided to the dev team and asked if the same has been fixed.

    Regarding the Icon issue, we could also see the issue at our end. We have escalated it to the dev team. In the meantime, the workaround you suggested can be used.

    We will let you know as soon as we have an update.

    [Tracking ID : C1WIN-25772]

    Regards

    Avnish

  • Posted 30 September 2021, 6:12 am EST

    Hi Wolfgang,

    According to the dev team, your issues also should be fixed.

    If you face any issues again, please let us know.

    Regards

    Avnish

  • Posted 1 October 2021, 4:01 am EST

    Hi Avnish,

    thanks for the feedback.

    Best regards

    Wolfgang

  • Posted 9 December 2021, 5:12 am EST

    I can confirm that the issue with monochrome icons was fixed in .532.

    Best regards

    Wolfgang

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels