Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Key already exists error in WindowsForm Designer
posted

Has been occurring for a while now from version 12+; currently trying to use v13.2.20132.2098. It just cost me another 4 hours’ work today, so I've come here.

I'll be going along doing my work in VsiualStudio 2012, and things will be fine, but then suddenly this error will crop up when trying to open the designer for a form containing Infragistics controls: 

Key already exists Parameter name: Key 
Instances of this error (1) 
Call Stack : 
at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKeyDoesNotExist(String key, IKeyedSubObject ignoreObject)
at Infragistics.Shared.KeyedSubObjectsCollectionBase.ValidateKey(String key, IKeyedSubObject ignoreObject)
at Infragistics.Shared.KeyedSubObjectsCollectionBase.InternalAdd(IKeyedSubObject obj)
at Infragistics.Win.UltraWinGrid.ColumnsCollection.InternalAdd(UltraGridColumn column)
at Infragistics.Win.UltraWinGrid.ColumnsCollection.Add(Object obj)
at Infragistics.Win.UltraWinGrid.ColumnsCollection.AddRange(Object[] columns) 

What I believe is happening is that every time I go to debug the app, the Windows Form Designer code for all the Infragistics controls gets re-generated. I can see differences between two successive iterations of the designer file; appearance instances get renumbered, grid column instances get renumbered, band instances get renumbered, etc. If I happen to have the designer form open when I start the debug, then the odds of this regenerated code getting out of alignment are raised greatly, but it is by no means a sure thing that having the designer closed when debugging will keep the problem from happening. When it gets out of alignment, this error is presented, with nothing to do but hope I made a recent backup before the debug, or wading through 1000's of lines of designer-generated code looking for duplicates.

So, anyone else experiencing this? Is it an aspect of Visual Studio, or Infragistics, that this designer code re-generation even occurs? Anyone have a solution?