[Gtk-sharp-list] Storing System.Type in a TreeStore

Gustavo Ramos eureko@grmexico.com.mx
Mon, 25 Aug 2003 05:22:54 -0500


There is a NullReferenceException that I don't caught. I am suspecting about
the System.Type I want to store in the TreeStore, it may not be supported...
or is it? Am confused, any ideas?

Regards, Gustavo


treeStore = new Gtk.TreeStore(
	typeof(string),
	typeof(string),
	typeof(Type)
);
foreach(Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
{
	Type asmType = asm.GetType();

	// Here is the error:
	TreeIter iterAsm = treeStore.AppendValues(
		asm.GetName().Name, asmType.FullName, asmType);

	foreach(Type t in asm.GetTypes())
	{
		TreeIter iterType = treeStore.AppendValues(
			iterAsm, t.Name, t.FullName, t.GetType());
		// some other processing
		// ...
	}
}

Error dump:
Unhandled Exception: System.NullReferenceException: Object reference not set
to
an instance of an object.
   at Gtk.TreeStore.gtk_tree_store_set_value(IntPtr raw, TreeIter& iter,
Int32 c
olumn, IntPtr value)
   at Gtk.TreeStore.SetValue(TreeIter iter, Int32 column, Value value)
   at Gtk.TreeStore._AppendValues(TreeIter iter, Array values)
   at Gtk.TreeStore.AppendValues(Array values)
   at Gtk.TreeStore.AppendValues(Object[] values)
   at Grmexico.Samples.MainWindow.InitStore() in
D:\Programacion\AlphaProjects\c
sharp\mysqlnet-gtk\MainWindow.cs:line 49
   at Grmexico.Samples.MySQLNetGtkApp.Main(String[] args) in
D:\Programacion\Alp
haProjects\csharp\mysqlnet-gtk\main.cs:line 13