Solved

System.ArgumentException: Item has already been added.

Hello,

On defining the datamodel we run into the following problems:

System.ArgumentException: Item has already been added. Key in dictionary: 'Relation_Address' Key being added: 'Relation_Address'

With every multiple-to-multiple relationship we get this error and then the model gets corrupted.

I also happens with single-to-single relationship. In this situation we are able to proceed after pressing 'continue'

We even get these errors when we start with a fresh new database, so the cause would most likely not be in the tables we already created.

Any clue what could be wrong?

System.ArgumentException: Item has already been added. Key in dictionary: 'Relation_Address' Key being added: 'Relation_Address' at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at BizAgi.EntityManager.CEntityMD.GetFactsMetadata() at BizAgi.EntityManager.CEntityMD.get_Facts() at BizAgiStudio.EntityManagerPlugin.Diagram.Wizards.CreateRelationship.Steps.Step3_SelectTypeRelationship.OnValidateFinish(Object sender, CancelEventArgs e) at Vision.Forms.Wizard.SequentialWizard.CtrlSequentialWizard.ExecuteFinish(Object sender) at DevComponents.DotNetBar.ButtonX.OnClick(EventArgs e) at DevComponents.DotNetBar.ButtonX.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Regards, Arjan

Comments (3)

photo
0

Dear Arjan,

This error usually occurs when the rule is including the creation or configuration of a Key and when it's multiple Bizagi runs the rule everytime and try to execute that creation or modify that configuration for the Key every time it's runs. We recommend reviewing the structure of the rule so this kind of process runs only once.

Regards

photo
0

So what you are saying is that when we add or change relations to many-to-many there is a higher chance of this error occurring?

And what do we do when we have this situation? How do we 'repair' the solution? It's not really an option to lose all our work. Or do a DB backup before every action that we do.

photo
0

Dear Arjan,

No. It is very common in projects to add multiple-to-multiple relationship. We have an article where explain how to create it: relationship_types. You will not lose your work.

Take care to not modify the keys when you create relations constantly. Bizagi does the process automaticlly. If you mind, you can send us the full version of Bizagi, event viewer application log and screenshots.

Regards