Skip to content

System.ArgumentException: An item with the same key has already been added

Problem

All orders get stuck as Ordered and you get following error message

Log Name: ZervicePoint
Source: Process system service  
Date: 17.8.2015 10:10:39  
Event ID: 0  
Task Category: None  
Level: Error  
Keywords: Classic  
User: N/A  
Computer: v-enszzp01.mspzp.local  
Description:  
Timestamp: 10:10:39.006  
Message: Error processing orders: 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 System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)  
    at lambda_method(Closure , Object )  
    at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()  
    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)  
    at lambda_method(Closure )  
    at System.Linq.EnumerableExecutor`1.Execute()  
    at System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)  
    at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)  
    at Zipper.ZervicePoint.OrderComponent.Queries.GetNextOrderToProcess.Execute()  
    at Zipper.ZervicePoint.ProcessSystem.Engine.Detectors.OrderJobsDetector.GetNewOrder()  
    at Zipper.ZervicePoint.ProcessSystem.Engine.Detectors.OrderJobsDetector.ProcessNewOrders()  
Category: Process.OrderDetection  
Priority: -1  
EventId: 0  
Severity: Error  
Title:  
Machine: V-ENSZZP01  
Application Domain:
Zipper.ZervicePoint.ProcessSystem.WorkflowService.exe  
Process Id: 1532  
Process Name: C:\\Program
Files\\Zipper\\ZervicePoint\\ProcessSystem\\Zipper.ZervicePoint.ProcessSystem.WorkflowService.exe  
Win32 Thread Id: 1864  
Thread Name:
Extended Properties:
Event Xml:  

Solution

  1. Search for a service that has two attributes with the same name. (A clue is to check the earliest order that is stucked in "Ordered")
  2. Terminate all orders made from this service
  3. The error message might still continue in your Event Viewer although the orders are seems to be processed. You might need to put these terminated orders in "Error state" for the error message to stop

Troubleshooting guidelines