Github user NightOwl888 commented on the issue:
https://github.com/apache/lucenenet/pull/185
Okay, I added some commits that take care of these issues.
I ported the test and worked out how to make the iterator logic work in the
WeakIdentityMap. The idea about mimicking the iterator by using yield return
was pretty clever, but unfortunately won't work because it won't stop the outer
loop when a stale key is hit. We need an iterator for it to work.
Unfortunately, although the logic works on one thread (you can verify that
by commenting [these
lines](https://github.com/apache/lucenenet/blob/c67366fd4b383c31971a8ae68b458dec7aee2d7f/src/Lucene.Net.Tests/core/Util/TestWeakIdentityMap.cs#L286-L289)),
when you hit it with multiple threads it blows up. Perhaps there is a way to
make it work but then again, it is only used in 3 classes in the original
Lucene:
1. Core.Util.AttributeSource
2. Core.Util.VirtualMethod
3. Core.Util.ByteBufferIndexInput
In AttributeSource it was replaced with WeakDictionary. Perhaps it could
just be replaced in all of them and eliminated rather than spending more time
trying to fix it.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---