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

Update inconsistent text in analyzer for Null-conditional Assignment #77985

Closed
KathleenDollard opened this issue Apr 3, 2025 · 2 comments
Closed

Comments

@KathleenDollard
Copy link

Brief description:

The text for rule CS0031 is lovely "Null check can be simplified"

Unfortunately, the fixer text is "Use null propagation" which does not align with the rule name and also differs from how we refer to the feature ("Null-conditional assignment")

It takes a few extra brain cycles to select the correct fixer when it differs from the name of the rule.

"Simplify null check" would align and what I think would be best. "Use null-conditional assignment" would align with the feature name as a second choice.

Languages applicable:

C#

Code example that the analyzer should report:

This issue regards the text when you hover on if in the following code:

    public static void UpdateAge(Customer? customer, int newAge)
    {
        if (customer is not null)
        {
            customer.Age = newAge;
        }
    }
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 3, 2025
@CyrusNajmabadi
Copy link
Member

This has been the text on this feature since it was introduced in 2016. It's widely used, and hasn't seemed to be a problem so far. I would prefer we just keep it as is.

@CyrusNajmabadi
Copy link
Member

Closing as not planned.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2025
@dotnet-policy-service dotnet-policy-service bot removed the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants