[Mono-bugs] [Bug 56767][Wis] New - NullReferenceException in System.Drawing.Bitmap(Stream)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 9 Apr 2004 17:31:12 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mono-bug@jerryweb.info.

http://bugzilla.ximian.com/show_bug.cgi?id=56767

--- shadow/56767	2004-04-09 17:31:12.000000000 -0400
+++ shadow/56767.tmp.22306	2004-04-09 17:31:12.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 56767
+Product: Mono: Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Gentoo
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mono-bug@jerryweb.info               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException in System.Drawing.Bitmap(Stream)
+
+In the current version (downloaded from CVS 2004-04-08) of libgdiplus the
+constructor System.Drawing.Bitmap(Stream) ends by error, except the program
+is run in graphical mode (under X-windows).
+
+
+Steps to reproduce the problem:
+Compile and run the following code.
+================================================================
+using System;
+using System.IO;
+using System.Drawing;
+
+namespace Example {
+   class Class1 {
+      [STAThread]
+      static void Main(string[] args) {
+         FileStream fs = new FileStream(args[0], FileMode.Open);
+         Bitmap b = new Bitmap(fs);
+         Console.WriteLine("Width: {0}", b.Width);
+         fs.Close();
+      }
+   }
+}
+================================================================
+
+Actual Results:
+
+test src # mono ./Class3.exe 01.jpg
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required.
+in (unmanaged) /usr/X11R6/lib/libX11.so.6(XGetDefault+0x36) [0x41b782d6]
+in (unmanaged)
+/opt/mono-0.31.01//lib/libgdiplus.so(gdip_get_display_dpi+0x4d) [0x41a828bd]
+in (unmanaged) /opt/mono-0.31.01//lib/libgdiplus.so(gdip_image_init+0x49)
+[0x41a89539]
+in (unmanaged) /opt/mono-0.31.01//lib/libgdiplus.so(gdip_bitmap_init+0x22)
+[0x41a80642]
+in (unmanaged) /opt/mono-0.31.01//lib/libgdiplus.so(gdip_bitmap_new+0x2d)
+[0x41a8071d]
+in (unmanaged)
+/opt/mono-0.31.01//lib/libgdiplus.so(gdip_load_jpeg_image_internal+0x3c)
+[0x41a8e17c]
+in (unmanaged)
+/opt/mono-0.31.01//lib/libgdiplus.so(gdip_load_jpeg_image_from_stream_delegate+0x80)
+[0x41a8e6a0]
+in (unmanaged)
+/opt/mono-0.31.01//lib/libgdiplus.so(GdipLoadImageFromDelegate_linux+0xa0)
+[0x41a8a3e0]
+in <0x00055> (wrapper managed-to-native)
+System.Drawing.GDIPlus:GdipLoadImageFromDelegate_linux
+(System.Drawing.GDIPlus/StreamGetBytesDelegate,System.Drawing.GDIPlus/StreamSeekDelegate,intptr&)
+in <0x00090> System.Drawing.Bitmap:InitFromStream (System.IO.Stream)
+in <0x00056> (wrapper remoting-invoke-with-check)
+System.Drawing.Bitmap:InitFromStream (System.IO.Stream)
+in <0x0001c> System.Drawing.Bitmap:.ctor (System.IO.Stream,bool)
+in <0x00012> System.Drawing.Bitmap:.ctor (System.IO.Stream)
+in <0x00056> (wrapper remoting-invoke-with-check)
+System.Drawing.Bitmap:.ctor (System.IO.Stream)
+in <0x00069> Example.Class1:Main (string[])
+
+test src # DISPLAY=j-book:0 mono ./Class3.exe 01.jpg
+Width: 1024
+test src #