Language Manager: Cannot replace content added to multiple projects

Found in

EPiServer.Labs.LanguageManager 3.1.0

Fixed in

EPiServer.Labs.LanguageManager 3.1.0

Created

Nov 21, 2017

Updated

Dec 01, 2017

State

Closed, Fixed and tested


Description

Preconditions

  • Install Language Manager.
  • Enable several languages. For example, English, Svenska (Swedish).

1. Create a page on English.
2. Translate the page to Svenska.
3. Add the svenska verision to multiple projects.
4. Select Options/More Opitions > Replace content > Duplicate.

Expected: The content is replaced.
Actual: Error

The referenced content version '293_345' is already assigned to another project '2'.
 
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.InvalidOperationException: The referenced content version '293_345' is already assigned to another project '2'.
 
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: 
 
 
[InvalidOperationException: The referenced content version '293_345' is already assigned to another project '2'.]
   EPiServer.DataAbstraction.Internal.DefaultProjectRepository.SaveItems(IEnumerable`1 projectItems) +887
   EPiServer.Cms.Shell.UI.Rest.Projects.Internal.ProjectService.AddItemsInternal(ICollection`1 projectItems) +494
   EPiServer.Cms.Shell.UI.Rest.Projects.Internal.ProjectService.AddItems(IEnumerable`1 projectItems) +1664
   EPiServer.Cms.Shell.UI.Rest.Projects.Internal.ProjectService.AddToCurrentProject(IEnumerable`1 contentLinks) +91
   EPiServer.Labs.LanguageManager.Controllers.LanguageStore.AddContentLinksToCurrentProject(IEnumerable`1 contentLinks) +58
   EPiServer.Labs.LanguageManager.Controllers.LanguageStore.CopyDataFromMasterBranch(String contentLink, String languageID) +45
   lambda_method(Closure , ControllerBase , Object[] ) +147
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +38
   EPiServer.Shell.Services.Rest.RestHttpHandler.EndProcessRequest(IAsyncResult result) +28
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9765121
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
 
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1590.0