<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS Automation Error in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcgis-automation-error/m-p/324214#M8450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i try to create a (point)-feature in an existing Layer via ArcGIS Automation.&lt;/P&gt;&lt;P&gt;I can create the Feature but when I call feature.Store() I get an "HRESULT: 0x80010105 (RPC_E_SERVERFAULT)" error.&lt;/P&gt;&lt;P&gt;If I just edit an existing feature that I got from a SearchCursor it works flawlessly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My application is a WinForms .Net 4.5 programm.&lt;/P&gt;&lt;P&gt;I get a connection to a running ArcMap Instance via IAppRot-&amp;gt;IAppRef-&amp;gt;IApplication-&amp;gt;IDocument.&lt;/P&gt;&lt;P&gt;From the IDocument I get a reference to a specific Layer where I need to add a feature.&lt;/P&gt;&lt;P&gt;After that it is very basic stuff:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;IFeatureClass featureClass &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IFeatureLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;i_Layer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureClass&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
IFeature newObject &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; featureClass&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CreateFeature&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Assign a geometry to the feature &lt;/SPAN&gt;
newObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Shape &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; geom&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
newObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Store&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Store allways fails with the RPC_E_SERVERFAULT Exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried to create the feature via IFeatureCursor-&amp;gt;IFeatureBuffer but then it fails with the same error on&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;featureCursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;InsertFeature&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureBuffer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Starting an Edit-Session for this operation has no effect. It just fails later when calling&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;workspaceEdit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;StopEditing&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with ArcGIS 10.5 an 10.3 but the results are the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other automation tasks like moving the map, setting layer-visibilities or even editing existing features work perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read the introduction on ArcGIS automation in the documentation and learned about application's process space and "IObjectFactory".&lt;/P&gt;&lt;P&gt;Do I have to use that somehow to create the new Feature? How can I do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is there something else that I am doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea is apreciated!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:23:32 GMT</pubDate>
    <dc:creator>AmazingMapMan</dc:creator>
    <dc:date>2021-12-11T15:23:32Z</dc:date>
    <item>
      <title>ArcGIS Automation Error</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcgis-automation-error/m-p/324214#M8450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i try to create a (point)-feature in an existing Layer via ArcGIS Automation.&lt;/P&gt;&lt;P&gt;I can create the Feature but when I call feature.Store() I get an "HRESULT: 0x80010105 (RPC_E_SERVERFAULT)" error.&lt;/P&gt;&lt;P&gt;If I just edit an existing feature that I got from a SearchCursor it works flawlessly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My application is a WinForms .Net 4.5 programm.&lt;/P&gt;&lt;P&gt;I get a connection to a running ArcMap Instance via IAppRot-&amp;gt;IAppRef-&amp;gt;IApplication-&amp;gt;IDocument.&lt;/P&gt;&lt;P&gt;From the IDocument I get a reference to a specific Layer where I need to add a feature.&lt;/P&gt;&lt;P&gt;After that it is very basic stuff:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;IFeatureClass featureClass &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IFeatureLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;i_Layer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureClass&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
IFeature newObject &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; featureClass&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CreateFeature&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// Assign a geometry to the feature &lt;/SPAN&gt;
newObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Shape &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; geom&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
newObject&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Store&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Store allways fails with the RPC_E_SERVERFAULT Exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried to create the feature via IFeatureCursor-&amp;gt;IFeatureBuffer but then it fails with the same error on&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;featureCursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;InsertFeature&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;featureBuffer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Starting an Edit-Session for this operation has no effect. It just fails later when calling&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;workspaceEdit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;StopEditing&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with ArcGIS 10.5 an 10.3 but the results are the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other automation tasks like moving the map, setting layer-visibilities or even editing existing features work perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read the introduction on ArcGIS automation in the documentation and learned about application's process space and "IObjectFactory".&lt;/P&gt;&lt;P&gt;Do I have to use that somehow to create the new Feature? How can I do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is there something else that I am doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea is apreciated!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:23:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcgis-automation-error/m-p/324214#M8450</guid>
      <dc:creator>AmazingMapMan</dc:creator>
      <dc:date>2021-12-11T15:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Automation Error</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcgis-automation-error/m-p/324215#M8451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it.&lt;/P&gt;&lt;P&gt;With a little help from &lt;A href="https://gis.stackexchange.com/questions/273867/arcgis-net-automation-error-when-creating-a-feature" rel="nofollow noopener noreferrer" target="_blank"&gt;stackoverflow &lt;/A&gt;I found a solution.&lt;/P&gt;&lt;P&gt;The problem was indeed that I have to use IObjectFactory to create the new geometry object.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;IObjectFactory objFactory = m_application as IObjectFactory;
//Use reflection to get ClsID of PointClass.
Type pointClassType = typeof(PointClass);
string typeClsID = pointClassType.GUID.ToString("B");
IPoint esriProcessSpacePoint = (IPoint)objFactory.Create(typeClsID);
esriProcessSpacePoint.X = x;
esriProcessSpacePoint.Y = y;
newObject.Shape = (IGeometry)esriProcessSpacePoint;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcgis-automation-error/m-p/324215#M8451</guid>
      <dc:creator>AmazingMapMan</dc:creator>
      <dc:date>2021-12-12T16:20:36Z</dc:date>
    </item>
  </channel>
</rss>

