Bugzilla – Bug 419087
c'tor of System.Windows.Forms.Control has a bug
Last modified: 2008-08-23 13:28:08 UTC
Hello, this is my first bug report. I hope the description is clear. Description of Problem: I wrote a component based on System.Windows.Forms.Control. In OnPaint I create a brush an Paint a region. I wrote 3 c'tors in my component. 1 use as base c'tor System.Windows.Forms.Control() and sets Parent, Left, Top, Height, ... itself. With this base c'tor everything is okay. 2 c'tors use the System.Windows.Forms.Control(Control parent, string text, int left, int top, int width, int height) as base c'tor. With this c'tors I get an OutOfMemeoryException on creating the brush. This can always be reproduced. With best regards Simon Schäberle
Hey, We actually need a test case (a simple .cs file showing the problem). It would be great if you could cook it from your app to isolate the issue.
Created attachment 234685 [details] TestCaseSolution Here is the TestCase Solution. The Exception raises only if a Control is created in the c'tor of a form. On a Windows maschine with the .Net Framework the testcase works like expected,
We were invoking SetBounds after modifying the bounds, and as a result OnLocationChanged/OnSizeChanged are never invoked. I've commit a fix and corresponding unit tests in r111461.