An item with the same key has already been added, error
I am getting an error after upgrading from 4.7 to 6.0.2.
Server Error in '/' Application.
An item with the same key has already been added.
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 item with the same key has already been added.
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 item with the same key has already been added.]
It seems to be happening quite randomly. Any pageload/ajax event on the site in frontend or backend randomly throws this error. It is quite frustrating.
If you have any tips to debug it better, I am more than willing. :)
@Matt ok, but are you getting this error every single time you are creating content of these types ? And what property types do you have assigned to this content type? I need to have a way to reproduce this error as i cannot locally at the moment.
I installed the Standard Website MVC Starter Kit, I copied the 'Standard' doc type positioned under 'Standard' (named 'Chapter'), removed the panels tab and picker for the panels. In the Structure for 'Standard' I allowed Chapter to be a child.
I hadn't added any additional properties to the Chapter type yet. Every time i tried to add a chapter under a s Standard doc i got the error.
I have now deleted the copied Doc Type and just added it using Create instead of copy and that's ok, but I guess copy should be ok too?
Also note that the issue @Matt is having is different from the one that @Stephen is having since his appears to be on the front-end. @Matt can you please post the full stack trace you are getting ?
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 item with the same key has already been added.
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.
Just checking in again. It seems that the problem hasn't 'gone away' (I didn't think it would magically, but you never know).
Is there any way to get better debug information from the system?
[NullReferenceException: The UmbracoContext.Current is null, ProcessRequest cannot proceed unless there is a current UmbracoContext] Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +408 Umbraco.Web.UmbracoModule.<Init>b__7(Object sender, EventArgs e) +79 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +135 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
I had the exact same issue and it was resolved by removing duplicate properties from child document types.
In example, my "root" document type had a property called Title and a child to this document type had also implemented that property in a previous version. This was probably allowed since the relations in my database wasn't intact at the moment.
The benefit from removing the property from the child is that you can edit the pages again
The downside of removing it is that all data is also removed.
When I copied the Doctype it created two Content tabs, one inherited from the parent and one for the new Doctype, removing duplicate fields corrected the error.
An item with the same key has already been added, error
I am getting an error after upgrading from 4.7 to 6.0.2.
Server Error in '/' Application.
An item with the same key has already been added.
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 item with the same key has already been added.
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 item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +265
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +36
umbraco.cms.businesslogic.ContentType.GetDataType(String contentTypeAlias, String propertyTypeAlias) +274
Umbraco.Core.PublishedContentHelper.GetDataType(String docTypeAlias, String propertyAlias) +22
Umbraco.Web.PublishedContentExtensions.GetPropertyValue(IPublishedContent prop, String alias, Boolean recursive, T ifCannotConvert) +76
Umbraco.Web.PublishedContentExtensions.GetPropertyValue(IPublishedContent prop, String alias, T ifCannotConvert) +11
Umbraco.Web.Routing.PublishedContentRequestBuilder.FollowRedirect() +47
Umbraco.Web.Routing.PublishedContentRequestBuilder.LookupDocument() +190
Umbraco.Web.Routing.PublishedContentRequest.ProcessRequest(HttpContextBase httpContext, UmbracoContext umbracoContext, Action`1 onSuccess) +171
Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +356
Umbraco.Web.UmbracoModule.<Init>b__7(Object sender, EventArgs e) +79
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +135
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
If you need any other information, please let me know. :)
Also getting the error :
2013-03-19 12:50:25,609 [34] ERROR Umbraco.Core.UmbracoApplicationBase - [Thread 22] An unhandled exception occurred
System.NullReferenceException: The UmbracoContext.Current is null, ProcessRequest cannot proceed unless there is a current UmbracoContext
at Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext)
at Umbraco.Web.UmbracoModule.<Init>b__7(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Can you give steps to reproduce how you are getting this issue? What code is causing this ?
It seems to be happening quite randomly. Any pageload/ajax event on the site in frontend or backend randomly throws this error. It is quite frustrating.
If you have any tips to debug it better, I am more than willing. :)
I'm also getting this error on a new install of Umbraco v6.0.3 (Assembly version: 1.0.4834.18854)
Just when I add any new content.
@Matt, does that happen every time you add new content ? Is it only one type of content or all types?
Hi Shannon,
It's just 2 content types, I'd created them by making copies of an existing doc type. I wanted to do that because they have similar properties.
@Matt ok, but are you getting this error every single time you are creating content of these types ? And what property types do you have assigned to this content type? I need to have a way to reproduce this error as i cannot locally at the moment.
Hi Shannon
The whole process I went through is:
I installed the Standard Website MVC Starter Kit, I copied the 'Standard' doc type positioned under 'Standard' (named 'Chapter'), removed the panels tab and picker for the panels. In the Structure for 'Standard' I allowed Chapter to be a child.
I hadn't added any additional properties to the Chapter type yet. Every time i tried to add a chapter under a s Standard doc i got the error.
I have now deleted the copied Doc Type and just added it using Create instead of copy and that's ok, but I guess copy should be ok too?
@Matt, ok thanks, i'll create an issue with these details and see if we can replicate.
Also note that the issue @Matt is having is different from the one that @Stephen is having since his appears to be on the front-end. @Matt can you please post the full stack trace you are getting ?
sure:
Server Error in '/' Application.
An item with the same key has already been added.
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 item with the same key has already been added.
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:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
I had a simmilar problem, but the source of my problem was that I've used incorectly the "Mixin" option in uSiteBuilder
Just checking in again. It seems that the problem hasn't 'gone away' (I didn't think it would magically, but you never know).
Is there any way to get better debug information from the system?
[NullReferenceException: The UmbracoContext.Current is null, ProcessRequest cannot proceed unless there is a current UmbracoContext] Umbraco.Web.UmbracoModule.ProcessRequest(HttpContextBase httpContext) +408 Umbraco.Web.UmbracoModule.<Init>b__7(Object sender, EventArgs e) +79 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +135 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
Also, for hte record, we don't use uSiteBuilder.
The site is an upgrade from 4.7 though.
We ended up disabling log4net and it works now.
... and for the record, Stephen's (and my) server is running New Relic, which may be what's in conflict.
I had the exact same issue and it was resolved by removing duplicate properties from child document types.
In example, my "root" document type had a property called Title and a child to this document type had also implemented that property in a previous version. This was probably allowed since the relations in my database wasn't intact at the moment.
I resolved my same error similarly to Eric above.
When I copied the Doctype it created two Content tabs, one inherited from the parent and one for the new Doctype, removing duplicate fields corrected the error.
is working on a reply...