GDI+ Generic Error

I see lot of people asking about GDI+ Generic Error. Since this is “generic” error nobody can tell what is wrong with code. So did a work around and get it working. I had this error quite a time in early days of my programming and just found same error in one of junior’s code. Well from my experience I can say one thing. GDI+ Generic error 99.9% means “developer miss a detail or overlooked something”. Most common reason of error are negligence of

1. Path should be physical path

2. All folder should present before you create file.

3. Previous files should be in write mode if case of overriding files.

4. Make sure permission are for writing to User of process.

5. Do not include any special character which windows do not permit in folder name or file name.

6. FILE FORMAT has nothing to do with this error most often.

7. Recheck permission if you try all above.

8. Recheck Path again :).

Point #7 and #8 are most important solution and always works for me.