Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StyleCleanUp] ThreadStatic fields should not use inline initialization (CA2019) #10301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Contributor

@h3xds1nz h3xds1nz commented Jan 16, 2025

Fixes #10300

Description

Avoid initializing [ThreadStatic] variables inline to prevent mistakes as it may lead you into thinking that such value will be initialized for all instances of the variable, not just the first thread.

Customer Impact

Cleaner codebase for developers.

Regression

No.

Testing

Local build.

Risk

Low. I've checked that fields that require initialization are properly initialized elsewhere.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners January 16, 2025 09:40
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CA2019: ThreadStatic fields should not use inline initialization
1 participant