I’ve implemented drawing on earth’s surface using polylines, and now I need the ability to remove these polylines. If I remove each of the lines from the PolylineCollection and then remove the PolylineCollection, I’m getting an error. When a polyline is removed, then the array of polylines in the collection, doesn’t actually remove that item from the array. Instead the collection removes the polyline and replaces the object with a null in the array. When the collection is removed, then it goes through it’s array of polylines and doesn’t check for a valid object before trying to access each object in the array resulting in the crash.
I’ve worked around this by not removing the polylines from the collection, before removing the collection.