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

Error when applying the IDE0059 rule on code with simplified 'new' expression #64291

Closed
vsfeedback opened this issue Sep 26, 2022 · 0 comments · Fixed by #64662
Closed

Error when applying the IDE0059 rule on code with simplified 'new' expression #64291

vsfeedback opened this issue Sep 26, 2022 · 0 comments · Fixed by #64662
Assignees
Labels
Area-IDE Bug Tenet-Reliability Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner.
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]
When I apply the rule IDE0059 to remove a unnecessary value assignment that can be discarded with _ but the variable has a simplified 'new' expression the discarded version does not know the Type.

// before applying IDE0059 rule
MyClass obj = new("test");

// after applying IDE0059 rule
_ = new("test");

So in this example the version after applying the rule does not know what Type the simplified new should be.

The solution to this would be that when applying the IDE0059 rule it should be checked if there is a simplified new and than add the ClassType to that like this:

_ = new MyClass ("test");

Original Comments

Feedback Bot on 9/22/2022, 05:28 PM:

(private comment, text removed)


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 26, 2022
@jasonmalinowski jasonmalinowski removed the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 3, 2022
@jasonmalinowski jasonmalinowski added this to the 17.5 milestone Oct 3, 2022
@arunchndr arunchndr modified the milestones: 17.5, 17.5 P1 Oct 3, 2022
@mavasani mavasani added Bug Tenet-Reliability Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner. labels Oct 12, 2022
@mavasani mavasani modified the milestones: 17.5, 17.5 P1 Oct 12, 2022
mavasani added a commit to mavasani/roslyn that referenced this issue Oct 12, 2022
mavasani added a commit to mavasani/roslyn that referenced this issue Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Tenet-Reliability Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants