While writing a simple ICommand in ArcMap 10.2.1 using C# that lets you select two different point features on the map and it creates a feature in a polyline feature class with those two points as its end points (connect the dots!) using the simple logic: grab the two selected points add the two points to an IPointCollection call IFeatureClass.CreateFeature() on the polyline feature class set the new feature's shape to the point collection call IFeature.Store() to save it. Then we got this error: "Zero-length polylines not allowed..." Even adding a few debug lines in to check the new feature's shape correctly has the FromPoint and ToPoint coordinates AND the Shape.Length correctly shows 204.34566 it still gives this error.
closed as off-topic by PolyGeo♦ Aug 2 '16 at 20:33
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
After troubleshooting by putting in some X Y coordinates and creating a new feature in a point feature class in a similar way it gave a better error message: "The value of the subtype code is NULL." So we then went back to our code for creating the line feature and added a step that sets the subtype attribute before calling IFeature.Store() and it worked perfectly! So this looks to be a "bug" in the error handling of IFeature.Store().