Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchard.Templates: Cloning a Template creates "same key" error. #5092

Open
orchardbot opened this issue Mar 13, 2015 · 1 comment
Open

Orchard.Templates: Cloning a Template creates "same key" error. #5092

orchardbot opened this issue Mar 13, 2015 · 1 comment
Labels
Milestone

Comments

@orchardbot
Copy link

remesq created:
https://orchard.codeplex.com/workitem/21263

My template with an @this.WorkContext.CurrentUser.UserName in it was throwing an object reference error when I signed-out of a page.

When I realized it was the template + sign out combination that was throwing the error I went and clicked "clone" on the template, which created a duplicate. I then went in and changed the name of the template and clicked save. That throws the following error:

Server Error in '/OrchardLocal' 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:

Line 55: _cacheContextAccessor.Current = context;
Line 56:
Line 57: entry.Result = acquire(context);
Line 58: }
Line 59: finally {

Source File: e:\DEVELOPMENT\Orchard 1.9-int\src\Orchard\Caching\Cache.cs Line: 57

The entire site became unavailable.

I dug into the DB. Under Orchard_Framework_ContentItemRecord I found the two templates. However, they BOTH had the same identical , where "#" was a long alpha numeric key. Deleting the DB entry for the one I "Cloned" fixed my problem.

So it appears that cloning should be disabled in the Admin > Template screen, or some other work around.

I imagine any content items that can be cloned may run into this same problem IF an Identity Part is attached AND the user clicks "Clone"?

@orchardbot orchardbot added this to the Orchard 1.8.x milestone Apr 13, 2015
@sebastienros sebastienros modified the milestones: Orchard 1.9.x, Orchard 1.10.x Mar 17, 2016
@Skrypt
Copy link
Contributor

Skrypt commented Mar 27, 2016

#6630 PR fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants