runtime: Unable to install templates on Ubuntu 18.04 after upgrading to 2.1.302

From @NatElkins on July 21, 2018 22:23

Steps to reproduce

Try installing any dotnet template with dotnet version 2.1.302 on Ubuntu 18.04. For example, dotnet new -i "Amazon.Lambda.Templates::*". But it happens with any of them.

Expected behavior

The templates should install without any issues.

Actual behavior

You’ll get an error like:

nathaniel@nelknet:~/Projects$ dotnet new -i "Amazon.Lambda.Templates::*"
  Restoring packages for /home/nathaniel/.templateengine/dotnetcli/v2.1.302/scratch/restore.csproj...
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/nathaniel/.templateengine/dotnetcli/v2.1.302/scratch/restore.csproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   The type initializer for 'System.Net.Http.HttpConnectionPool' threw an exception. [/home/nathaniel/.templateengine/dotnetcli/v2.1.302/scratch/restore.csproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   Version's parameters must be greater than or equal to zero. [/home/nathaniel/.templateengine/dotnetcli/v2.1.302/scratch/restore.csproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   Parameter name: revision [/home/nathaniel/.templateengine/dotnetcli/v2.1.302/scratch/restore.csproj]

and the templates will not be installed.

Environment data

dotnet --info output:

nathaniel@nelknet:~/Projects$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.302
 Commit:    9048955601

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.302/

Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0

.NET Core SDKs installed:
  2.0.2 [/usr/share/dotnet/sdk]
  2.1.4 [/usr/share/dotnet/sdk]
  2.1.302 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Copied from original issue: dotnet/cli#9713

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 29 (24 by maintainers)

Most upvoted comments

Bingo: revision is 24201807041620

Damn @danmosemsft, you’re an animal! 😃

@nguerrera Thanks for looking into this so quickly! From the non-working machine, uname -a returns:

Linux nelknet 4.15.0-24201807041620-generic #0+mediatree+hauppauge-Ubuntu SMP Thu Jul 5 01:38:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Some kind of patched kernel was required in order to support a TV tuner that I use with the computer. Instructions for that are here: http://hauppauge.com/pages/support/support_linux.html

For the working machine, uname -a returns:

Linux nelknet-carbon 4.15.0-23-generic dotnet/corefx#25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

From @NatElkins on July 22, 2018 19:6

With verbosity set to detailed, I’m seeing this:

     1>Target "Restore" in file "/usr/share/dotnet/sdk/2.1.302/NuGet.targets" from project "/home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj" (entry point):
       Task "RemoveDuplicates"
       Done executing task "RemoveDuplicates".
       Using "RestoreTask" task from assembly "/usr/share/dotnet/sdk/2.1.302/NuGet.Build.Tasks.dll".
       Task "RestoreTask"
         (in) RestoreGraphItems Count '5'
         (in) RestoreDisableParallel 'False'
         (in) RestoreNoCache 'False'
         (in) RestoreIgnoreFailedSources 'False'
         (in) RestoreRecursive 'True'
         (in) RestoreForce 'False'
         (in) HideWarningsAndErrors 'False'
         Running restore with 4 concurrent jobs.
         Reading project file /home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj.
         Restoring packages for /home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj...
         Restoring packages for .NETCoreApp,Version=v2.1...
     1>/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   The type initializer for 'System.Net.Http.HttpConnectionPool' threw an exception. [/home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   Version's parameters must be greater than or equal to zero. [/home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   Parameter name: revision [/home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj]
         NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://api.nuget.org/v3/index.json. 
---> System.TypeInitializationException: The type initializer for 'System.Net.Http.HttpConnectionPool' threw an exception. 
---> System.ArgumentOutOfRangeException: Version's parameters must be greater than or equal to zero.
         Parameter name: revision
            at System.Version..ctor(Int32 major, Int32 minor, Int32 build, Int32 revision)
            at System.Environment.<>c.<.cctor>b__79_0()
            at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
            at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
            at System.Lazy`1.CreateValue()
            at System.Environment.get_OSVersion()
            at System.Net.Http.HttpConnectionPool.GetIsWindows7Or2008R2()
            at System.Net.Http.HttpConnectionPool..cctor()
            --- End of inner exception stack trace ---
            at System.Net.Http.HttpConnectionPool.ConstructSslOptions(HttpConnectionPoolManager poolManager, String sslHostName)
            at System.Net.Http.HttpConnectionPool..ctor(HttpConnectionPoolManager poolManager, HttpConnectionKind kind, String host, Int32 port, String sslHostName, Uri proxyUri, Int32 maxConnections)
            at System.Net.Http.HttpConnectionPoolManager.SendAsyncCore(HttpRequestMessage request, Uri proxyUri, Boolean doRequestAuth, Boolean isProxyConnect, CancellationToken cancellationToken)
            at System.Net.Http.HttpConnectionPoolManager.SendAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
            at System.Net.Http.HttpAuthenticatedConnectionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            at NuGet.Protocol.ServerWarningLogHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            at NuGet.Protocol.HttpSourceAuthenticationHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
            at NuGet.Protocol.TimeoutUtility.StartWithTimeout[T](Func`2 getTask, TimeSpan timeout, String timeoutMessage, CancellationToken token)
            at NuGet.Protocol.HttpRetryHandler.SendAsync(HttpRetryHandlerRequest request, ILogger log, CancellationToken cancellationToken)
            at NuGet.Protocol.HttpSource.GetThrottledResponse(Func`1 requestFactory, TimeSpan requestTimeout, TimeSpan downloadTimeout, Int32 maxTries, Guid sessionId, ILogger log, CancellationToken cancellationToken)
            at NuGet.Protocol.HttpSource.<>c__DisplayClass14_0`1.<<GetAsync>b__0>d.MoveNext()
         --- End of stack trace from previous location where exception was thrown ---
            at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLockedAsync[T](String filePath, Func`2 action, CancellationToken token)
            at NuGet.Protocol.HttpSource.GetAsync[T](HttpSourceCachedRequest request, Func`2 processAsync, ILogger log, CancellationToken token)
            at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3(SourceRepository source, DateTime utcNow, ILogger log, CancellationToken token)
            --- End of inner exception stack trace ---
            at NuGet.Protocol.ServiceIndexResourceV3Provider.GetServiceIndexResourceV3(SourceRepository source, DateTime utcNow, ILogger log, CancellationToken token)
            at NuGet.Protocol.ServiceIndexResourceV3Provider.TryCreate(SourceRepository source, CancellationToken token)
            at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T](CancellationToken token)
            at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T]()
            at NuGet.Protocol.HttpFileSystemBasedFindPackageByIdResourceProvider.TryCreate(SourceRepository sourceRepository, CancellationToken token)
            at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T](CancellationToken token)
            at NuGet.Protocol.Core.Types.SourceRepository.GetResourceAsync[T]()
            at NuGet.Commands.SourceRepositoryDependencyProvider.EnsureResource()
            at NuGet.Commands.SourceRepositoryDependencyProvider.FindLibraryCoreAsync(LibraryRange libraryRange, NuGetFramework targetFramework, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
            at NuGet.Commands.SourceRepositoryDependencyProvider.<>c__DisplayClass18_0.<<FindLibraryAsync>b__0>d.MoveNext()
         --- End of stack trace from previous location where exception was thrown ---
            at NuGet.Commands.SourceRepositoryDependencyProvider.FindLibraryAsync(LibraryRange libraryRange, NuGetFramework targetFramework, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
            at NuGet.DependencyResolver.ResolverUtility.<>c__DisplayClass7_1.<<FindLibraryFromSourcesAsync>b__0>d.MoveNext()
         --- End of stack trace from previous location where exception was thrown ---
            at NuGet.DependencyResolver.ResolverUtility.FindLibraryFromSourcesAsync(LibraryRange libraryRange, IEnumerable`1 providers, Func`2 action)
            at NuGet.DependencyResolver.ResolverUtility.FindLibraryByVersionAsync(LibraryRange libraryRange, NuGetFramework framework, IEnumerable`1 providers, SourceCacheContext cacheContext, ILogger logger, CancellationToken token)
            at NuGet.DependencyResolver.ResolverUtility.FindLibraryMatchAsync(LibraryRange libraryRange, NuGetFramework framework, GraphEdge`1 outerEdge, IEnumerable`1 remoteProviders, IEnumerable`1 localProviders, IEnumerable`1 projectProviders, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
            at NuGet.DependencyResolver.ResolverUtility.FindLibraryEntryAsync(LibraryRange libraryRange, NuGetFramework framework, GraphEdge`1 outerEdge, RemoteWalkContext context, CancellationToken cancellationToken)
            at NuGet.DependencyResolver.RemoteDependencyWalker.CreateGraphNode(LibraryRange libraryRange, NuGetFramework framework, String runtimeName, RuntimeGraph runtimeGraph, Func`2 predicate, GraphEdge`1 outerEdge)
            at NuGet.DependencyResolver.RemoteDependencyWalker.CreateGraphNode(LibraryRange libraryRange, NuGetFramework framework, String runtimeName, RuntimeGraph runtimeGraph, Func`2 predicate, GraphEdge`1 outerEdge)
            at NuGet.Commands.ProjectRestoreCommand.WalkDependenciesAsync(LibraryRange projectRange, NuGetFramework framework, String runtimeIdentifier, RuntimeGraph runtimeGraph, RemoteDependencyWalker walker, RemoteWalkContext context, CancellationToken token)
            at NuGet.Commands.ProjectRestoreCommand.TryRestoreAsync(LibraryRange projectRange, IEnumerable`1 frameworkRuntimePairs, NuGetv3LocalRepository userPackageFolder, IReadOnlyList`1 fallbackPackageFolders, RemoteDependencyWalker remoteWalker, RemoteWalkContext context, Boolean forceRuntimeGraphCreation, CancellationToken token)
            at NuGet.Commands.RestoreCommand.ExecuteRestoreAsync(NuGetv3LocalRepository userPackageFolder, IReadOnlyList`1 fallbackPackageFolders, RemoteWalkContext context, CancellationToken token)
            at NuGet.Commands.RestoreCommand.ExecuteAsync(CancellationToken token)
            at NuGet.Commands.RestoreRunner.ExecuteAsync(RestoreSummaryRequest summaryRequest, CancellationToken token)
            at NuGet.Commands.RestoreRunner.ExecuteAndCommitAsync(RestoreSummaryRequest summaryRequest, CancellationToken token)
            at NuGet.Commands.RestoreRunner.CompleteTaskAsync(List`1 restoreTasks)
            at NuGet.Commands.RestoreRunner.RunAsync(IEnumerable`1 restoreRequests, RestoreArgs restoreContext, CancellationToken token)
            at NuGet.Commands.RestoreRunner.RunAsync(RestoreArgs restoreContext, CancellationToken token)
            at NuGet.Build.Tasks.RestoreTask.ExecuteAsync(ILogger log)
       Done executing task "RestoreTask" -- FAILED.
     1>Done building target "Restore" in project "fs.fsproj" -- FAILED.
     1>Done Building Project "/home/nathaniel/Projects/debug-nuget-issue/fs/fs.fsproj" (Restore target(s)) -- FAILED.

Looks like it is failing on this line: https://github.com/dotnet/corefx/blob/a3021f143b762006a7e19ad11785ca0c3c454933/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs#L22