TryGetToken reads from CacheEntry.Tokens without taking the per-key lock, while SetCache mutates that Dictionary under the lock. Dictionary is not safe for concurrent read/write, so this can throw or corrupt state under concurrency. Consider synchronizing reads using the same per-key lock, or switching Tokens to a thread-safe/immutable structure (e.g., ConcurrentDictionary or replace the dictionary on updates).
Originally posted by @Copilot in #331 (comment)
TryGetToken reads from CacheEntry.Tokens without taking the per-key lock, while SetCache mutates that Dictionary under the lock. Dictionary is not safe for concurrent read/write, so this can throw or corrupt state under concurrency. Consider synchronizing reads using the same per-key lock, or switching Tokens to a thread-safe/immutable structure (e.g., ConcurrentDictionary or replace the dictionary on updates).
Originally posted by @Copilot in #331 (comment)