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)
-----------------------------------------
Hi all. Help me
Sometimes the following error occurs when the application attemps to start. I development Windowsform application. Errors when i add row into Grid
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************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.UltraWinGrid.UltraGridRow.get_ScrollCountInternal() at Infragistics.Win.UltraWinGrid.UltraGridRow.Infragistics.Shared.ISparseArrayMultiItem.get_ScrollCount() at Infragistics.Shared.SparseArray.GetVisibleIndexOf(ISparseArrayMultiItem item, Boolean ignoreItemHiddenState) at Infragistics.Win.UltraWinGrid.RowsCollection.GetVisibleIndex(UltraGridRow row, Boolean includeSpecialRows) at Infragistics.Win.UltraWinGrid.RowsCollection.GetVisibleIndex(UltraGridRow row) at Infragistics.Win.UltraWinGrid.UltraGridRow.get_VisibleIndex() at Infragistics.Win.UltraWinGrid.MergedCell.get_IsValid() at Infragistics.Win.UltraWinGrid.MergedCell.EnsureHeightMatrixCalculated() at Infragistics.Win.UltraWinGrid.MergedCell.GetTopRelativeTo(UltraGridRow row) at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.PositionMergedCellElements(UIElementsCollection oldMergedCellElems) at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive) at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered) at Infragistics.Win.ControlUIElementBase.get_CurrentCursor() at Infragistics.Win.UltraControlBase.get_Cursor() at System.Windows.Forms.Control.WmSetCursor(Message& m) at System.Windows.Forms.Control.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)
Help me. I'm so need to fix it to run applications
Thanks for your answer. The problem appears only on some clients' machines, so it's not easy to debug it. As always, the development / test machines do not show this issue. We will continue to investigate in the direction you suggested.
It looks like you may have two different versions of the UltraToolbarsManager assembly loaded at the same time. Can you look at the modules window in VS to see if that's the case?