How to Fix "Sys.ArgumentTypeException: Object of type ‘Sys._Application’ cannot be converted to type ‘Sys._Application’." Error

Image representing NewsGator as depicted in Cr...

Image via CrunchBase

In one of my client projects, we kept seeing this error, and basically ignored it for a long time. In our case, we saw the errors specifically on pages that included NewsGator Web Parts and we thought they might be the problem, but it was actually a problem with the SharePoint AJAX settings which NewsGator would have initially installed, but which had been changed many times by other installs and/or people.

A typical full error looked like this:
Sys.ArgumentTypeException: Object of type 'Sys._Application' cannot be converted to type 'Sys._Application'.
Parameter name: instance  ScriptResource.axd?d=3OFwNP2OqissPVnq69wL3hN2bp71o6_alyDiAQ4AtZb7FI9MYnlhIQdNZXDeHZVNPXrWlmYq-0mnuHvEHRe7gW131sU6muSFCaVlWX7ED1k1&t=45c7299c, line 1559 character 43

I did a lot of searching on the Web, of course. Everything I found seemed to be from 2007 or earlier and have to do with asp:ScriptManager. Most of the suggestions said to set the ScriptMode attribute of ScriptManager to Release, so from this:

<%--<asp:ScriptManager ID="ScriptManager1" runat="server" />—%>

to this:

<%--<asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" runat="server" />—%>

This didn’t have any effect for us, unfortunately. FYI – the ScriptManager will be in your master page if you have SharePoint AJAX enabled.

After a *lot* more fishing around (I get tenacious with this stuff once I start – I don’t like to see *any* error messages, because they tend to “cascade” on you.) I found the problem.

In this case, the web.config file had been built up over time with little documentation of the steps involved, who did what, etc.  In other words, pretty much the usual state.  SharePoint had been put out there, its use expanded virally, they tried a lot of different third party things, some of which stayed and others were removed, etc.

Somehow in all of that back and forth, in the line highlighted below, debug had been set to “true”. Setting it to “false” fixed the problem.

<globalization fileEncoding="utf-8" />
    <compilation batch="false" debug="false">
      <assemblies>
        <add assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      </assemblies>
      <expressionBuilders>
        <remove expressionPrefix="Resources" />
        <add expressionPrefix="Resources" type="Microsoft.SharePoint.SPResourceExpressionBuilder, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add expressionPrefix="SPHtmlEncodedResources" type="Microsoft.SharePoint.SPHtmlEncodedResourceExpressionBuilder, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add expressionPrefix="SPSimpleFormattingEncodedResources" type="Microsoft.SharePoint.SPSimpleFormattingEncodedResourceExpressionBuilder, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add expressionPrefix="SPUrl" type="Microsoft.SharePoint.Publishing.WebControls.SPUrlExpressionBuilder, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      </expressionBuilders>
    </compilation>

16 Comments

  1. I am using jquery popup and got this issue in popup back fourth .I am using window xp and ie8.and issue comes ion ie8.can anybody help me/

    Reply
    • Whomever (it doesn’t look like you provided a name!):

      I don’t really understand your question. This post doesn’t seem like it has anything to do with what you’re asking, but maybe I’m missing it. What do you mean by ‘jQuery popup’? A plugin? A function you’ve built?

      M.

      Reply
  2. You pointed me in the right direction.

    After changing the reference from “MicrosoftAjax.debug.js” to “MicrosoftAjax.js” it worked.

    Thank you!

    Reply
  3. For some reason I was having this issue testing locally and my co-workers weren’t (I’m new to .NET) … don’t know why it wasn’t happening to them, but this stopped them from happening to me… THANK YOU!!!

    Reply
  4. Hi,
    I have the same issue, i have the OOB Upload page and the first time it does not render properly. I am getting this javascript error. In the custom master page, i have ScriptMode to release, debug is set to release.
    Is there any other help on this. I have asked this is MSDN Sharepoint 2010 forum (http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/50b18cc2-3361-4539-87bc-e50d8f10445e/), but have not got any result.

    Any help on this.

    Reply
  5. Hi Marc, thanks for your solution.

    I was getting this error and I even don’t use SharePoint, just Ajax
    I’ve just turned the debug attribute off (compilation tag) and it worked.
    I think this is not the proper solution, it just hides the error.

    Reply
  6. Nice find Marc!

    I jumped back onto a project that I haven’t worked on for a while and the TaxonomyWebTaggingControls were not displaying. After hours of searching and playing around I stumbled upon your post. Turns out that debugging mode on my mysite caused that javascript error, which caused only those types of fields to not display.

    Reply

Have a thought or opinion?