Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Unassigned: System.ArgumentException: An item with the same key has already been added. [27684]

$
0
0
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
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.ToolkitScriptManagerCombiner.GetCombinedScriptContentHash(HttpContextBase context, String[] bundles, Boolean enableCdn)
at AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase context, String[] bundles, Boolean forCombineAndMinify)
at AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()

I'm thinking there should be a lock used in the following function in AjaxControlToolkit.ToolkitScriptManagerHelper.

```

internal static Assembly GetAssembly(string name) {
if (!LoadedAssemblies.ContainsKey(name))
LoadedAssemblies.Add(name, Assembly.Load(name));
return LoadedAssemblies[name];
}
```
Comments: My guess this is a multi threading issue. Thread 1 enters and calls if (!LoadedAssemblies.ContainsKey(name)), after that thread 1 is paused. Thread 1 enters and calls if (!LoadedAssemblies.ContainsKey(name)) and LoadedAssemblies.Add(name, Assembly.Load(name));. Then thread 1 resumes and tries to call LoadedAssemblies.Add(name, Assembly.Load(name)); but then the assembly has already been added and the exception is thrown.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>