Skip to content

BUG: Create code fix for update ReadonlyFieldCodeFixProvider so that the code does not break on public fields #293

@giggio

Description

@giggio

See discussion on #292, specifically this comment: #292 (comment)

The code fix from NoPrivateReadonlyFieldAnalyzer (CC0074) is handled by the same code fix provider from the private analyzer, on ReadonlyFieldCodeFixProvider. As the CC0074 is only generated at the end of the compilation stage, it will produce a diagnostic that might be later fixed by the user but won't be notice until the next compilation ends. That might take time. In the mean time, the user might apply the code fix, breaking his/her code.

This only happens for the non private analyzer, the other analyzer works perfectly because it is private, and the analysis context is smaller.

The code fix should be updated, or another one created, so that it runs the analysis again before producing any change, to make sure it is still necessary. Another option is to update the analyzer to not incur in the problem anymore, but that is unlikely to be feasible.

After this is fixed CC0074 should be enabled by default.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions