you're reading...
.NET 2.0, Rants

System.Drawing classes not supported outside of Windows Forms

A while back a note was added to the documentation of the System.Drawing namespace stating:

“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.”

Today the Windows Forms Documentations Updates blog clarifies what this means.

“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.”

I won’t offer my opinion on this as I can see several things going on here. But I do hope they change their tune and support the scenario again.  An ASP.NET control that generates HTML for a barcode is a hack, the only way to do a barcode correctly is to create an image, something that will also now require the use of another library to create the image in order to be 100% supported now.

I will, however, put forth some speculation, just something that came to mind while I was writing this post.  When GDI+ was announced there was also mention that in the future it could be updated to use hardware acceleration.  I dug up this link from Google that talks about that very thing: http://www.microsoft.com/whdc/archive/GDInext.mspx Now, if GDI+ (i.e. System.Drawing.*) were to become accelerated then there is the very real possibility that it would be impossible for the System.Drawing stuff to work outside of a Windows Forms environment.

There are some things that counter this idea.

  • Why put the note up there now?  Currently all of the GDI+ features appear to be implemented in software rather than hardware.  So if there was a change to be made the System.Drawing team could make sure it still uses the software implementation rather than the hardware one if running outside of a windows application.
  • Why accelerate GDI+ now when WPF just came out?  That would surely send a mixed signal to some people.

A question that falls in with this is that Windows Vista makes use of available DirectX acceleration for its window drawing.  Could this mean that Windows Vista’s GDI+ implementation is already hardware accelerated and the note is added so that things don’t go downhill when run on Windows Longhorn server?

Speculation is fun!


About James

I am a Senior Developer/Consultant for InfoPlanIT, LLC. I previously spent over 7 years as a Product Manager for what eventually became ComponentOne, a division of GrapeCity. While there, I helped to create ActiveReports 7, GrapeCity ActiveAnalysis, and Data Dynamics Reports.


4 thoughts on “System.Drawing classes not supported outside of Windows Forms

  1. FYI: AT some point a couple years ago, someone from Microsoft told me GDI+ was considered “retired”. At the time it was very shocking, as despite the age of native GDI+ it was still not widely used. I recall one of the others involved in the conversation exclaiming “we’ve just figured out how to properly use GDI+ !”

    Posted by Scott Willeke | May 16, 2007, 2:39 am
  2. no im not working this weekend…why are you coming home??? You know I never did get to drive that nice new car of yours:)

    Posted by Jenn | May 24, 2007, 1:28 am
  3. oh and dont forget to call mom and dad and wish them a happy anniversary.

    Posted by Jenn | May 24, 2007, 1:29 am
  4. Any news on when this problem is going to be fixed?

    How does the statement that the library is ‘not supported in asp.net’ fit in with the following MSDN article?


    Posted by Andy Deighton | June 16, 2010, 9:48 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: