codecadwallader/codemaid

Automatic Cleanup On Save option not working after update to VS 17.7.0

Wozniax1 opened this issue · 9 comments

Environment

  • Visual Studio version: 2022 Community 17.7.0
  • CodeMaid version: 12.0
  • Code language: C#

Description

Automatic Cleanup On Save option not working after update to VS 17.7.0. In 17.6.X it worked.

Steps to recreate

  1. Open a C# script
  2. Make a change that should be formatted
  3. Make sure Cleanup On Save is ON
  4. Save the file

Current behavior

Now on saving a file it does nothing, but when clicked Cleanup Active Document directly it formats it.

Expected behavior

Formatting should run on saving a file.

TimDN commented

Seeing the same issue on my machine using the same environment as OP

I am seeing the same issue on my machine. Only difference from OP is that I am using Visual Studio Professional 2022 v17.7.2.

I can confirm that a different machine that is running Visual Studio Professional 2022 v17.6.4 IS working as expected.

Same issue on my end too. Running CodeMaid in Diagnostics mode resulted in this message in the Output:

[CodeMaid Diagnostic 07:24:02 PM] WindowEventListener.OnWindowChange raised for 'C:*****\Application.cs'

Only explicit call to 'Cleanup Active Document' from the extension menu invokes CodeMaid.

Hope this helps.
Thanks!

UPDATE: Issue persists after latest update to VS 2022 Community 17.7.3
Re-installing CodeMaid didn't help

Same issue on my machine
VS 2022 Community 17.7.2
C++ language

This is my second update on the issue. Here is a list of steps that brought CodeMaid's cleanup-on-save back in the game for me:

  • Uninstalled VS 2022
  • Cleaned up any relevant app data I could find
  • Cleaned up shared librares and other leftover files and folders under "Program Files" and "Program Files (x86)". Basically sweeped everything having "Microsoft\Visual Studio" or "VisualStudio" in its path
  • Reinstalled VS2022
  • Reinstalled CodeMaid
  • As odd as it may sound, closed all open windows in a solution for which CodeMaid had stopped cleaning on save. The count might have been up to hundreds (did not check it explicitly) open files. The cleanup on save started working immediately after this step.

In my efforts to solve the case by myself, I cloned and debugged the CodeMaid.2022 project. It had issues that pointed to possible library version conflicts (there were "method not found" exceptions). This made me try re-installation with manual VS files cleanup. Once the debug started working, it turned out it nicely cleans on save some small test app projects with a couple of open source file windows. That's when I went for closing the windows in the bigger solution.

Hope this may help.

Thanks for the tip. This will work if nothing else helps.
But that can't be the way to solve this problem. Completely uninstalling Visual Studio is very time-consuming if you also want to have the many extensions back in the same individual configuration.

Thanks for the tip. This will work if nothing else helps. But that can't be the way to solve this problem. Completely uninstalling Visual Studio is very time-consuming if you also want to have the many extensions back in the same individual configuration.

@illusion-walk I completely agree with your point. I just listed everything I tried. In fact, I had multiple re-installations of VS that just didn't help. Closing all open .cs files for a solution that had probably hundreds of them is what actually made it work, for me.

Yes, after closing all open .cs files the auto format on save is working well!
Thanks a lot for the hint!
This is definitely much easier than reinstalling VS :D

If you are also using a CMake project, check this option: Clean -> General -> Perform partial clean when files are no longer part of the solution.