csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Rider asks to install csharpier every time I open it

Open donkee opened this issue 2 years ago • 8 comments

Rider keeps asking me to install csharpier globally or locally every time I open a project, even though I have the latest version installed globally (0.24.2 as of this time). I click to have it install it globally, nothing seems to happen, but csharpier still seems to format on save like I've set it to do.

So really the issue is just the annoying pop-up every time I open a project.

donkee avatar May 22 '23 15:05 donkee

Is there anything in the rider logs about what CSharpier is trying to do? https://github.com/belav/csharpier/tree/main/Src/CSharpier.Rider has details of getting to the logs. I normally only see this when CSharpier is failing to install, but if your format on save is working that doesn't seem to be the case. The plugin installs its own copy of CSharpier because it leaves the tool running, which can cause issues if it makes use of the default tool install.

belav avatar May 22 '23 15:05 belav

Here's the CSharpier logs from the last few days:

2023-05-18 10:14:53,464 [ 582811]   WARN - #c.i.c.CSharpierLogger - CSharpier was not found so files may not be formatted.
2023-05-22 09:29:08,082 [  10901]   WARN - #c.i.c.CSharpierLogger - CSharpier was not found so files may not be formatted.
2023-05-22 09:57:16,991 [  11633]   WARN - #c.i.c.CSharpierLogger - CSharpier was not found so files may not be formatted.
2023-05-22 09:59:59,117 [   9486]   WARN - #c.i.c.CSharpierLogger - CSharpier was not found so files may not be formatted.
2023-05-22 10:07:24,026 [   9661]   WARN - #c.i.c.CSharpierLogger - CSharpier was not found so files may not be formatted.
2023-05-23 08:30:29,913 [  10866]   WARN - #c.i.c.CSharpierLogger - CSharpier was not found so files may not be formatted.

and here's me checking the version of the tool in my terminal: image

donkee avatar May 23 '23 13:05 donkee

In my case it require .net in version 6 where i have 7 so it failing

dotnet csharpier --version You must install or update .NET to run this application.

App: C:\Users.dotnet\tools\dotnet-csharpier.exe Architecture: x64 Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64) .NET location: C:\Programs\dotnet-sdk-7.0.101-win-x64

sirdawidd avatar May 24 '23 08:05 sirdawidd

I have dotnet 6 and am using it image

donkee avatar May 24 '23 13:05 donkee

@donkee the plugin installs its own version of CSharpier, which is the part I believe is failing. It will determine the version to install based on a dotnet-tools.json or running the dotnet csharpier --version command that you are.

There should be some logs prior to the ones you sent that look something like this

2023-05-27 11:49:58,742 [   4376]   FINE - #c.i.c.CSharpierLogger - Ensure there is a csharpier process for C:\projects\csharpier\Src\CSharpier.Cli
2023-05-27 11:49:58,809 [   4443]   FINE - #c.i.c.CSharpierLogger - Looking for C:\projects\csharpier\Src\CSharpier.Cli\.config\dotnet-tools.json
2023-05-27 11:49:58,809 [   4443]   FINE - #c.i.c.CSharpierLogger - Looking for C:\projects\csharpier\Src\.config\dotnet-tools.json
2023-05-27 11:49:58,809 [   4443]   FINE - #c.i.c.CSharpierLogger - Looking for C:\projects\csharpier\.config\dotnet-tools.json
2023-05-27 11:49:58,810 [   4444]   FINE - #c.i.c.CSharpierLogger - Found version 0.22.0 in C:\projects\csharpier\.config\dotnet-tools.json
2023-05-27 11:49:58,812 [   4446]   FINE - #c.i.c.CSharpierLogger - Running dotnet tool install csharpier --version 0.22.0 --tool-path C:\Users\bela\AppData\Local\CSharpier\0.22.0
2023-05-27 11:50:03,081 [   8715]   FINE - #c.i.c.CSharpierLogger - Adding new version 0.22.0 process for C:\projects\csharpier\Src\CSharpier.Cli
2023-05-27 11:50:03,108 [   8742]   FINE - #c.i.c.CSharpierLogger - Warm CSharpier with initial format

The Adding new version entry will hopefully have another entry after it indicating the error.

I'm hoping to add better error detection to the install process soon to surface the error to the user without needing to get into the log.

belav avatar May 27 '23 16:05 belav

I don't see anything like your example. The only other thing I can see is the following:

2023-05-26 08:07:12,004 [ 131684]   WARN - #c.i.o.a.e.ActionUtil - Action is not performed because target component is not showing: action=com.intellij.csharpier.InstallGlobalAction, component=com.intellij.notification.impl.NotificationsManagerImpl$10

Should I create a dotnet-tools.json file? I am using an M1 Mac, btw - in case that matters.

donkee avatar May 30 '23 15:05 donkee

That message doesn't seem related.

It could be that you are running into the problem here - https://github.com/belav/csharpier/issues/716#issuecomment-1532178103 which has a workaround for setting PATH.

I am hoping to address the problem in https://github.com/belav/csharpier/issues/893

belav avatar Jun 01 '23 21:06 belav

I ran this command launchctl config user path "xxxx1:xxxx2:xxxx3" and rebooted, but I'm still seeing the behavior

donkee avatar Jun 02 '23 14:06 donkee