I got the error while trying to install dotnet-sonarscanner as suggested by Sonarqube. This happened when I was installing into 2nd server. My 1st server can run the installation command without any issue. Is there anyone who has encountered this error?
The command is here: dotnet tool install --global dotnet-sonarscanner
Below is the error message.
Unhandled exception: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
at System.String.Substring(Int32 startIndex, Int32 length)
at Microsoft.DotNet.Cli.RestoreCommandParser.RestoreRuntimeArgFunc(IEnumerable`1 rids)
at Microsoft.DotNet.Cli.ForwardedOption`1.<>c__DisplayClass6_0.<SetForwardingFunction>b__0(T o)
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Microsoft.DotNet.Tools.Restore.RestoreCommand.FromParseResult(ParseResult result, String msbuildPath, Boolean noLogo)
at Microsoft.DotNet.Tools.Restore.RestoreCommand.Run(ParseResult parseResult)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.DotNet.Cli.Parser.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()
The tool package could not be restored.
Tool 'dotnet-sonarscanner' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
I've already checked Nuget.config, and The nuget URL has already been there: https://api.nuget.org/v3/index.json