<?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 Re: Occasional exceptions thrown while fetching multipatch feature rows. in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/occasional-exceptions-thrown-while-fetching/m-p/739661#M217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bill,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of question&amp;nbsp;&lt;/P&gt;&lt;P&gt;- what type of attributes do you have on the feature class?&amp;nbsp; Maybe one of them is the problem.&amp;nbsp; &amp;nbsp;What happens if you set the SubFields on your spatial query filter to just be ObjectId, Shape?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you see the same problem if you pass null to the Table.Search?&amp;nbsp; that is you're iterating through all records rather than those that match your spatial filter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, if you reorganize your code so that the cursor iteration occurs immediately after the search, do you still see the same problem?&amp;nbsp; You should also wrap your OpenDataset and Search methods in a using statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example see this snippet as a suggestion of how to iterate.&amp;nbsp; We generally don't recommend caching objects such as RowCursors.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-table-using-queryfilter" title="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-table-using-queryfilter"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-table-using-queryfilter&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if these&amp;nbsp;suggestions don't help to track down your issue.&amp;nbsp;&amp;nbsp;If you're still having problems, maybe we can get your data for further investigation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 May 2020 22:55:42 GMT</pubDate>
    <dc:creator>NarelleChedzey</dc:creator>
    <dc:date>2020-05-14T22:55:42Z</dc:date>
    <item>
      <title>Occasional exceptions thrown while fetching multipatch feature rows.</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/occasional-exceptions-thrown-while-fetching/m-p/739660#M216</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'm experiencing a strange error that only happens on some of my multipatch feature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An error occurs when cycling through a RowCursor on a couple of features, but the rest come through fine.&amp;nbsp; I have this working with legacy ArcObject code, so I don't see a problem with the features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception thrown is "Value does not fall within the expected range." for 3 out of&amp;nbsp;79 features.&amp;nbsp; Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the basic code snippets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Reset a search cursor.&lt;/P&gt;&lt;P&gt;Table table = m_db_info.geodb.OpenDataset&amp;lt;Table&amp;gt;(m_class_name);&lt;BR /&gt; FeatureClass fc = table as FeatureClass;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (fc != null &amp;amp;&amp;amp; m_mbr != null) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;SpatialQueryFilter spatial_filter = new SpatialQueryFilter();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (SetupQueryGeometry(m_mbr, fc.GetDefinition().GetSpatialReference(), out Geometry extent)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// If queryFilter is an instance of ArcGIS.Core.Data.SpatialQueryFilter, either&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// both the 'FilterGeometry' and 'SpatialRelationship' properties are set or both&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// are not set. Otherwise, an ArgumentException will be raised.&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (extent.Extent.Area &amp;gt; 0) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spatial_filter.FilterGeometry = extent;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spatial_filter.SpatialRelationship = SpatialRelationship.Intersects;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (m_query.Length &amp;gt; 0) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spatial_filter.WhereClause = m_query;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spatial_filter.SubFields = "*";&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (m_postfix.Length &amp;gt; 0) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;spatial_filter.PostfixClause = m_postfix;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_cursor = table.Search(spatial_filter, false); // m_cursor is a RowCursor&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...............................&lt;/P&gt;&lt;P&gt;// Traverse the features in another method.&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Table table = m_db_info.geodb.OpenDataset&amp;lt;Table&amp;gt;(m_class_name);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;FeatureClass fc = table as FeatureClass;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (m_cursor.MoveNext()) {&amp;nbsp; &lt;STRONG&gt;(THROWING AN EXCEPTION ON A FEW FEATURES HERE)&lt;/STRONG&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using (Row row = m_cursor.Current) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Process the feature.&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;EsriFeatureRow feature = new EsriFeatureRow {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_feature_id = (int)row.GetObjectID()&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;/P&gt;&lt;P&gt;...etc...&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for any suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2020 15:24:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/occasional-exceptions-thrown-while-fetching/m-p/739660#M216</guid>
      <dc:creator>BillSmith</dc:creator>
      <dc:date>2020-05-13T15:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Occasional exceptions thrown while fetching multipatch feature rows.</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/occasional-exceptions-thrown-while-fetching/m-p/739661#M217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bill,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of question&amp;nbsp;&lt;/P&gt;&lt;P&gt;- what type of attributes do you have on the feature class?&amp;nbsp; Maybe one of them is the problem.&amp;nbsp; &amp;nbsp;What happens if you set the SubFields on your spatial query filter to just be ObjectId, Shape?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you see the same problem if you pass null to the Table.Search?&amp;nbsp; that is you're iterating through all records rather than those that match your spatial filter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, if you reorganize your code so that the cursor iteration occurs immediately after the search, do you still see the same problem?&amp;nbsp; You should also wrap your OpenDataset and Search methods in a using statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example see this snippet as a suggestion of how to iterate.&amp;nbsp; We generally don't recommend caching objects such as RowCursors.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-table-using-queryfilter" title="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-table-using-queryfilter"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#searching-a-table-using-queryfilter&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if these&amp;nbsp;suggestions don't help to track down your issue.&amp;nbsp;&amp;nbsp;If you're still having problems, maybe we can get your data for further investigation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2020 22:55:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/occasional-exceptions-thrown-while-fetching/m-p/739661#M217</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2020-05-14T22:55:42Z</dc:date>
    </item>
  </channel>
</rss>

