Periodically someone questions me about a caution that appears in all of the System.Drawing.* namespace overview topics. It reads:
“Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.”
This warning has generated a lot of speculation and confusion and I apologize for this. This caution confused me when I was asked to add it to the documentation. I’d seen examples demonstrating how to use System.Drawing classes in ASP.NET pages and I questioned whether the caution should be added. The explanation I was given is that the System.Drawing.* classes were designed for use with Windows Forms and were tested for use with Windows Forms. When we say they are not supported in services or ASP.NET applications (also a service), we mean exactly that; they are not supported. We don’t mean they won’t work in an ASP.NET application or that we are trying to cover up some known bug that occurs when you use them in a service. The bottom line is that if you call Microsoft Product Support Services regarding a problem you have using a System.Drawing.* class in a service, they will not offer free support.
Hopefully this clears up any confusion.