Solved! Go to Solution.
private static void check(IFeatureWorkspace fws) { IFeatureCursor c = fws.OpenFeatureClass("XYZ").Search(null, false); IFeature f = c.NextFeature(); m_List = null; GC.Collect(2); m_List = new List<IFeature>(); while (f != null) { m_List.Add(f); f = c.NextFeature(); } Marshal.FinalReleaseComObject(c); }
For anyone having this issue in 10.4.1. Looks like its a bug in ArcObjects. Doesn't get fixed until 10.5.1.