[Mono-dev] SystemIcons.Exclamation produces an exception.

Sebastien Pouliot sebastien.pouliot at gmail.com
Sun Dec 3 11:03:30 EST 2006


Hello Caz,

On Sun, 2006-12-03 at 07:36 -0800, caz yokoyama wrote:
> Hello Sebastien,
> Thank you for improving mono. The problem was found when I tried to display
> my own gif format bitmap as an icon for my application. Do you have a plan
> to implement GetHicon()? 

That one will take a little longer. Currently Mono's Icon implementation
resides in managed code (and all other codecs are unmanaged).

The plan (see the wiki for libgdiplus) is to move this into libgdiplus
(unmanaged) like all other codecs. Once there the handle will start to
make sense (and conversion should be possible).

> I'll download mono by svn and confirm your improvement.

You may want to wait a little more as:

(a) I'll update it to use (most of) the icons mentioned by Konstantin.

(b) I also found out, by additional unit tests, that unlike the
"regular" Icon, the SystemIcons icon's can't be disposed. So I need to
fix this in our icon code too (it shouldn't be an issue for the Mainsoft
code as it looks they don't ever dispose any icons).

> Thank you again.
> -Caz Yokoyama. caz at caztech dot com
> 
> -----Original Message-----
> From: Sebastien Pouliot [mailto:sebastien.pouliot at gmail.com] 
> Sent: Saturday, December 02, 2006 5:29 PM
> To: caz yokoyama
> Cc: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] SystemIcons.Exclamation produces an exception.
> 
> Hello again,
> 
> On Sat, 2006-12-02 at 12:24 -0500, Sebastien Pouliot wrote:
> > Hello Caz,
> > 
> > The class is not implemented. The current stub just returns null for any
> > icons.
> > 
> > This makes me wonder where does SWF get it's own icons ;-) There's
> > probably some code/art sharing do be done there.
> 
> ah... MWF delegates the icons to the themes (make sense too).
> 
> I added the code to make SystemIcons works in SVN (one less
> MonoTODO :-). Right now they all return the same mono icon (at least you
> won't get an exception). I'll look for appropriate icon this week.
> 
> Thanks
> 
> > On Sat, 2006-12-02 at 08:56 -0800, caz yokoyama wrote:
> > > Has anyone ever used SystemIcons.Exclamation? It produces an exception
> > > while it works on Windows. Is this a bug or am I missing something?
> > > 
> > >  
> > > 
> > > ------------ icon.cs ----------
> > > 
> > > using System;
> > > 
> > > using System.Drawing;
> > > 
> > > using System.Collections;
> > > 
> > > using System.Drawing.Imaging;
> > > 
> > > using System.Security.Cryptography;
> > > 
> > >  
> > > 
> > > class icon
> > > 
> > > {
> > > 
> > >             public static void Main () {
> > > 
> > >                         Icon aaa = new Icon(SystemIcons.Exclamation,
> > > 40, 40);
> > > 
> > >                         Console.WriteLine("Hello World");
> > > 
> > >             }
> > > 
> > > }
> > > 
> > >  
> > > 
> > > -------------- log ---------
> > > 
> > > [caz at localhost icon]$ mcs -debug  -r:System.Drawing.dll icon.cs
> > > 
> > > icon.cs(10,8): warning CS0219: The variable `aaa' is assigned but its
> > > value is never used
> > > 
> > > Compilation succeeded - 1 warning(s)
> > > 
> > > [caz at localhost icon]$ mono --debug icon.exe
> > > 
> > >  
> > > 
> > > Unhandled Exception: System.NullReferenceException: Object reference
> > > not set to an instance of an object
> > > 
> > >   at System.Drawing.Icon..ctor (System.Drawing.Icon original, Size
> > > size) [0x0001f]
> > > in
> /tmp/scratch/BUILD/mono-1.2.1/mcs/class/System.Drawing/System.Drawing/Icon.c
> s:129
> > > 
> > >   at System.Drawing.Icon..ctor (System.Drawing.Icon original, Int32
> > > width, Int32 height) [0x00000]
> > > in
> /tmp/scratch/BUILD/mono-1.2.1/mcs/class/System.Drawing/System.Drawing/Icon.c
> s:122
> > > 
> > >   at (wrapper remoting-invoke-with-check) System.Drawing.Icon:.ctor
> > > (System.Drawing.Icon,int,int)
> > > 
> > >   at icon.Main () [0x00000] in /home/caz/umd/icon/icon.cs:10
> > > 
> > >  
> > > 
> > > - caz at caztech dot com.
> > > 
> > >  
> > > 
> > > 
> > > _______________________________________________
> > > Mono-devel-list mailing list
> > > Mono-devel-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-devel-list
-- 
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/




More information about the Mono-devel-list mailing list