<?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 IIdentifyObj.Name throws COMException in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321533#M8367</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an ArcMap extension (written in C#) that was created for 9.3 - I am testing its compatibility with version 10 as we have customers that want to upgrade. I can build the extension using Visual Studio 2008 on a machine with a clean install of ArcGIS 10. I have a&amp;nbsp; static method that gets the display value of a field for a feature using the IIdentifyObj.Name property which works fine in 9.3; in version 10 however, a COMException is thrown (error 0x80004005). Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;summary&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Returns the "Display Field" string value that is shown in ArcMap
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// when the feature is selected with a tool (such as the Identify tool).
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;/summary&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;param name="feature"&amp;gt;The feature to retrieve the Display Field for.&amp;lt;/param&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;returns&amp;gt;String value of the feature's display field in ArcMap.&amp;lt;/returns&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static String GetDisplayFieldValue(IFeature feature)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureIdentifyObj featureIdentifyObject = new FeatureIdentifyObjectClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureIdentifyObject.Feature = feature;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IIdentifyObj identifyObject = featureIdentifyObject as IIdentifyObj;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return identifyObject.Name;&amp;nbsp; // exception thrown on this line 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there some other method to get the display value of a field that should be used in version 10?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 May 2011 20:18:22 GMT</pubDate>
    <dc:creator>JackGiebler</dc:creator>
    <dc:date>2011-05-19T20:18:22Z</dc:date>
    <item>
      <title>IIdentifyObj.Name throws COMException</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321533#M8367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an ArcMap extension (written in C#) that was created for 9.3 - I am testing its compatibility with version 10 as we have customers that want to upgrade. I can build the extension using Visual Studio 2008 on a machine with a clean install of ArcGIS 10. I have a&amp;nbsp; static method that gets the display value of a field for a feature using the IIdentifyObj.Name property which works fine in 9.3; in version 10 however, a COMException is thrown (error 0x80004005). Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;summary&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Returns the "Display Field" string value that is shown in ArcMap
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// when the feature is selected with a tool (such as the Identify tool).
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;/summary&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;param name="feature"&amp;gt;The feature to retrieve the Display Field for.&amp;lt;/param&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;returns&amp;gt;String value of the feature's display field in ArcMap.&amp;lt;/returns&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static String GetDisplayFieldValue(IFeature feature)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureIdentifyObj featureIdentifyObject = new FeatureIdentifyObjectClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureIdentifyObject.Feature = feature;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IIdentifyObj identifyObject = featureIdentifyObject as IIdentifyObj;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return identifyObject.Name;&amp;nbsp; // exception thrown on this line 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there some other method to get the display value of a field that should be used in version 10?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 20:18:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321533#M8367</guid>
      <dc:creator>JackGiebler</dc:creator>
      <dc:date>2011-05-19T20:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: IIdentifyObj.Name throws COMException</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321534#M8368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just a thought but is the feature object you are passing into the function actually a valid object?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 13:43:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321534#M8368</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2011-05-24T13:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: IIdentifyObj.Name throws COMException</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321535#M8369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Just a thought but is the feature object you are passing into the function actually a valid object?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;yes, maybe your identifyObject is null, because the cast fails&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you should debug it and have a look at the attributes of each object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;whats about the Ifeature object comming as parameter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;it could be that this isnt correct, so &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;featureIdentifyObject.Feature = feature;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;fails&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and then &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;= featureIdentifyObject as IIdentifyObj;
&lt;/PRE&gt;&lt;SPAN&gt; fails, too&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:15:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/iidentifyobj-name-throws-comexception/m-p/321535#M8369</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2021-12-11T15:15:44Z</dc:date>
    </item>
  </channel>
</rss>

