NightOwl888 commented on code in PR #1096:
URL: https://github.com/apache/lucenenet/pull/1096#discussion_r1917774255


##########
src/Lucene.Net.TestFramework/Support/Util/RandomizedContext.cs:
##########
@@ -37,6 +40,12 @@ internal class RandomizedContext
         private readonly long randomSeed;
         private readonly string randomSeedAsHex;
         private readonly long testSeed;
+        private List<IDisposable>? toDisposeAtEnd = null;

Review Comment:
   I ended up using your suggestion of 
`Lazy<ConcurrentQueue<DisposableResourceInfo>>` after porting the 
`ClosableResourceInfo` class from randomizedtesting.
   
   `DisposableResourceInfo` keeps track of the details of the caller of 
`LuceneTestCase.DisposeAfterSuite()` (including the stack trace) so it can be 
used to log the caller details when an exception is thrown from `Dispose()`. 
The cheapest way I could find to do this was to instantiate a `StackTrace` 
instance at the point where we want to record the details and wait until after 
an exception is thrown to call `ToString()` on it to allocate the string. Let 
me know if you can think of a more efficient way.
   
   Also note that I didn't port the part of `randomizedtesting` that gives each 
thread a unique name (yet). So at present, `ThreadName` is always `null`.



-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to