fsprojects / fsprojects/Paket

Paket fails to install NETStandard.Library 2.0.x when hosted in Sonatype Nexus Repository Manager

Open
#3,630 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

Paket fails to install NETStandard.Library 2.0.1 and 2.0.3 when Sonatype Nexus Repository Manager is used as the package server. Paket is able to install v1.6.1 of the same package. When attempting to install 2.0.x versions of NETStandard.Library, the following error occurs:

System.Exception: error ---> System.ArgumentException: Version string portion was too short or too long.
   at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
   at System.Version.TryParseVersion(String version, VersionResult& result)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at Paket.FrameworkDetection.tryNormalizeVersion@696(String s)
   at Paket.FrameworkDetection.|MatchTfm|_|@727-1.Invoke(String s)
   at Paket.FrameworkDetection.f@62-2(String path)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.FSharp.Collections.ArrayModule.Choose[T,TResult](FSharpFunc`2 chooser, T[] array)
   at Paket.PlatformMatching.f@62-5(String path)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Paket.PlatformMatching.extractPlatforms(Boolean warn, String path)
   at Paket.NuGetV2.rawPackages@189.Invoke(String d)
   at Microsoft.FSharp.Collections.ArrayModule.Choose[T,TResult](FSharpFunc`2 chooser, T[] array)
   at Paket.NuGetV2.handleODataEntry[a,b](String nugetURL, a packageName, b version, XmlNode entry)
   at Paket.NuGetV2.parseODataListDetails(String url, String nugetURL, PackageName packageName, SemVerInfo version, XmlNode doc)
   at Paket.NuGetV2.handleListUrl@362-7.Invoke(Unit unitVar)
   at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@522.Invoke(AsyncParams`1 args)
   --- End of inner exception stack trace ---
   at Paket.NuGetV2.getDetailsFromNuGetViaODataFast@381-1.Invoke(FSharpChoice`2 _arg5)
   at Microsoft.FSharp.Control.AsyncBuilderImpl.args@506-1.Invoke(a a)
Something failed in GetPackageDetails, trying again with force: Couldn't get package details for package NETStandard.Library 2.0.1 on http://localhost:8081/repository/cwtest.
         - 2_http://localhost:8081/repository/cwtest/Packages?$filter=(tolower(Id) eq 'netstandard.library') and (Version eq '2.0.1')q '2.0.1')
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1645.Invoke(String message)
   at Paket.NuGetCache.tryAndBlacklistUrl@591-8.Invoke(Tuple`2 _arg5)
   at Microsoft.FSharp.Control.AsyncBuilderImpl.args@506-1.Invoke(a a)
    Package not available.
      Message: Unable to retrieve package details for 'NETStandard.Library'-2.0.1

Paket is able to restore NETStandard.Library 2.0.x from nuget.org. I've tested Paket against both Nexus 3.15.0 and 3.18.0. I've also tested with various versions of Paket, including v5.215.0.

The standard NuGet package restore in Visual Studio 2017 and dotnet cli are both able to restore the same NETStandard.Library 2.0.x packages from the same Nexus servers, so I do not believe it is a problem with Nexus.

Repro steps

Please provide the steps required to reproduce the problem

  1. Create a Console application using Visual Studio 2017 and .NET 4.7.2.
  2. Convert the project to use Paket as the package manager.
  3. Update packet.dependencies to include NETStandard.Library 2.0.1 and its single dependency: Microsoft.NETCore.Platforms 1.1.0.
  4. Add the two packages to packet.references for the project.
  5. Setup Nexus OSS and install the above packages.
  6. Update the source in packet.dependencies to point to the Nexus OSS server.
  7. Attempt to perform paket.exe install

I've uploaded both a sample Console project and the response from Nexus for the http://localhost:8081/repository/cwtest/Packages?$filter=(tolower(Id) eq 'netstandard.library') and (Version eq '2.0.1') query indicated in the failure message from Paket.

ConsoleApp.zip
feed-response.txt

Expected behavior

The packages can be installed successfully.

Actual behavior

The exception show above is given when attempting to download NETStandard.Library 2.0.1. At the completion of the install attempt and after the error has occurred, the following result message is given by Paket:

Paket failed with
-> There was a version conflict during package resolution.
     Conflict detected:
      - Dependencies file requested package NETStandard.Library: 2.0.1
      - Available versions:
        - (2.0.1, [http://localhost:8081/repository/cwtest])

     Please try to relax some conditions or resolve the conflict manually (see http://fsprojects.github.io/Paket/nuget-dependencies.html#Use-exactly-this-version-constraint).
-> Unable to retrieve package details for 'NETStandard.Library'-2.0.1
-> Couldn't get package details for package NETStandard.Library 2.0.1 on http://localhost:8081/repository/cwtest.
         - 2_http://localhost:8081/repository/cwtest/Packages?$filter=(tolower(Id) eq 'netstandard.library') and (Version eq '2.0.1')q '2.0.1')
Known workarounds

Obtain the packages from nuget.org instead. Unfortunately, this is not a good workaround for us because we need to build from internally hosted packages for compliance reasons.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The failure reaches Paket.FrameworkDetection.tryNormalizeVersion and Paket.NuGetV2.parseODataListDetails; begin there and inspect feed-response.txt for the Nexus metadata shape. Reproduce with ConsoleApp.zip and the listed Nexus setup, then verify that paket.exe install succeeds for NETStandard.Library 2.0.1 and 2.0.3 from Nexus.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.