I try to create a (point)-feature in an existing Layer via ArcGIS Automation.
I can create the Feature but when I call feature.Store() I get an
HRESULT: 0x80010105 (RPC_E_SERVERFAULT)
If I just edit an existing feature that I got from a SearchCursor it works flawlessly.
My application is a WinForms .Net 4.5 programm.
I get a connection to a running ArcMap Instance via IAppRot->IAppRef->IApplication->IDocument.
From the IDocument I get a reference to a specific Layer where I need to add a feature. After that it is very basic stuff:
IFeatureClass featureClass = ((IFeatureLayer)i_Layer).FeatureClass; IFeature newObject = featureClass.CreateFeature(); // Assign a geometry to the feature newObject.Shape = geom; newObject.Store();
Store allways fails with the RPC_E_SERVERFAULT Exception.
I also tried to create the feature via IFeatureCursor->IFeatureBuffer but then it fails with the same error on
Starting an Edit-Session for this operation has no effect. It just fails later when calling
I tried with ArcGIS 10.5 and 10.3 but the results are the same.
Other automation tasks like moving the map, setting layer-visibilities or even editing existing features work perfectly.
I read the introduction on ArcGIS automation in the documentation and learned about application's process space and "IObjectFactory".
Do I have to use that somehow to create the new Feature?
How can I do that?
Or is there something else that I am doing wrong?
As requested: The table definition doesn't seem to make a difference. I tried with featureclasses that have multiple fields and assigned values to the fields via
newObject.Value[index] = somevalue;
But now my tests use a featureclass that has only the fields "objectid" and "shape". The results are allways the same.
As requested: The geometry is created like this:
IGeometry geom = new PointClass(); ((IPoint)geom).X = x; ((IPoint)geom).Y = y;
The x and y values are guaranteed to be within the featureclass bounds.
The featureclass is in an file-geodatabase. Z and M values are not activated for the featureclass.