Broken on VS2022 > 17.3.3
lucasbenhur opened this issue ยท 60 comments
Latest update from VS seems to have broken this extension unfortunately.
No longer formatting document when I edit.
My settings are set at the default.
Same
๐ค Will check it on Monday...
Hmm, it is working for me. It just takes 1-2 minutes VS2022 to load all extensions. Once loaded it is working.
Could you please check that? If this is the case we can't do anything. The other options is to take a look at the VS logs and see for errors there.
How to know when extensions is loaded?
At first i thought it is resharper but then i disable it and it still dont format on save.
I waited 1-2 min, but it didn't work.
I also tried:
- Reset visual studio settings.
- Re-install extension
Unsuccessfully!
<time>2022/09/09 11:23:12.610</time>
<type>Information</type>
<source>Extension Manager</source>
<description>Successfully loaded extension 'Format document on Save' (2f4fac85-be4e-4d7a-8c74-93cc4389b427)...</description>
There is no errors in my logs, but the extension is not working.
Hey, great news. It stopped working for me as well. Just like that. No idea why. It is really...
Here is what I have found. And I do not think we could fix it at all. When you edit a file and save it, the extension captures the action and formats the document before being saved. This is possible because of the events coming from VS. However, the document is actually saved before throwing the event. See the screenshot bellow:
The Saved
boolean is the only indicator to not enter into infinite loop.
Soo is it end for this extension?
Did you wrote smth to MS?
Now extension works again in 17.3.4 version
Woooow, this is madness. I am glad they have fixed that.
It was working. Now it is not again. I think it works sometimes and sometimes not.
Anyone else could confirm it works for them?
It was working after updating to 17.3.4.
It is not working after updating winOS and rebooting.
I have added steps to reproduce to MS. I doubt that they will fix this.
We also hit this, but we found an alternative which makes the whole extension obsolete, at least for our use cases. In "Options -> Text Editor -> Code Cleanup" there is an option "Run Code Cleanup profile on save". If you include the fixer "Format document" in the configured profile you basically have the same functionality this extension provides.
@mus65 I dont want be a bummer about this extension but your suggestion is great. I dont need this extension anymore :). I havent heard about it but looks usefull, simple and customizable. I just missing more explanation on some formatting
Code Cleanup is not working for me.
Yes, again - Clang Power Tools (format on save) and this extension (format document on save) no longer work and Code Cleanup doesn't work either. (See https://developercommunity.visualstudio.com/t/Code-Cleanup-Support-for-C/1693911)
We also hit this, but we found an alternative which makes the whole extension obsolete, at least for our use cases. In "Options -> Text Editor -> Code Cleanup" there is an option "Run Code Cleanup profile on save". If you include the fixer "Format document" in the configured profile you basically have the same functionality this extension provides.
Unfortunately, the code clean up setting cannot be synchronized among the team. Instead, this extension can. This makes the difference
@Krusty93 i think sync setting is also doable or at least in close future. Check it out more here
https://devblogs.microsoft.com/visualstudio/bringing-code-cleanup-on-save-to-visual-studio-2022-17-1-preview-2/#comment-26451
dotnet/roslyn#40163
I am working on a workaround. ;)
It seems that extension now work again for VS 17.3.5
It is still not working on my end. This is strange.
It is still not working on my end. This is strange.
For me, formatting on save works with the VS Update to 17.3.5. I'm not sure if it is this extension or one of the others (Clang power tools, ...). If you instruct me how to find out which one does the job I would be happy to share this information with you.
I just tested this myself. VS 17.3.5 does not fix the issue, but the Format on Save option of Clang Power Tools 2022 does work.
But unfortunately their solution does seem to introduce a noticeable delay when saving as well as an additional undo step (you need to press Ctrl + Z twice after saving if you want to undo the automatic formatting), so it's quite a downgrade from your extension.
@WolfgangVogl you can go and disable an extension without uninstalling it. I think it requires a VS restart.
Hey everyone, I have a workaround implemented in the version attached to this comment. If you think it works properly I will upload it to the extension store. Please give any feedback.
I just tried it on 17.3.5 and the formatting works again now. Thanks for the fix!
Still appears to be broken for me on 17.3.5.
Hey everyone, I have a workaround implemented in the version attached to this comment. If you think it works properly I will upload it to the extension store. Please give any feedback.
I gave this version a try and it seems to be functional based on my spot testing.
Hey everyone, I have a workaround implemented in the version attached to this comment. If you think it works properly I will upload it to the extension store. Please give any feedback.
Elders.VSE_FormatDocumentOnSave.vsix.zipI gave this version a try and it seems to be functional based on my spot testing.
On further testing I'm seeing a weird issue where I sporadic pop up dialogs prompting me to save an unknown file as filename "Output-Build.txt". Sometimes I get many of these pop ups in a row. The pop ups go away when I disable the experimental extension.
On further testing I'm seeing a weird issue where I sporadic pop up dialogs prompting me to save an unknown file as filename "Output-Build.txt". Sometimes I get many of these pop ups in a row. The pop ups go away when I disable the experimental extension.
Interesting, this happened to me as well. Though it stopped after I restarted VS (at least so far), didn't make the connection that it might be related to the extension.
I'll give it a try tomorrow.
Like dlehn already mentioned the clang powertools work but introduce other issues.
https://developercommunity.visualstudio.com/t/Visual-Studio-clears-dirty-flag-before-c/10124978#T-N10148841-N10155655
got reopened and they're asking for more information. I've tried to create a video/gif from a debug session to attach it but for some reason I can't get visual studio to load the debug symbols so the breakpoint isn't hit.
On further testing I'm seeing a weird issue where I sporadic pop up dialogs prompting me to save an unknown file as filename "Output-Build.txt". Sometimes I get many of these pop ups in a row. The pop ups go away when I disable the experimental extension.
Today I got the pop-up as well. (With the filename "Incredibuild-Output.txt" or something like that (I use Incredibuild to compile, so it seems logical to me).
BUT I did NOT install the experimental fix for this extension - so that doesn't seem to be the cause of the pop-ups?!
Maybe the popup issue was just caused by the update to VS 17.3.5? Sounds like we all just installed that recently.
Have you noticed if the focus is changing while saving? I am curious if other extensions are changing the focus to other tabs for some reason.
I used to have that issue when using Tabs Studio, if you hit save with multiple changed documents it would cycle through all the respective tabs while saving them. Haven't had any similar issues since I got rid of that.
I used to have that issue when using Tabs Studio, if you hit save with multiple changed documents it would cycle through all the respective tabs while saving them. Haven't had any similar issues since I got rid of that.
True, this happens when you do ctrl+shift+s
and it is normal
So, should we close this issue?
I'm using VS 17.3.5 and extension version 3.5. The formatting - so the default functionality of the extension - works.
But I've changed the Commands
option of the extension to Edit.FormatDocument Edit.RemoveAndSort
and the Edit.RemoveAndSort
part doesn't work.
Oh, and my Visual Studio also often crashes now when I do simple things like Add - New Item - Search for something or just when renaming a folder in the solution explorer. After I restart VS it shows a yellow bar where it blames the FormatDocumentOnSave extension for the crash.
Wooow, we have a developer at Microsoft looking into our problem. They still can't reproduce it on their machines for some reason but I have sent a video. Hope this helps them figure this out.
Have you sent them the stack traces I collected on my issue?
I am going to revert the hack because it causes event more problems
VS 17.4.0 Preview 3.0, VSE v.3.6 - dont work.
VS 17.3.6, VSE v.3.6 - work ok.
VSE v.3.7 cant install - "Extension already installed"
Since the update/rollback, the extension doesn't work for me nor the rest of my team in VS 17.3.6. No crash, but it does nothing.
*Only commenting for documentation since the comment above seemed to imply it works, the problem seems to already be known.
@dmitryvhf : the .vsix downloaded as VSE v3.7 contains the identical binaries as the v3.6 .vsix.
I just updated from extension version 3.5 to 3.7 but after that VS showed that 3.6 is installed. And as already reported an update from 3.6 to 3.7 doesn't work.
And with 3.6 (or maybe 3.7?) in VS 17.3.6 the extension seems to do nothing.
@dmitryvhf Are you sure that the combination VS 17.3.6 and extension 3.6 works for you?
Are you sure that the combination VS 17.3.6 and extension 3.6 works for you?
@cremor Yes, i sure. Checked few times.
Working for me with latest Visual Studio 2022 version 17.3.6.
Working for me with latest Visual Studio 2022 version 17.3.6.
Still not working here, on 2 different PCs. Have you tried a new project and/or deleted the .vs
folder or anything else?
Working for me with latest Visual Studio 2022 version 17.3.6.
Still not working here, on 2 different PCs. Have you tried a new project and/or deleted the
.vs
folder or anything else?
Yeah, sad, Extension not working on newer version of projects, .NET Framework and .NET Core (Console apps) not works for me =(
Hey everyone,
I have good news. Microsoft were able to reproduce and fix the bug. It will be probably released with the next VS version.
New preview release just dropped. I tested and it appears to be fixed for me.
New preview release just dropped. I tested and it appears to be fixed for me.
VS2022 Preview 5, VSE 3.6; old project.
Confirm. It's working.
Fixed in VS2022 Preview 5
https://learn.microsoft.com/th-th/visualstudio/releases/2022/release-notes-preview#17.4.0-pre.5.0
New preview release just dropped. I tested and it appears to be fixed for me.
VS2022 Preview 5, VSE 3.6; old project. Confirm. It's working.
Working fine for me after update too!
Extension working fine as it intentional, but I got new problem after new preview visual studio update, see #53
I had to push a v3.9 where everything should be working now.