Hello to all. I'm a newbie and I joined because I have an error that I just couldn't solve. It's System.ArgumentException: An entry with the same key already exists. error.
Here is the whole stack trace:
An entry with the same key already exists. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An entry with the same key already exists.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: An entry with the same key already exists.] System.Collections.Specialized.ListDictionary.Add(Object key, Object value) +6157735 System.Collections.Specialized.HybridDictionary.Add(Object key, Object value) +60 System.Web.UI.StateBag.Add(String key, Object value) +126 System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +77 System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +113 System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +46 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnLoadComplete(EventArgs e) +8876398 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2350
I can't figure out what produces the error because it shows only frequently. For example: I am browsing my website and refreshing the page over and over and it' s ok for like 10 minutes and then all of a sudden it throws an error. then I refresh it once
more and the error is gone.
I just don't know when will it show and why, but after refreshing website only once it works perfect again.
Hello to all. I'm a newbie and I joined because I have an error that I just couldn't solve. It's System.ArgumentException: An entry with the same key already exists. error.
Here is the whole stack trace:
An entry with the same key already exists. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An entry with the same key already exists.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: An entry with the same key already exists.] System.Collections.Specialized.ListDictionary.Add(Object key, Object value) +6157735 System.Collections.Specialized.HybridDictionary.Add(Object key, Object value) +60 System.Web.UI.StateBag.Add(String key, Object value) +126 System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +77 System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +113 System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +46 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnLoadComplete(EventArgs e) +8876398 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2350
I can't figure out what produces the error because it shows only frequently. For example: I am browsing my website and refreshing the page over and over and it' s ok for like 10 minutes and then all of a sudden it throws an error. then I refresh it once
more and the error is gone.
I just don't know when will it show and why, but after refreshing website only once it works perfect again.
marchetto271
Member
2 Points
2 Posts
System.ArgumentException: An entry with the same key already exists.
Aug 11, 2011 03:33 PM|LINK
Hello to all. I'm a newbie and I joined because I have an error that I just couldn't solve. It's System.ArgumentException: An entry with the same key already exists. error.
Here is the whole stack trace:
An entry with the same key already exists.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An entry with the same key already exists.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: An entry with the same key already exists.]
System.Collections.Specialized.ListDictionary.Add(Object key, Object value) +6157735
System.Collections.Specialized.HybridDictionary.Add(Object key, Object value) +60
System.Web.UI.StateBag.Add(String key, Object value) +126
System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +77
System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +113
System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +46
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnLoadComplete(EventArgs e) +8876398
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2350
I can't figure out what produces the error because it shows only frequently. For example: I am browsing my website and refreshing the page over and over and it' s ok for like 10 minutes and then all of a sudden it throws an error. then I refresh it once more and the error is gone.
I just don't know when will it show and why, but after refreshing website only once it works perfect again.
Please help me because I'm starting to freak out.
Thanks in advance,
marchetto271
madhu mogull...
Member
2 Points
1 Post
Re: System.ArgumentException: An entry with the same key already exists.
Aug 11, 2011 04:39 PM|LINK
vmillasp
Member
626 Points
154 Posts
Re: System.ArgumentException: An entry with the same key already exists.
Aug 12, 2011 07:40 PM|LINK
find in your code the the class instance of 'ListDictionary' and find when the function 'Add' is called,
the error means there is an value pair with the same index already in the dictionay
so do something like this:
if (listdictionary.contains('key')) { //put special code here to handle adding the same key } else { listdictionary.add(...) }marchetto271
Member
2 Points
2 Posts
Re: System.ArgumentException: An entry with the same key already exists.
Aug 14, 2011 09:57 PM|LINK
Thanks, I'll try that!
Damon Liu - ...
Contributor
5920 Points
535 Posts
Microsoft
Re: System.ArgumentException: An entry with the same key already exists.
Aug 16, 2011 06:13 AM|LINK
Hi,
In your Program,System.Collections.Specialized.ListDictionary.Add(Object key, Object value) you can add same key in a ListDictionary.
About hoew to use ListDictionary you can refer to the link:http://msdn.microsoft.com/en-us/library/system.collections.specialized.listdictionary.add.aspx
Best Regards,
Damon
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework