Re: GDI+ Exception

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 10/05/04


Date: Tue, 5 Oct 2004 12:31:11 +0200

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
"Maqsood Ahmed" <maqsood_ahmed@gawab.com> wrote in message
news:epVZV7qqEHA.3848@TK2MSFTNGP14.phx.gbl...
> 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)
> ----------------------
>
>
> Maqsood Ahmed
> Kolachi Advanced Technologies
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Relevant Pages

  • Re: K Map solution
    ... >SSI and MSI chips are mostly for data paths and buffering and stuff. ... >One exception is ECL in the sub-ns range, but even then the logic is ...
    (sci.electronics.design)
  • Re: InvalidPrinterException for Print() or PrintPreviewDialog()
    ... Answer those GDI+ questions with the GDI+ FAQ ... The exception happens ... > PrintDocument pd = new PrintDocument; ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: InvalidPrinterException for Print() or PrintPreviewDialog()
    ... Answer those GDI+ questions with the GDI+ FAQ ... The exception happens ... > PrintDocument pd = new PrintDocument; ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: .NET Picturebox problems under Windows 98
    ... this is odd then because the exception suggests that the failure comes ... from the fact that the PictureBox is failing to extract the frame dimension ... Answer those GDI+ questions with the GDI+ FAQ ... It is a jpg file, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: loading, Flipping and saving jpgs
    ... It doesn't appear to be much of a wrapper for GDI+. ... As has already been pointed out it is vastly simpler than having to port the entire app over to dotnet and then worry about distributing the dotnet libraries and which versions etc, ... That Image.FromFile throws a file not found exception rather than letting the API throw that is immaterial as it is still possible for the file to be renamed or moved before the API call actually loads it. ...
    (microsoft.public.vb.general.discussion)