U4-8631 - Two properties with the same alias, exist on document type.

Created by Rasmus Eeg Møller 22 Jun 2016, 10:13:01 Updated by Sebastiaan Janssen 04 Aug 2016, 12:08:44

Tags: Backport

Relates to: U4-8663

What did you do?

  1. Create new document type "Page" with a property name e.g. "umbracoNaviHide"
  2. Save "Page" document type
  3. Create new document type "Composition" with same property allias "umbracoNaviHide"
  4. Save "Composition" document type
  5. Edit the "Page" document type
  6. Delete property umbracoNaviHide.
  7. While still on "Page" add "Composition" as a composition
  8. Now save "Page" ''NOTE: I did not save between deleting and adding the compostion''

What did you expect to happen? That the "umbracoNaviHide" property on "Page" would be deleted, and then inherit "umbracoNaviHide" from "Composition"

What actually happened?

An error occured

ContentType with alias 'CompositionGenerics' was added as a Composition to ContentType with alias 'container', but there was a conflict on the following PropertyTypes: 'umbracoNaviHide'. PropertyTypes must have a unique alias across all Compositions in order to compose a valid ContentType Composition.

EXCEPTION DETAILS

Umbraco.Core.Exceptions.InvalidCompositionException: ContentType with alias 'CompositionGenerics' was added as a Composition to ContentType with alias 'container', but there was a conflict on the following PropertyTypes: 'umbracoNaviHide'. PropertyTypes must have a unique alias across all Compositions in order to compose a valid ContentType Composition.
STACKTRACE

at Umbraco.Core.Models.ContentTypeCompositionBase.AddContentType(IContentTypeComposition contentType)
   at Umbraco.Core.Persistence.Repositories.ContentTypeBaseRepository`1.ContentTypeQueryMapper.MapContentTypeChildren[TRepo](IContentTypeComposition[] contentTypes, Database db, ISqlSyntaxProvider sqlSyntax, TRepo contentTypeRepository, IDictionary`2 allParentContentTypeIds)
   at Umbraco.Core.Persistence.Repositories.ContentTypeBaseRepository`1.ContentTypeQueryMapper.GetContentTypes[TRepo](Database db, ISqlSyntaxProvider sqlSyntax, TRepo contentTypeRepository, ITemplateRepository templateRepository)
   at Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PerformGetAll(Int32[] ids)
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.PerformGetAll(Func`2 getFromRepo)
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.GetAll(TId[] ids, Func`2 getFromRepo)
   at Umbraco.Core.Persistence.Repositories.RepositoryBase`2.GetAll(TId[] ids)
   at Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PerformGetAll(Guid[] ids)
   at Umbraco.Core.Persistence.Repositories.ContentTypeRepository.<get_CachePolicyFactory>b__0()
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.<Get>b__6(TId[] ids)
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.PerformGetAll(Func`2 getFromRepo)
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.GetAll(TId[] ids, Func`2 getFromRepo)
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.Get(TId id, Func`2 getFromRepo)
   at Umbraco.Core.Persistence.Repositories.RepositoryBase`2.Get(TId id)
   at Umbraco.Core.Services.ContentTypeService.GetContentType(Int32 id)
   at Umbraco.Web.Editors.ContentTypeController.GetById(Int32 id)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()

Comments

Sebastiaan Janssen 22 Jun 2016, 11:07:05

Alright, can repro.. if you save Page, then navigate away from it and come back it works fine and you can save the composed doctype just fine.


Rasmus Eeg Møller 22 Jun 2016, 14:28:26

Sadly thats not the case om our solution. Once saved every document type throws error when trying to edit.


Rasmus Eeg Møller 23 Jun 2016, 07:04:56

@sebastiaan Take a look here https://rem.tinytake.com/sf/NzY2NjQ2XzM0Nzg2NzE Depends on what the name of the tab is apparently. The SQL i use, only removes the composition from Mappe (aka: container)

Sorry about the audio in the video. Just mute me. There is only office noise :-)


Sebastiaan Janssen 23 Jun 2016, 09:04:53

Well that sucks! :-) At least you found a fix for now, I'm sure it's just a quick angular update somewhere to make sure this doesn't happen :) We'll have a look at it for our next sprint.


Sebastiaan Janssen 23 Jun 2016, 09:05:56

Would be good if you could post the SQL, in case someone else runs into this problem!


Rasmus Eeg Møller 23 Jun 2016, 11:42:09

Quick fix it this happends.

SELECT *
	FROM cmsContentType2ContentType
	INNER JOIN cmsContentType
	ON cmsContentType2ContentType.childContentTypeId = cmsContentType.nodeId /* The id of your composed docoument */
	WHERE cmsContentType2ContentType.parentContentTypeId = 1078 /* GenericComposition */
	AND cmsContentType.alias = 'container' /* The alias of your document type which inherits your composed document */

DELETE type2type
	FROM cmsContentType2ContentType type2type
	INNER JOIN cmsContentType
	ON type2type.childContentTypeId = cmsContentType.nodeId
	WHERE type2type.parentContentTypeId = 1078 /* The id of your composed docoument */
	AND cmsContentType.alias = 'container' /* The alias of your document type which inherits your composed document */


Claus Jensen 26 Jul 2016, 08:32:06

I can also reproduce on 7.4.3 but it seems to be fixed in the latest 7.5 branch. There has been some refactoring of how properties are handled so I'm guessing this may also have affected/fixed this bug.

I will mark the issue as fixed in 7.5 and if anyone is still seeing the issue please feel free to reopen.


Sebastiaan Janssen 04 Aug 2016, 12:08:27

This was what fixed it: https://github.com/umbraco/Umbraco-CMS/pull/1386


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.3

Due in version: 7.5.0

Sprint: Sprint 38

Story Points:

Cycle: