Hello,
I've got a workflow instance stuck in a waiting state with the following error: "An item with the same key has already been added."
Here's the stack trace:
"Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Crm.Workflow.ActivityHostBase.OnWorkflowLoaded(WorkflowApplication activityInstance, ICommonWorkflowContext context)
at Microsoft.Crm.Workflow.ActivityHost.StartWorkflowExecution(Activity workflow, ICommonWorkflowContext context)
at Microsoft.Crm.Workflow.ActivityHostBase.StartWorkflow(ICommonWorkflowContext context, Activity preLoadedActivity)"
Has anyone encountered this issue before? If so, how was it solved?
*This post is locked for comments
Thanks for the response Nadeeja,
I'm using CRM 2016 on premise.
I do have a custom code activity in the workflow, but next to its step I see the green check mark indicating success.
The custom code activity only sets some entity reference output parameters. I am not inserting existing attributes into an entity anywhere. It is puzzling to me where the dictionary is coming from in the stack trace.
I also have numerous tracing statements in the code activity. I don't see them showing up under the Plug-in trace logs. (Yes, I have turned on tracing in the settings)
Hi Crispin,
Which version of CRM is it?
Do you have any custom workflow activities in the workflow?
Possible reason is that you are trying to add an attribute to an entity that's already which already exists.
Check out this thread.
https://community.dynamics.com/crm/f/117/t/163705
Cheers,
Nadeeja
If the answer solves your problem, please mark as Verified. Thanks.
My Blog: http://dyn365apps.com/ - Follow me on Twitter: https://twitter.com/dyn365apps
LinkedIn: https://www.linkedin.com/in/nadeeja
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156