Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Binary format of the specified custom attribute was invalid + Ajax errors

$
0
0

I am having a heck of a time after having converted from Framework 3.5 to Framework 4 and Ajax 4. Everything works beautifully, except that I get "Binary format of the specified custom attribute was invalid" every second or third time I update the project OR the web.config file. If I then recycle the app pool (or, sometimes, refreshing the browser instead of recycling the app pool), things work fine again - until the next update. If I don't, I get the above error, all related to the ToolkitScriptManager (in debug mode in the browser). I have tried stripping the page down to nothing except a TSM, stripping the web.config down to nothing except a profile provider (so that I have one profile value I can use to generate the error), using a TSM in the master page or not, using a master page or not, plus loading and reloading every version of the Ajax DLL, which all produce the same result. If I do not include a TSM in the page, everything works fine, before and after any update I may make to the web.config or page code; I have also created a clean project in VS2010 and placed TSMs on the pages, and they work fine. This may be something simple and obvious that I'm missing, but I can't for the life of me figure out what it might be!

The stack traces are as follows (note that I am not including "custom attributes" in the TSM):

USING A MASTER PAGE:

[CustomAttributeFormatException: Binary format of the specified custom attribute was invalid.]    System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0    System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +77    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1286    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)+146    System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +103    System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +592    System.Web.UI.ScriptManager..ctor() +30    ASP.app_master_ui_master.__BuildControlform1()+200    ASP.app_master_ui_master.__BuildControlTree(app_master_ui_master __ctrl) +372    System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +1349    System.Web.UI.Page.ApplyMasterPage()+75    System.Web.UI.Page.PerformPreInit() +210    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1716

NOT USING A MASTER PAGE:

[CustomAttributeFormatException: Binary format of the specified custom attribute was invalid.]

   System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0

   System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +46

   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)+529

   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103

   System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33

   System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76

   System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +399

   System.Web.UI.ScriptManager..ctor() +26

   ASP.start_aspx.__BuildControlToolkitScriptManager1() +32

   ASP.start_aspx.__BuildControlform1() +65

   ASP.start_aspx.__BuildControlTree(start_aspx __ctrl) +249

   ASP.start_aspx.FrameworkInitialize() +53

   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +54

   System.Web.UI.Page.ProcessRequest() +78

   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21

   System.Web.UI.Page.ProcessRequest(HttpContext context) +49

   ASP.start_aspx.ProcessRequest(HttpContext context) +4

   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100

   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 

THE STRIPPED-DOWN WEB.CONFIG FILE:

<?xml version="1.0"?>

<configuration>

  <system.web>

     

      <profile defaultProvider="CPP">

      <providers>

        <add name="CPP" type="System.Web.Profile.SqlProfileProvider" connectionStringName="objConn" />

      </providers>

      <properties>

 

          <add name="TestValue" type="System.Byte" defaultValue="0"/>

 

      </properties>

    </profile>

  </system.web>

  <system.webServer>

  </system.webServer>

</configuration>

THE STRIPPED-DOWN PAGE (NO MASTER):

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Start.aspx.vb" Inherits="Start" MasterPageFile="" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <html><head><title></title></head> <form id="form1" runat="server"><cc1:ToolkitScriptManager ID="tsm" runat="server" /></form> </html>

CODEBEHIND:

Partial Class Start    

Inherits System.Web.UI.Page

End Class


Viewing all articles
Browse latest Browse all 5678

Trending Articles