[Mono-bugs] [Bug 78166][Wis] Changed - Image.FromFile gives ambiguous exception

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Apr 25 10:26:18 EDT 2006

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 sebastien at ximian.com.


--- shadow/78166	2006-04-22 15:14:40.000000000 -0400
+++ shadow/78166.tmp.7011	2006-04-25 10:26:18.000000000 -0400
@@ -1,16 +1,16 @@
 Bug#: 78166
 Product: Mono: Class Libraries
 Version: 1.1
+OS: unknown
 OS Details: 
 Status: NEW   
-Priority: Minor
-Component: Sys.Drawing.
+Severity: Unknown
+Priority: Wishlist
+Component: libgdiplus
 AssignedTo: peter at novonyx.com                            
 ReportedBy: scottell.lists at gmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -33,6 +33,40 @@
 in <0x0000c> System.Drawing.Image:FromFile (System.String filename)
 in <0x000fa> DrawMe:Main (System.String[] argv)
 I would expect that exception if the FromFile method not implemented.  Not
 when I pass a bad parameter.
+------- Additional Comments From sebastien at ximian.com  2006-04-25 10:26 -------
+I don't find that really ambiguous. This means the support for the
+file format isn't implemented (note that we could, in theory, produce
+an image out of a text file).
+From the source we can see that GdipLoadImageFromFile isn't complete.
+EXIF, WMF, EMF, ICON *and unkown file types* all returns
+NotImplemented, which is mapped to NotImplementedException in
+Trying the same code on a text file on MS.NET/Windows results in a
+OutOfMemoryException (which is even more ambiguous).
+That being said, gdip.h has an error code for UnknownImageFormat,
+which would be mapped to a NotSupportedException in System.Drawing.dll
+(which I find a little more appropriate, at least when we do not know
+the format).
+                case EXIF:
+                case WMF:
+                case EMF:
+-               case ICON:
+-               default: {
++               case ICON: {
+                        status = NotImplemented;
+                        break;
+                }
++               default: {
++                       status = UnknownImageFormat;
++                       break;
++               }

More information about the mono-bugs mailing list