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

Plugin fails without CSharpier.MSBuild reference #1336

Closed
rjrudman opened this issue Aug 26, 2024 · 2 comments · Fixed by #1338
Closed

Plugin fails without CSharpier.MSBuild reference #1336

rjrudman opened this issue Aug 26, 2024 · 2 comments · Fixed by #1338

Comments

@rjrudman
Copy link

rjrudman commented Aug 26, 2024

Environments

  • IDE Version: 2024.2.1
  • Extension Version: 1.8.0
  • CSharpier Version: 0.29.1
  • Operating System: MacOS
  • .csharpierrc Settings: None
  • .editorconfig Settings: None

Steps to reproduce

  1. Have csharpier installed globally
  2. Have the csharpier plugin installed in rider
  3. Create a new C# solution
  4. Enable 'Run on Save' in CSharpier plugin in rider
  5. Make changes to the generated Program file

Expected behavior

Changes to be formatted

Actual behavior

No formatting applied, the with the following errors in the log:

2024-08-26 16:08:20,175 [ 294030]   FINE - #c.i.c.CSharpierLogger - Running /usr/local/share/dotnet/dotnet tool list  in /Users/robertrudman/RemuxPruner
2024-08-26 16:08:20,241 [ 294096]   FINE - #c.i.c.CSharpierLogger - Unrecognized command or argument ''

2024-08-26 16:08:20,241 [ 294096]   FINE - #c.i.c.CSharpierLogger - Running 'dotnet tool list' to look for version
2024-08-26 16:08:20,241 [ 294096]   FINE - #c.i.c.CSharpierLogger - Output was: 
 null
2024-08-26 16:08:20,242 [ 294097]   FINE - #c.i.c.CSharpierLogger - Ensure there is a csharpier process for /Users/robertrudman/RemuxPruner
2024-08-26 16:08:20,242 [ 294097]   FINE - #c.i.c.CSharpierLogger - Looking for csproj in or above /Users/robertrudman/RemuxPruner that references CSharpier.MsBuild
2024-08-26 16:08:20,242 [ 294097]   FINE - #c.i.c.CSharpierLogger - Looking for /Users/robertrudman/RemuxPruner/*.csproj
2024-08-26 16:08:20,243 [ 294098]   FINE - #c.i.c.CSharpierLogger - Looking for /Users/robertrudman/*.csproj
2024-08-26 16:08:20,243 [ 294098]   FINE - #c.i.c.CSharpierLogger - Looking for /Users/*.csproj
2024-08-26 16:08:20,243 [ 294098]   FINE - #c.i.c.CSharpierLogger - Looking for //*.csproj
2024-08-26 16:08:20,243 [ 294098]   FINE - #c.i.c.CSharpierLogger - Running /usr/local/share/dotnet/dotnet tool list  in /Users/robertrudman/RemuxPruner
2024-08-26 16:08:20,295 [ 294150]   FINE - #c.i.c.CSharpierLogger - Unrecognized command or argument ''

2024-08-26 16:08:20,295 [ 294150]   FINE - #c.i.c.CSharpierLogger - Running 'dotnet tool list' to look for version
2024-08-26 16:08:20,295 [ 294150]   FINE - #c.i.c.CSharpierLogger - Output was: 
 null
2024-08-26 16:08:20,299 [ 294154] SEVERE - #c.i.o.e.i.DocumentImpl - CompositeException (2 nested):
------------------------------
[1]: Cannot invoke "String.split(String)" because "output" is null
[2]: Cannot invoke "String.split(String)" because "output" is null
------------------------------

CompositeException (2 nested):
------------------------------
[1]: java.lang.NullPointerException: Cannot invoke "String.split(String)" because "output" is null
	at com.intellij.csharpier.CSharpierProcessProvider.findCSharpierVersionInToolOutput(CSharpierProcessProvider.java:172)
	at com.intellij.csharpier.CSharpierProcessProvider.lambda$getCSharpierVersion$1(CSharpierProcessProvider.java:139)

Adding a reference in the project to CSharpier.MSBuild fixes this. However, this requirement is not mentioned anywhere in the plugin setup: https://plugins.jetbrains.com/plugin/18243-csharpier

This happens both with both locally and globally installed csharpier

belav added a commit that referenced this issue Aug 28, 2024
@belav
Copy link
Owner

belav commented Aug 28, 2024

I couldn't reproduce this in windows/ubuntu but I'm pretty sure I know what code was causing the problem you are seeing. I submitted 1.8.1 to jetbrains, it may take a day or two for them to approve it.

@rjrudman
Copy link
Author

Just following up to confirm that the change made did in fact fix the issue (tested on 1.8.2). Thanks!

pisolofin pushed a commit to pisolofin/csharpier-editorconfig that referenced this issue Aug 30, 2024
I believe OSX was unhappy with the empty string in the list, while
ubuntu and windows were okay with it. Also added logic to make sure if
the command fails the plugin doesn't try to split null.

closes belav#1336
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

Successfully merging a pull request may close this issue.

2 participants