New Posts New Posts RSS Feed: An item with the same key has already been added.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

An item with the same key has already been added.

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: An item with the same key has already been added.
    Posted: 14-Oct-2013 at 11:05am
It had to be a corrupted model. I went back to a backup from the previous day and everything is fine.
 
Bill
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 14-Oct-2013 at 10:31am
DevForce will only throw this exception if an entity key already exists in cache.  I can't think why every query for any type would suddenly start throwing this error.  To diagnose this I'd enable breaking on all CLR exceptions so that you'll get a popup for all first chance exceptions.  You'll have to walk through some spurious exceptions to get to the point where this exception is thrown, but you should then have a better idea of where in your code the problem starts.
Back to Top
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Posted: 14-Oct-2013 at 3:13am
I am using Devforce 2010 6.1.15 with Intersoft UI Controls to create a WPF app. Prior to the middle of the day yesterday my application was working just fine, reading and processing data. Last night i was working on the code and built the latest version and started it up in Visual Studio 2012 using .net 4.0. As soon as i entered the username and password in the login window and called my ValidateLogin routine, I received the above error. Prior to this call there is no data call to retreive data so i know i cannot have a duplicate key value in the cache. So I commented out the call to validate the login. I ran the program again. The very next call to my Repository which is using my entity manager to call an ExecuteQuery I get the above error. I commented out the call to that line. The next call to my repository and a line using the entity manager to execute a query also caused that error. All my calls to my repository class and then any call to the entity manager and trying to run a query i get that error message.
 
In design mode, I can connect to the database and see my model on the screen. I see my entities in the model browser. Validate the model produces no errors. I can refresh the model from the database.
 
Any suggestions? I am out of ideas. My query strategy is set to normal. As i said it was working fine and then this occured. Could my domain model be corrupted? Obvkously every call to retrieve data in a query can't be multiple keys in the cache. So i am assuming this can be a spurious error and refer to some other problem.
 
Bill
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down