A generic error occurred in GDI+
ISSUE :
System.Runtime.InteropServices.ExternalException: “A generic error occurred in GDI+.” Issue occurred: When you are trying to save the image.
SOLUTION:
The System.Runtime.InteropServices namespace provides a wide variety of members that support COM interop and platform invoke services. If you are unfamiliar with these services, see Interoperating with Unmanaged Code.
The System.Runtime.InteropServices namespace provides a collection of classes useful for accessing COM objects, and native APIs from .NET. The types in this namespace fall into the following areas of functionality: attributes, exceptions, managed definitions of COM types, wrappers, type converters, and the Marshal class.
A generic error occurred in GDI+, one of the most common error occured while saving the image into the directory, the error occured because of the several reasons including the permission on the folder to write, which can be done by right click on the folder and assign write permission to the user. Some times, you get this error when someone else is using the same file on which you are performing the operation, the better solution is to lock the file when it is use and dispose the object when you are done.
I have illustrated the series of cause and remedy in my article.
Please check this article for complete detail: http://tinyurl.com/25khl98
Your comments and suggestions are highly appreciated. kindly let me know if the tutorial is not able to solve your issue.
To get the more information about this error, please check this site http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.externalexception.aspx.
Thanks
-
About the Author:
Anuj Tripathi
Visit my Blog: http://www.anujtripathi.net
When you lose, don’t lose the lesson.
Mothers are those wonderful people who can get up in the morning before the smell of coffee.
Article Source