[Mono-bugs] [Bug 75694][Maj] New - Graphics.FromImage NullReferneceException

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 2 16:53:49 EDT 2005

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 mha at sollentuna.net.


--- shadow/75694	2005-08-02 16:53:49.000000000 -0400
+++ shadow/75694.tmp.20519	2005-08-02 16:53:49.000000000 -0400
@@ -0,0 +1,71 @@
+Bug#: 75694
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Slackware linux 10.1
+Status: NEW   
+Priority: Major
+Component: Sys.Drawing.
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: mha at sollentuna.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Graphics.FromImage NullReferneceException
+(mono installed using the linux installer, version
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The following program fails:
+using System;
+using System.Drawing;
+namespace t
+    public class test {
+        static void Main(string[] arg)
+        {
+            Bitmap b1 = new Bitmap(10,10);
+            Graphics gfx1 = Graphics.FromImage(b1);
+            Console.WriteLine("OK");
+        }
+    }
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00000> <unknown method>
+in (wrapper managed-to-native)
+System.Drawing.GDIPlus:GdipGetImageGraphicsContext (intptr,intptr&)
+in <0x00057> System.Drawing.Graphics:FromImage (System.Drawing.Image image)
+in <0x00036> t.test:Main (System.String[] arg)
+Expected Results:
+Pass through without exception, outputting OK.
+Copying the .EXE from Linux to a Windows XP box and running it under the MS
+.Net Framework works, as well as compiling the same source using Visual
+Studio and running it on windows. Taking the visualstudio-compiled file
+over to linux and the problem is back.
+How often does this happen? 
+Every time.
+Additional Information:
+Same problem occurs if I do new Bitmap("myfile.png") which is what I was
+actually trying to do when hitting this problem.

More information about the mono-bugs mailing list