Home All Groups Group Topic Archive Search About

Random ArgumentException errors

Author
14 Oct 2005 1:30 PM
risaacs99@gmail.com
Hi Everyone,

I have been getting the following error seemingly randomly in my
WinForms application.  The stack trace is:

System.ArgumentException: Invalid parameter used.
at System.Drawing.Region.GetHrgn(Graphics g)
at System.Windows.Forms.Control.GetHRgn(Region region)
at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
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)

We started getting this error when we switched to drawing border around
our buttons using regions.

Is this a known issue?  Is there anything in particular I should be
looking for to resolve this issue?  If I could reproduce it
consistently then I would have a much easier time with this.

I have tried coding in some more aggressive Dispose logic with regards
to the regions, but it is difficult for me to know if I am spending
time on the right avenue of attack...

Any help would be appreciated.

Thanks,

Robert

AddThis Social Bookmark Button