[Mono-bugs] [Bug 368487] New: Nullreference exception in icon loading

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Mar 9 03:32:56 EDT 2008


           Summary: Nullreference exception in icon loading
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: x86
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Drawing.
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: olivier.duff at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer

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)
[0x000dc] in
  at System.Drawing.Icon..ctor (System.Drawing.Icon original, Int32 width,
Int32 height) [0x00000] in
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:.ctor
  at Utilities.ResourceHandler.GetIcon (System.String name, Int32 width, Int32
height) [0x00000] in
  at MonoTorrent.GUI.View.MainWindow..ctor () [0x0001a] in
  at (wrapper remoting-invoke-with-check) MonoTorrent.GUI.View.MainWindow:.ctor
  at MonoTorrent.GUI.Program.Main (System.String[] args) [0x0001b] in

//mono.ico is in Resources.resx file
//it work on MS.NET
//name = "mono"
//width = height = 16

Icon ico;
object resObj = rm.GetObject(name);
switch (resObj.GetType().Name.ToLower())
case "bitmap":
    Bitmap bmp = (Bitmap)resObj;
    ico = Icon.FromHandle(bmp.GetHicon());
    // By default, VS shows only the 32 x 32 version
    // Use overloaded GetIcon with width and height to get a specific icon
    ico = (Icon)rm.GetObject(name);

Icon ico = new Icon(ico, width, height);

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list