<p>I am getting some errors thrown in my code when I open a Windows Forms form in Visual Studio's designer. I would like to branch in my code and perform a different initialization if the form is being opened by designer than if it is being run for real. </p>

<p>How can I determine at run-time if the code is being executed as part of designer opening the form?</p>

```
```
System.Diagnostics.Debugger.IsAttached
```
```