-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet run
gives ArgumentOutOfRangeException
error at TryGetTargetArchitecture
method
#23004
Comments
According to `LastIndexOf`` documentation here:
It seems that int separator = runtimeIdentifier.LastIndexOf("-", StringComparison.InvariantCulture); I have tried rebuilt with the above fix, and the command |
have this error too |
Temporary solution for Windows users until newer .NET version fix this issue: Firstly, create a file name $env:DOTNET_SYSTEM_GLOBALIZATION_INVARIANT='True'
& 'C:\Program Files\dotnet\dotnet.exe' @args If necessary, update Then, add path of the directory which contains Command (in Thai) @Pathomkarn วิธีแก้ชั่วคราวนะครับ ให้สร้างไฟล์ชื่อ |
👆 I will for now give up with 6.0 and going to keep my projects being 5.0 until there is a proper fix. |
ถ้าผมถอยไปใช้.net version5 ความสามรถในการทำงานจะเหมือนกับตัว.net version6เลยไหมครับ? ปล.โปรแกรมที่ผมต้องใช้คือ Visual Studio Codeครับ |
We should take the suggested fix as soon as possible - RIDs should always be parsed/manipulated in Invariant ways in the SDK. I've marked the issue as up-for-grabs if anyone from the community would like to contribute it. Tests would need to demonstrate that this function works for several different cultures set as the CurrentCulture/CurrentUICulture, ideally including several of those that use non-ASCII character sets, and some that use right-to-left encodings. |
Looks like there are a couple of other places with the same issue: sdk/src/Cli/dotnet/CommonOptions.cs Lines 252 to 254 in dd53a44
|
@ponlawat-w This should be fixed in the 6.0.300 SDK. Let us know if you run into any other issues. |
Thank you @dsplaisted @marcpopMSFT. I have quickly updated dotnet to runtime version 6.3.0, but still got the error.
I am still busy these days, so I will investigate more when I have time, and open a new issue if neccessary. |
@ponlawat-w note that you may be on runtime 6.0.3, but this change was a change in the SDK, and the 6.0.300 SDK releases haven't happened quite yet. So keep your eyes peeled for that! |
@baronfel Oh, OK. I must have been confused with the number. Thank you for clarifying. I am looking forward to the new release. |
This document will help with SDK versioning. https://docs.microsoft.com/en-us/dotnet/core/porting/versioning-sdk-msbuild-vs Basically, the SDK matches the major version of .NET but does feature releases with VS hence the hybrid version numbers that don't match either. |
I found this solution when looking for the dotnet tool install fail. The error message also make me don't understand what a related to startIndex. My dotnet SDK version is 7.0.305 on Windows 11 Thai. |
This issue still present as of .NET version 7.0.306. Might be time to reopen this up. i'm still not sure how much this would affect my workflow. Let's hope for a minimal effect long-terms wise |
Hello, This issue still present as of .NET version 8.0.101. |
Describe the bug
I installed .NET 6.0.1 SDK, and turned out that I cannot use command
dotnet run
at all, because it keeps giving meArgumentOutOfRangeException
. However, it is successful to rundotnet build
thendotnet [path-to-dll]
ordotnet watch run
instead.The full error message:
I have tried reinstalled using SDK Installer, Visual Studio Installer, and binaries zip file. All gave me the same result.
So I decided to pull the branch
release/6.0.1xx
from this repository, and modified the methodTryGetTargetArchitecture
in filesrc\Cli\dotnet\commands\dotnet-run\RunCommand.cs
to add try&catch blocks as following to debug the behaviour of the command:Here is the result:
Oddly, it seems that
String.LastIndexOf
in my machine does not work as expected, and that cause it returns an incorrect character index.I don't know what in my machine breaks the
LastIndexOf
, but it would be better if we have a safer logic in this method to prevent the similar problem.Further technical details
dotnet --info
The text was updated successfully, but these errors were encountered: