Question

I have a project in Visual Studio 2010 (converted from 2008), and I have created a User control, like this:

namespace Common.Controls 
{
    public partial class Panel_BaseMap : UserControl 
    {
        public Panel_BaseMap()
        {
            //Some properties initialization here, just like = new X();
            InitializeComponent();
        }

        private void BaseMapPanel_Load(object sender, EventArgs e) {
            //Here, a new Thread is initialized and started.
        }
    }
}

I don't have any problem with this, it is opened in Design Mode without any problem. But I have created a new UserControl that extends to the first one, like this:

using Common.Controls;
namespace BC.controls 
{
    public partial class MapPanel : Panel_BaseMap 
    {
        public MapPanel()
        {
            InitializeComponent();
        }
    }
}

Well, in the very moment I try to open this new control on design mode, Visual Studio gets totally blocked, and I have to force it to close because it doesn't respond. I have tried many things, like for example:

public MapPanel()
{
    if (!this.DesignMode)
        InitializeComponent();
}

Still blocked. I have opened a second instance of Visual Studio, then on the first one "Debug --> Attach to process --> devenv" and I have put a breakpoint on the Load method and on both constructors on the second instance. The result: both instances totally blocked.

Can anyone help me, please?

Thank you very much in advance!

Was it helpful?

Solution

Ok I've found the problem.

Some code was executed by the designer, and that code crashed the application. It was inside a try-catch, and inside the catch I logged the error with a method that tried to load an encripted file with this: Directory.GetFiles(Application.StartupPath, "*.xml"). The problem is that Application.StartupPath is not my application path, but "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.Data.ConnectionUI.xml". So, when I tried to decrypt it, it throwed another exception, that was logged with the same method... so infinite loop!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top