Hello… I keep getting an exception that seems almost at random when I am doing the following:
I am trying to select features based off a mouse click location. The code I have below shows two versions I am trying based off of the active shapefile’s shape type.
Essentially, we are creating a box around the mouse click location based off of the zoom level we are at (that is the xAdjust variable). I will occasionally get this exception:
A first chance exception of type ‘System.InvalidOperationException’ occurred in MapSuiteCore.dll
Additional information: Your input index is out of bound
When the point layer is active, we just take features that fall within our box, but I am trying to use intersection to grab the polygons. The bold line is the one where I get the exception. I can continue the program in debugging mode and it will eventually grab the feature, I am just wondering if there is something I can do besides catching and ignoring the exception?
I am using this production build currently. I will be switching over the the licensed copy sometime soon, but I would like to know how to counteract this exception in case it appears in that too.
WpfDesktopEditionEvaluation7.0.0.306DllPackage.zip
44.62 MB
4/12/2014
'xlayer is the active shapefile - it could be a point or polygon
’selectedfeatures is the collection of features for thisbox =
New
RectangleShape(e.WorldX - xAdjust, e.WorldY + xAdjust, e.WorldX + xAdjust, e.WorldY - xAdjust)
xlayer.Open()
If
xlayer.GetShapeFileType = ShapeFileType.Point
Then
selectedfeatures = xlayer.QueryTools.GetFeaturesWithin(box, ReturningColumnsType.AllColumns)
Else
'assuming polygon layer here
selectedfeatures = xlayer.QueryTools.GetFeaturesIntersecting(box, ReturningColumnsType.AllColumns)
End
If
xlayer.Close()
Return
selectedfeatures