Vanishing Controls when changing from Debug to Release

  • Thread starter Thread starter Andrew Ducker
  • Start date Start date
A

Andrew Ducker

I have a project with a variety of forms in it. The controls on those
forms are from another project in the same solution.

When I change from Debug to Release, I can do a build just fine (and
the built project runs just fine too), but if I open one of the forms
up in the IDE to edit it visually, it complains that it can't find the
controls.

Going into the code, and checking with "Go To Definition" confirms that
it _can_ find the definition, and as I said, it compiles just fine.
It's just the visual editing that goes strangely askew.

Anyone encountered this one before?

Andy D
 
We've experienced the same problems with Visual Studio 2003 because we could
not reproduce it and since it only happened once in a while we never figured
out what the problem was. Altough we believed that it had to do with the
combination of SourceSafe and checking out/in resource files.

Gabriel Lozano-Morán
 
It could well be to do with version control - we're using CVS here, and
it wouldn't surprise me if there was an odd glitch going on.

Thank goodness for version control though - if the controls go missing
I can just uncheckout the form and revert to the version on the server.
 
Andrew,

This problem has been seen by a lot of folks including myself. Here are
some notes that I keep on the subject:

There is supposedly a fix from Microsoft (see Article 842706):
FIX: Controls disappear from the Windows Forms Designer in Visual Studio
..NET 2003
http://support.microsoft.com/default.aspx?scid=KB;EN-US;842706

Other Notes:
- Make sure the form's tab is not visible and move the forms constructor to
the very top of the form class. Yes, above the field declarations as well.
Afterwards, recompile the solution and view the form.

- If the control has never been compiled for either debug or release, make
sure that the from tab is not visible when you switch your build option from
debug to release or vice versa if the control has never been built for the
target build type. At any rate, rebuild the solution for the new target
build option and then you can open your form.

- It also seems like some folks don't take into consideration what custom
controls are doing at design time in the IDE and should consider using the
this.DesignMode property inside of constructors and paint methods to avoid
creating stuff and using objects that aren't really used at design time.

- To avoid having to retrieve code from source control to restore, consider
turning off the auto-save before building options (Tools->Options->Build and
Run options). Yes, you may have to manually save sometimes to see your
changes before building and running. Sometimes you don't...haven't figured
that one out.....

- Finally, the one that I have seen work a few times.... Open a form with
problems, move a few things around, close the form and DO NOT save, reopen
the form and the controls are back in place. Don't ask me why....Microsoft
has some bugs that I hope they have fixed in 2.0.


Have fun,
Dave
 
Andrew said:
I have a project with a variety of forms in it. The controls on those
forms are from another project in the same solution.

When I change from Debug to Release, I can do a build just fine (and
the built project runs just fine too), but if I open one of the forms
up in the IDE to edit it visually, it complains that it can't find the
controls.

Going into the code, and checking with "Go To Definition" confirms that
it _can_ find the definition, and as I said, it compiles just fine.
It's just the visual editing that goes strangely askew.

Anyone encountered this one before?

Andy D

Andy,
I presume that you're using VS2002 or VS2003. I had a horrific time with
the designer eating my forms as well. Its voracious appetite seemed to
stem from my use of visual inheritance and custom controls. I've lost
many hours of work to this annoying bug and finally found a workaround--
its a little more time consuming, but sure beats redesigning a whole
form. Check out these URL's for the details:

http://www.shawnburke.com/default.aspx?document=183&userinterface=9
http://spaces.msn.com/members/mwadams/Blog/cns!1pAMOzaH98ZfHK1uhQS5Bd5g!111.entry

The good I've started using VS2005 Beta 2 and the form designers
appetite seems to have been satiated for the time being :)

Good luck.
-DS
 
Back
Top