Issue with refreshing a catalog "An item with the same key has already been added."

Posts   
 
    
bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 04-Jan-2011 16:36:19   

We are using 2.6 October 2009 build, just downloaded from the site. When we refresh an existing project against the database we are getting this exception.

If I create a new project I am able to bring in all entities. I'm working through the things we've added to the project, but thought that you might be able to point me in the best direction as far as what to look for with relationships that would be causing duplicate keys.

I can send you a schema and the project file if needed also. Just let me know the preferred method.


An item with the same key has already been added.

-----[Core exception]--------------------
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at SD.LLBLGen.Pro.ApplicationCore.Entities.EntityRelationCollection.BuildCacheForContains()
   at SD.LLBLGen.Pro.ApplicationCore.Entities.EntityContainer.ConstructRelations(EntityDefinition entityToUpdate, Int32 recursionDepth)
   at SD.LLBLGen.Pro.ApplicationCore.Entities.EntityDefinition.MapField(IEntityFieldMapTargetElement targetField, ProjectProperties properties)
   at SD.LLBLGen.Pro.ApplicationCore.CatalogRefresher.MigrateEntityFields(EntityDefinition entity)
   at SD.LLBLGen.Pro.ApplicationCore.CatalogRefresher.MigrateEntities()
   at SD.LLBLGen.Pro.ApplicationCore.CatalogRefresher.MigrateProjectToNewCatalog(Boolean isUnattended, SelectTargetsForOrphanedElementsCallBack targetSelectCallBack)
   at SD.LLBLGen.Pro.Gui.Forms.MainWindow.RefreshCatalogs(Boolean unattended, Hashtable catalogsToRefresh)
   at SD.LLBLGen.Pro.Gui.Forms.MainWindow.RefreshAllCatalogs(Boolean unattended)
   at SD.LLBLGen.Pro.Gui.Forms.MainWindow._menuItemProjectRefreshCatalogsUnattended_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripMenuItem.ProcessCmdKey(Message& m, Keys keyData)
   at System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut)
   at System.Windows.Forms.ToolStripManager.ProcessCmdKey(Message& m, Keys keyData)
   at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 04-Jan-2011 16:59:12   

Something interesting. I changed the project and saved and it mentioned that the file was saved with 2.5. So we reinstalled 2.5 and did a refresh and didn't receive a problem.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 04-Jan-2011 21:21:33   

Certainly looks like it's trying to add 2 relations with the same name, but I'm pretty sure that SQL doesn't let that situation arise.

If you could send us the project file and schema script we'll look at recreating this for ourselves.

Thanks

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 38110
Joined: 17-Aug-2003
# Posted on: 05-Jan-2011 11:18:46   

Please use the latest v2.6 build and try again. October 2009 is the latest v2.6 build.

I do recall some problems with that method when it was initially added (to prevent long winded m:n discovery), but we haven't seen any reports about this since it was added (in April 2009)