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
235
System.ArgumentException: An item with the same key has already been added
posted

Hi,

Sometimes the following error occurs when the application attemps to start. It crashes just before any UI can be seen. The error is thrown from an Infragistics assembly and it seems there is an unprotected code block where items are added to an dictionary. I do not know why the keys are duplicated, because the application itself doesn't  have such code.

Error:

---------------------------------

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 Infragistics.Win.AppStyling.StyleUtilities.StyleHashtable`2.Add(TKey key, TValue value)

   at Infragistics.Win.AppStyling.StyleUtilities.UpdateRoleHierarchy(StyleHashtable`2 table, AssemblyStyleInfo[] assemblyInfos)

   at Infragistics.Win.AppStyling.StyleManager.ProcessLoadedAssembliesImpl()

   at Infragistics.Win.AppStyling.StyleManager.ProcessLoadedAssemblies()

   at Infragistics.Win.AppStyling.StyleManager.GetParentRole(String role)

   at Infragistics.Win.AppStyling.StyleManager.CreateStyleInfo(UIRole role)

   at Infragistics.Win.AppStyling.UIRole.UpdateCache()

   at Infragistics.Win.AppStyling.UIRole.VerifyCache()

   at Infragistics.Win.AppStyling.UIRole.ResolveAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps, RoleState state)

   at Infragistics.Win.UltraWinToolbars.ToolBase.ResolveAppearancePhase(ResolveAppearancePhaseInfo& phaseInfo, AppearanceData& appearance, AppearancePropFlags& requestedProps)

   at Infragistics.Win.UltraWinToolbars.EditorToolBase.ResolveAppearancePhase(ResolveAppearancePhaseInfo& phaseInfo, AppearanceData& appearance, AppearancePropFlags& requestedProps)

   at Infragistics.Win.UltraWinToolbars.TextEditorToolBase.ResolveAppearancePhase(ResolveAppearancePhaseInfo& phaseInfo, AppearanceData& appearance, AppearancePropFlags& requestedProps)

   at Infragistics.Win.UltraWinToolbars.TextBoxTool.ResolveAppearancePhase(ResolveAppearancePhaseInfo& phaseInfo, AppearanceData& appearance, AppearancePropFlags& requestedProps)

   at Infragistics.Win.UltraWinToolbars.ToolBase.ResolveAppearanceHelper(Boolean resolveAsMenu, Boolean resolveAsToolbar, Boolean editArea, AppearanceData& appearance, AppearancePropFlags& requestedProps, Boolean drawAsActive, Boolean drawAsPressed, Boolean largeImages, Object context, UIRole role, MenuItemBase menuItem)

   at Infragistics.Win.UltraWinToolbars.ToolBase.ResolveAppearanceHelper(Boolean resolveAsMenu, Boolean resolveAsToolbar, Boolean editArea, AppearanceData& appearance, AppearancePropFlags& requestedProps, Boolean drawAsActive, Boolean drawAsPressed, Boolean largeImages, Object context)

   at Infragistics.Win.UltraWinToolbars.ToolBase.ResolveAppearance(Boolean editArea, AppearanceData& appearance, AppearancePropFlags& requestedProps, Boolean drawAsActive, Boolean drawAsPressed, Object context)

   at Infragistics.Win.UltraWinToolbars.EditorToolBase.CalculateLogicalSizeOfToolInstance()

   at Infragistics.Win.UltraWinToolbars.ToolBase.CalculateLogicalSizeOfToolInstanceHelper()

   at Infragistics.Win.UltraWinToolbars.ToolBase.CalculateHeightResolved(Boolean useCalculateLogicalSize)

   at Infragistics.Win.UltraWinToolbars.ToolBase.get_Height()

   at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.GetMaxToolHeight(Boolean considerBumpedStatus)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.CalcHeight(Boolean considerBumpedStatus)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.get_Height()

   at Infragistics.Win.UltraWinToolbars.DockRow.CalculateMetrics()

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.RefreshDockAreaSize(Size& currentSize)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.RefreshDockAreaSize()

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.AddToolbar(UltraToolbarBase toolbar, Int32 row, Int32 col, Boolean refreshDockAreaSize, Boolean exclusiveOnRow)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.AddToolbar(UltraToolbar toolbar, Boolean restoreOldPosition)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.AddToolbarToDockArea(UltraToolbar toolbar, Boolean restoreOldPosition)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.AddToolbarsToDockArea(List`1 toolbarList)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.AddToolbarsToDockArea(DockedPosition targetDockArea)

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.InitializeDockAreaToolbars()

   at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnFormLoad(Object sender, EventArgs e)

   at System.Windows.Forms.UserControl.OnLoad(EventArgs e)

   at System.Windows.Forms.UserControl.OnCreateControl()

   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

   at System.Windows.Forms.Control.CreateControl()

   at System.Windows.Forms.Control.WmShowWindow(Message& m)

   at System.Windows.Forms.Control.WndProc(Message& m)

   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

   at System.Windows.Forms.ContainerControl.WndProc(Message& m)

   at System.Windows.Forms.UserControl.WndProc(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

-----------------------------------------