Monday, May 11, 2009

A generic error occurred in GDI+ when saving an image

This has to be one of the most useless error message I’ve ever encountered in the .NET framework. It seems that pretty much any problem that occurs when using Image.Save will produce this error message. Looking at the code in Reflector, the error is returned from the GDI+ function GdipSaveImageToFile. For me the solution was pretty simple, the folder I was trying to save my image to didn’t actually exist but it took some head scratching before I realised.

No comments: