We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Runtime error

I''m getting the following runtime error and I have no idea why. "An unhandled exception of type ''System.InvaliOperationException'' occurred in syncfusion.grid.windows.dll Additional Information: Recursive call detected. When accessing grid cell objects from a QueryCellInfo event handler make sure you do not recursively access the same cell." Has anyone seen this before? How can I detect if my app is recursively accessing the same cell? Thanks.

5 Replies

AD Administrator Syncfusion Team November 2, 2005 05:55 PM UTC

In QueryCellInfo, e.RowIndex and e.ColIndex point to the cell whose style is being queried. This means inside QueryCellInfo, you cannot try to look up the same cell using an indexer on the grid (for example). So, code like grid[r.RowIndex, e.ColIndex] inside QuerycellInfo would show this problem. If you need to get the style at e.RowIndex, e.ColIndex inside QueryCellInfo, check e.Style itself.


AD Administrator Syncfusion Team November 2, 2005 08:46 PM UTC

I don''t seem to doing that in my event handler. Is there any other way this can happen?


AD Administrator Syncfusion Team November 2, 2005 10:33 PM UTC

Can you post the code in your QueryCellInfo handler?


AD Administrator Syncfusion Team November 3, 2005 03:53 PM UTC

Does this apply only to using both the row and col indexes or can it happen if you access either one? If I''m accessing the ColIndex or RowIndex (for any use) while in the event handler, this recursive error will be raised? Can it be raised if multiple threads are calling this event handler at the same time? The error occurs when the grid''s ColWidths.ResizeToFit method is being called. ColWidths.ResizeToFit calls the QueryCellInfo event handler, raisng the error from time to time. >In QueryCellInfo, e.RowIndex and e.ColIndex point to the cell whose style is being queried. This means inside QueryCellInfo, you cannot try to look up the same cell using an indexer on the grid (for example). So, code like grid[r.RowIndex, e.ColIndex] inside QuerycellInfo would show this problem. If you need to get the style at e.RowIndex, e.ColIndex inside QueryCellInfo, check e.Style itself.


AD Administrator Syncfusion Team November 3, 2005 04:14 PM UTC

It only applies when you are trying to get the exact cell. It is ok to access other cells in the same row or column, just not the cell pointed to by e.RowIndex, e.ColIndex (in some manner). >>Can it be raised if multiple threads are calling this event handler at the same time? Like all Windows Forms Controls, the grid is not thread safe. You can only access the grid on the thread that created it. If QuerycellInfo is being raised on some other thread, then this will not work and will cause many kinds of wierd problems. You need to do a grid.InvokeRequired check at the top of the QueryCellInfo event code. If it comes back true, then you need to call grid.Invoke to invoke the event handler on teh grid''s thread. These gird.InvokdeRequired checks would have ot be used in any code that might be accessed on a different thread than the thread that created the grid.

Loader.
Live Chat Icon For mobile
Up arrow icon