You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
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)
The text was updated successfully, but these errors were encountered: