[Mono-list] Dynamically loading wx widgets

Kris Luyten kris.luyten@luc.ac.be
Wed, 17 Dec 2003 00:56:20 +0100


Hi,

I got some problems executing the following code:
======
Gtk.Application.Init();
Assembly wxAssembly = Assembly.Load("wx.NET.dll");
Type wxClassType = wxAssembly.GetType("wx.Button");
System.Object wxObject = Activator.CreateInstance(wxClassType); 
======
(small test file here:
http://lumumba.luc.ac.be/kris/projects/uiml.net/test11.cs).

This gives me: 
Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.NullReferenceException: A null value was found where an object
instance was required
in (unmanaged)
/usr/local/lib/libwx-c.so(__eq__C8wxCursorRC8wxCursor+0x9) [0x419a7bf5]
in (unmanaged)
/usr/local/lib/libwx-c.so(__as__8wxCursorRC8wxCursor+0x18) [0x419a7bd0]
....

I suppose this is caused by Wx.NET.dll, because the same code for Gtk#
works fine:
=====
Gtk.Application.Init();
Assembly gtkAssembly = Assembly.Load("gtk-sharp.dll");
Type gtkClassType = gtkAssembly.GetType("Gtk.Button");
System.Object gtkObject = Activator.CreateInstance(gtkClassType); 
=====

Anyone an idea what causes this exception?

Thanks,
Kris
-- 
Kris Luyten
email: kris.luyten@luc.ac.be
http://lumumba.luc.ac.be/kris/projects/uiml.net