aaronpowell / dotnet-delice

πŸ“‘ A CLI to help you get insight into your projects' licenses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArgumentNullException

Danielmdmu opened this issue Β· comments

I'm trying to use dotnet-delice but getting an Unhandled Exception.

I've tried the following call of dotnet-delice:

PS C:\SolutionFolder> dotnet delice .\solutionFile.sln --check-github

Getting the following Output:
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'path1') at System.IO.Path.Combine(String path1, String path2) at App.getLicenses(Boolean checkGitHub, String token, Boolean checkLicenseContent, PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 40 at App.getLicenses'@96.Invoke(PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 96 at App.OnExecute@103-1.Invoke(PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 104 at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 495 --- End of stack trace from previous location where exception was thrown --- at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.<OnExecute>b__0() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 9

Am I using it wrong?

Are there any project files that aren't using the SDK project file, but using traditional msbuild style?

Yeah, that's it. They are traditional MsBuild-Style Project Files

Unfortunately, only SDK-style project files are supported. I need to make that clearer on the readme and work out how to detect it to provide a better user experience.

commented

running into this same problem with a rather large project. i get quite a bit of output until it comes to that exception. is there any way i can simply exclude those old-style projects? how would i detect those? could you write out the name of the package, when such error occurs?

Hmm I'd have to look into how old-style project files are detected to see if there is a way to exclude (and notify of exclusion)

@joreg do you have a repo I can test against?

commented

@aaronpowell i'm afraid the repo is private.
i just tried with your 1.4 release and i still get the same error...

commented

the last output project before the crash is this:
grafik
thing is: we don't have a project called "vvvv" in that solution!

we have projects that start with "VVVV." but none that is only "vvvv" in lower case letters. does this provide a hint?

commented

@aaronpowell
ok, i found one candidate to reproduce with:

  • create an empty winforms project
  • add the nuget: CommandLineParser
  • save sln
  • run dotnet delice on it to get above error

Sorry, I'm still unable to reproduce this:

PS C:\Users\aapowell\source\repos\WindowsFormsApp1> dotnet run --project C:\_Code\github\dotnet-delice\src\DotNetDelice
Project WindowsFormsApp1
License Expression: MIT
β”œβ”€β”€ There are 1 occurances of MIT
β”œβ”€β”¬ Conformance:
β”‚ β”œβ”€β”€ Is OSI Approved: true
β”‚ β”œβ”€β”€ Is FSF Free/Libre: true
β”‚ └── Included deprecated IDs: false
└─┬ Packages:
  └── CommandLineParser@2.7.82

Since you've been able to sandbox it, can you share that solution?

commented

sorry, i forgot about the SDK-style-projects only requirement and tested the above with an old style project.

but now i got it, see attached
WindowsFormsApp6.zip

the crucial lines in the .csproj are:

<ItemGroup>
<DotNetCliToolReference Include="dotnet-codegen" Version="0.4.88" />
</ItemGroup>

those are causing the initial AV. removing them everything works. i hope this helps you figure out the problem.

Awesome, thanks for the project I'm able to replicate it. Looks like the way the DotNetCliTool is detected doesn't work well so I'll need to tweak that.

Going to do some investigation first to see how I can handle it before submitting a fix.

Spawning off a new thread in issue #15