Home: PackageReference range with exclusive lower bound does not work if the lower bound is present on one of the sources.

Created on 24 Apr 2019  路  9Comments  路  Source: NuGet/Home

馃搶 _Transferred from https://github.com/aspnet/AspNetCore/issues/9680_

Describe the bug

PackageReference exclusive definition does not work correctly.

_According to Microsoft Docs_
_Notation (1.0,2.0) Applied Rule 1.0 < x < 2.0 Description Exact range, exclusive_

To Reproduce

  1. Confirm that you have SDK 2.2.203 through dotnet --info
  2. Create a new console project dotnet new console
  3. Add a package with dotnet add package Ruya.AppDomain
  4. Locate the error message error: Unable to find package Ruya.Primitives with version (> 1.0.470)
  5. You may see the complete Ruya.AppDomain.csproj file here
  6. Go to https://www.nuget.org/packages/Ruya.Primitives/
  7. Locate that there is a version above 1.0.487

image

Expected behavior

It should pick the correct version of the package _(Ruya.Primitives 1.0.487 in this case)_ correctly.

Screenshots

image

Additional context

output of dotnet --info

image

Restore RegressionFromPreviousRTM PackageReference Bug

Most helpful comment

@cilerler

This will be in:
5.1 of NuGet
16.1 of Visual Studio
2.2.300/ 2.1.700/ 3.0.100-preview6 of the SDK.

All 9 comments

Thanks for creating this @cilerler.

Do you know if this is a new behavior?

I'd imagine the problem is here, https://github.com/NuGet/NuGet.Client/blob/5b975f446808a318e0696c8c23cd2dd6b9aa817b/src/NuGet.Core/NuGet.Commands/RestoreCommand/SourceRepositoryDependencyProvider.cs#L211

Related https://github.com/NuGet/NuGet.Client/pull/2578.

I would imagine 2.2.10x line does not have this bug.

@rrelyea This looks like a regression worth investigating.

@nkolev92 as long as I know it was there forever.
Moreover, you are probably right about the code location; and, I don't see any indication of filtering the unlisted ones.

Quick check suggests that 2.1.500 does not have this bug, so I think my "educated guess" above is correct.
This is a regression.

Unlisted ones are handled in different ways depending on the scenario. Unlisted versions are allowed in certain cases.

Great, so, should I expect a fix soon? 馃槃

@cilerler

We will triage and come back to you when we know more.

As a workaround you can always specify
<PackageReference Include="Ruya.Primitives" Version="[1.0.471,)" />

It will have the same meaning.

@cilerler

This will be in:
5.1 of NuGet
16.1 of Visual Studio
2.2.300/ 2.1.700/ 3.0.100-preview6 of the SDK.

Was this page helpful?
0 / 5 - 0 ratings