You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executing dotnet tool restore, it throws an exception stating ArgumentOutOfRangeException. This seems to only occur when the localization of the PC is set to any language that includes non-Latin characters, such as Thai.
This seems to be related to the same issue that happened with dotnet run in Issue #23004
The full exception is included below in the exception section.
To Reproduce
Set the localization language of your PC to any language that includes non-Latin characters. In this case, to reproduce the issue as we saw it, set the localization language to Thai.
After doing this, attempt to install any dotnet tool, for instance you can try dotnet tool install -g dotnet-ef and the error will occur.
As for the specific instance we noticed this issue, it was while helping a fellow community member diagnose the issue when creating a MonoGame project which includes several dotnet tools that needed to be restored. A basic sample of this project can be found at https://github.com/AristurtleDev/MonoGameSample
Before attempting use the sample project, ensure you have set your PC localization to anything that includes non-Latin characters such as Thai in our specific scenario.
Exceptions (if any)
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()
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.SelectManySingleSelectorIteratSystem.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.DotNetor`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..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 fromParser.<>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.<<U 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()seParseDirective>b__0>d.MoveNext()--- End of stack trace from previous location --- at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()
Further technical details
Include the output of dotnet --info
$ dotnet --info
.NET SDK:
Version: 7.0.306
Commit: f500069cb7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.306\
Host:
Version: 7.0.9
Architecture: x64
Commit: 8e9a17b221
.NET SDKs installed:
7.0.306 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
This occurs both in Visual Studio and VSCode when the dotnet tool restore command is executed on a windows PC where the language localization is one with non-Latin characters such as Thai.
The text was updated successfully, but these errors were encountered:
The 'restore' versions of these same forwarding functions here
The LastIndexOf call's aren't taking into account that the index could be -1 when not found, as in the case of the any RID.
We should fix these two, and to be honest the 'restore' versions of the option should be removed in favor of the CommonOptions version, like the other places that have a Runtime option have done.
Describe the bug
When executing
dotnet tool restore
, it throws an exception statingArgumentOutOfRangeException
. This seems to only occur when the localization of the PC is set to any language that includes non-Latin characters, such as Thai.This seems to be related to the same issue that happened with
dotnet run
in Issue #23004The full exception is included below in the exception section.
To Reproduce
Set the localization language of your PC to any language that includes non-Latin characters. In this case, to reproduce the issue as we saw it, set the localization language to Thai.
After doing this, attempt to install any dotnet tool, for instance you can try
dotnet tool install -g dotnet-ef
and the error will occur.As for the specific instance we noticed this issue, it was while helping a fellow community member diagnose the issue when creating a MonoGame project which includes several dotnet tools that needed to be restored. A basic sample of this project can be found at https://github.com/AristurtleDev/MonoGameSample
Before attempting use the sample project, ensure you have set your PC localization to anything that includes non-Latin characters such as Thai in our specific scenario.
Exceptions (if any)
Further technical details
dotnet --info
This occurs both in Visual Studio and VSCode when the
dotnet tool restore
command is executed on a windows PC where the language localization is one with non-Latin characters such as Thai.The text was updated successfully, but these errors were encountered: