So following this link


I am able to convert my featureLayer into a shapefile and export it.

However, some how for 1 specific layer that I tested with I always get this error:

Item NOT found in collection

During this piece of code:

IFeatureDataConverter featureDataConverter = new FeatureDataConverterClass();
IEnumInvalidObject enumInvalidObject =
  featureDataConverter.ConvertFeatureClass(((IDataset)featureLayer.FeatureClass).FullName as IFeatureClassName,
  null, null, targetFeatureClassName, targetGeometryDef, targetFields, "", 1000, 0);

// Check for errors.
IInvalidObjectInfo invalidObjectInfo = null;
while ((invalidObjectInfo = enumInvalidObject.Next()) != null)
    // Handle the errors in a way appropriate to the application.
    Debug.WriteLine("Errors occurred for the following feature: {0}, {1}",
      invalidObjectInfo.InvalidObjectID, invalidObjectInfo.ErrorDescription);
    result = false;

It does not crash, but the enumInvalidObject always gives me the error Item not found in this collection.

Does anyone have an idea on what may cause this, I know saying that ONE of my layer don't work is very vague, but I really don't know what is special about that layer.

It does export the shapefile, but no features inside.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.