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

Primary ctor parameter writes should be assumed necessary even if not read later in the method #68904

Closed
RikkiGibson opened this issue Jul 6, 2023 · 3 comments
Assignees
Milestone

Comments

@RikkiGibson
Copy link
Contributor

RikkiGibson commented Jul 6, 2023

Version Used: VS 17.7.0 Preview 2.0

Steps to Reproduce:

class MyClass(int value)
{
    public int Get()
    {
        var x = value;
        value++; // IDE0059: unnecessary assignment of a value to 'value'
        return x;
    }
}

Expected Behavior: No diagnostic. Behavior should be similar to if a field 'int value' were explicitly declared in 'MyClass'.

Actual Behavior: IDE0059 is reported

Relates to #65697

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 6, 2023
@RikkiGibson
Copy link
Contributor Author

Ping @arkalyanms @dotnet/roslyn-ide for triage

@arunchndr arunchndr removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 1, 2023
@arunchndr arunchndr added this to the 17.8 P2 milestone Aug 1, 2023
@arunchndr
Copy link
Member

Starting with Cyrus for first look.

@mavasani
Copy link
Contributor

mavasani commented Sep 1, 2023

Duplicate of #69643. Verified that this was fixed with #69748

@mavasani mavasani closed this as completed Sep 1, 2023
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

5 participants