Skip to content

Conversation

@h3xds1nz
Copy link
Member

@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

@harshit7962 harshit7962 self-assigned this Apr 1, 2025
@harshit7962 harshit7962 merged commit 9e96cc9 into dotnet:main Apr 1, 2025
8 checks passed
@harshit7962
Copy link
Member

Thank you @h3xds1nz for the contributions.

@h3xds1nz
Copy link
Member Author

h3xds1nz commented Apr 1, 2025

@harshit7962 Thank you :)

@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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

2 participants