-
Notifications
You must be signed in to change notification settings - Fork 252
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
Floating version patterns like '1.* are treated as ranges without a max,
1.*` is [1.*, )
#5097
Comments
For reference look at the documentation: |
Users can specify |
A floating range is treated as two ranges currently.
In the case of |
I find this non-intuitive. The |
The wildcard is matched to what's highest the feed first, and then acts like a normal range afterwards. So if the feed has 1.1.0,1.2.0,1.3.0,2.0.0 and you look for 1.* Then it's effectively turned to 1.3 without a maximum. Like @emgarten mentioned then - if you have [1.*, 2.0) then it's effectively turned to [1.3, 2.0) which gives you the clamped range you were looking for. However there is a problem if a wildcard automatically adds a maximum. Let's say you have project Q that uses library A and B, and A and B use package X. If A says X 1.4 is ideal, and B says X 2.2 is ideal, then Q gets X 2.2 which is the lowest matching package in the intersection of ranges. But if a wildcard also implies a maximum and A says X 1.* is ideal, and B says X 2.* is ideal, then Q will get a restore error because the ranges [1.3, 2.0) and [2.0, 3.0) have no intersection. The major version might not seem so bad, but you'd have the same problem with any non-identical wildcard... 1.5.* and 1.6.* will exclude each other, but 1.5.4 and 1.6.1 will happily select 1.6.1 for you. |
That said - I do think this is a case where you should get the "under-versioning" warning. Just like if I say 1.3 is ideal and restore ends up handing me 2.0 I'll get a warning, if I say 1.* is ideal and restore ends up with 2.0 I should get that same warning. |
@lodejard I see 2 issues with the current behavior using wild card:
|
Wow... that's completely awkward. Docs say:
In reality, But even How many people would write it correctly from the first time? And what is the point in having |
In fact, even the last one is not right because of #912 as it won't consider pre-release versions if there is at least one version without pre-release label (i.e. |
are treated as ranges without a max,
1.*` is [1.*, )
<ItemGroup> <PackageReference Include="NuGetPlayLib" Version="1.*" /> </ItemGroup>
Expected: It should throw an error as it would have if the dependency was specified as:
<ItemGroup> <PackageReference Include="NuGetPlayLib" Version="[1.0.0, 2.0.0)" /> </ItemGroup>
Actual: It resolves to version 2.0.0
The text was updated successfully, but these errors were encountered: