[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


https://bugzilla.novell.com/show_bug.cgi?id=368487


           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
/tmp/monobuild/build/BUILD/mono-1.2.6/mcs/class/System.Drawing/System.Drawing/Icon.cs:154 
  at System.Drawing.Icon..ctor (System.Drawing.Icon original, Int32 width,
Int32 height) [0x00000] in
/tmp/monobuild/build/BUILD/mono-1.2.6/mcs/class/System.Drawing/System.Drawing/Icon.cs:128 
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:.ctor
(System.Drawing.Icon,int,int)
  at Utilities.ResourceHandler.GetIcon (System.String name, Int32 width, Int32
height) [0x00000] in
/home/dufoli/src/monotorrent/MonoTorrent.GUI/Controller/ResourceHandler.cs:100 
  at MonoTorrent.GUI.View.MainWindow..ctor () [0x0001a] in
/home/dufoli/src/monotorrent/MonoTorrent.GUI/View/MainWindow.cs:25 
  at (wrapper remoting-invoke-with-check) MonoTorrent.GUI.View.MainWindow:.ctor
()
  at MonoTorrent.GUI.Program.Main (System.String[] args) [0x0001b] in
/home/dufoli/src/monotorrent/MonoTorrent.GUI/Program.cs:27 

//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());
    break;
default:
    // 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);
    break;

}
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