You did not show any code, so no one can point out where the bug is. However, I can give you the advice on what you do.
The situation is pretty typical: some piece of your code can throw an exception when it is executed by a designer, by one or another reason. You can use one simple technique for two purposes at the same time: 1) to pin-point the problem, 2) to avoid it. Look at the property
System.Windows.Forms.Control.DesignMode
:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control%28v=vs.110%29.aspx[
^].
Start putting the pieces of your code under the "if" block, such as
if (!myControl.DesingMode)
{
}
if (!myForm.DesingMode)
{
}
As adding this check does not modify the behavior during the execution of your application, it won't be broken. At the same time, some code which causes the problem under the designed will be eliminated from the execution. This is just the idea, but it works very effectively in such cases.
—SA