Solve Umbraco Error Message: Item has already been added. Key in dictionary
When working with macros and parameters in Umbraco you might have stumbled upon the error:
Item has already been added. Key in dictionary: '[parameter-name]' Key being added: '[parameter-name]'
This is very easy to solve when you know the reason for it...
Most of the times you will get this error when you install a package that was previously installed, since most macro parameters where added before the “new” ones will be duplicates.
When struck by the “Item has already been added” error it seems like there’s no turning back besides deleting the entire macro, you can’t delete any parameters and you can’t save your macro, but there is an easy solution: Just make sure all your duplicate parameters has unique Aliases, I usually add a letter or two and renames them to “macroParameterxxx” and doesn’t click Save until all parameters has unique Aliases. As soon as you have renamed them all you can delete them one by one...
That wasn’t to hard was it?
The real solution to this problem would of course be that the Umbraco UI checks for duplicates in an earlier stage and never allows them to be added in the first place...
