GDI+ Exception

M

Maqsood Ahmed

Hello!
We have experienced following exception in our application that runs
over .net v1.0, I had gone through the internet to find an answer about
it but failed to do so. I had found a comment about this exception by
Mr. Bob Powell (MVP).
Now I want to know that if this problem presists in .net framework
v1.1??

---------------
System.InvalidOperationException: The object is currently in use
elsewhere.
at System.Drawing.Graphics.EndContainer(GraphicsContainer container)
at System.Windows.Forms.DibGraphicsBufferManager.ReleaseBuffer
(GraphicsBuffer buffer)
at System.Windows.Forms.GraphicsBuffer.Dispose()
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg)
at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message&
msg)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr
wparam, IntPtr lparam)
 
B

Bob Powell [MVP]

Hi, When I made my comments about this exception it was in relation to code
running on version 1.1.

My observation of a similar exception was also made using a very simple
test-case which had only standard Windows Forms controls and no third-party
components. The exception you're seeing here is due to code trying to use a
GDI+ Graphics object in two places at once, possibly due to a threading
issue or some race condition. I have noticed that very occasionally, and
unfortunately it's not repeatable otherwise I would have filed a bug report,
the standard Windows Forms double buffering scheme fails in this manner.
Manual doule buffering seems to prevent this from ever happening.

However, in the case you mention the exception is raised inside one of the
SyncFusion third-party tools and it's obvious that they use built-in double
buffering in their tools. It's unlikely that you can turn this off so you
may be stuck with the problem unless SyncFusion kow of any issues with their
grid product.

I would strongly recommend that you upgrade to .NET 1.1 with the latest
service pack in any case. It's free from Microsoft.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
M

Maqsood Ahmed

Thanx for such quick and prompt answer. I have posted this issue to
SyncFusion support forum. I hope they'll look into it ASAP.

Maqsood Ahmed
Kolachi Advanced Technologies
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top