Skip to content

4.2.1

Latest

Choose a tag to compare

@seesharper seesharper released this 24 Feb 13:26
3774723

Change Log

4.2.1 (02/24/2026)

Full Changelog

Merged Pull Requests

Use AsyncLocal instead of ThreadStatic for SqlStatement.Current (02/24/2026) #79 (seesharper)

Summary

  • SqlStatement.Current was annotated with [ThreadStatic], which stores values per OS thread
  • With async/await, continuations can resume on a different thread pool thread (especially after .ConfigureAwait(false)), causing SqlStatement.Current to be null or stale in the async read path
  • Replaced with AsyncLocal<string>, which flows through ExecutionContext and correctly tracks the value across await boundaries
  • Public API is unchanged — callers read/write SqlStatement.Current the same way

Test plan

  • All 225 existing tests pass
  • Verify async reads (ReadAsync, ReadWithoutNavigationPropertiesAsync) correctly use the cache key across thread switches

🤖 Generated with Claude Code