diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs index 050825893e..6e5f3f8d31 100644 --- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs +++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs @@ -986,6 +986,10 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use // LUCENENET: We are doing this in the finally block to ensure it happens // when there are exceptions thrown (such as when the assert fails). ts.Close(); + + // ... and we dispose of it because it's the last use of the token stream + // before being reassigned below + ts.Dispose(); } // verify reusing is "reproducable" and also get the normal tokenstream sanity checks @@ -1043,6 +1047,7 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use finally { ts.Close(); + ts.Dispose(); } } else if (evilness == 7) @@ -1075,6 +1080,7 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use finally { ts.Close(); + ts.Dispose(); } } } @@ -1179,6 +1185,7 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use finally { ts.Close(); + ts.Dispose(); } if (field != null)