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

[8.0.100-rc.2.23469.4] some deprecated global tools get NuGetPackageNotFoundException when installing #35566

Closed
Junjun-zhao opened this issue Sep 20, 2023 · 23 comments
Assignees

Comments

@Junjun-zhao
Copy link
Member

Junjun-zhao commented Sep 20, 2023

Issue Description:
When installing these global tools with "dotnet tool install" command, NuGetPackaeNotFoundException will be thrown on dotnet-sdk-8.0.100-rc.2.23469.4. But they are installed successful with dotnet-sdk-8.0.100-rc.2.23466.1.

Application Name: Elemental.SysInfoTool, dotnet-giio, dotnet-sqldb
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-8.0.100-rc.2.23469.4

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-8.0.100-rc.2.23469.4: Fail
  2. Windows10 21h2 x64 + dotnet-sdk-8.0.100-rc.2.23466.1: Pass

Repro steps:
The machine only has 8.0.100-rc.2.23469.4 installed and set DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX environment variable as 2.

  1. Open cmd.exe form %windir%\System32
  2. Input ‘dotnet tool install -g Elemental.SysInfoTool’
  3. Press keyboard ‘Enter’

Expected Result:
Elemental.SysInfoTool install successful.

Actual Result:
Install failed with following exception:

Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageNotFoundException: elemental.sysinfotool::[*, ) is not found in NuGet feeds https://api.nuget.org/v3/index.json, https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json, https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json, https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev, https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json, https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json, https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json, https://pkgs.dev.azure.com/dnceng/internal/_packaging/6.0.414-servicing.23416.29-shipping/nuget/v3/index.json".

   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetMatchingVersionInternalAsync(String packageIdentifier, IEnumerable`1 packageSources, VersionRange versionRange, CancellationToken cancellationToken)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

Findings:
These tools do not exist in NuGet Gallery | Packages
And their details page marked them as deprecated and cannot be used anymore. For example, this is the Elemental.SysInfoTool tool page.
But we can install this tool successfully when we have earlier SDK installed in our machine.
This issue seems related to 8114042

@dotnet-actwx-bot @dotnet/compat

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Sep 20, 2023
@Junjun-zhao
Copy link
Member Author

@marcpopMSFT Could you please help check this bug? It appears to be intentional.

@KalleOlaviNiemitalo
Copy link

This seems to be by design, according to #24037 and #28951. Also #32092, although that one is still open.

Does the installation succeed if you specify the --version of the tool explicitly?

This might still deserve a breaking-change entry in https://learn.microsoft.com/dotnet/core/compatibility/8.0#sdk. There was a pull request dotnet/docs#32567 but it was closed as premature.

@Junjun-zhao
Copy link
Member Author

Does the installation succeed if you specify the --version of the tool explicitly?

No, it does not work either. Same exception shows when try to install the tool with or without "--version"
For example, dotnet tool install --global Elemental.SysInfoTool --version 0.5.0

@marcpopMSFT
Copy link
Member

@JL03-Yue @dsplaisted This was an intentional change. Do you know if it was intended to still work if the user specified an exact version of the package? We may want to mark this as a breaking change and document it as it appears some folks were relying on this.

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Sep 28, 2023

ParseResultExtension.GetVersionRange(this ParseResult parseResult) from #28951 used to skip the NuGet search if --version was specified:

string packageVersion = parseResult.GetValue(ToolInstallCommandParser.VersionOption);
if (string.IsNullOrEmpty(packageVersion))
{
var nugetToolSearchApiRequest = new NugetToolSearchApiRequest();

But that code was removed in #33835 and replaced with NuGetPackageDownloader, which works differently. The comments on that pull request do not include the string "unlist". Some comments include the word "version" in relation to package versions but they do not directly address this issue:

@Kralizek
Copy link

Kralizek commented Oct 11, 2023

I'm experiencing the same issue when restoring in Azure DevOps a project that references Microsoft Tye 0.11 since RC2 went live.

The same issue doesn't happen on my local machine.

$ dotnet --version
8.0.100-rc.2.23502.2

See for more details the issue on the Tye repo: dotnet/tye#1615

@JL03-Yue
Copy link
Member

This will be targeted to be fixed in .NET 8 GA.

@JL03-Yue JL03-Yue removed the untriaged Request triage from a team member label Oct 20, 2023
@Junjun-zhao
Copy link
Member Author

@JL03-Yue We verified it on the latest coherent build 8.0.100-rtm.23527.22, it fails to install unlisted tool by specifying version. Could you please check whether this build consuming the fix?
For example:
dotnet tool install --global Elemental.SysInfoTool --version 0.5.0.

And are we going to document it as breaking change if we change the behavior to install the unlist tool by specifying the version?

This seems to be by design, according to #24037 and #28951. Also #32092, although that one is still open.

Does the installation succeed if you specify the --version of the tool explicitly?

This might still deserve a breaking-change entry in https://learn.microsoft.com/dotnet/core/compatibility/8.0#sdk. There was a pull request dotnet/docs#32567 but it was closed as premature.

@Junjun-zhao
Copy link
Member Author

@JL03-Yue Also verify it with today's coherent build dotnet-sdk-8.0.100-rtm.23530.10, it still repro and unable to install the unlisted tool with specified version. Could you please help check whether this build contains the fix?

CC: @marcpopMSFT @KalleOlaviNiemitalo @PriyaPurkayastha for awareness.

@Junjun-zhao
Copy link
Member Author

Junjun-zhao commented Nov 1, 2023

Update: The unlist tool can be successfully installed when a version is specified and enclosed in square brackets(install the Exact version match). The above validation which just mentioned the version, actually it is a range (X >=Version) according to the document https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-basics

For example:
dotnet tool install --global Elemental.SysInfoTool --version [0.5.0]
image

The only thing to need your kindly confirm is whether we will be creating a breaking document for this? @JL03-Yue @marcpopMSFT @KalleOlaviNiemitalo

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Nov 1, 2023

I'd prefer that it work with the same syntax as before, i.e. 0.5.0 means exactly version 0.5.0, rather than the lowest listed version that is not lower than 0.5.0. If the bracketed expression [0.5.0] were the only way to specify an exact version, then it would have to be quoted, to prevent Bash from replacing it with a file name 0 or . or 5 if such a file exists.

@KalleOlaviNiemitalo
Copy link

Maybe the brackets make sense in dotnet add package; but I don't think version ranges are useful in dotnet tool install. There are no transitive references to .NET tool packages, so NuGet never has to choose a tool version that satisfies multiple constraints.

@Junjun-zhao
Copy link
Member Author

Maybe the brackets make sense in dotnet add package; but I don't think version ranges are useful in dotnet tool install. There are no transitive references to .NET tool packages, so NuGet never has to choose a tool version that satisfies multiple constraints.

Thanks for your information. @JL03-Yue Could you please have a look at this issue again? Thanks

@KalleOlaviNiemitalo
Copy link

@Junjun-zhao, does the [0.5.0] syntax work with local tools? If so, does it copy the brackets into .config/dotnet-tools.json as well, and can the local tool be run after it has been installed with this syntax?

@Junjun-zhao
Copy link
Member Author

Yes, it works well after installing with [0.5.0] syntax. It doesn't copy the brackets into .config/dotnet-tools.json.
image

@baronfel
Copy link
Member

baronfel commented Nov 1, 2023

I agree with you all - we should retain the previous syntax and accept 'bare' versions to mean NuGet-exact-version syntax.

@Junjun-zhao
Copy link
Member Author

A breaking change document filed dotnet/docs#37655 for this issue with currently workaround that installing the unlisted tools by specifying the version in brackets.

Confirm with Marc offline, Team will plan to improve this in .NET 8 servicing build to simplify it without brackets.

@JL03-Yue
Copy link
Member

@Junjun-zhao A change that accept the bare version as NuGet exact version was merged

@Junjun-zhao
Copy link
Member Author

@JL03-Yue We verified with latest build 8.0.200-preview.23564.1, bare version doesn't work yet.
image

Following is the dotnet info, could you please help confirm if it is merged into this build?

.NET SDK:
Version:           8.0.200-preview.23564.1
Commit:            f0c4e4e14c
Workload version:  8.0.200-manifests.f64e8451
 
Runtime Environment:
OS Name:     Windows
OS Version:  10.0.19045
OS Platform: Windows
RID:         win-x64
Base Path:   C:\Program Files\dotnet\sdk\8.0.200-preview.23564.1\
 
.NET workloads installed:
Workload version: 8.0.200-manifests.f64e8451
There are no installed workloads to display.
 
Host:
  Version:      8.0.0-rtm.23520.16
  Architecture: x64
  Commit:       11ad607efb
 
.NET SDKs installed:
  8.0.200-preview.23564.1 [C:\Program Files\dotnet\sdk]
 
.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.0-rtm.23520.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.0-rtm.23520.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 8.0.0-rtm.23521.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@KalleOlaviNiemitalo
Copy link

KalleOlaviNiemitalo commented Nov 17, 2023

PR #36671 was merged to the release/8.0.1xx branch in commit 5a7019c, but it seems the GetBestPackageVersionAsync change in src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs was not correctly merged to the release/8.0.2xx branch in commit 7d995fc (PR #36874). Commit 6c74ad6 in PR #36641 to release/8.0.2xx had added a space in if ( and caused a merge conflict that was resolved incorrectly.

$ git show --diff-merges=remerge 7d995fce293917e817f63d0a41808dfc6779a034 -- src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
commit 7d995fce293917e817f63d0a41808dfc6779a034
Merge: a1c5ff764e 91840a4e2e
Author: v-codyguan <v-codyguan@microsoft.com>
Date:   Wed Nov 15 07:03:30 2023 +0000

    Merge branch 'release/8.0.1xx' into release/8.0.2xx

diff --git a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
remerge CONFLICT (content): Merge conflict in src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
index 3d0a8466eb..933f561d98 100644
--- a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
+++ b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
@@ -559,12 +559,7 @@ private string GenerateVersionRangeErrorDescription(string packageIdentifier, Ve
             VersionRange versionRange,
              PackageSourceLocation packageSourceLocation = null)
         {
-<<<<<<< a1c5ff764e ([release/8.0.2xx] Update dependencies from dotnet/razor (#36863))
             if (versionRange.MinVersion != null && versionRange.MaxVersion != null && versionRange.MinVersion == versionRange.MaxVersion)
-=======
-            if (versionRange.MinVersion != null && !versionRange.IsFloating &&
-                (versionRange.MaxVersion == null || versionRange.MinVersion == versionRange.MaxVersion))
->>>>>>> 91840a4e2e (Update manpages for 8.0 (#36447))
             {
                 return versionRange.MinVersion;
             }

@JL03-Yue
Copy link
Member

@Junjun-zhao The change is expecting in December fix.

@KalleOlaviNiemitalo Thanks for pointing it out!

@Junjun-zhao
Copy link
Member Author

Thank you @JL03-Yue.
We will verify this issue with the validation build for December update as soon as it is available.

@Junjun-zhao
Copy link
Member Author

Verified this issue on dotnet-8.0.101-servicing.23579.12, bare version works now. Thank you.

For example:

dotnet tool install --global dotnet-giio --version 1.0.2
dotnet tool install --global Elemental.SysInfoTool --version 0.5.0
dotnet tool install --global dotnet-sqldb --version 0.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants