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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=80786 --- shadow/80786 2007-02-10 14:26:10.000000000 -0500 +++ shadow/80786.tmp.27756 2007-02-10 14:26:10.000000000 -0500 @@ -0,0 +1,87 @@ +Bug#: 80786 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: Windows XP SP 2 Czech +Status: NEW +Resolution: +Severity: +Priority: Major +Component: Sys.Drawing. +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Saving Image to MemoryStream faills + +Description of Problem: +Saving System.Drawing.Image into MemoryStream throws exception. + + +Steps to reproduce the problem: +1. Create object of Image type +2. Create MemoryStream +3. Call Save method on Image which saves image to stream + +Actual Results: + +Unhandled Exception: System.ArgumentNullException: Argument cannot be null. + at (wrapper managed-to-native) +System.Drawing.GDIPlus:GdipSaveImageToStream +(System.Runtime.InteropServices.HandleRef, +System.Runtime.InteropServices.UCOMIStream,System.Guid&,System.Runtime.InteropServices.HandleRef) + at System.Drawing.Image.Save (System.IO.Stream stream, +System.Drawing.Imaging.ImageCodecInfo encoder, System.Drawing.I +maging.EncoderParameters encoderParams) [0x00000] + at System.Drawing.Image.Save (System.IO.Stream stream, +System.Drawing.Imaging.ImageFormat format) [0x00000] + at (wrapper remoting-invoke-with-check) System.Drawing.Image:Save +(System.IO.Stream,System.Drawing.Imaging.ImageFormat +) + at ImageSerialize.MainClass.ImageToString (System.Drawing.Image img) +[0x00000] + at ImageSerialize.MainClass.Main (System.String[] args) [0x00000] + + +Expected Results: +Not to crash :) + +How often does this happen? +Everytime + +Additional Information: +Sample application + +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; + +namespace ImageSerialize +{ + class MainClass + { + + // Returns given image as base64 string. + public static string ImageToString(Image img) + { + MemoryStream stream = new MemoryStream(); + img.Save(stream, ImageFormat.Png); + stream.Position = 0; + int LengthOfBuffer = (int) stream.Length; + byte[] buff = new byte[LengthOfBuffer]; + stream.Read(buff, 0, LengthOfBuffer); + return(Convert.ToBase64String(buff)); + } + + public static void Main(string[] args) + { + Image img = Image.FromFile(@"C:\someimage.png"); + string smg = ImageToString(img); + + Console.WriteLine(smg); + } + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
