[Mono-bugs] [Bug 446341] New: System. ArgumentException raised eventually on control with double buffering

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 18 19:48:49 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=446341


           Summary: System.ArgumentException raised eventually on control
                    with double buffering
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Drawing.
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: bsd at cs.ubc.ca
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


I'm using MacOS X 10.5 running Mono 2.0.1 as from the binary package on
go-mono.com.

I have a chess game written as a .NET application.  This game has a control to
represent a chess board, called VisualChessBoard, which is implemented as a
subclass of UserControl.  This control uses double buffering -- it looks
terrible under Windows otherwise.

I've found that the game will eventually barf with the following error:

Unhandled Exception: System.ArgumentException: A null reference or invalid
value was found [GDI+ status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] 
  at System.Drawing.Region.Exclude (Rectangle rect) [0x00000] 
  at (wrapper remoting-invoke-with-check) System.Drawing.Region:Exclude
(System.Drawing.Rectangle)
  at System.Windows.Forms.Control+DoubleBuffer.End
(System.Windows.Forms.PaintEventArgs pe) [0x00000] 
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m)
[0x00000] 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x00000] 
  at System.Windows.Forms.ScrollableControl.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.ContainerControl.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.UserControl.WndProc (System.Windows.Forms.Message& m)
[0x00000] 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x00000] 
  at System.Windows.Forms.XplatUICarbon.DispatchMessage
(System.Windows.Forms.MSG& msg) [0x00000] 
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG&
msg) [0x00000] 
  at System.Windows.Forms.Application.RunLoop (Boolean Modal,
System.Windows.Forms.ApplicationContext context) [0x00000] 
  at System.Windows.Forms.Application.Run
(System.Windows.Forms.ApplicationContext context) [0x00000] 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm)
[0x00000] 
  at RTChess.Server.ServerProgram.Main () [0x0000b] in
/Users/bsd/NECTAR/RTChess/svn-rtchess-gt2/RTChessServer/ServerProgram.cs:17 

This exception usually happens within 4 minutes, but can happen anytime from 20
seconds to 4 minutes.  We have never seen this problem under Windows.  I have
tried recompiling the source using Mono to no avail.

The double buffering is enabled both by setting the DoubleBuffered property to
true (performed by the VisualStudio designer) as well as invoking the following
code in the constructor:

           SetStyle(ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); 
            UpdateStyles();

If I disable the double-buffering by commenting out these lines, the app runs
for hours with no issues.

To help debug this, I modified mono 2.0.1's
mcs/class/System.Drawing/System.Drawing/Region.cs to spit out some debugging
information in Region.Exclude(Rectangle).  Interestingly the nativeRegion is a
null pointer.

   Region.Exclude(Rectangle) status=Ok: region=System.Drawing.Region,
nativeRegion=265536160, rectangle={X=0,Y=0,Width=528,Height=528}
   Region.Exclude(Rectangle) status=Ok: region=System.Drawing.Region,
nativeRegion=265536160, rectangle={X=0,Y=0,Width=528,Height=528}
   Region.Exclude(Rectangle) status=Ok: region=System.Drawing.Region,
nativeRegion=265536160, rectangle={X=0,Y=0,Width=528,Height=528}
   Region.Exclude(Rectangle) status=Ok: region=System.Drawing.Region,
nativeRegion=265536160, rectangle={X=0,Y=0,Width=528,Height=528}
   Region.Exclude(Rectangle) status=InvalidParameter:
region=System.Drawing.Region, nativeRegion=0,
rectangle={X=0,Y=0,Width=528,Height=528}

I have no MONO* vars (except for MONO_PATH to find my hacked System.Drawing.dll
for the above messages).


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list