web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Plugin error "An entry with the same key already exists"

(0) ShareShare
ReportReport
Posted on by

Hello,

I am getting the below error in Plugin traces for many of the plugins. Please look at this and provide the solution if any.

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An unexpected error occurred.Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
 <ActivityId>1114f53b-6a0e-4463-8cce-5c93198f1360</ActivityId>
 <ErrorCode>-2147220970</ErrorCode>
 <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic">
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiExceptionSourceKey</d2p1:key>
 <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">Step/Microsoft.Crm.Extensibility.ImageRetrievalStep</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiOriginalExceptionKey</d2p1:key>
 <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">System.ArgumentException: An entry with the same key already exists.
 at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
 at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
 at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
 at Microsoft.Crm.BusinessEntities.RollupsExtension.GetRecentCalculationTimes(AttributeExpressionCollection requestedAttributes, IOrganizationContext context)
 at Microsoft.Crm.BusinessEntities.RollupsExtension.UpdateCalcuationTimes(IEnumerable`1 entities, AttributeExpressionCollection requestedAttributes, IOrganizationContext context)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostRetrieveEventHandler.Invoke(Object sender, ExtensionEventArgs e)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.&lt;&gt;c__DisplayClass172_0.&lt;TryRetrieve&gt;b__0()
 at Microsoft.D365.ServicePlatform.Context.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.TryRetrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, LocalizedEnumLabelCache localizedEnumLabelCache, DatabaseQueryTarget queryTarget, BusinessEntity&amp; businessEntity)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.RetrieveEntity(BusinessEntityMoniker moniker, EntityExpression entityExpression, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.RetrieveEntityWithColumns(BusinessEntityMoniker businessEntityMoniker, List`1 columns, ContextEntityKey entityRequest, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.Execute(PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.Pipeline.&lt;&gt;c__DisplayClass1_1.&lt;Execute&gt;b__0()</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiStepKey</d2p1:key>
 <d2p1:value xmlns:d4p1="schemas.microsoft.com/.../Serialization" i:type="d4p1:guid">84b9d1ca-3e30-11db-b951-000cf1fe02ff</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiDepthKey</d2p1:key>
 <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:int">3</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiActivityIdKey</d2p1:key>
 <d2p1:value xmlns:d4p1="schemas.microsoft.com/.../Serialization" i:type="d4p1:guid">1114f53b-6a0e-4463-8cce-5c93198f1360</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiPluginSolutionNameKey</d2p1:key>
 <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">System</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiStepSolutionNameKey</d2p1:key>
 <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">System</d2p1:value>
 </KeyValuePairOfstringanyType>
 </ErrorDetails>
 <Message>An unexpected error occurred.</Message>
 <Timestamp>2018-06-20T12:27:44.2835934Z</Timestamp>
 <ExceptionRetriable>false</ExceptionRetriable>
 <ExceptionSource>SdkClient</ExceptionSource>
 <InnerFault>
 <ActivityId>1114f53b-6a0e-4463-8cce-5c93198f1360</ActivityId>
 <ErrorCode>-2147220970</ErrorCode>
 <ErrorDetails xmlns:d3p1="schemas.datacontract.org/.../System.Collections.Generic">
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiExceptionSourceKey</d3p1:key>
 <d3p1:value xmlns:d5p1="www.w3.org/.../XMLSchema" i:type="d5p1:string">Step/Microsoft.Crm.Extensibility.ImageRetrievalStep</d3p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiOriginalExceptionKey</d3p1:key>
 <d3p1:value xmlns:d5p1="www.w3.org/.../XMLSchema" i:type="d5p1:string">System.ArgumentException: An entry with the same key already exists.
 at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
 at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
 at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
 at Microsoft.Crm.BusinessEntities.RollupsExtension.GetRecentCalculationTimes(AttributeExpressionCollection requestedAttributes, IOrganizationContext context)
 at Microsoft.Crm.BusinessEntities.RollupsExtension.UpdateCalcuationTimes(IEnumerable`1 entities, AttributeExpressionCollection requestedAttributes, IOrganizationContext context)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostRetrieveEventHandler.Invoke(Object sender, ExtensionEventArgs e)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.&lt;&gt;c__DisplayClass172_0.&lt;TryRetrieve&gt;b__0()
 at Microsoft.D365.ServicePlatform.Context.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.TryRetrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, LocalizedEnumLabelCache localizedEnumLabelCache, DatabaseQueryTarget queryTarget, BusinessEntity&amp; businessEntity)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.RetrieveEntity(BusinessEntityMoniker moniker, EntityExpression entityExpression, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.RetrieveEntityWithColumns(BusinessEntityMoniker businessEntityMoniker, List`1 columns, ContextEntityKey entityRequest, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.Execute(PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.Pipeline.&lt;&gt;c__DisplayClass1_1.&lt;Execute&gt;b__0()</d3p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiStepKey</d3p1:key>
 <d3p1:value xmlns:d5p1="schemas.microsoft.com/.../Serialization" i:type="d5p1:guid">84b9d1ca-3e30-11db-b951-000cf1fe02ff</d3p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiDepthKey</d3p1:key>
 <d3p1:value xmlns:d5p1="www.w3.org/.../XMLSchema" i:type="d5p1:int">3</d3p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiActivityIdKey</d3p1:key>
 <d3p1:value xmlns:d5p1="schemas.microsoft.com/.../Serialization" i:type="d5p1:guid">1114f53b-6a0e-4463-8cce-5c93198f1360</d3p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiPluginSolutionNameKey</d3p1:key>
 <d3p1:value xmlns:d5p1="www.w3.org/.../XMLSchema" i:type="d5p1:string">System</d3p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d3p1:key>ApiStepSolutionNameKey</d3p1:key>
 <d3p1:value xmlns:d5p1="www.w3.org/.../XMLSchema" i:type="d5p1:string">System</d3p1:value>
 </KeyValuePairOfstringanyType>
 </ErrorDetails>
 <Message>System.ArgumentException: An entry with the same key already exists.</Message>
 <Timestamp>2018-06-20T12:27:44.2835934Z</Timestamp>
 <ExceptionRetriable>false</ExceptionRetriable>
 <ExceptionSource i:nil="true" />
 <InnerFault i:nil="true" />
 <OriginalException i:nil="true" />
 <TraceText i:nil="true" />
 </InnerFault>
 <OriginalException>System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: An unexpected error occurred. (Fault Detail is equal to Exception details:
ErrorCode: 0x80040216
Message: An unexpected error occurred.
TimeStamp: 2018-06-20T12:27:44.2835934Z
--
Exception details:
ErrorCode: 0x80040216
Message: System.ArgumentException: An entry with the same key already exists.
TimeStamp: 2018-06-20T12:27:44.2835934Z
--
).
 at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)
 at Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest request)
 at Microsoft.Crm.Sandbox.SandboxSdkListener.ExecuteInternal(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest, IExecutionContext context, String&amp; primaryEntityName)
 at Microsoft.Crm.Sandbox.SandboxSdkListener.Execute(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest)
 Original SdkErrors:
{ "ApiExceptionSourceKey": "Step/Microsoft.Crm.Extensibility.ImageRetrievalStep" }, { "ApiOriginalExceptionKey": "System.ArgumentException: An entry with the same key already exists.
 at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
 at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
 at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
 at Microsoft.Crm.BusinessEntities.RollupsExtension.GetRecentCalculationTimes(AttributeExpressionCollection requestedAttributes, IOrganizationContext context)
 at Microsoft.Crm.BusinessEntities.RollupsExtension.UpdateCalcuationTimes(IEnumerable`1 entities, AttributeExpressionCollection requestedAttributes, IOrganizationContext context)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostRetrieveEventHandler.Invoke(Object sender, ExtensionEventArgs e)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.&lt;&gt;c__DisplayClass172_0.&lt;TryRetrieve&gt;b__0()
 at Microsoft.D365.ServicePlatform.Context.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.TryRetrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, LocalizedEnumLabelCache localizedEnumLabelCache, DatabaseQueryTarget queryTarget, BusinessEntity&amp; businessEntity)
 at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.RetrieveEntity(BusinessEntityMoniker moniker, EntityExpression entityExpression, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.RetrieveEntityWithColumns(BusinessEntityMoniker businessEntityMoniker, List`1 columns, ContextEntityKey entityRequest, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.ImageRetrievalStep.Execute(PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.Pipeline.&lt;&gt;c__DisplayClass1_1.&lt;Execute&gt;b__0()" }, { "ApiStepKey": "84b9d1ca-3e30-11db-b951-000cf1fe02ff" }, { "ApiDepthKey": "3" }, { "ApiActivityIdKey": "1114f53b-6a0e-4463-8cce-5c93198f1360" }, { "ApiPluginSolutionNameKey": "System" }, { "ApiStepSolutionNameKey": "System" }</OriginalException>
 <TraceText>


 </TraceText>
</OrganizationServiceFault>

Server stack trace:
 at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
 at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
 at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
 at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
 at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
 at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
 at Microsoft.Crm.Sandbox.ISandboxHost.ExecuteAndReturnTraceInfo(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, String assemblyContents, Boolean returnTraceInfo)
 at Microsoft.Crm.Sandbox.SandboxPlugin.Execute(SandboxClient client, SandboxCallTracker callTracker, IExecutionContext requestContext, String assemblyContents, Boolean returnTraceInfo)
 at Microsoft.Crm.Sandbox.SandboxCodeUnit.ExecuteInternal(SandboxClient client, IExecutionContext context, SandboxTraceContext sandboxTraceContext, SandboxCallTracker callTracker, Guid parentExecutionId, String assemblyContents, Boolean& isSafeToRetry, Boolean& executeDone)
 at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans