Some user have reported the grid font becomes large and red crosses appear in cell in the place of cell values. The application later throws an unrecoverable error, not a unhandled .NET exception.
I''m using Performance Grid in virtual mode with UseGDI and Double buffering on.
Has anyone ever reported this or similar problem? Any suggestions, ideas?
ADAdministrator Syncfusion Team August 15, 2005 05:30 PM
Red crosses suggest exceptions are being thrown during the drawing code.
Are you trying to use multiple threads? If so, you must make sure you only try to access grid methods on the thread that created the grid. One way to do this is to use grid.InvokeRequired checks to test whether you need to use a grid.Invoke to make sure the code is being executed on the grid''s thread. Here is a KB on this issue. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=78
MIMikeAugust 15, 2005 06:03 PM
I''m using multiple threads extensively.
All updates are performed using BeginInvoke. Its unlikely this problem is caused by the threading rule violations.
In addition, cells that have a control type, say, check box, turn red and the content reads "Exception".
Somehow I think the problem is related to low memory.
ADAdministrator Syncfusion Team August 15, 2005 07:41 PM
Instead of BeginInvoke, try using Invoke.
MIMikeAugust 16, 2005 04:08 PM
This would block the calling thread and is an undesirable change.
Another symptom of this problem is ALL the grids in ALL the windows start having this issue at the same time.
My code event resizes columns to fit the new font when it happens. It may have to do with weak font references and lack of system resources.
>Instead of BeginInvoke, try using Invoke.
ADAdministrator Syncfusion Team August 16, 2005 08:07 PM
You probably should be able to make it work with BeginInvoke but it does require great care.
From the time the BeginInvoke is called until the time the grid handles the call you have to make sure that the data the grid wants to draw have not become out of date.
Say for example, you insert a row, make a BeginInvoke and later delete a row and only after you delete the row the grid gets the insertion message you are in trouble. The grid will want to get the data for the inserted row which does not exist anymore and will throw an exception. You also have to consider cases where you change a cell and insert a row or if you delete rows then change cells etc.
If you can make sure that the data are in sync with what the grid is expecting them to be than BeginInvoke should work. But it is not an easy task to make sure things stay in sync.
220.127.116.11 also had a problem with checkbox cells not being threadsafe. This and also another threading problem with 18.104.22.168 with attaching to a DataSet are mentioned in forum thread http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=28722.
ADAdministrator Syncfusion Team August 29, 2005 09:59 AM
The grid updates take place within the same BeginInvoke as the repaints. This may be less efficient but takes care of the synchronization issues.
The font seems still to be a resource issue. It reminds me of old days when Windows used to use the system font when it has reached resource limits.
Is it possible that I use the QueryCellInfo in a way that it forces the grid to reallocate fonts too frequently that the system runs out of recourses? When I receive market updates I paint cells with different color. I never change the grid font which is supplied in the table style (All my styles derive from my table style). All my variety of styles is basically colors.
In the QueryCellInfo handler I just call this:
e.Style.ModifyStyle( myStyle, StyleModifyType.Override );
What do you think?
ADAdministrator Syncfusion Team August 29, 2005 10:13 AM
How/how often is myStyle being created? Are you explicitly do a new GridStyleInfo? If so, after you have finished with myStyle, are you calling myStyle.Dispose?
Unless you are cacheing new GridStyleInfo objects over and over again without disposing them, my educated guess is that you may still be seeing a threading issue.
ADAdministrator Syncfusion Team September 1, 2005 02:32 PM
The problem with enlarged fonts happens on the grids that do not use the check box.
I create myStyles only when a form opens. Then I just look it up in the QueryCellInfo and call e.Style.ModifyStyle( myStyle, StyleModifyType.Override );
Is it possible that the font problem is related to the one described here:
It’s possible that due to a bug in an MDI application references to windows/grids/fonts not being GCed so eventually the system runs out of handles…
ADAdministrator Syncfusion Team September 1, 2005 03:46 PM
The change mentioned in http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=18559 is in our current code base. You might consider trying the 3.3 code to see if it solves your porblem. 3.3 and 22.214.171.124 have different assembly names so it is usually no problem keeping both sets of libraries in the GAC. Or, if you have the source, you can try modifying it as the customer did in 18559 to see if it solves the problem you are seeing.
If you can send us a sample project showing the problem, we can test it with 3.3 here to see if it handles the issues you have. And if it does not, we can debug it to see what needs to be done.