Winform Custom Controls - Designer randomly stops initializing / calling constructor RRS feed

  • Question

  • This is a freaking nightmare and I'm desperately needing help. I've looked EVERYWHERE for help NOTHING has worked as a permanent fix.

    I've got some custom controls I've 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.

    I've tested and ruled out the following as issues:

    1.  Public constructor - evidently having a non public (internal, etc.) constructor can cause issues like this. I've checked 100 times - ALL the custom controls have public constructors.

    2.  Empty constructors - in addition to being public, it needs to be empty.

    3.  No calling anything that could fail in the constructor - I've reduced ALL constructors for custom controls to empty

     Name() { }

    calls. No luck there.

    4.  Namespaces - evidently being in a different namespace can cause problems? I'm in the same one, and the files are IN THE SAME PROJECT.

    5.  Unload project. Close VS. Delete .suo intellisense file. Delete obj files. Open VS. Reload project. Rebuild project. Still no luck.

    This is INSANELY frustrating. It's to the point I'm 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?

    Sunday, April 29, 2012 6:46 AM