Skip to content

Conversation

stephentoub
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 30, 2025 03:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes ThreadStatic field patterns by replacing explicit ThreadStatic field declarations with the newer field keyword syntax in auto-properties. This simplifies the code by eliminating the need for separate backing fields and getter/setter logic.

Key changes:

  • Replaces [ThreadStatic] private static Type? t_field; patterns with [field: ThreadStatic] on auto-properties
  • Consolidates multi-line property implementations into single-line expressions using field ??= new()
  • Removes redundant backing fields and associated boilerplate code

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
System/Transactions/Transaction.cs Converts ContextData ThreadStatic field to use field keyword in TLSCurrentData property
CoseTestHelpers.cs Simplifies TestKeyRing ThreadStatic property using field keyword
System/Diagnostics/Debug.cs Updates IndentLevel ThreadStatic property to use field keyword
RandomNumberGenerator.cs Converts Current property ThreadStatic backing field to field keyword
ImportType.cs Simplifies CastSingleValueCache ThreadStatic property using field keyword
ContractNameServices.cs Updates TypeIdentityCache ThreadStatic property to use field keyword
LazyAsyncResult.cs Converts CurrentThreadContext ThreadStatic property to use field keyword

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 30, 2025
@stephentoub stephentoub merged commit bd305f6 into dotnet:main Sep 30, 2025
143 of 145 checks passed
@stephentoub stephentoub deleted the tlfield branch September 30, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants