This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

When deploying a package on your 4.7 environment through P&D, one of the Views fails to deploy with the error below returned:

"An item with the same key has already been added"

Symptoms

  • From the deployment logs, the full error message is as follows:-

"Fail <View Name> An item with the same key has already been added. System.ArgumentException: An item with the same key has already been added. at SourceCode.Hosting.Client.BaseAPI.BaseAPIConnection.RemoteCall(String TypeName, String MethodName, Object[] Parameters, Boolean[] NullList, MarshalMessageType CallType) at SourceCode.Hosting.Client.BaseAPI.BaseAPI.RemoteSessionCall(String TypeName, String MethodName, Object[] Parameters, Boolean[] NullList) at SourceCode.Forms.Management.FormsManager.DoSessionCall(String method, Object[] parameters, Boolean[] nullList) 2. Deleting the View and its dependencies on the Target environment, and then re-deploying the package does not help. at SourceCode.Forms.Management.FormsManager.Deploy(String definition, String category, Boolean checkIn, Boolean skipReferenceValidation) at SourceCode.Runtime.Services.Forms.FormsSessionData.DeployView(View view, Boolean checkIn, Boolean skipReferenceValidation) at SourceCode.Runtime.Services.Forms.Services.BaseFormViewService`3.DeployAuthoringInstance(AuthoringType instance) at SourceCode.Runtime.Services.Forms.Services.BaseFormViewService`3.Deploy(IDeploymentContext context)"

  • The issue persists after deleting the erroneous View along with its dependencies on the Target environment, and then re-deploying the package.

Troubleshooting Steps

To resolve the issue, please apply the latest available 4.7 Cumulative Update which can be downloaded here.