Mauro
Mauro

Reputation: 2070

Visual Studio 2010 Designer opens an empty popup

recently I was working on Windows Form Project on Visual Studio 2010, when it started to show this strange behavior. Whenever I open a windows form in designer, an empty control is created and hangs in the middle of the screen.

The only "non standard" feature I am using, I extend each control with a parent user control as following

    public partial class MainUserControl : UserControl
    {
    ...
    }
    public partial class UserControl : MainUserControl
    {
    ...
    }

StrangePopup

Any hint on how to fix?

Upvotes: 0

Views: 126

Answers (1)

Mauro
Mauro

Reputation: 2070

It is difficolt to give a comprehensive explanation on how I solved it but it does seem like one of the many designer bugs that may eventually appear when extending a user control from another user control.

By creating a simpler constructor to "trick" the designer the popup went away.

Always try to have something like

public class BaseUserControl : UserControl
{
    protected BaseUserControl(... [many params passed])
    {
        ...
    }

    protected BaseUserControl()
    {
        ...
    }
}

and avoid

protected BaseUserControl() : BaseUserControl(... [many params passed])
{
    ...
}

Upvotes: 1

Related Questions