System.Linq.Dynamic Error An item with the same key has already been added RRS feed

  • Question

  • Hello,

    I have a program in which I use System.Linq.Dynamic and pass a string of parameters into the .Where(string) clause in order to dynamically create my Where clause and execute it on that on my List<object>.  When I run the program locally, I do not get any errors and the code executes fine.  However, when I run the code on the server I get the following message on the execution of the .Where(string) clause: Message = An item with the same key has already been added.  This is impossible to debug as the issue only happens on the server.  What is the solution to this issue?



    Thursday, February 4, 2016 8:12 PM

All replies

  • Hi, breynolds0120

    This is the forum to discuss questions and feedback for General Office Development, I'll move your question to the MSDN forum for LINQ to SQL


    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents,
    and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Friday, February 5, 2016 2:27 AM
  • Here is the exact error message:

    Error Message = An item with the same key has already been added. | Error Stack Trace =    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

       at System.Linq.Dynamic.ExpressionParser.CreateKeywords()

       at System.Linq.Dynamic.ExpressionParser..ctor(ParameterExpression[] parameters, String expression, Object[] values)

       at System.Linq.Dynamic.DynamicQueryable.Where(IQueryable source, String predicate, Object[] values)

       at System.Linq.Dynamic.DynamicQueryable.Where[T](IQueryable`1 source, String predicate, Object[] values)

       at System.Linq.Dynamic.DynamicQueryable.Where[T](IEnumerable`1 source, String predicate, Object[] values)

    Tuesday, February 9, 2016 6:17 PM
  • Hi breynolds0120,

    Since the program works on your local machine, but it does not work on your serve, it seems that the it should be the issue with the serve settings. I would suggest that you reproduce your local setting to serve and check if it works for you.

    in addition, I search related web sites by searching tools, and find some similar thread for your reference.



    Best regards,

    Cole Wu

    Monday, February 29, 2016 3:13 AM