By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,149 Members | 1,764 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,149 IT Pros & Developers. It's quick & easy.

Event code: 3005 - An unhandled exception has occurred

P: n/a

I have an ASP.NET 2 intranet application written in C#. I use Active
Directory authentication and parts of the application uses AJAX.

From time to time (about once every 200-300 accesses at least) I get the
following error on the server:

Event code: 3005
Event message: An unhandled exception has occurred.
Exception information:
Exception type: ArgumentException
Exception message: An entry with the same key already exists.
Thread information:
Thread ID: 5
Is impersonating: False
Stack trace: at
System.Collections.Specialized.ListDictionary.Add( Object key, Object value)
at System.Web.UI.ClientScriptManager.RegisterScriptBl ock(ScriptKey key,
String script, ListDictionary& scriptBlocks, ArrayList& scriptList, Boolean
needsScriptTags, Boolean& inScriptBlock)
at System.Web.UI.ClientScriptManager.RegisterScriptBl ock(ScriptKey key,
String script, ClientAPIRegisterType type)
at System.Web.UI.ClientScriptManager.RegisterClientSc riptInclude(Type
type, String key, String url)
System.Web.UI.ScriptRegistrationManager.RegisterCl ientScriptInclude(Control
control, Type type, String key, String url)
System.Web.UI.ScriptManager.RegisterClientScriptIn cludeInternal(Control
control, Type type, String key, String url)
at System.Web.UI.ScriptManager.RegisterScripts()
at System.Web.UI.ScriptManager.OnPagePreRenderComplet e(Object sender,
EventArgs e)
at System.Web.UI.Page.OnPreRenderComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The page that is throwing this error has an AJAX tab control in it, uses a
master page and has the usual sprinkling of controls. There is no
code behind on the page.

Any ideas on why I'm getting this error, or a pointer in the right
direction, would be much appreciated.

Jun 11 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Hi Zinon,

I've used Reflector ( to check the
ClientScriptManager.RegisterScriptBlock, and found the code is like

if (scriptBlocks == null)
scriptBlocks = new ListDictionary();
if (scriptBlocks[key] == null)
scriptBlocks.Add(key, script);

This means the only possible cause that might throw an "An entry with the
same key already exists" will be that there's already an item in the
scriptBlocks that has null value:
ListDictionary dict = new ListDictionary();
object key = GetType();
dict.Add(key, null);
if (dict[key] == null)
dict.Add(key, "Hello");
Please check if your code might be passing a null script block to those
functions that are used to register script blocks.

If in doubt, please feel free to post more code of your WebForm. Thanks.
Walter Wang (wa****, remove 'online.')
Microsoft Online Community Support

Get notification to my posts through email? Please refer to
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 12 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.