AD
Administrator
Syncfusion Team
April 20, 2004 11:43 AM UTC
> 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