InspectCode - Specify only one solution file

Hi,

I'm trying to run InspectCode on this repo from a powershell script that looks like this:

```

dotnet new tool-manifest
dotnet tool install JetBrains.ReSharper.GlobalTools
dotnet jb inspectcode --swea -it --output="./reports/Wyam2.jb.resharper.xml" --verbosity=VERBOSE Wyam.sln
dotnet jb dupfinder --output="./reports/Wyam2.jb.dupfinder.xml" --show-text Wyam.sln

```

The inspectcode always fails with "Specify only one solution file". DupFinder is succesful.

The full message returned by inspectcode:

```

JetBrains Inspect Code 2021.1.5
Running on AMD 64 in 32-bit mode, .NET runtime 3.1.17 under Microsoft Windows NT 10.0.19042.0
Specify only one solution file
Usage: inspectcode [options] [solution or project file]
Show help: inspectcode --help

```

Please advice.

Thank you.

 
 
 
 
 
 
 
10 comments
Comment actions Permalink

Hello Simona, thanks for the report.

Unfortunately, I was unable to reproduce the issue as described thus far. I am getting another error - "Solution file should not be specified for issues types dumping", which is the expected behavior.

I use the following command:

dotnet jb inspectcode --swea --it --output="./reports/Wyam2.jb.dupfinder.xml" --verbosity=VERBOSE Wyam.sln

JetBrains Inspect Code 2021.1.5
Running on AMD 64 in 64-bit mode, .NET runtime 3.1.17 under Microsoft Windows NT 10.0.19041.0
Solution file should not be specified for issues types dumping

Is there a chance you are getting "Specify only one solution file" error when -it option is not specified in the command?

How do you specify the path to the .sln file? Exactly as shown - Wyam.sln? Have you tried putting quotation marks around it? Have you tried specifying the full path to the output?

0
Comment actions Permalink

I get the same error, but only with the .Net tools version.

I did try this:

PS F:\Projects\test> dotnet tool install JetBrains.ReSharper.GlobalTools
PS F:\Projects\test> dotnet jb inspectcode .\Test.sln

Which resulted in this:

JetBrains Inspect Code 2021.2
Running on AMD 64 in 64-bit mode, .NET runtime 5.0.7 under Microsoft Windows NT 10.0.19042.0
Specify only one solution file
Usage: inspectcode [options] [solution or project file]
Show help: inspectcode --help

Interestingly this happens when I call it without any path to a solution:

PS F:\Projects\test> dotnet jb inspectcode

Output:

Warning: Starting from version 2021.2, InspectCode builds the target solution before starting the analysis to make sure it only finds relevant code issues.
To explicitly accept the new behavior and suppress this warning, use the '--build' option.
To match the behavior in previous versions and skip the build, use '--no-build'.
Unable to find target solution file in path F:\Projects\test\inspectcode

So the tool already gets some path injected even when no path was provided.

 

When I use the inspectcode.exe directly, everything works as expected.

Even the call without a provided solution file gives me the expected response:

PS F:\Projects\test> F:\Projects\jb\inspectcode.exe

 

JetBrains Inspect Code 2021.2
Running on AMD 64 in 64-bit mode, .NET runtime 4.0.30319.42000 under Microsoft Windows NT 10.0.19042.0
Solution file is not specified
Usage: inspectcode [options] [solution or project file]
Show help: inspectcode --help

0
Comment actions Permalink

Hi Jonas,

Great finding. It looks like the given parameters are not passed correctly from dotnet to inspectcode.

I'll look into it later today.

0
Comment actions Permalink

Hello Simona Jonas Meer

Thank you for your findings! Do you observe the behavior using the PowerShell only? Could you check if the issue persists when running the latest 2021.2.1 build?

0
Comment actions Permalink

Hello Andrey Simukov

I updated to the latest build but the behavior is the same:

Powershell:

PS F:\Projects\test> dotnet jb inspectcode .\Test.sln
JetBrains Inspect Code 2021.2.1
Running on AMD 64 in 64-bit mode, .NET runtime 5.0.7 under Microsoft Windows NT 10.0.19042.0
Specify only one solution file
Usage: inspectcode [options] [solution or project file]
Show help: inspectcode --help

Windows cmd:

F:\Projects\test>dotnet jb inspectcode .\Test.sln
JetBrains Inspect Code 2021.2.1
Running on AMD 64 in 64-bit mode, .NET runtime 5.0.7 under Microsoft Windows NT 10.0.19042.0
Specify only one solution file
Usage: inspectcode [options] [solution or project file]
Show help: inspectcode --help

Git bash (MINGW64):

$ dotnet jb inspectcode ./Test.sln
JetBrains Inspect Code 2021.2.1
Running on AMD 64 in 64-bit mode, .NET runtime 5.0.7 under Microsoft Windows NT 10.0.19042.0
Specify only one solution file
Usage: inspectcode [options] [solution or project file]
Show help: inspectcode --help

 

And without any provided solution file (with latest .Net runtime):

PS F:\Projects\test> dotnet jb inspectcode
JetBrains Inspect Code 2021.2.1
Running on AMD 64 in 64-bit mode, .NET runtime 5.0.9 under Microsoft Windows NT 10.0.19042.0
Warning: Starting from version 2021.2, InspectCode builds the target solution before starting the analysis to make sure it only finds relevant code issues.
To explicitly accept the new behavior and suppress this warning, use the '--build' option.
To match the behavior in previous versions and skip the build, use '--no-build'.
Unable to find target solution file in path F:\Projects\test\inspectcode

0
Comment actions Permalink

Hi Jonas Meer, Simona

Is there any chance that the current user's folder has a space in his home folder? E.g. C:\Users\space user\

0
Comment actions Permalink

Hi,

yes mine has a space: C:\Users\Jonas Meer\

0
Comment actions Permalink

Hi Andrey Simukov

That's an Yes for me

```

echo %userprofile%
C:\Users\Simona Avornicesei

```

but the source code and the script are executed from another folder, that has no space in its path.

0
Comment actions Permalink

Jonas Meer, Simona,

This is a known bug which should be fixed by the upcoming 2021.3 release: https://youtrack.jetbrains.com/issue/RSRP-485105 You're welcome to try the preview version once the 2021.3 EAP program is opened https://www.jetbrains.com/resharper/nextversion/

0
Comment actions Permalink

Thanks Andrey Simukov, I'm looking forward for the next release.

Meanwhile we'll keep battling with spaces and unicode chars in paths :D

 

0

Please sign in to leave a comment.