I have a question related to the error on the title. Im working with c# and Visual Studio 2010.
I have a form declared as \"public class FormularioGeneral : Form\",
First I had code that referenced something a type that the designer couldn't load (for whatever reason). Then I had code in the constructor that couldn't be executed from my local laptop. I decided the best option was to move the logic to the Load event and check if the component was in DesignMode and exit if it was.
Even this wasn't enough for me as the designer still tried to JIT the type that was later down in the method, so I had to move it out to a separate method to stop that from happening. Here's basically what I ended up with:
private void userControl_Load(object sender, EventArgs e)
{
if (DesignMode) return;
Initialize();
}
private void Initialize()
{
// do your work
}
Special thanks to this SO answer which pointed me to a comment in a blog post about not accessing the DesignMode property until you're in the Load event...