The bug was in line 22 of TypeHandlerBase.cs:
if (x != null && y != null) return false;
This condition returns false when BOTH objects are non-null, which is
the normal comparison case. This caused the ConcurrentDictionary to:
1. Never find existing cache entries (Equals always returns false)
2. Add a new entry for every SetValue() call
3. Grow unboundedly causing memory leaks in production
The fix changes the null checks to proper equality semantics:
if (x == null && y == null) return true; // Both null = equal
if (x == null || y == null) return false; // One null = not equal
Added unit test to verify cache reuse behavior.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The bug was in line 22 of TypeHandlerBase.cs:
if (x != null && y != null) return false;
This condition returns false when BOTH objects are non-null, which is the normal comparison case. This caused the ConcurrentDictionary to:
The fix changes the null checks to proper equality semantics:
if (x == null && y == null) return true; // Both null = equal
if (x == null || y == null) return false; // One null = not equal
Added unit test to verify cache reuse behavior.
🤖 Generated with Claude Code