ERROR: "An item with the same key has already been added"

Posts   
 
    
luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 18-May-2009 02:20:52   

llblgen 2.6 C# VS 2008, targeted to .net 2.0 SQL 2005, sp 2

I am using llblgen to manage the aspnet membership schema. I recently added a new table with the table name: aspnet_Users_Custom and set the primary key to unique identifier and created relationship to aspnet_Users.userId

I refreshed my catalogs in llblgen, and an error occured that the project was unstable. The specific error:


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 System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at SD.LLBLGen.Pro.ApplicationCore.Entities.EntityContainer.ConstructRelations(EntityDefinition entityToUpdate, Int32 recursionDepth)
   at SD.LLBLGen.Pro.ApplicationCore.Entities.EntityContainer.ConstructRelations(EntityDefinition entityToUpdate, Int32 recursionDepth)
   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 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.ToolStripMenuItem.ProcessCmdKey(Message& m, Keys keyData)
   at System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut)
   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.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)

source:
mscorlib


Now, whenever I attempt to remove and manually add back in the aspnet_Users table to llblgen, the same error above occurs. I deleted the new table, but the same error occurs.

Thanks!

luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 18-May-2009 02:47:29   

Video with the error being reproduced: (14MB) http://www.nema.org/files/temp/llblgenerror.avi

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-May-2009 07:25:50   

This has been reported here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15936

Please download the latest build.

luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 18-May-2009 08:02:10   

got it, thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 18-May-2009 09:28:04   

luciusism wrote:

got it, thanks!

Warning: the build online doesn't fix your issue. Though it's caused by an illegal FK constraint in the database: an FK which points to itself. Could you check that for me please? (so an Fk on the PK which points to itself, the PK: Order.ID -> Order.ID)

Frans Bouma | Lead developer LLBLGen Pro
luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 18-May-2009 17:11:09   

relationships is correct, originally created via SQL 2005 database designer. (simple m:n between aspnet_users.userId and aspnet_users_custom.userId)

Re-install, even though the April build, fixed the problem. No changes to database were made. It's possible there was an issue with my original upgrade from 2.5 to 2.6

Thanks!