We are finding that sometimes when we sort by group by columns using a custom GroupByComparer we are getting a stack overflow exception.
I am attaching a sample project to illustrate this problem with grid version 12.1.20121.2008. To reliably produce the exception, just group by Issuer, then by Parent Company. Sort by Parent Company and observe the exception. Notice that the test program adds less than 2000 rows to the grid and it is still possible to get the exception. Note that removing the following line:
tbl.Rows.Add((i / 10).ToString(), i.ToString(), (i / 100).ToString(),
1000000 - i);
allows the grid to be sorted successfully even if we add thousands more rows. I believe that the underlying sorting algorithm used in the grid may be failing for even modestly sized data sets if they are in nearly worst-case sorting order. Is there a way to avoid this exception?
Hi,
I tried this out with your sample and I am not getting any exceptions. I'm using the latest Service Release, of course, so you probably just need to update.
How to get the latest service release - Infragistics Community
Would you mind changing the For loop in Form1 from i < 100 to i < 1000 and trying again? I was experimenting with the solution and must have had it saved in a state that didn't give the exception when I sent it to you.
Okay, I am getting the exception now.
It looks like the problem is your reference to the Description property inside the GroupByComparer. Referencing this property causes the Description to be recreated, but in order to do this, the Grouping has to be completed, but the grid is in the middle of grouping, so this is causing infinite recursion.
So I don't think it's possible to reference the Description property of the GroupByRow inside the comparer.