Skip to content
New issue

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

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

Already on GitHub? # to your account

[StyleCleanUp] Add readonly modifiers in PresentationBuildTasks #10729

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Apr 7, 2025

Fixes #10726

Description

Fixes occurences of fields that are only written during construction to be readonly in PresentationBuildTasks.

In case they were being initialized to non-default value (e.g. initialized to string.Empty) but are always overwritten in the constructor, I have removed such assigment. This is a case which analyzers won't flag and imho there's no better time to do it than when resolving IDE0044 and changing fields to readonly.

Customer Impact

Increased performance due to the fields being treated as JIT-time constant in case of static readonly and better code-gen in readonly cases. These changes unlock #10724 since full sweep can only be done after the fields are marked appropriately.

Regression

No.

Testing

Local build.

Risk

Full test pass will be required, even in cases where no manual changes are done.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners April 7, 2025 16:53
@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 Apr 7, 2025
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 11.25659%. Comparing base (72af9a5) to head (664e45c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10729         +/-   ##
===================================================
- Coverage   11.25778%   11.25659%   -0.00120%     
===================================================
  Files           3315        3315                 
  Lines         665229      665228          -1     
  Branches       74668       74668                 
===================================================
- Hits           74890       74882          -8     
- Misses        589035      589042          +7     
  Partials        1304        1304                 
Flag Coverage Δ
Debug 11.25659% <ø> (-0.00120%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# for free to join this conversation on GitHub. Already have an account? # 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.

IDE0044: Add readonly modifier (fields) - PresentationBuildTasks
1 participant