C1SplitButton: Crash if UIAutomation is enabled

Posted by: wknauf on 6 September 2024, 9:21 am EST

  • Posted 6 September 2024, 9:21 am EST

    Hi C1,

    C1SplitButton crashes if a UIAutomation provider is enabled (e.g. caused by windows screen narrator, might also happen in RDP/Citrix sessions):

    Exception-Type: System.InvalidCastException
    
    Message: Unable to cast object of type 'C1.Win.Input.SplitButtonItem' to type 'C1.Win.Input.C1SplitButton'.
    
    StackTrace:
       at i.a()
       at i..ctor(bd a, dm b)
       at bd.bc()
       at fv.get_b()
       at cm..ctor(dm a, C1SplitButton b)
       at dm.ck()
       at fw.get_b()
       at fw.WndProc(Message& a)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

    Attached sample reproduces it:

    step 1: start windows screen narrator

    step 2: start the sample, drop down the split button and hover over the items. I have a global “unhandled exception” handler which shows a messagebox.

    SplitButtonTest.zip

    Some time ago, a similar problem happened with C1FlexGrid: https://developer.mescius.com/forums/winforms-edition/c1flexgrid-crash-raiseautomationevent-value-cannot-be-null

    But I cannot apply the workaround to override WndProc and ignore event “61”. My sample already contains a C1SplitButton subclass, but the issue still happens. Do you have any idea?

    Best regards

    Wolfgang

  • Posted 7 September 2024, 12:06 pm EST

    It happens only when hovering over items that have child items.

    Workaround to avoid the crash: override “WndProc” in e.g. the form that contains the C1SplitButton. If the message “WM_GETOBJECT” is received, then hide all drop down items that contain child items. Of course this means that part of the functionality is lost.

    protected override void WndProc(ref Message m)
    {
      //WM_GETOBJECT = 61 = 0x003D
      if (m.Msg == 61)
      {
        //...Hide all items with children
      }
    }
    

    Hopefully, C1 has an idea for a better workaround.

  • Posted 9 September 2024, 5:19 am EST

    Hello Wolfgang,

    Thank you for providing the details. We were able to observe the behavior as well.

    We have escalated it to the development team for their insights. Rest assured, we’ll update once we have more information.

    [Internal tracking ID: C1WIN-32912]

    Regards,

    Uttkarsh.

  • Posted 23 September 2024, 7:52 am EST

    Hello Wolfgang,

    As per the development team, the reported behavior is a bug.

    [Bug tracking ID: C1WIN-32976]

    Unfortunately, currently we neither have a workaround for this nor an ETA for the fix. Rest assured, we’ll update you once the issue’s fixed.

    Regards,

    Uttkarsh.

Need extra support?

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

Learn More

Forum Channels