1
votes

Can anyone help with this issue? I recieve this error in our logs every so often but the users say they didnt experience any issues.

Thanks

Error Description

Exception of type 'System.Web.HttpUnhandledException' was thrown.Inner Exception-->An item with the same key has already been added. - System.ArgumentException: An item with the same key has already been added. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at AjaxControlToolkit.ToolkitScriptManagerHelper.GetAssembly(String name) at AjaxControlToolkit.ToolkitScriptManagerCombiner.IsScriptCombinable(ScriptEntry scriptEntry, Boolean enableCdn) at AjaxControlToolkit.ToolkitScriptManagerCombiner.WriteScripts(List`1 scriptEntries, TextWriter outputWriter, Boolean enableCdn) at AjaxControlToolkit.ToolkitScriptManagerCombiner.GetCombinedRegisteredScriptContent(Boolean enableCdn) at AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase context, String[] bundles, Boolean forCombineAndMinify) at AjaxControlToolkit.ToolkitScriptManager.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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Stack Trace:

  • 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.ProcessRequest(HttpContext context)
  • at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

  • at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)Occured onSystem.Web - Boolean
    HandleError(System.Exception) Inner Exception-->

  • at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

  • at AjaxControlToolkit.ToolkitScriptManagerHelper.GetAssembly(String name)

  • at AjaxControlToolkit.ToolkitScriptManagerCombiner.IsScriptCombinable(ScriptEntry scriptEntry, Boolean enableCdn)

  • at AjaxControlToolkit.ToolkitScriptManagerCombiner.WriteScripts(List`1
    scriptEntries, TextWriter outputWriter, Boolean enableCdn)

  • at AjaxControlToolkit.ToolkitScriptManagerCombiner.GetCombinedRegisteredScriptContent(Boolean enableCdn)

  • at AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase context, String[] bundles, Boolean forCombineAndMinify)

  • at AjaxControlToolkit.ToolkitScriptManager.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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

1

1 Answers

0
votes

You are registering scripts with the same key (name). Check ScriptManager <Scripts> section, and all RegisterClientScriptBlock and RegisterStartupScript calls for duplicates.

Also use IsClientScriptBlockRegistered and IsStartupScriptRegistered before registering any scripts to avoid that in the future.