I have a bit of SDK functionality that creates a featurelayer from a mapservice uri and then queries the layer for a search string using layer.Search(queryFilter) to retrieve a rowcursor, and then loops through the rowcursor to retrieve values using while (cursor.MoveNext())
This works most of the time but I occassionally get a geodatabase exception when calling MoveNext()
ArcGIS.Core.Data.GeodatabaseException: 'A geodatabase exception has occurred.'
COMException: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE))
at ArcGIS.Core.Data.RowCursor.MoveNext()
Any ideas what could be causing this error? The same bit of code works perfectly for local layer files.