[MonoDevelop] Using icons in resources

alan battersby alan.battersby at ntlworld.com
Wed Aug 5 18:03:36 EDT 2009

In my project I have a folder called icons containing several 48x48 xpm
images. I have selected each one and set to embed as resource in
property manager accepting the suggested name (which includes the folder
name) such as icons.X.xpm. 

Now adding a button to a toolbar select project icons tab in select
image menu. press add and give icon a name in edit icon dialog. Press
select image , choose resources tab,select image (say X.xpm) and see
resource name for that icon as X.xpm not the icons.X.xpm name above.
Press ok and compile and run to see the following exception
Unhandled Exception: System.ArgumentException: 'X.xpm' is not a valid
resource name of assembly.

So go back to select image menu and change resource name to icons.X.xpm,
but now image disappears off button and when I click on button to set
its icon again I get  a exception messagebox

System.NullReferenceException: Object reference not set to an instance
of an object
  at Stetic.Editor.IconSelectorItem.Expose (Boolean draw, Int32 testx,
Int32 testy, System.Int32& ix, System.Int32& iy) [0x00000]
  at Stetic.Editor.IconSelectorItem.Draw () [0x00000]
  at Stetic.Editor.IconSelectorItem.OnExposeEvent (Gdk.EventExpose ev)
  at Gtk.Widget.exposeevent_cb (IntPtr widget, IntPtr evnt) [0x00000]

When I click ok on this messagebox, Monodevelop crashes and disappears
off my screen.

So restart monodevelop and use property explorer to change the resource
name of my icon from suggested icons.X.xpm to just X.xpm and everything
fine. So moral is if you have resources in folders ignore the folder
bit.  However also that if I try to change the resource name in the
select image menu my version of monodevelop 2.0 crashes consistently.
Now I know as a newbie to this resource embedding I have been blundering
about the IDE which is generally very resilient. But Ive found in this
case it isnt, so should I report a bug or has it already been dealt
with? I had assumed that because the Resource Name entry in the select
image menu was editable this meant that I could use it to change the
resource name. If you can't then perhaps you should make this entry

This is only a minor problem in what I feel is an excellent IDE. However
this  did give me a couple of hours of misery.

Keep up the good work

More information about the Monodevelop-list mailing list