Error when updating model with ModelBuilder: Index was outside the bounds of the array.

Product(s): WaterGEMS, WaterCAD, SewerGEMS, SewerCAD, CivilStorm, StormCAD, HAMMER
Version(s): 10.XX.XX.XX, 08.11.XX.XX
Area:  Modeling

Problem

When updating an existing model with ModelBuilder, the following error message is generated:

System.IndexOutOfRangeException: Index was outside the bounds of the array.

   at Haestad.Drawing.PolylineDrawingObject.GetMainColor()
   at Haestad.Drawing.CompositeDrawingObjectBase.GetAnnotationColor()
   at Haestad.Drawing.LayerDefinition.AddAnnotation(Int32 annotationId, Int32 count, Int32[] ids, Int32[] lengths, Byte[] strbuffer, GeometryPoint initialOffset, Double scaleFactor, Boolean isBoxed, Boolean useMultiLine)
   at Haestad.Drawing.Domain.StandAloneFeatureManagerBase.AddAnnotation(IDomainProject project, Int32 annotationDefinitionID, Int32 elementTypeID, Int32 count, Int32[] ids, Int32[] lengths, Byte[] strings, GeometryPoint initialOffset, Double scaleFactor, Boolean isBoxed, Boolean useMultiLine)
   at Haestad.Mapping.Support.ElementSymbologyAnnotationDefinitionManager.ApplyAnnotation(IDomainProject project, ElementSymbologyAnnotationDefinition annotationDefinition, HmIDCollection& elementIds, IFeatureAnnotationManager featureManager, IDomainElementManager manager, AnnotationActionType action, HmIDCollection allElementIds)
   at Haestad.Mapping.Library.MappingLibrary.RefreshDrawing(IMappingProject project, IFeatureManager featureManager, ElementSymbologyManagerCollection elementSymbologyManagerCollection, Boolean refreshFlowArrows)
   at Haestad.Drawing.Domain.LayoutControllerBase.RefreshDrawing()
   at Haestad.Drawing.Control.Support.Actions.Drawing.RefreshAnnotationAction.ExecuteImpl(IQueryGraphicalApplicationState queryApplicationState)
   at Haestad.Framework.Support.Actions.ActionBase`2.Execute()
   at Haestad.Drawing.Control.Support.Actions.ModelBuilderAction.ExecuteImpl(IQueryGraphicalApplicationState queryApplicationState)
   at Haestad.Idaho.Support.Actions.IdahoModelBuilderAction.ExecuteImpl(IQueryGraphicalApplicationState queryApplicationState)
   at Haestad.Framework.Support.Actions.ActionBase`2.Execute()
   at Haestad.Drawing.Control.Forms.GraphicalDrawingParentForm.menuButtonItemToolsModelBuilder_Activate(Object sender, EventArgs e)
   at TD.SandBar.ToolbarItemBase.OnActivate()
   at TD.SandBar.ToolBar.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at TD.SandBar.ToolBar.WndProc(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)

 

Solution

This error occurs when updating an existing model that has multiple duplicate GIS-IDs listed in the model file. This can occur when using any source file type, including Oracle Database and Excel spreadsheets.

Reference # 111918

To resolve the issue, open the element FlexTables and look for the fields "GIS-IDs" and "GIS-IDs <Count>". If the are not in the FlexTable, you can add them by selecting the Edit button. 

Once they are in the FlexTable, right-click on the "GIS-IDs <Count>" field and select Sort > Descending. Some items will have multiple IDs. View the collection and remove the duplicate entries. Once this is done, you should be able to update the model without issue.

If you are using the latest version, you can alternatively use the GIS-ID Control Center to perform this check.

See Also

Troubleshooting ModelBuilder issues and errors connecting to an Oracle database

Recommended
Related