"Red Cross" problem on MenuStrip and ToolStrip

Go To StackoverFlow.com

4

I have a piece of software that has worked fine on many machines, althoughon one machine there is a problem that appears to occur occasionaly, the MenuStrip and the ToolStrip both appear as a blank white background with a red cross over it, as a custom control would if you created a null object. This doesn't happen whilst I am debugging and I don't know how to make the problem re-occur, but it does happen. I was wondering if anyone knew what could be the problem?

Would it be the version of the .NET framework?

Thanks

2009-06-16 07:44
by ThePower


3

This is a common occurrence when there's a GDI+ problem ("The Red X of Death"). Are you doing any custom drawing in OnPaint? Or perhaps there's a graphic resource or a glyph which is corrupt or being improperly disposed of.

Edit: I've re-read your question. You seem to have this only on one of the machines. I've googled around a bit for this, and I stumbled upon this old thread. The post at the bottom suggests that there might be an issue with Virtual Memory turned off:

We did manage to solve this - we were seeing the problem on a device running XP embedded. The XPe image developer had turned off Virtual Memory and as soon as we turned it on the problem went away. I believe it is just a symptom of the system running out of memory to display the graphics (maybe particularly if you use a lot of double buffering)

Hope that helps.

2009-06-16 08:07
by Igal Tabachnik
No, I'm not doing any custom drawing, just using them as standard, I understand what you mean as i've stumbled across that when I have created custom controls in the past. Thanks for your help anyhow - ThePower 2009-06-16 08:09
Sorry, I misread your question the 1st time - Igal Tabachnik 2009-06-16 08:15
Thanks for the update and the informatio - ThePower 2009-06-16 08:35


2

Sounds like a symptom of an Out Of Memory Exception to me.

Edit: Which can sometimes lead onto a System.InvalidOperationException: BufferedGraphicsContext

2009-06-16 07:45
by Pondidum


1

Are you trying to update the GUI controls from a thread other than the GUI thread? Combine the cross thread operation with an exception handler that swallowed everything and we had the behavior you describe (on a grid control, not a menustrip bar) on an app I was maintaining.

2009-06-16 07:59
by Jason Punyon


1

Definitively sounds like a cross-thread problem.

Make sure you use Invoke when accessing controls and/or firing events from a thread that is not the main UI thread.

2009-06-16 08:08
by Dun3


1

Seeing this happen on just one computer of more than a 1000 that have our prouducts. On that one computer I am seeing a .NET 3.5 program occassionally show the red X on its datagrid. And another far simpler .NET 2.0 program got the red X on its menuStrip. I only have source code for the simpler program but I can say that there isn't any user code at all which affects that component. No cross-thread stuff because nothing updates it. It's contents are set at development time with one item added to it at program load. The Red X failure was well after program load.

I was very surprised to see the problem across two different frameworks and on one program that has no data bindings. I am very wishfully hoping that the computer has its virtual memory turned off.

If it isn't that then any guidance on system parts that are shared across .NET 2.0 and .NET 3.5 would be appreciated.

Update: The user with the problem retired the computer and replaced it (which solved the problem)

2014-03-04 19:32
by user922020
Ads