Workaround for BindingSource designer error

Posted Thu, Oct 13 2005 1:22 by bill

When working with a Windows.Forms application in Visual Studio 2005 (Whidbey), you may encounter a strange error when you try to open a form or control that has data binding using the new Bindingsource components.  The error usually reads like :

One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.

Type must be a type provided by the runtime. Parameter name: type 

at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.Windows.Forms.SecurityUtils.SecureCreateInstance(Type type, Object[] args)
at System.Windows.Forms.BindingSource.CreateBindingList(Type type)
at System.Windows.Forms.BindingSource.GetListFromType(Type type)
at System.Windows.Forms.BindingSource.ResetList()
at System.Windows.Forms.BindingSource.EnsureInnerList()
at System.Windows.Forms.BindingSource.System.ComponentModel.ISupportInitialize.EndInit()

An easy way to work around this problem is to close the form or control designer, open the data sources window, then open the form or control designer again.  The problem only occurs when you try to open a form or control designer and you haven't had the Data Sources window open in that project since you last opened it.

So the solution is simple, just open the data sources window if you come across this error.

Filed under: ,


# Unable to Edit Form in Designer

Wednesday, February 22, 2006 7:15 AM by In the Minority (Ken Getz)

Speaking of Bill McCarthy, he also solved another recent problem for me, inadvertently.
I recently wrote...