Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSharpier Process Error in VS2022 #1341

Open
marss72 opened this issue Aug 29, 2024 · 6 comments
Open

CSharpier Process Error in VS2022 #1341

marss72 opened this issue Aug 29, 2024 · 6 comments

Comments

@marss72
Copy link

marss72 commented Aug 29, 2024

Environments

  • IDE Version: Microsoft Visual Studio Community 2022, Version 17.11.2
  • Extension Version: 1.8.0
  • CSharpier Version: 0.29.1
  • Operating System: Windows 11 Home 23H2 (OS Build 22631.4112)
  • .csharpierrc Settings:
    {
        "printWidth": 100,
        "useTabs": false,
        "tabWidth": 4,
        "endOfLine": "crlf"
    }
    
  • .editorconfig Settings: None. Globally installed, and this issue happens in all projects, with and without the editor config (if present, it contains just one to two warning suppressions)

Log Output

[Info - 29.8.2024 20:07:32] Starting
[Debug - 29.8.2024 20:07:32] Ensure there is a csharpier process for D:\VS\AnyProject\AnyProject
[Debug - 29.8.2024 20:07:32] Looking for csproj in or above D:\VS\AnyProject\AnyProject that references CSharpier.MsBuild
[Debug - 29.8.2024 20:07:32] Running 'dotnet tool list' to look for version
[Debug - 29.8.2024 20:07:32] Output was: 
 Package Id      Version      Commands      Manifest
---------------------------------------------------
[Debug - 29.8.2024 20:07:33] Running 'dotnet tool list-g' to look for version
[Debug - 29.8.2024 20:07:33] Output was: 
 Package Id               Version      Commands        
------------------------------------------------------
csharpier                0.29.1       dotnet-csharpier
csharprepl               0.6.7        csharprepl      
dotnet-example           3.1.0        dotnet-example  
[Debug - 29.8.2024 20:07:33] Using 0.29.1 as the version number.
[Debug - 29.8.2024 20:07:34] dotnet csharpier --version output: 0.29.1
[Debug - 29.8.2024 20:07:34] Using 0.29.1 as the version number.
[Debug - 29.8.2024 20:07:34] CSharpier at C:\Users\admin\AppData\Local\CSharpier\0.29.1 already exists
[Debug - 29.8.2024 20:07:34] Adding new version 0.29.1 process for D:\VS\AnyProject\AnyProject
[Debug - 29.8.2024 20:07:34] Running C:\Users\admin\AppData\Local\CSharpier\0.29.1\dotnet-csharpier --server
[Warn - 29.8.2024 20:07:36] Spawning the csharpier server timed out.

[Debug - 29.8.2024 20:07:37] Ensure there is a csharpier process for D:\VS\AnyProject\AnyProject
[Debug - 29.8.2024 20:08:52] Ensure there is a csharpier process for D:\VS\AnyProject\AnyProject
[Info - 29.8.2024 20:08:54] Formatting started for D:\VS\AnyProject\AnyProject\Program.cs using CSharpier 0.29.1
[Warn - 29.8.2024 20:08:54] CSharpier process failed to start. Formatting cannot occur.
[Info - 29.8.2024 20:08:54] Formatted in 2ms
[Info - 29.8.2024 20:08:58] Formatting started for D:\VS\AnyProject\AnyProject\Program.cs using CSharpier 0.29.1
[Warn - 29.8.2024 20:08:58] CSharpier process failed to start. Formatting cannot occur.
[Info - 29.8.2024 20:08:58] Formatted in 0ms
[Debug - 29.8.2024 20:17:09] Ensure there is a csharpier process for D:\VS\AnyProject\AnyProject
[Debug - 29.8.2024 20:17:09] Ensure there is a csharpier process for D:\VS\AnyProject\AnyProject
[Debug - 29.8.2024 20:21:26] Ensure there is a csharpier process for D:\VS\AnyProject\AnyProject

Steps to reproduce
I don't know if there are any steps. But, this issue started appearing right after I switched from Visual Studio 2022 Preview (due to some issues (not csharpier)) to the stable version. Since this switch, the issue now appears on both versions.

Expected behavior
After starting Visual Studio 2022, CSharpier process and extension will load successfully and formatting will be available.

Actual behavior
Sometimes (usually once every day, doesn't seem to have any "pattern"), CSharpier process will fail to load and formatting is not available with the following Visual Studio message:

CSharpier could not be set up properly so formatting is not currently supported. Read More 

As I said, this usually gets fixed by just restarting the IDE - but this is just a temporary fix and the error appears again after some time (a few hours usually), or sometimes (not always) on another IDE restart.


I tried the steps in Editor Troubleshooting at least twice: reinstalling CSharpier (also with deleting the %localappdata%\CSharpier), reinstalling the extension and checking for updates. Did not help. I will let you know if I manage to fix it without re-installing the whole IDE (I will reinstall soon if this issue does not stop.)

@marss72
Copy link
Author

marss72 commented Aug 30, 2024

I repaired the Visual Studio 2022 and uninstalled the Preview version. Also deleted CSharpier before first turning the repaired version on and installing the extension - the same error keeps showing.

@belav
Copy link
Owner

belav commented Aug 30, 2024

I haven't updated the troubleshooting steps to include information for the new csharpier server. I believe there should be a server.log file next to the file at C:\Users\admin\AppData\Local\CSharpier\0.29.1\dotnet-csharpier. Hopefully that shows why the process is unable to start the server.

As a workaround there is an option to disable csharpier server. I'm also considering making the extension automatically fall back to disabling csharpier server, but ideally I'd get the problems in csharpier server resolved and I can't resolve them if they aren't reported.

@marss72
Copy link
Author

marss72 commented Aug 30, 2024

Yes, I've been checking the settings and turned the CSharpier server off and everything works fine now. An automatic fallback would be a great idea.

About the server.log, there is no such file in that directory.

@Eptagone
Copy link

I have the same problem using Rider and as @marss72 mentioned. It works again by disabling the CSharpier server.
It's a little strange because the first time I installed the plugin it worked but the next day, it stopped working.

@marss72
Copy link
Author

marss72 commented Nov 17, 2024

I have the same problem using Rider and as @marss72 mentioned.

The issue stopped somehow for me since I installed Rider. I haven't used Visual Studio in longer coding sessions (> 2 hours) since that moment.

It's a little strange because the first time I installed the plugin it worked but the next day, it stopped working.

The same thing happened to me too. Everything worked fine, but after a few days, this error started happening.

@belav
Copy link
Owner

belav commented Dec 7, 2024

@marss72 it turns out the server log file is a bit more buried than I originally thought, I found mine at
C:\Users\bela\AppData\Local\CSharpier\0.30.2\.store\csharpier\0.30.2\csharpier\0.30.2\tools\net9.0\any\serverX.log

@belav belav added this to the Planned - Extensions milestone Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants