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

Daniel Morgan danmorg@comcast.net
Mon, 25 Aug 2003 12:41:54 -0400

How about storing a string name of the type.


-----Original Message-----
From: gtk-sharp-list-admin@lists.ximian.com
[mailto:gtk-sharp-list-admin@lists.ximian.com]On Behalf Of Gustavo Ramos
Sent: Monday, August 25, 2003 6:23 AM
To: gtk-sharp-list
Subject: [Gtk-sharp-list] Storing System.Type in a TreeStore

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(
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
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
sharp\mysqlnet-gtk\MainWindow.cs:line 49
   at Grmexico.Samples.MySQLNetGtkApp.Main(String[] args) in
haProjects\csharp\mysqlnet-gtk\main.cs:line 13

Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com