Abnormal VS2017 Winform Designer investigation

 

 Winform software development process, using visual designers greatly improving the efficiency of layout applications, today met the designer error, the following error screenshots, recording about troubleshooting process.

       Pre-written user control from the toolbox out of control after being given shots are as follows (1-1). Such errors do not exist the program is actually running. It was discovered that when vs 2017 Designer rendering controls the appearance of the default implementation of the custom control class constructor or Load method caused. So why did not actually running abnormal? 

       Thus, in the thrown point plus try catch, control checks the caller, the following screenshot (1-2), then the abnormality display such as designer (1-3). The original is loaded controls from the IDE startup directory, the environment is not the beginning of the application directory. Because the user controls rely on application startup directory configuration information and some other DLL, and configure the IDE environment these dependencies do not exist.

   Solution:

   1. At the beginning of the user such that the control configuration or the Load plus Try Catch.

   2. First the user control to reduce the dependency on the external enable the process, as some external dependencies can be transmitted by way of injection parameters.

 

Picture 1-1

 

Figure 1-2

 

Figure 1-3

 

Guess you like

Origin www.cnblogs.com/howtrace/p/11423593.html