Description
In case of multi-threads, ObjectPool.Get() returns null, seems not thread-safe under NET8 (8.0.0) and throws exception, but not under NET7.
Reproduction Steps
Checkout below demo to reproduce, watch for debugger break in the logger codes:
Symptom:
ObjectPool.Get() in the log object's WriteInternal() method, which uses a DefaultObjectPool, throws exception.
While the ObjectPoolCase1 and ObjectPoolCase2 in Main() seems not causing this problem, nor eitherway under NET7.
https://github.com/xiaoyuvax/ObjectPoolReuseCaseDemo
Expected behavior
DefaultObjectPool.Get() should be thread-safe, and always return an object instead of null.
Actual behavior
DefaultObjectPool.Get() returns null randomly.
Regression?
No response
Known Workarounds
Check if returns null and use new keyword to create new instance
Configuration
No response
Other information
No response