DesignMode property doesn't behave as anticipated - by Jonathan Dyke

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


4
0
Sign in
to vote
ID 309922 Comments
Status Closed Workarounds
Type Bug Repros 4
Opened 11/12/2007 5:53:30 PM
Duplicates 314048 Access Restriction Public

Description

The DesignMode property is frequently used to prevent the designer from running code the should only be executed at runtime. This works fine for both forms and user controls. 

After adding a usercontrol to a form, the story changes. Opening the form in the IDE continues to produce the expected behavior, however the usercontrol now behaves as if it is runtime. The code that is supposed to be runtime-only is now executing in the designer anyway. This can lead to a number of performance issues and bizarre IDE errors, particularly when the code accesses a database (and has to wait for a connection to timeout) or tries to access an object (that may or may not have been instantiated).

Restructuring the code is always an option, however this type of code is almost impossible to find unless it does something that is either time consuming or error-prone at runtime. Most developers would simply overlook it as the cause of their IDE crashes because of the designmode block anyway.
Sign in to post a comment.
Posted by Microsoft on 5/27/2008 at 8:51 PM
Thanks for your feedback on the .NET Framework!

We are able to reproduce this issue in our environment and consider rolling in a fix to this issue in next release.

Many customers have found it useful to discuss issues like this in the forums (http://forums.microsoft.com/msdn/default.aspx?siteid=1) where Microsoft and other members of the community can suggest workarounds.

Please keep the feedback comming.

Thanks,
UIFx Team
Posted by Jonathan Dyke on 11/14/2007 at 8:29 AM
Thanks to Stephan Smetsers for the work-around. After overriding the designmode property in my base usercontrol to implement his code, everything behaves as expected.
Posted by Microsoft on 11/13/2007 at 8:01 PM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Posted by Microsoft on 11/13/2007 at 5:50 PM
Thank you for your feedback. We are currently investigating. The investigation process normally takes 7-14 days. If this issue is urgent, please contact support directly (see http://support.microsoft.com).

If at any time your issue is closed unsatisfactorily, you may edit your issue via Connect and change the status to “Active.”

Thank you,
Visual Studio Product Team