Intermittently, our application crashes with :
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Drawing.SafeNativeMethods.Gdip.GdipDrawLineI(HandleRef graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at Infragistics.Win.DrawUtility.DrawBordersHelper(Graphics gr, Border3DSide sides, Pen leftTopPen, Pen rightBottomPen, Rectangle rect, Rectangle invalidRect, Boolean isDashedPen).......
I have attached the full stack trace.
We have used this product for many years and have never seen anything like this. It happens for multiple users, many different machines. There seems to be no pattern. Our application uses the grid, toolbars, dockmgr, etc, but nothing out of the ordinary. We have no unmanaged code and definitely are not doing anything related to drawing or GDI. Searching on google has some hits, mostly related to Pen/Brush disposal.
I have submitted this issue to support, but of course without a reproduceable example, I don't expect great results.
I was hoping someone here could give me some ideas of what the problem might be. Could our managed code be causing this?
Thanks in advance.
Scott
Scott,
Given by how it's intermittent, it sounds like it might be caused by a threading issue. Are you updating any data or doing anything that could cause the UI to be updated from another thread? If so, you will need to make sure that all code that touches the UI is marshalled back to the main thread.
-Matt
Yes, for sure there is a thread which updates the grid.
I do believe we are invoking everything properly on the gui thread (via invoke). I thought you always get the cross-threaded operation not valid exception (or something like that) if you are not properly invoking on the gui thread.
Either way, it's worth a try, I will definitely try 'unthreading' the application and see if it helps.
Thanks,