We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Activator.CreateInstance

Thread ID:

Created:

Updated:

Platform:

Replies:

1448 Oct 30,2002 08:14 AM Apr 20,2004 07:43 AM Windows Forms 1
loading
Tags: FAQ
Thomas Zueger
Asked On October 30, 2002 08:14 AM

Hi We have a problem with the dynamicly creation of winfomrs. After calling the Activator.CreateInstance method, the follwing exception will be thrown: Exception: System.Runtime.InteropServices.SEHException Message: External component has thrown an exception. Source: mscorlib at System.Reflection.Assembly.GetResource(String resourceName, UInt64& length, StackCrawlMark& stackMark, Boolean skipSecurityCheck) at System.Reflection.Assembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck) at System.Reflection.Assembly.GetManifestResourceStream(Type type, String name, Boolean skipSecurityCheck, StackCrawlMark& stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture) at System.Resources.ResourceManager.GetObject(String name) at ACAG.AppConfiguratorWinForms.DataFormResKategorie.InitializeComponent() at ACAG.AppConfiguratorWinForms.DataFormResKategorie..ctor() another exception: Exception: System.Reflection.TargetInvocationException Message: Exception has been thrown by the target of an invocation. Source: mscorlib at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at ACAG.DnxCommon.DynamicInstances.CreateDataFormOfEntryAssembly(String formTypeName) at ACAG.DnxWinControls.SelectionManager.CreateDataForm() at ACAG.DnxWinControls.SelectionManager.OnEdit(DataRow selectedRow) at ACAG.DnxWinControls.SelectionFormDataGrid.grdSelection_DoubleClick(Object sender, EventArgs e) at System.Windows.Forms.Control.OnDoubleClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Nested Exception Exception: System.BadImageFormatException Message: An attempt was made to load a program with an incorrect format. Source: AppConfiguratorWinForms at ACAG.AppConfiguratorWinForms.DataFormResKontext..ctor() This is the method to create the instance: public static IDnxDataStatusManageable CreateDataFormOfEntryAssembly(string formTypeName) { Type t = System.Reflection.Assembly.GetEntryAssembly().GetType(formTypeName); return (IDnxDataStatusManageable)Activator.CreateInstance(t); } The point is, that the exception is not thrown in general. Does anybody have the similar problem with Winforms or is the anything to know when creating dynamic instances of forms? Regards Thomas

Administrator [Syncfusion]
Replied On April 20, 2004 07:43 AM

> Hi > > We have a problem with the dynamicly creation of winfomrs. After calling the Activator.CreateInstance method, the follwing exception will be thrown: > Exception: System.Runtime.InteropServices.SEHException > Message: External component has thrown an exception. > Source: mscorlib > at System.Reflection.Assembly.GetResource(String resourceName, UInt64& length, StackCrawlMark& stackMark, Boolean skipSecurityCheck) > at System.Reflection.Assembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck) > at System.Reflection.Assembly.GetManifestResourceStream(Type type, String name, Boolean skipSecurityCheck, StackCrawlMark& stackMark) > at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) > at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) > at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) > at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture) > at System.Resources.ResourceManager.GetObject(String name) > at ACAG.AppConfiguratorWinForms.DataFormResKategorie.InitializeComponent() > at ACAG.AppConfiguratorWinForms.DataFormResKategorie..ctor() > > another exception: > Exception: System.Reflection.TargetInvocationException > Message: Exception has been thrown by the target of an invocation. > Source: mscorlib > at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) > at System.Activator.CreateInstance(Type type, Boolean nonPublic) > at System.Activator.CreateInstance(Type type) > at ACAG.DnxCommon.DynamicInstances.CreateDataFormOfEntryAssembly(String formTypeName) > at ACAG.DnxWinControls.SelectionManager.CreateDataForm() > at ACAG.DnxWinControls.SelectionManager.OnEdit(DataRow selectedRow) > at ACAG.DnxWinControls.SelectionFormDataGrid.grdSelection_DoubleClick(Object sender, EventArgs e) > at System.Windows.Forms.Control.OnDoubleClick(EventArgs e) > at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) > at System.Windows.Forms.Control.WndProc(Message& m) > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) > > Nested Exception > > Exception: System.BadImageFormatException > Message: An attempt was made to load a program with an incorrect format. > Source: AppConfiguratorWinForms > at ACAG.AppConfiguratorWinForms.DataFormResKontext..ctor() > > > This is the method to create the instance: > public static IDnxDataStatusManageable CreateDataFormOfEntryAssembly(string formTypeName) > { > > Type t = System.Reflection.Assembly.GetEntryAssembly().GetType(formTypeName); > return (IDnxDataStatusManageable)Activator.CreateInstance(t); > } > > The point is, that the exception is not thrown in general. Does anybody have the similar problem with Winforms or is the anything to know when creating dynamic instances of forms? > > Regards > Thomas

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;