A generic error occurred in GDI+
I hate that error with a passion. Generic Error is possibly the most useless error description ever written.
When I've encountered it the problem as always been related to file IO.
Here is the list of fixes I keep in my notes- Not sure if these apply but they usually do the trick for me.
- Check File path
- Make sure that the parent directory exists
- Ensure that path includes both the filename and extension
- Use server.MapPath() to create the path
- Make sure that the file isn't being written back to it's source. Close and reopen the stream if necessary.
My apologies if i stole this list from somewhere else. It has been in my notebook for awhile and I can't remember where it came from.
Everyone here (and on this site) has discussed this as due to a permissions error. I've stumbled over another flavor: memory. I ran out of memory and started receiving this error as well. So keep that in mind as another potential source of error.
In my particular case I was running in a .NET application, and running against a number of threads (few enough that I wasn't being held back too much by the GDI+ process-wide lock). Adding a "GC.Collect()" after major tasks finished didn't seem to affect the speed much, but did completely get rid of the out of memory errors.