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

2 BUGS in Visual Studio Community 2022 Preview Code Cleanup #63213

Open
vsfeedback opened this issue Aug 4, 2022 · 0 comments
Open

2 BUGS in Visual Studio Community 2022 Preview Code Cleanup #63213

vsfeedback opened this issue Aug 4, 2022 · 0 comments
Assignees
Milestone

Comments

@vsfeedback
Copy link

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


See the sample project on github at: https://github.com/pfafft33/BugSampleCodeCleanup

I'm running VS Community 2022 Preview 17.3.0 Preview 5.0

I'm encountering buggy behavior in Code Cleanup

I went into Tools/Options/Text Editor/C#/Code Style/General/Code Block Preferences
I set the "Prefer simple 'using' statement to "YES"
I went into Tools/Options/Text Editor/C#/Code Style/General/Expression Preferences
I set the "Prefer conditional expression over 'if' with assignments to "YES"
I set the "Prefer conditional expression over 'if' with returns to "YES"
I went into Analyze/Code Cleanup/Configure Code Cleanup/Profile 1 (default)
I moved "Apply using statement preferences" from Available fixers up to Included fixers
I moved "Apply conditional expression preferences" from Available fixers up to Included fixers
I saved the solution
I ran Analyze/Code Cleanup/Run Code Cleanup (Profile 1) on Solution
NO changes were made to my sample code, even though there are 3 places where the Code Cleanup should have altered the code to the new preferences.
At this point I got fed up and just closed VS. Later I thought of something else to try, so I opened the solution again.

To my SURPRISE, now when I ran the Code Cleanup on the Solution, the 3 changes that I was expecting happended!!! So, there is a BUG (#1) that requires closing VS and re-opening it before Code Cleanup preferences take effect.

But, WAIT! I'm not done yet.

I went back into Tools/Options and changed the 3 preferences back to "NO"
I saved the solution
I closed VS and re-opened it
I ran Code Cleanup on the solution again, expecting my code to be changed back to the original (WITHOUT simple usings and conditional expressions)
NOTHING happened to the code!
So, there is ANOTHER BUG (#2) that Code Cleanup will only change your code in ONE direction. Code Cleanup was happy to change my code when I set these 3 preferences to "YES", but Code Cleanup did NOT change my code back when I set these 3 preferences to "NO".


Original Comments

Feedback Bot on 8/1/2022, 08:25 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 Aug 4, 2022
@vatsalyaagrawal vatsalyaagrawal added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 8, 2022
@vatsalyaagrawal vatsalyaagrawal added this to the Backlog milestone Aug 8, 2022
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

3 participants