I have been working on setting a new DOM module. I imported a test version of my model using the Excel sheet and Dom Designer automation script. After making some changes, I wanted to start over, so I deleted the module using the Dom Editor and tried to re-create it, but now I get the error:
System.ArgumentException: An item with the same key has already been added.
Any thoughts on how I can track down what key is already there? Or, better, how do I get rid of it?
Thanks!
Hi Jamie,
In the Client Test tool, you can go to:
- Advanced>App>DataMiner Object Model...
There you should get an overview the different DOM modules you have.
If you then select a particular Module, and Click on view, you can then navigate to the "SectionDefinitions" tab, and again View this. Then you should get an overview of the Fields which are in the Definition. If you would compare this to the information that you are currently trying to recreate you might spot the key which is already in there.
Note that instead of the "Dom Designer" Script, there is also a "Dom Editer" Script. This script allows you to easily Edit your Dom module.
If you would require this script, this can be provided to you.
Kind regards,
Hey James,
The easiest way is probably to connect with the SLNetClientTest tool onto the DMA, then Advanced > Apps > DataMiner Object Model. That brings you to a page where you can see the different DOM module instances.
If you select the right one, then click on view, you'll see all the different DOM instances. Selecting one there and clicking view again will show you all the details.
There is also a possibility to delete specific instances from here, if needed.
Thanks guys! Completely forgot about the DOM tool in Client Test. That did help me figure out the problem was actually in my import file. I had a copy / paste error that resulted in two field names being the same. So, in the long run it was on my end all along, but the DOM Client Test tool helped me see that.
For reference, here’s a more complete version of the error in the logs:
2023/01/19 22:57:03.444|SLAutomation.exe 10.2.2241.34|10564|66008|CScriptLoader::ExitNow|DBG|-1|[James Stutz] (Script Dom Designer) EXIT: “System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Script.Run(Engine engine)”