Skip to content

Conversation

@stephentoub
Copy link
Member

Follow-up to #45296
cc: @marek-safar

@ghost
Copy link

ghost commented Nov 30, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
See info in area-owners.md if you want to be subscribed.

Issue Details

Follow-up to #45296
cc: @marek-safar

Author: stephentoub
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@marek-safar
Copy link
Contributor

Is there analyzer we could enable to catch this?

@stephentoub
Copy link
Member Author

stephentoub commented Nov 30, 2020

Is there analyzer we could enable to catch this?

https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0044

<Rule Id="IDE0044" Action="Hidden" /> <!-- MakeFieldReadonly -->

It's not ideal for Corelib, though, given how many fields end up being used from native.

@marek-safar
Copy link
Contributor

It's not ideal for Corelib, though, given how many fields end up being used from native.

What do you mean, it should kick in only for the inline assigned fields. Do we do that for such fields?

@stephentoub
Copy link
Member Author

it should kick in only for the inline assigned fields

It warns about any fields for which there aren't any assignments outside of ctors / declarations. That means any fields which are set by the EE end up getting flagged. Just change that one line from Hidden to Warning, build corelib, and you'll see what I mean.

@stephentoub stephentoub merged commit 2445324 into master Nov 30, 2020
@stephentoub stephentoub deleted the stephentoub-iculocaledatareadonly branch November 30, 2020 19:15
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants