I've been encountering an OverflowException recently within GDI+ via a 3rd party tool which is causing me a few problems. I'm trying to track down the cause of this, and then decide if there is any resolution for the problem.
The error is occuring in SafeNativeMethods.Gdip.GdipFillPath() returning an error code of 11 which is equal to GpStatus.ValueOverflow. I have no idea what this means, or what might be causing it. The consequences are quite high, because I have a large area of screen that can't be drawn.
The stack trace for this error is:
System.OverflowException: Overflow error. at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.FillPath(Brush brush, GraphicsPath path) at Northwoods.Go.GoShape.DrawPath(Graphics g, GoView view, Pen pen, Brush brush, GraphicsPath path) at Northwoods.Go.GoRoundedRectangle.Paint(Graphics g, GoView view) at Northwoods.Go.GoLayer.Paint(Graphics g, GoView view, RectangleF clipRect) at Northwoods.Go.GoView.PaintObjects(Boolean doc, Boolean view, Graphics g, RectangleF clipRect) at Northwoods.Go.GoView.PaintView(Graphics g, RectangleF clipRect) at Northwoods.Go.GoView.onPaintCanvas(PaintEventArgs evt) at Northwoods.Go.GoView.OnPaint(PaintEventArgs evt) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
There are obviously 2 parameters that are being used here. The GraphicsPath which I have no control over and the Brush. The brush is returned by a static method, and just to be sure that it's not a problem with it being Disposed I've tried changing the Brush propety to return a clone like the following. However this seems to have made no impact.
public Brush
{
get {
return MappingLinearGradient(this.Bounds).Clone();
}
}