AnsweredAssumed Answered

ICursor issue in 10.1 SP-1

Question asked by sshepard on Nov 8, 2012
Latest reply on Feb 23, 2015 by Adhimoolam
I have used the code below for a few years in an ArcGIS Engine application we have developed.  Essentailly it builds a sorted IEnumerator of unique values from a specific field in a layers attribute table.  It has worked fine for years however after upgrading to SP-1 of 10.1 running it consecutivly three times to build three differant lists of values it causes our application to crash.  The crash seems to happed a few seconds after we step through the last IEnumerator to populate a listbox.

Am I missing somthing here?  The crash is an "nt.dll" error in a standard windows error box.

private IEnumerator getSortedList(string mField, ILayer mLayer, string whereclause)         {             IQueryFilter mQFilter = new QueryFilterClass();             mQFilter.WhereClause = whereclause;             IEnumerator mEnumstreets = null;             if (mLayer != null)             {                 IFeatureLayer mFeatureLayer = (IFeatureLayer)mLayer;                 IFeatureClass pFeatureClass = mFeatureLayer.FeatureClass;                 if (pFeatureClass != null)                 {                         ITable pTable = (ITable)pFeatureClass;                         IFeatureCursor pCursor = pFeatureClass.Search(mQFilter, true);                          ITableSort mTableSort = new TableSortClass();                         mTableSort.Table = pTable;                         mTableSort.Fields = mField;                         mTableSort.set_Ascending(mField, true);                         mTableSort.QueryFilter = mQFilter;                         mTableSort.Sort(null);                          IDataStatistics mDataStats = new DataStatisticsClass();                         mDataStats.Cursor = mTableSort.Rows;                         mDataStats.Field = mField;                         mEnumstreets = mDataStats.UniqueValues;                         pCursor = null;                 }             }             return mEnumstreets;         }