Skip to content

Plugin fails without CSharpier.MSBuild reference #1336

Description

@rjrudman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions