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

I get this stacktrace at my ExceptionManager. It is caught in the Global.asax, so the exception is unhandled by my code :(

We have many visitors and customers. This error occurs at least once a week, and all websites in the same pool are down. Only solution for now is to reset the pool when the error occurs.

I know there are more topics on this, and I know MicroSoft is aware of the bug but does not know what to do about it. The bug will still be in the 3.5 release.

If anybody has a work around for the fix, or a solution which is acceptable and avoids my customers and visitors with this exception, would be nice.

 

UNHANDLED EXCEPTION

   at System.Web.UI.Page.HandleError(Exception e)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest()   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)   at System.Web.UI.Page.ProcessRequest(HttpContext context)   at ASP.default_aspx.ProcessRequest(HttpContext context)   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  

INNER EXCEPTION

Object reference not set to an instance of an object.    at DLink.Page_Load(Object sender, EventArgs e)   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)   at System.Web.UI.Control.OnLoad(EventArgs e)   at System.Web.UI.Control.LoadRecursive()   at System.Web.UI.Control.LoadRecursive()   at System.Web.UI.Control.LoadRecursive()   at System.Web.UI.Control.LoadRecursive()   at System.Web.UI.Control.LoadRecursive()   at System.Web.UI.Control.LoadRecursive()   at System.Web.UI.Control.LoadRecursive()

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

IF I DISABLE THE EXCEPTION MANAGER THIS WILL BE DISPLAYED ON THE PAGE: 

<html>
    <head>
        <title>GDI+ is not properly initialized (internal GDI+ error).</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Lucida Console";font-size: .9em}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>GDI+ is not properly initialized (internal GDI+ error).</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

            <br><br>

            <b> Exception Details: </b>System.Runtime.InteropServices.ExternalException: GDI+ is not properly initialized (internal GDI+ error).<br><br>

            <b>Source Error:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code>

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>

                  </td>
               </tr>
            </table>

            <br>

            <b>Stack Trace:</b> <br><br>

            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>

[ExternalException (0x80004005): GDI+ is not properly initialized (internal GDI+ error).]
   System.Drawing.Bitmap..ctor(Stream stream) +383578
   System.Drawing.ToolboxBitmapAttribute..cctor() +209

[TypeInitializationException: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.]
   System.Reflection.CustomAttribute._CreateCaObject(Void* pModule, Void* pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
   System.Reflection.CustomAttribute.CreateCaObject(Module module, RuntimeMethodHandle ctor, IntPtr&amp; blob, IntPtr blobEnd, Int32&amp; namedArgs) +104
   System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) +482
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) +258
   System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit) +63
   System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type) +262
   System.ComponentModel.ReflectedTypeData.GetAttributes() +36
   System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes() +50
   System.ComponentModel.TypeDescriptor.GetAttributes(Type componentType) +26
   System.Web.UI.ThemeableAttribute.IsTypeThemeable(Type type) +98
   System.Web.UI.Control.ApplySkin(Page page) +49
   System.Web.UI.Control.InitRecursive(Control namingContainer) +2117294
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Control.InitRecursive(Control namingContainer) +198
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692
</pre></code>

                  </td>
               </tr>
            </table>

            <br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

            </font>

    </body>
</html>
<!--
[ExternalException]: GDI+ is not properly initialized (internal GDI+ error).
   at System.Drawing.Bitmap..ctor(Stream stream)
   at System.Drawing.ToolboxBitmapAttribute..cctor()
[TypeInitializationException]: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
   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)
[HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown.
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.default_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using &lt;customErrors mode="Off"/&gt;. Consider using &lt;customErrors mode="On"/&gt; or &lt;customErrors mode="RemoteOnly"/&gt; in production environments.-->


Mathijs - ASP.NET developer for Bibito project.
http://www.bibito.nl
0
mathijs_bibito
1/29/2008 9:35:46 AM
asp.net.getting-started 91979 articles. 2 followers. Follow

0 Replies
564 Views

Similar Articles

[PageSpeed] 4

Reply:

Similar Artilces:

The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception
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:* 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://w...

Parser Error Message: The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
Hi When i create my code which uses AutoComplete feature of AJAX ToolKit, everything works fine, but when i deploy the same in our development server, error as below occurs. i have searched lots in net, but in vain.Even forumns doesnt help me on this much.Any clue as to why is this occuring and how to solve it? Any pointers regarding this would be of great help.  Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser...

'ds.SqlCacheDependency' threw an exception of type 'System.NotSupportedException'
Hi guys, As a follow up on my previous question: http://forums.asp.net/t/1336003.aspx I would like to know if any of you have an answer to the problem with the SqlCacheDependency throwing an System.NotSupportedException when trying to update using an AccessDataSource? Thanks :) /Ole   Since the SqlCacheDependency is not supported by Access, any attempt to make use of it through an AccessDataSource control will result in a NotSupportedException: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.accessdatasource.sqlcachedependency.aspx.  The mystery is why ...

Length = 'requestStream.Length' threw an exception of type 'System.NotSupportedException'
 I cannot figure out why when I expand the requestStream variable that I see that error.  Here's my code:   ... request.Timeout = 30000; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; // write data to stream byte[] requestBytes = Encoding.UTF8.GetBytes(request.ToString()); using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(reque...

Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'
Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error... Dim EmailBodyTxt As New StringBuilder EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test<br />RESPONSE SYSTEM</h1></td>...

'Sybase.Data.AseClient.AseConnection.DriverVersion' threw an exception of type 'System.TypeInitializationException'
'Sybase.Data.AseClient.AseConnection.DriverVersion' threw an exception of type 'System.TypeInitializationException' This is an error which I am getting while instantiating AseConnection. Can I get help on this exception. I am using C# in Visual Studio 2005. I checked the version in the C:\Program Files\Sybase\OC12_5_1\ADO.NET\dll folder of Sybase.Data.AseClient.dll and sybdrvado11.dll and copied these dlls to my application's bin folder. The versions are the same. Still I am getting the above exception. Whats this code look like? Are you sure both DLLs are sa...

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
 Hi all,When i run my project on my own computer, it works fine. But when i deploy it to server, it gives me this error. I can run my other dts and sp, but i get this error on this.. The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. I googled it but could not find a solution. How can i solve this problem?  Hello sourvil, I'm not sure what the problem is. The following thread explains how you can find out more about the error that is reported: http://blogs.infosupport.com/martijnb/archive/2006/01/27/3582.aspx Jeroen Molenaar.----...

The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.
This is the error I receive when I try to Build my website. The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception. My website was created using the IIS on localhost option and that is how I open it. If select View In Browser for any page, I receive the following HTML response: Server Error in '/websiteX' Application. Mutex could not be created. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception ...

How do I get around this error "Unable to cast object of type 'System.DBNull' to type 'System.String' "
I am using Visual Developer 2008 Express Edition for the first time, and I keep getting the following error below. The site allows anyone to enter with a valid username and password, but even when I logoff the site I get the same error....like the memory or database is not getting refreshed. I would think that when I initially compile the site that anything left in memory would be flushed out. Can someone please help me to figure this out. Thanks,Ramell P.S. The site is programmed using C#    Unable to cast object of type 'System.DBNull' to type 'System.String&...

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add("admin1@yoursite.com"); message.Subject = "Feedback"; message.CC.Add("admin1@yoursite.com"); message.CC.Add("admin2@yoursite.com"); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.
This is my first time working without a datagrid, formview, or detail view to display data returned from my sql db and I'm trying to figure out how to deal with some null values.   I have a vb.net page with a few textboxes and radio buttons.  I have a query in my codebehind that returns data based on a value in a query string.  As long as data is present for each field, the page loads fine, but if a field is null, I get this error message  Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.N...

System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'
Hello , I am a data table with null able Columns.I am not able to catch the value for DBNull. I did set a value to be returned as empty in dataset. Here is the code where i am trying to catch.1 public List GetStores() 2 { 3 List tmpStore = new List(); 4 StoresService.shopDBDataSet.StoresDataTable stores = 5 storesService.GetStores(); 6 for (int i = 0; i < stores.Count ; i++) 7 { 8 Store store = new Store(); 9 store.StoreID = stores[i].StoreID...

System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Byte[]'.
Hi All, I am trying to retrieve a Picture from an SQL 2005 database. Here is my code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ListingID As String = (Request.QueryString("GUID")) 'Connect to the database and bring back the image contents & MIME type for the specified pictureUsing myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionStringListings").ConnectionString) Const SQL As String = "SELECT [Pic1Ext], [Picture1] FROM [Listings] WHERE [ListingID] = @ListingID"C...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

Web resources about - The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception. - asp.net.getting-started

Resources last updated: 1/13/2016 10:12:16 PM