[Mono-list] [resolved] Re: Unspecific error: System.Exception: Generic Error [GDI+ status: GenericError]

Yves Goergen nospam.list at unclassified.de
Mon Nov 1 09:55:58 EDT 2010


On 26.10.2010 23:34 CE(S)T, Yves Goergen wrote:
> I'm writing an application that shall generate graph images and save
> them in a PNG file. I'm writing and compiling the code with Visual
> Studio 2005 on Windows and running it on Ubuntu Linux 10.4 with Mono
> 2.4.4. Here's the error message I get:
> 
>> Unhandled Exception: System.Exception: Generic Error [GDI+ status: GenericError]
>>   at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] 
>>   at System.Drawing.Image.Save (System.String filename, System.Drawing.Imaging.ImageCodecInfo encoder, System.Drawing.Imaging.EncoderParameters encoderParams) [0x00000] 
>>   at System.Drawing.Image.Save (System.String filename, System.Drawing.Imaging.ImageFormat format) [0x00000] 
>>   at (wrapper remoting-invoke-with-check) System.Drawing.Image:Save (string,System.Drawing.Imaging.ImageFormat)
> ...
> 
> And here's the offending code:
> 
>> Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
>> string fileName = "graph.png";
>> // Drawing stuff
>> bmp.Save(fileName, ImageFormat.Png);
> 
> I don't understand the error message. What has happened? Is it my fault
> or is Mono broken? I had other exceptions before that I could resolve by
> installing more packages, most recently libgdiplus.

This error message is very misleading. After a few more tests, I found
out that the process wasn't allowed to write where it was supposed to.
Running the whole thing with strace (thus debugging Mono, sort of)
revealed the actual EACCESS error condition. Mono just wasn't able to
tell me that.

-- 
Yves Goergen "LonelyPixel" <nospam.list at unclassified.de>
Visit my web laboratory at http://beta.unclassified.de


More information about the Mono-list mailing list