Winform Custom Controls - Designer randomly stops initializing / calling constructor

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
This is a freaking nightmare and Im desperately needing help. Ive looked EVERYWHERE for help NOTHING has worked as a permanent fix.<br/>
<br/>
Ive got some custom controls Ive developed; controls that extend button, user control, etc. I have an issue that VS2010 constantly and randomly, with no rhyme or reason that I can discern, decides when I try and open the design view of a control which uses
the custom control that it should COMPLETELY REMOVE THE LINE which calls the constructor for the custom control from the .designer.cs file, thus completely breaking my ability to view the Design View. The application still builds and runs completely fine.<br/>
<br/>
Ive tested and ruled out the following as issues:<br/>
<br/>
1. Public constructor - evidently having a non public (internal, etc.) constructor can cause issues like this. Ive checked 100 times - ALL the custom controls have public constructors.<br/>
<br/>
2. Empty constructors - in addition to being public, it needs to be empty.<br/>
<br/>
3. No calling anything that could fail in the constructor - Ive reduced ALL constructors for custom controls to empty<br/>
<br/>
Name() { }
calls. No luck there.<br/>

4. Namespaces - evidently being in a different namespace can cause problems? Im in the same one, and the files are IN THE SAME PROJECT.<br/>
<br/>
5. Unload project. Close VS. Delete .suo intellisense file. Delete obj files. Open VS. Reload project. Rebuild project. Still no luck.<br/>
<br/>
This is INSANELY frustrating. Its to the point Im ready to throw out using custom controls and SKIN EVERY CONTROL INDIVIDUALLY BY HAND TO AVOID IT. Does ANYONE have ANY knowledge of what causes this?

View the full article
 
Back
Top