question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

csharp formatter not installed

See original GitHub issue

Issue Description

The formatter stopped working in one of the launches. Yesterday everything worked and the code was formatted, today VS Code gives an error: csharp formatter not installed

Settings jsom

{ "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "editor.fontFamily": "'Cascadia Code'", "workbench.colorTheme": "Cobalt2", "cSpell.language": "en, ru", "csharp.format.enable": true, "editor.fontLigatures": true, "editor.defaultFormatter": "ms-dotnettools.csharp", "editor.formatOnSave": true, "editor.formatOnType": true, "editor.cursorBlinking": "expand", "editor.formatOnPaste": true, "files.exclude": { "**/.git": true, "**/.DS_Store": true, "**/*.meta": true, "**/*.*.meta": true, "**/*.unity": true, "**/*.unityproj": true, "**/*.mat": true, "**/*.fbx": true, "**/*.FBX": true, "**/*.tga": true, "**/*.cubemap": true, "**/*.prefab": true, "**/Library": true, "**/ProjectSettings": true, "**/Temp": true }, "cSpell.userWords": [ "decuber" ] }

Expected Behavior

Actual Behavior

Logs

OmniSharp log

Starting OmniSharp server at 25.07.2021, 12:28:23 Target: s:\Projects\Development\Projects\Unity\My Games\Decuber\Decuber\Decuber.sln

OmniSharp server started. Path: c:\Users\OdIUm.vscode\extensions\ms-dotnettools.csharp-1.23.13.omnisharp\1.37.12\OmniSharp.exe PID: 16616

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet

System.IO.FileNotFoundException: P:\Development\Visual Studio 2019\MSBuild\Current\Bin\Microsoft.Build.dll в System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName) в OmniSharp.MSBuild.Discovery.MSBuildInstanceProvider.GetMSBuildVersion(String microsoftBuildPath) в D:\a\1\s\src\OmniSharp.Host\MSBuild\Discovery\MSBuildInstanceProvider.cs:строка 104 в OmniSharp.MSBuild.Discovery.Providers.MicrosoftBuildLocatorInstanceProvider.<>c.<GetInstances>b__1_0(VisualStudioInstance instance) в D:\a\1\s\src\OmniSharp.Host\MSBuild\Discovery\Providers\MicrosoftBuildLocatorInstanceProvider.cs:строка 30 в System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() в System.Linq.Buffer1…ctor(IEnumerable1 source) в System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) в System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable1 items) в OmniSharp.MSBuild.Discovery.MSBuildLocator.GetInstances() в D:\a\1\s\src\OmniSharp.Host\MSBuild\Discovery\MSBuildLocator.cs:строка 115 в OmniSharp.MSBuild.Discovery.Extensions.GetBestInstance(IMSBuildLocator msbuildLocator, Version minimumMSBuildVersion, ILogger logger, Boolean& invalidVSFound, Boolean& vsWithoutSdkResolver) в D:\a\1\s\src\OmniSharp.Host\MSBuild\Discovery\Extensions.cs:строка 109 в OmniSharp.MSBuild.Discovery.Extensions.RegisterDefaultInstance(IMSBuildLocator msbuildLocator, ILogger logger, DotNetInfo dotNetInfo) в D:\a\1\s\src\OmniSharp.Host\MSBuild\Discovery\Extensions.cs:строка 17 в OmniSharp.CompositionHostBuilder.Build(String workingDirectory) в D:\a\1\s\src\OmniSharp.Host\CompositionHostBuilder.cs:строка 71 в OmniSharp.Stdio.Host..ctor(TextReader input, ISharedTextWriter writer, IOmniSharpEnvironment environment, IServiceProvider serviceProvider, CompositionHostBuilder compositionHostBuilder, ILoggerFactory loggerFactory, CancellationTokenSource cancellationTokenSource) в D:\a\1\s\src\OmniSharp.Stdio\Host.cs:строка 49 в OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_1.<Main>b__1() в D:\a\1\s\src\OmniSharp.Stdio.Driver\Program.cs:строка 74 в OmniSharp.HostHelpers.Start(Func1 action) в D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:строка 29 [ERROR] Error: OmniSharp server load timed out. Use the ‘omnisharp.projectLoadTimeout’ setting to override the default delay (one minute).

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.58.2 C# Extension: 1.23.13

Dotnet Information ����� SDK ��� .NET (��ࠦ��騩 �� global.json): Version: 5.0.302 Commit: c005824e35

�।� �믮������: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.302\

Host (useful for support): Version: 5.0.8 Commit: 35964c9215

.NET SDKs installed: 5.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
auto-using Fudge 0.7.15
better-comments aaron-bond 2.1.0
bracket-pair-colorizer CoenraadS 1.0.61
change-case wmaurer 1.0.0
code-spell-checker streetsidesoftware 1.10.2
code-spell-checker-russian streetsidesoftware 0.2.10
csharp ms-dotnettools 1.23.13
csharpsortusings jongrant 0.0.3
docomment k–kato 0.1.20
eppz-code eppz 1.2.52
material-icon-theme PKief 4.8.0
material-theme zhuangtongfa 3.11.1
namespace adrianwilczynski 1.1.2
night-owl sdras 2.0.1
one-dark-theme mskelton 1.9.0
shader slevesque 1.1.5
shaderlabvscodefree amlovey 1.2.8
theme-cobalt2 wesbos 2.2.5
theme-dracula dracula-theme 2.22.4
theme-onedark azemoh 0.6.0
Theme-TomorrowKit ms-vscode 0.1.4
trailing-spaces shardulm94 0.3.1
unity-code-snippets kleber-swf 1.3.0
unity-debug Unity 3.0.2
unity-snippets YclepticStudios 0.1.2
vscode-icons vscode-icons-team 11.5.0
vscode-language-pack-ru MS-CEINTL 1.58.8
vscode-theme-darcula rokoroku 1.2.3
vscode-theme-onedark akamud 2.2.3
vscode-theme-superonedark seansassenrath 0.0.15
vscodeintellicode VisualStudioExptTeam 1.2.14

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Ciph3rzer0commented, Sep 24, 2021

I installed this extension and VSCode doesn’t recognize it as a csharp formatter. Searching on the marketplace for category:formatters csharp does not list this extension. Setting “editor.defaultFormatter”: “ms-dotnettools.csharp” and formatting with shift+alt+F says the same thing, “Extension C# cannot format (filename).cs”

I eventually got it working by simply saving with “format on save” enabled. After this, now shift+alt+F formats properly, whereas before it said there was no formatter.

1reaction
eranimocommented, Aug 6, 2021

Reinstalling did not fix the issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code doesn't format C# code - Stack Overflow
Press Ctrl + , to open the Settings panel. Change the editor.formatOnType setting to be enabled. This wasn't enabled by default in my...
Read more >
CSharpier - Code formatter - Visual Studio Marketplace
CSharpier Formatter for Visual Studio Code​​ CSharpier is an opinionated code formatter for c#. It uses Roslyn to parse your code and re-prints ......
Read more >
Visual Studio Code Prettier Extension Set up - C# Corner
Open visual studio code as administrator. From extensions, install “Prettier – code formatter”. Once you have installed the program, ...
Read more >
dotnet format command - .NET CLI - Microsoft Learn
Verifies that no formatting changes would be performed. ... that you can specify in your .editorconfig file, see the C# formatting options.
Read more >
CSharpier
CSharpier is an opinionated code formatter for c#. ... CSharpier provides a few basic options that affect formatting and has no plans to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found