public virtual IComponent CreateInstance(Type type, string name) { IComponent c = null; try { VPLUtil.SetupExternalDllResolve(Path.GetDirectoryName(type.Assembly.Location)); } catch { } try { if (_loaderHost == null) { c = (IComponent)Activator.CreateInstance(type); } else { c = _loaderHost.CreateComponent(type, name); //VPLUtil.FixPropertyValues(c); } if (c != null) { VPLUtil.FixPropertyValues(c); } else { MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "Cannot create design time instance for type [{0}], name:[{1}]", type.AssemblyQualifiedName, name), "Load design object"); } } catch (Exception err) { MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "Cannot create design time instance for type [{0}], name:[{1}]. Error:{2}", type.AssemblyQualifiedName, name, err.Message), "Load design object"); throw; } finally { VPLUtil.RemoveExternalDllResolve(); } return(c); }