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

When using Paket the local case has invalid version options #206

Open
michalsteyn opened this issue Feb 8, 2024 · 0 comments
Open

When using Paket the local case has invalid version options #206

michalsteyn opened this issue Feb 8, 2024 · 0 comments

Comments

@michalsteyn
Copy link

michalsteyn commented Feb 8, 2024

When using Paket, the local cache returns invalid versions such as "lib", or "ref" when using the --use-project-assets-json argument.

Here is an example of the error produced:

Reading dependencies for target net8.0
'lib' is not a valid version string. (Parameter 'value')
System.ArgumentException: 'lib' is not a valid version string. (Parameter 'value')
   at NuGet.Versioning.NuGetVersion.Parse(String value)
   at NugetUtility.Methods.<>c.<ResolvePackageVersionAsync>b__15_0(String v) in /home/runner/work/nuget-license/nuget-license/src/Methods.cs:line 235
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at NuGet.Versioning.VersionRange.FindBestMatch(IEnumerable`1 versions)
   at NugetUtility.Methods.GetVersionFromRange(String versionRange, IEnumerable`1 versionList) in /home/runner/work/nuget-license/nuget-license/src/Methods.cs:line 304
   at NugetUtility.Methods.ResolvePackageVersionAsync(String name, String versionRange, Func`2 GetVersions) in /home/runner/work/nuget-license/nuget-license/src/Methods.cs:line 235
   at NugetUtility.Methods.ResolvePackageVersionFromLocalCacheAsync(String name, String versionRange) in /home/runner/work/nuget-license/nuget-license/src/Methods.cs:line 245
   at NugetUtility.Methods.GetNugetInformationAsync(String project, IEnumerable`1 packages) in /home/runner/work/nuget-license/nuget-license/src/Methods.cs:line 118

A very easy and safe way to fix this is to simply check that versions reported by the cache starts with a number.

See the PR: #207

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

No branches or pull requests

1 participant