AnsweredAssumed Answered

ArcGIS Automation Error

Question asked by SuperLoehr on Mar 7, 2018
Latest reply on Mar 9, 2018 by SuperLoehr

Hello,

 

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)" error.

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

featureCursor.InsertFeature(featureBuffer);

 

Starting an Edit-Session for this operation has no effect. It just fails later when calling

workspaceEdit.StopEditing(true);

 

I tried with ArcGIS 10.5 an 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?

 

Any idea is apreciated!!

 

Thanks,

Stefan

Outcomes