Search code examples
.netesriarcobjects

What does the exception "Exception from HRESULT: 0x80040653" when calling IFeatureClass.Search in ArcObjects mean?


I'm supporting an application built on ESRI ArcObjects where the original developers are long since gone. The application after having worked fine for a couple of years has started failing with this exception. The application runs on a daily schedule.

The error message isn't very helpful. Any ideas what the cause of the error might be?

Exception from HRESULT: 0x80040653
Date: Thursday, 4 March 2010
Time: 1:47:33 a.m.
Stack trace:    
   at ESRI.ArcGIS.Geodatabase.IFeatureClass.Search(IQueryFilter filter, Boolean Recycling)

Solution

  • It turns out the error was caused by the IQueryFilter.WhereClause property that was getting passed into the Search method, contained the name of a field that didn't exist in the feature class.

    It would be nice if the exception thrown had a relevant message. It would've saved me a lot of time.