In my case, the problem was related to code formatting extension.
I used C # for the extension "Visual Studio Code (based on OmniSharp)" (ms-vscode.csharp) for formatting. However, after some time, the context menu "document format" disappeared. And the keyboard shortcut for formatting "Shift + Alt + F" stopped working.
After some research, I found that there is a new extension called "C # FixFormat" (Leopotam.csharpfixformat) for formatting C # documents, which says in their description: "There is an error in omnisharp and they fix the problem temporarily."
After installing the C # FixFormat extension, I can now format the documents again.
source share