IIdentifyObj.Name throws COMException

Discussion created by jgieblerjr on May 19, 2011
Latest reply on May 25, 2011 by kaspatoo
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  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:

        /// <summary>
        /// Returns the "Display Field" string value that is shown in ArcMap
        /// when the feature is selected with a tool (such as the Identify tool).
        /// </summary>
        /// <param name="feature">The feature to retrieve the Display Field for.</param>
        /// <returns>String value of the feature's display field in ArcMap.</returns>
        public static String GetDisplayFieldValue(IFeature feature)
            IFeatureIdentifyObj featureIdentifyObject = new FeatureIdentifyObjectClass();
            featureIdentifyObject.Feature = feature;
            IIdentifyObj identifyObject = featureIdentifyObject as IIdentifyObj;
            return identifyObject.Name;  // exception thrown on this line 

Is there some other method to get the display value of a field that should be used in version 10?