Github user guidotag commented on the pull request: https://github.com/apache/lucenenet/pull/62#issuecomment-71775513 @laimis: Sure. I found that if you set file to null before entering the using's scope and then, inside it, change it to reference a File object, it does not dispose the resources correctly (namely, it does not close the file we are opening). I did an isolated test to reproduce it (constructed a dummy IDisposable object and used the using instruction in the same way), and it also failed. I am no C# expert, so I wasn't completely sure why this happened. Nevertheless, it is reasonable that if you change the reference of the variable inside the using's scope, bad things could happen.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---