C1FlexGrid crash: "RaiseAutomationEvent: Value cannot be null."

Posted by: wknauf on 15 September 2023, 2:59 am EST

  • Posted 15 September 2023, 2:59 am EST

    Worst case happened: we updated to C1 .611, and after doing the first releases, crashes happen for some users:

    System.ArgumentNullException: Message: Value cannot be null. (Parameter 'provider')
    StackTrace:
       at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationEvent(AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventArgs e)
       at C1.Win.Accessibility.UiAutomationExt.RaiseUiaEvent(IRawElementProviderSimple provider, AutomationEvent uiaEvent, AutomationEventArgs uiaArgs)
       at y.a(Int32 A_0, Int32 A_1)
       at C1.Win.FlexGrid.C1FlexGridBase.OnSelChange(EventArgs e)
       at C1.Win.FlexGrid.C1FlexGridBase.at()
       at C1.Win.FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)
       at au.a(GridChangedTypeEnum A_0)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3, Boolean A_4)
       at a6.a(GridChangedTypeEnum A_0)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at C1.Win.FlexGrid.RowCollection.b(Int32 A_0, Boolean A_1)
       ...our code that sets "Rows.Count = 0".

    The grid where it happens is some kind of list box, with only one column and no header rows, and it seems to happen when filling.

    Bad enough, it does not happen in my environment, only on the machines of my bosses (both HP tablets). The crash seems to happen only in a remote desktop session/ RemoteApp to our Azure environment.

    I see that there were some changes in “OnSelChange” since .603, so I hope you have an idea on how to fix it.

    Do you have any idea on how to work around it? Probably I have to switch back to .603.

    Best regards

    Wolfgang

  • Posted 15 September 2023, 6:22 am EST - Updated 15 September 2023, 6:27 am EST

    When looking at the code using ILSpy, I think the “null” happens here (when the grids RowCollection is empty, NULL is returned, which might become a parameter to the extension method “RaiseUiaEvent”):

    Still working on a small sample that reproduces it in our environment, but I cannot test it before monday.

  • Posted 17 September 2023, 8:27 pm EST - Updated 17 September 2023, 8:28 pm EST

    OK, I can reproduce it with a small sample in the environment of my boss.

    AutomationProviderTest.zip

    But we have no idea what software on the HP tablet of my boss is causing this problem. All other environments that we tested don’t seem to activate UI automation.

    It seems to happen only if the sample is running in a remote desktop session. Starting it directly does not cause the issue.

    To reproduce it (maybe): start the sample, first click the button “Refill”. Then double click the grid. Another refill is done, and this time the grid has focus. Here the crash might happen. The error occurs only if “ContainsFocus” is true (see “C1FlexGridBase.OnSelChange”).

    On filling, the sample also shows a messagebox with the value of the field “bw”. This seems to contain the control side of the UIAutomation, and it if is not null, the crash will occur.

    And this field pointed me to a possible workaround: it is initialized in “WndProc” for message WM_GETOBJECT (0x003D or 61 decimal). So, if I ignore this message in my own C1FlexGrid subclass, the UIAutomation is not initialized and the crash does not occur.

    Best regards

    Wolfgang

  • Posted 17 September 2023, 8:54 pm EST

    OK, you can easily reproduce the crash on your own machine when activating the windows screen narrator: https://uk.pcmag.com/windows0-2/88429/how-to-use-windows-10s-narrator-to-read-your-screen-aloud

  • Posted 17 September 2023, 11:01 pm EST

    Hi Wolfgang,

    Thanks a lot for your investigation and for providing the sample project. We were able to reproduce the issue by turning on the Windows narrator. We have reported the issue to the development team and will let you know the updates as soon as possible.

    [Internal Tracking ID: C1WIN-31097]

    Best Regards,

    Kartik

  • Posted 21 September 2023, 9:58 pm EST

    Hi Wolfgang,

    As per the development team, this is a bug. They have suggested a workaround - don’t set the number of rows to 0, just remove this code:

    c1FlexGrid1.Rows.Count = c1FlexGrid1.Rows.Fixed;

    Best Regards,

    Kartik

  • Posted 22 September 2023, 12:27 am EST

    This is not good workaround for us as we use the grid like a listbox, where it is reasonable to make it empty ;-). But I already ignored the “WM_GETOBJECT”, so that the issue does not appear any more.

    Best regards

    Wolfgang

  • Posted 25 September 2023, 7:37 am EST

    Good afternoon - I can confirm that we are having this same issue with .611 which we recently used to upgrade 65 different solutions for a client. Is this something that is going to be patched in the very near term? It’s starting to cause a lot of pain.

  • Posted 25 September 2023, 7:37 am EST

    Good afternoon - I can confirm that we are having this same issue with .611 which we recently used to upgrade 65 different solutions for a client. Is this something that is going to be patched in the very near term? It’s starting to cause a lot of pain.

  • Posted 25 September 2023, 3:24 pm EST

    Hi,

    We apologize for the inconvenience caused to you. We are getting in touch with the development team to get an update on the issue. We will let you know as soon as possible.

    Best Regards,

    Kartik

  • Posted 25 September 2023, 7:39 pm EST

    @cjb Is there any chance to apply my workaround and ignore the WM_GETOBJECT message in a C1FlexGrid subclass?

        protected override void WndProc(ref Message m)
        {
          //WM_GETOBJECT = 61 = 0x003D
          if (m.Msg == 61)
          {
            return;
          }
          base.WndProc(ref m);
        }
    

    Maybe you can also add this also to your form subclass and it will hopefully suppress UIAutomation for all child controls on the form.

    Best regards

    Wolfgang

  • Posted 25 September 2023, 10:51 pm EST

    In a perfect world, what we would want in the short term is a patched version of the C1.Win.FlexGrid.4.8.dll with the exact same assembly / version #. I’m not suggesting this be released to the wider world. This would allow us to simply overwrite the DLL in each of the 5+ dozen solutions that are currently in production at our client. This solution would allow us not to have to rebuild, re-package and re-deploy everything we’ve just recently done. It would also allow us to save some semblance of face with our client.

    In the medium term, I’d rather wait for a fully tested version of the DLL rather than employ the approach you’re suggesting. If you were to tell me that the only possible pathway forward is what you’re suggesting than we would obviously be forced to do it.

  • Posted 25 September 2023, 10:57 pm EST

    First a disclaimer - I am not from C1, just a customer. I fear there is not chance to get a hotfix patch - we will have to wait for the next patch release.

    We had the luck that all our C1FlexGrids were inherited from a single base class, so we could apply the workaround rather easy. If you have to apply it for each grid instance, this is probably no reasonable workaround.

    Is it possible for you to downgrade to the previous release, which did not contain this issue?

    Best regards

    Wolfgang

  • Posted 25 September 2023, 11:04 pm EST

    Ahh. Whoops. Sorry about that. Welcome fellow traveler. Our flexgrid usage is centralized into a single library, but any change to it implies a large re-deployment effort that I’ll need to eat in terms of time and costs. I’m trying to find a way around that, but something tells me you’re right in your analysis. These things do happen, but it sure stinks when they do.

  • Posted 27 September 2023, 6:42 pm EST

    The most recent update .620, that popped up in Nuget, does not contain a fix…

  • Posted 27 September 2023, 8:19 pm EST

    Same here during a Grd.Col = 1 operation … and only on 3 on our machines ; we are a little bit afraid as the version will be delivered in production tomorrow …

    “2023/09/28 09:46:49”;3;;"System.ArgumentNullException: Value cannot be null.

    Parameter name: provider

    at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationEvent(AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventArgs e)

    at C1.Win.Accessibility.UiAutomationExt.RaiseUiaEvent(IRawElementProviderSimple provider, AutomationEvent uiaEvent, AutomationEventArgs uiaArgs)

    at aj.a(Int32 A_0, Int32 A_1)

    at C1.Win.C1FlexGrid.C1FlexGridBase.OnSelChange(EventArgs e)

    at C1.Win.C1FlexGrid.C1FlexGridBase.au()

    at C1.Win.C1FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)

    at C1.Win.C1FlexGrid.C1FlexGrid.OnGridChanged(Object sender, GridChangedEventArgs e)

    at a5.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)

    at a5.a(GridChangedTypeEnum A_0)

    at bh.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3, Boolean A_4)

    at C1.Win.C1FlexGrid.C1FlexGridBase.set_Col(Int32 value)

    at OrfComponent.UIGrdEnhanced.DataSourceGeneric()"

  • Posted 27 September 2023, 8:56 pm EST - Updated 27 September 2023, 9:02 pm EST

    Hi,

    Problem occurs with the narrator even without a remote desktop environment.

  • Posted 27 September 2023, 11:22 pm EST

    We have found the origin ; the 3 persons have a program called “grammarly” that cause the issue.

  • Posted 28 September 2023, 2:54 pm EST

    Hi @ Everyone,

    We apologize for the inconvenience caused to you. The development team has provided an ETA for the fix i.e. the next 2023v3 release. If you need any other information, please let us know and we will discuss the same with the team.

    @Wolfgang, the builds for the 2023v2 hotfix release (.620) were already fixed before this issue was reported. Therefore, the fix could not be incorporated in this release.

    @Steven, thank you for adding to the existing information. We have informed the same to development team.

    Thanks, and Best Regards,

    Kartik

  • Posted 7 December 2023, 6:50 am EST

    I cannot reproduce the crash with Windows Narrator with .631, so I hope the initial issue (some HP tool in remote desktop sessions) is also fixed ;-).

    The changelog contains two changes that might be related, but both have different JIRA ids:

    [FlexGrid] FlexGrid did not work correctly with MS Power Automate. (Jira:C1WIN-31301)
    [FlexGrid] There was ArgumentNullException when using FlexGrid with Windows Narrator. (Jira:C1WIN-31115)

    Could you confirm that “C1WIN-31097” was also fixed in .631?

    Best regards

    Wolfgang

  • Posted 7 December 2023, 3:21 pm EST

    Hi @Wolfgang, @Cjp, @Steven,

    This issue has been fixed in the latest 2023v3 release. You can update to the latest version using ComponentOneControlPanel or directly install the latest packages through NuGet.

    @Wolfgang,

    Yes, the issue “C1WIN-31097” is the same as “C1WIN-31115” mentioned in the ChangeLog and it is fixed in the latest 2023v3 release. The issue “C1WIN-31301” you mentioned from the ChangeLog is different and it was reported in https://developer.mescius.com/forums/winforms-edition/power-automate-with-c1flexgrid

    Best Regards,

    Kartik

  • Posted 12 December 2023, 11:46 pm EST

    Hey Kartik, We have upgraded to the latest release and are still getting the error w/ narrator enabled. What is our next step?

  • Posted 13 December 2023, 5:14 pm EST

    Hi Dan,

    We tested the sample project (that was used to reproduce the issue) with the latest 2023v3(631) release and could not observe the error. We have attached the sample project for your reference. In the project. the error was earlier reproduced by double-clicking a row in the Grid.

    If you have a different implementation that still shows this issue, we request you to provide a stripped-down version of your project or update the attached project, so we can investigate further and assist you in the best way possible.

    Attachment: AutomationProviderTest631.zip

    Thanks, and Kind Regards,

    Kartik

  • Posted 14 December 2023, 2:16 am EST

    I could not reproduce it in your project but we are using .NET Framework 4.8 w/ the 4.8 controls. Can you try setting up a test project using those parameters?

  • Posted 14 December 2023, 3:38 pm EST

    Hi Daniel,

    We tested the same code in .NET Framework 4.8 w/ the 4.8 C1FlexGrid and observed similar behavior. The error was reproduced in the previous release i.e. 2023v2 hotfix (620) and is fixed in the latest 2023v3 (631) release. Please see the attached sample project for reference.

    If you have a different implementation that still shows this issue, we request you to update the attached project, so we can investigate further and assist you better.

    Attachment: AutomationProviderTest.NET48.zip

    Thanks, and Kind Regards,

    Kartik

  • Posted 17 January 2024, 10:59 pm EST - Updated 17 January 2024, 11:18 pm EST

    And here is another sample, which happens with this sequence of steps:

    AutomationProviderTest_Version3.zip

    this.c1FlexGrid1.Rows.Count = this.c1FlexGrid1.Rows.Fixed;
    this.c1FlexGrid1.Cols.Count = this.c1FlexGrid1.Cols.Fixed;
    this.c1FlexGrid1.Rows.Count = 20;
    this.c1FlexGrid1.Cols.Count = 1;

    Exception when starting the exe from Explorer:

    Value cannot be null. (Parameter 'provider') (System.ArgumentNullException)
       at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationEvent(AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventArgs e)
       at C1.Win.Accessibility.UiAutomationExt.RaiseUiaEvent(IRawElementProviderSimple provider, AutomationEvent uiaEvent, AutomationEventArgs uiaArgs)
       at y.a(Int32 A_0, Int32 A_1)
       at C1.Win.FlexGrid.C1FlexGridBase.OnSelChange(EventArgs e)
       at AutomationProviderTest611.MyFlexGrid.OnSelChange(EventArgs e) in C:\Users\wknauf\Desktop\AutomationProviderTest\AutomationProviderTest631\MyFlexGrid.cs:line 16
       at C1.Win.FlexGrid.C1FlexGridBase.as()
       at C1.Win.FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)
       at C1.Win.FlexGrid.C1FlexGrid.OnGridChanged(Object sender, GridChangedEventArgs e)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at au.a(GridChangedTypeEnum A_0)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3, Boolean A_4)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3)
       at a6.a(GridChangedTypeEnum A_0)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at C1.Win.FlexGrid.RowCollection.b(Int32 A_0, Boolean A_1)
       at C1.Win.FlexGrid.RowCollection.c(Int32 A_0)
       at C1.Win.FlexGrid.RowCollection.set_Count(Int32 value)
       at AutomationProviderTest611.Form1.c1FlexGrid1_DoubleClick(Object sender, EventArgs e) in ...\AutomationProviderTest\AutomationProviderTest631\Form1.cs:line 31
    

    Exception when starting the sample from Visual Studio:

    Value cannot be null. (Parameter 'provider') (System.ArgumentNullException)
       at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationEvent(AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventArgs e)
       at C1.Win.Accessibility.UiAutomationExt.RaiseUiaEvent(IRawElementProviderSimple provider, AutomationEvent uiaEvent, AutomationEventArgs uiaArgs)
       at y.a(Int32 A_0, Int32 A_1)
       at C1.Win.FlexGrid.C1FlexGridBase.OnSelChange(EventArgs e)
       at AutomationProviderTest611.MyFlexGrid.OnSelChange(EventArgs e) in C:\Users\wknauf\Desktop\AutomationProviderTest\AutomationProviderTest631\MyFlexGrid.cs:line 16
       at C1.Win.FlexGrid.C1FlexGridBase.as()
       at C1.Win.FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)
       at au.a(GridChangedTypeEnum A_0)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3, Boolean A_4)
       at a6.a(GridChangedTypeEnum A_0)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at C1.Win.FlexGrid.RowCollection.b(Int32 A_0, Boolean A_1)
       at AutomationProviderTest611.Form1.c1FlexGrid1_DoubleClick(Object sender, EventArgs e) in ...\AutomationProviderTest\AutomationProviderTest631\Form1.cs:line 31

  • Posted 17 January 2024, 11:26 pm EST - Updated 17 January 2024, 11:49 pm EST

    Sorry, with my previous comment I overwrote the comment that I had first created. So, this is what I wrote before:

    We found another way to reproduce the error with .631. In my original sample, I reset “Rows.Count” to “Rows.Fixed”. Here, the crash is fixed. But it still happens if “Cols.Count” is set to “Cols.Fixed”:

    this.c1FlexGrid1.Cols.Count = this.c1FlexGrid1.Cols.Fixed;  //Actually: "0"
    this.c1FlexGrid1.Cols.Count = 1;

    See attached reworked sample: start Windows Narrator, then double click in the grid to reproduce the error.

    AutomationProviderTest_Version2.zip

    The exception is:

    Starting the exe from Explorer

    System.ArgumentNullException: Value cannot be null. (Parameter 'provider')
       at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationEvent(AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventArgs e)
       at C1.Win.Accessibility.UiAutomationExt.RaiseUiaEvent(IRawElementProviderSimple provider, AutomationEvent uiaEvent, AutomationEventArgs uiaArgs)
       at y.a(Int32 A_0, Int32 A_1)
       at C1.Win.FlexGrid.C1FlexGridBase.OnSelChange(EventArgs e)
       at AutomationProviderTest611.MyFlexGrid.OnSelChange(EventArgs e) in C:\Users\wknauf\Desktop\AutomationProviderTest\AutomationProviderTest631\MyFlexGrid.cs:line 16
       at C1.Win.FlexGrid.C1FlexGridBase.as()
       at C1.Win.FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)
       at C1.Win.FlexGrid.C1FlexGrid.OnGridChanged(Object sender, GridChangedEventArgs e)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at au.a(GridChangedTypeEnum A_0)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3, Boolean A_4)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3)
       at a6.a(GridChangedTypeEnum A_0)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at C1.Win.FlexGrid.ColumnCollection.a(Int32 A_0, Boolean A_1)
       at C1.Win.FlexGrid.ColumnCollection.a(Int32 A_0)
       at C1.Win.FlexGrid.ColumnCollection.set_Count(Int32 value)
       at AutomationProviderTest611.Form1.c1FlexGrid1_DoubleClick(Object sender, EventArgs e) in ....\AutomationProviderTest\AutomationProviderTest631\Form1.cs:line 28
    

    Starting the sample from Visual Studio:

    Value cannot be null. (Parameter 'provider') (System.ArgumentNullException)
       at System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationEvent(AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventArgs e)
       at C1.Win.Accessibility.UiAutomationExt.RaiseUiaEvent(IRawElementProviderSimple provider, AutomationEvent uiaEvent, AutomationEventArgs uiaArgs)
       at y.a(Int32 A_0, Int32 A_1)
       at C1.Win.FlexGrid.C1FlexGridBase.OnSelChange(EventArgs e)
       at AutomationProviderTest611.MyFlexGrid.OnSelChange(EventArgs e) in C:\Users\wknauf\Desktop\AutomationProviderTest\AutomationProviderTest631\MyFlexGrid.cs:line 16
       at C1.Win.FlexGrid.C1FlexGridBase.as()
       at C1.Win.FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)
       at au.a(GridChangedTypeEnum A_0)
       at a6.a(C1FlexGridBase A_0, CellRange A_1, Boolean A_2, Boolean A_3, Boolean A_4)
       at a6.a(GridChangedTypeEnum A_0)
       at au.a(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
       at C1.Win.FlexGrid.ColumnCollection.a(Int32 A_0, Boolean A_1)
       at AutomationProviderTest611.Form1.c1FlexGrid1_DoubleClick(Object sender, EventArgs e) in ...\AutomationProviderTest\AutomationProviderTest631\For

    Best regards

    Wolfgang

  • Posted 18 January 2024, 1:50 am EST

    Glad you were able to reproduce it. Our app still had the problem on 2023v3 controls but I didn’t know the exact cause so we had to roll back to 2023v1. Hopefully this can be fixed in v4.

  • Posted 18 January 2024, 4:14 pm EST

    Hi @Wolfgang,

    Thank you for providing the sample project. We could reproduce the issue with the 2023v3(631) release. We have reported it to the development team for further investigation and will update you as soon as possible.

    Hi @Daniel,

    We apologize for the inconvenience caused to you. We will update the thread as soon as this issue is fixed so you can update to the latest version.

    [Internal Tracking ID: C1WIN-31097]

    Best Regards,

    Kartik

  • Posted 19 January 2024, 12:17 am EST

    @Kartik: sorry to be a bit nitpicking, but as you wrote “could reproduce the issue” instead of “issues”: did you forward the crashes from both of my replies? They seem to have different reasons.

    Best regards

    Wolfgang

  • Posted 21 January 2024, 3:58 pm EST

    Hi @Wolfgang,

    I forwarded both crashes to the developers, who confirmed these issues were fixed in the 2023v3 HF (636) release. This release is now available on NuGet and we confirmed that both issues are now fixed.

    (https://www.nuget.org/packages/C1.Win.FlexGrid/8.0.20233.636)

    @Daniel,

    These issues are fixed in the latest 2023v2 HF (636) release. This release is currently available for installation from NuGet and will be available for update from ComponentOneControlPanel in a few days.

    Thanks, and Best Regards,

    Kartik

  • Posted 25 January 2024, 7:58 pm EST

    Thanks, I can confirm that my two samples work now.

    We will meet again in about two months when we do the next release including C1 .636 - the issues only happen with the laptop of my boss :wink:

    Best regards

    Wolfgang

  • Posted 28 January 2024, 3:26 am EST

    Hi Wolfgang,

    Sure, you can take your time to test the behavior on your boss’ computer and let us know if you still face any issues.

    Best Regards,

    Kartik

Need extra support?

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

Learn More

Forum Channels