Shazwazza commented on issue #478:
URL: https://github.com/apache/lucenenet/issues/478#issuecomment-830563891


   The main reason I log this is really in case people go searching for a 
similar issue. The issue that was raised when porting over my work was a change 
in code in Lucene which revealed a mistake in my code. 
   
   I had accidentally disposed the IndexWriter but then tried to 
   
   ```cs
   IndexWriter?.Analyzer.Dispose();
   ```
   
   which threw the ObjectDisposedException. In my own indexer class, when it 
disposes at the end of being used (cannot be re-used) it disposes all other 
things that are disposable. The analyzer was one of them but due to the 
ordering of things I got the exception. The mistake in my code is disposing an 
object of an object that was originally owned by the parent. 
   
   I guess because Analyzer is virtual, it could do more than just return the 
value from the ctor so safer to throw. All good, will close this just wanted to 
ask. Cheers!
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to