Repository navigation
Description
I've had a bit of an issue recently with upgrading a specific NuGet package which caused the tool to fail with
...
C:\Program Files\dotnet\dotnet.exe" tool run dotnet-outdated --include-auto-references --version-lock None --output C:\MyPath\dotnet-outdated-report.json --upgrade:auto C:\MyPath\MySolution.sln
...
An error occurred while upgrading My.Project
...
Process 'dotnet.exe' has exited with code 3.
It turns out that if I run the dotnet add package command directly, it does complete successfully - although it is very slow.
Here's an example:
dotnet add .\src\My.Project.csproj package Grpc.Tools -v 2.63.0 -f net8.0
Determining projects to restore...
Writing C:\MyUser\Temp\tmphfjmft.tmp
info : X.509 certificate chain validation will use the default trust store selected by .NET for code signing.
info : X.509 certificate chain validation will use the default trust store selected by .NET for timestamping.
info : Adding PackageReference for package 'Grpc.Tools' into project '.\src\My.Project.csproj'.
info : Restoring packages for C:\MyPath\src\My.Project.csproj...
info : GET https://api.nuget.org/v3-flatcontainer/grpc.tools/index.json
info : OK https://api.nuget.org/v3-flatcontainer/grpc.tools/index.json 3005ms
info : GET https://api.nuget.org/v3-flatcontainer/grpc.tools/2.63.0/grpc.tools.2.63.0.nupkg
info : OK https://api.nuget.org/v3-flatcontainer/grpc.tools/2.63.0/grpc.tools.2.63.0.nupkg 1138ms
info : Installed Grpc.Tools 2.63.0 from https://api.nuget.org/v3/index.json to C:\MyPath\.nuget\packages\grpc.tools\2.63.0 with content hash kJ1+gtEmHQTG8AOtHQ1c/ScRihMijElYqylGGurraQP9yrl3paueI/iinsm6SOUjgOO3jjd3x3TmWNe8uvcRrw==.
info : GET https://api.nuget.org/v3/vulnerabilities/index.json
info : OK https://api.nuget.org/v3/vulnerabilities/index.json 587ms
info : GET https://api.nuget.org/v3-vulnerabilities/2024.04.25.01.10.39/vulnerability.base.json
info : GET https://api.nuget.org/v3-vulnerabilities/2024.04.25.01.10.39/2024.05.06.01.12.35/vulnerability.update.json
info : OK https://api.nuget.org/v3-vulnerabilities/2024.04.25.01.10.39/vulnerability.base.json 570ms
info : OK https://api.nuget.org/v3-vulnerabilities/2024.04.25.01.10.39/2024.05.06.01.12.35/vulnerability.update.json 1069ms
info : Package 'Grpc.Tools' is compatible with all the specified frameworks in project '.\src\My.Project.csproj'.
info : PackageReference for package 'Grpc.Tools' version '2.63.0' updated in file 'C:\MyPath\src\My.Project.csproj'.
info : Generating MSBuild file C:\MyPath\.\src\My.Project\obj\My.Project.csproj.nuget.g.props.
info : Generating MSBuild file C:\MyPath\src\My.Project.csproj\obj\My.Project.csproj.nuget.g.targets.
info : Writing assets file to disk. Path: C:\MyPath\src\My.Project.csproj\obj\project.assets.json
log : Restored C:\MyPath\src\My.Project.csproj (in 3,49 min).
So the actual restore took more than 3 minutes (for a single package).
Here are my machine specs:
Device name [irrelevant]
Full device name [irrelevant]
Processor 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz 2.50 GHz
Installed RAM 32,0 GB (31,7 GB usable)
Device ID [irrelevant]
Product ID [irrelevant]
System type 64-bit operating system, x64-based processor
---
Edition Windows 10 Enterprise
Version 22H2
Installed on [irrelevant]
OS build 19045.4291
Experience [irrelevant]
---
Internet: 100/100
What I do believe happens is that the process of upgrading the package is paused/delayed by a security system (Windows Defender or similar), which causes the package upgrade to take more than 3 minutes (and more specifically, not produce output for more than 20 seconds).
While I don't believe that this is an issue with dotnet-outdated or even dotnet add package itself, there is a possibility for the dotnet-outdated tool to increase the timeout after which the spawned dotnet.exe process will be killed.
Specifically, I am referring to src/DotNetOutdated.Core/Services/DotNetRunner.cs:L40 (const int Timeout = 20000;).
While I'm unsure if the actual timeout should be kept as a constant or configurable via a command line switch or explicit timeout argument, I am happy to tackle this issue, given feedback from the authors and the users.
Also, kudos to the maintainers - this is a really nice project!
Activity
Say when the idle timeout stops a dotnet command
Surface package-upgrade stdout so failures are diagnosable (#790)