Home Dashboard Directory Help
Search

The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception. by Mike737


Status: 

Closed
 as Fixed Help for as Fixed


5
0
Sign in
to vote
Type: Bug
ID: 384571
Opened: 11/27/2008 7:54:52 PM
Access Restriction: Public
1
Workaround(s)
view
6
User(s) can reproduce this bug

Description

Specific web pages from a domain were responding with empty content. Appears to be caused via exceptions being thrown on ASP.Net worker process startup around asp.net theming and the System.Drawing namespace.

Exceptions which were caught were:
- The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
- GDI+ is not properly initialized (internal GDI+ error).

Vijayshinva Karnure from Microsoft India wrote about the issue in his blog.

http://blogs.msdn.com/vijaysk/archive/2008/09/02/using-themes-in-asp-net-loads-system-drawing-namespace.aspx
Details
Sign in to post a comment.
Posted by Kartris on 11/28/2010 at 1:55 AM
This bug is ****NOT***** fixed.

I have three servers running ASP.NET 3.5, all latest service packs, we see this issue every week or two on all the servers on particular dotnet sites.


This is the trace from the first time the error occurred in the most recent outage:

System.TypeInitializationException: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception. ---> System.Runtime.InteropServices.ExternalException: GDI+ is not properly initialized (internal GDI+ error).
at System.Drawing.Bitmap..ctor(Stream stream)
at System.Drawing.ToolboxBitmapAttribute..cctor()
--- End of inner exception stack trace ---
at System.Reflection.CustomAttribute._CreateCaObject(Void* pModule, Void* pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(Module module, RuntimeMethodHandle ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type)
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetAttributes()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes()
at System.ComponentModel.TypeDescriptor.GetAttributes(Type componentType)
at System.Web.UI.ThemeableAttribute.IsTypeThemeable(Type type)
at System.Web.UI.Control.ApplySkin(Page page)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

==================================================


Once it occurs, the site is down until restarted - in fact, I generally find I have to switch to ASP.NET 1.1 and then back to 2.0 in IIS to force it to clear the error.

The KB article here unhelpfully omits to actually provide the fix it refers to: http://support.microsoft.com/kb/975410

But since this is an old KB, I assume that whatever fix it refers to is already supposed to be in ASP.NET 3.5.

But the error persists.

It is not easily repeatable - after restarting the site, everything works fine, sometimes for a few weeks. But then suddenly it's back and the site is down until manually restarted.

Please can MS open up this issue again and fix it or give some workaround more practical than this one (note: these guys too are still getting the issue in November 2010, so I am not alone here):

http://blog.dotsmart.net/2010/11/16/solved-the-type-initializer-for-system-drawing-toolboxbitmapattribute-threw-an-exception/

Turning off viewstate for my apps is not an option.
Posted by joman on 3/27/2009 at 6:38 AM
I'm experiencing the exact same problem, i'll try to escalate through microsoft local support and i'll let you know.
Posted by Microsoft on 2/10/2009 at 8:25 PM
If this becomes really urgent, you could escalate through Microsoft Product Service channel in your region, provided you and/or your company has service agreement signed.

Thanks!
UIFx Team
Posted by Mike737 on 1/11/2009 at 6:52 PM
I still have not received a response.
The issue is now becoming quite urgent.

Is there anyway I can escalate it further or get in touch with the team?
Posted by Mike737 on 12/8/2008 at 9:33 PM
We were able to find out some more info on it this time as one of our clients just experienced this issue again.

The server seemed to end its response prematurely with no response at all (no HTTP status code and no content)

Is there anyway I can escalate it further or get in touch with the team?
Posted by Microsoft on 12/3/2008 at 10:24 PM
Thanks for your feedback on the .NET Framework!

Unfortunately the issue that you have reported is caused by ASP.NET/GDI+, a component external to Windows Forms and as such cannot be fixed by our team.

We have informed the responsible team about the issue, and they may contact you for more repro info later on.

Thanks and keep the feedback coming.
UIFx Team
Posted by Microsoft on 11/30/2008 at 6:57 PM
Thanks for your feedback. We are escalating this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team
Sign in to post a workaround.
Posted by strive on 8/26/2011 at 2:47 PM
I was receiving this error. I know it worked, but I can't explain why. I created a new app pool, and assigned the application to the new app pool and it started to work again. I am curious to know why this worked.

thanks.