All of a sudden I started getting this nasty exception all over the place:
The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
Some relevant observations:
* The error started occuring a few hours after the last deployment to the live server, not immediately after. So it basically started occuring of its own accord.
* We have recently moved to a new host (a VPS). The error only occurs on that server, not our local server nor at the old host's (which was a shared environment).
* I tried reinstalling Ajax extensions, then our website in IIS, then finally the .Net 2 framework. But the error still occurs after all this.
* The error occurs on line 1, which is just the page directive:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Test.WebForm1" %>
I'm finding it difficult to get a decent trace, but here is one that our CMS provided:
The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
at System.Web.UI.TemplateControl.LoadControl(String virtualPath)
at umbraco.macro.loadUserControl(String fileName, Hashtable attributes, page umbPage)
My own code doesn't use the ToolboxBitmapAttribute, but third party products like Peter Blum's and Telerik's do.
Peter Blum replied with some useful hints:
* The "type initializer" concept probably needs some research, but I'm guessing that is an important clue. A quick web search of "type initializer" finds many situations it occurs for a variety of classes.
* The stack trace suggests that this is happening as ASP.NET is compiling your web form. The error is happening as the ASP.NET parser runs. Again this is external from my code (even creating or "type initializing" the attribute is not something my code does).
This problem seems to be a rare but devastating flaw which hopefully Microsoft can provide a fix for ASAP.
I'm getting the same error, "The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception" on a previously working website hosted at GoDaddy.com. The error does not occur for the same page on my development machine. The error started
occurring within the last few weeks (it is now August 19th). I'm not using any third party products in the website, but I am using a UserControl in the page header. I researched the problem on Google, and one person wrote that the IIS service needs to be
restarted.
Guys, any update on the problem? We have the same exception with godaddy web hosting. Locally works just fine. We put AJAX Toolkit dll in Bin folder, we do not put Extensions dll there (as it's installed already on the server and as godaddy recommends).
Cannot find other solutions rather than change the web hosting, but no guarantee if another one won't have the same issue... :(
The sad part is, looks like some ppl have AJAX working fine including AJAX Toolkit as well on godaddy windows hosting. How come?!
We ended up starting again on a completely fresh install of the VPS on a different machine. Not fun at all.
The problem hasn't come back for a few months since then, so obviously this is not a code or site configuration issue.
Still, everyday I worry about it returning... it's like a ticking time bomb.
Thanks for the update even though it's bad news. :( In our case we just cannot reinstall anything on shared web hosting. Looks like we have bad luck with our server there and that issue happens for us. Some of their users have AJAX Toolkit working fine though.
follow-up: We removed all references to AJAX whatsoever and tried to use free date picker control (BasicDatePicker) - and we've got the same error when accessing the page with that control on it. Something must be wrong with the server setup...
By the way, when we were setting up our VPS we were quite aggressive with security and removed or turned off quite a few Windows components that we didn't think were necessary. I have a suspicion this was the cause of the problem. Are you on shared hosting,
or do you have access to your server?
By the way, when we were setting up our VPS we were quite aggressive with security and removed or turned off quite a few Windows components that we didn't think were necessary. I have a suspicion this was the cause of the problem. Are you on shared hosting,
or do you have access to your server?
we are on shared hosting, no control over it; we have no time to wait till godaddy or microsoft will come up with a solution so we move to another hosting :) Hopefully it will be better (but not cheaper though).
I dont know if its related, but I never had this problem for years. It just showed up. I recently installed .net 3.5 and of course all the service packs for .net in one day (yesterday).
I wonder if its related to the .net framework service pack. I will have to find a resolution in the code.
acl123
Member
55 Points
64 Posts
The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Aug 14, 2007 12:54 AM|LINK
Hi,
All of a sudden I started getting this nasty exception all over the place:
The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
Some relevant observations:
.
wind.com/WebLog/posts/3381.aspx
* The error started occuring a few hours after the last deployment to the live server, not immediately after. So it basically started occuring of its own accord.
* We have recently moved to a new host (a VPS). The error only occurs on that server, not our local server nor at the old host's (which was a shared environment)
* The problem is basically the same as this guys:
http://www.west-
* I tried reinstalling Ajax extensions, then our website in IIS, then finally the .Net 2 framework. But the error still occurs after all this.
* The error occurs on line 1, which is just the page directive:" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Test.WebForm1" %>
<%@ Page Language="C#
I'm finding it difficult to get a decent trace, but here is one that our CMS provided:
ToolboxBitmapAttribute' threw an exception.TemplateParser.ProcessException(Exception ex)TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)TemplateParser.ParseInternal()TemplateParser.Parse()ion.BaseTemplateBuildProvider.get_CodeCompilerType()ion.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)ion.BuildProvidersCompiler.ProcessBuildProviders()ion.BuildProvidersCompiler.PerformBuild()ion.BuildManager.CompileWebFile(VirtualPath virtualPath)ion.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)ion.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)TemplateControl.LoadControl(VirtualPath virtualPath)TemplateControl.LoadControl(String virtualPath)loadUserControl(String fileName, Hashtable attributes, page umbPage)
The type initializer for 'System.Drawing.
at System.Web.UI.
at System.Web.UI.
at System.Web.UI.
at System.Web.UI.
at System.Web.UI.
at System.Web.UI.
at System.Web.Compilat
at System.Web.Compilat
at System.Web.Compilat
at System.Web.Compilat
at System.Web.Compilat
at System.Web.Compilat
at System.Web.Compilat
at System.Web.UI.
at System.Web.UI.
at umbraco.macro.
My own code doesn't use the ToolboxBitmapAttribute, but third party products like Peter Blum's and Telerik's do.
Peter Blum replied with some useful hints:
* The "type initializer" concept probably needs some research, but I'm guessing that is an important clue. A quick web search of "type initializer" finds many situations it occurs for a variety of classes.
* The stack trace suggests that this is happening as ASP.NET is compiling your web form. The error is happening as the ASP.NET parser runs. Again this is external from my code (even creating or "type initializing" the attribute is not something my code does).
This problem seems to be a rare but devastating flaw which hopefully Microsoft can provide a fix for ASAP.
CYCLIST
Member
24 Points
5 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Aug 20, 2007 08:40 AM|LINK
I'm getting the same error, "The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception" on a previously working website hosted at GoDaddy.com. The error does not occur for the same page on my development machine. The error started occurring within the last few weeks (it is now August 19th). I'm not using any third party products in the website, but I am using a UserControl in the page header. I researched the problem on Google, and one person wrote that the IIS service needs to be restarted.
acl123
Member
55 Points
64 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Aug 21, 2007 12:19 AM|LINK
Yep, tried an IIS reset and it didn't work.
We had no solution but to move to a new host which solved the problem.
This error is nasty. Beware all .Net users!
codertown
Member
20 Points
19 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Nov 05, 2007 05:22 PM|LINK
Guys, any update on the problem? We have the same exception with godaddy web hosting. Locally works just fine. We put AJAX Toolkit dll in Bin folder, we do not put Extensions dll there (as it's installed already on the server and as godaddy recommends).
Cannot find other solutions rather than change the web hosting, but no guarantee if another one won't have the same issue... :(
The sad part is, looks like some ppl have AJAX working fine including AJAX Toolkit as well on godaddy windows hosting. How come?!
http://www.west-wind.com/WebLog/ShowPost.aspx?id=3381 - no solution :(
acl123
Member
55 Points
64 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Nov 05, 2007 11:09 PM|LINK
Hi,
We ended up starting again on a completely fresh install of the VPS on a different machine. Not fun at all.
The problem hasn't come back for a few months since then, so obviously this is not a code or site configuration issue.
Still, everyday I worry about it returning... it's like a ticking time bomb.
codertown
Member
20 Points
19 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Nov 06, 2007 02:38 AM|LINK
codertown
Member
20 Points
19 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Nov 06, 2007 02:59 PM|LINK
acl123
Member
55 Points
64 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Nov 06, 2007 10:16 PM|LINK
Good luck. Let us know if you find a solution.
By the way, when we were setting up our VPS we were quite aggressive with security and removed or turned off quite a few Windows components that we didn't think were necessary. I have a suspicion this was the cause of the problem. Are you on shared hosting, or do you have access to your server?
codertown
Member
20 Points
19 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Nov 06, 2007 10:40 PM|LINK
TravisWhidden
Member
17 Points
4 Posts
Re: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
Jan 05, 2008 06:38 AM|LINK
Sorry to bring this back up.
I dont know if its related, but I never had this problem for years. It just showed up. I recently installed .net 3.5 and of course all the service packs for .net in one day (yesterday).
I wonder if its related to the .net framework service pack. I will have to find a resolution in the code.
Travis