fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

--preferreduilang appears in fsi.CommandLineArgs when run from Msbuild and .NET 10 SDK

Open glen-nicol opened this issue 1 month ago • 3 comments

Repro steps

Provide the steps required to reproduce the problem:

  1. Build the attached FsiBugRepo.csproj from VS 22 or 26. Notice erroneous--preferreduilang:en-US in the output from the fsx script
  2. Run the dotnet fsi fsi_test.fsx from the command line. Notice absence of option. Correct
  3. Switch the SDK to the .NET 8 SDK and rebuild from VS. Notice absence of option. Correct.

FsiBugRepo.zip

Expected behavior

No additional command line args present in fsi.CommandLineArgs variable.

Actual behavior

presence of --preferreduilang:en-US where it shouldn't be

Known workarounds

None except to ignore the extra option.

Related information

  • Operating system
  • Windows 11
  • VS 2026 18.1, VS 22 17.14.22
  • .NET 10.0.101, .NET 8.0.319

glen-nicol avatar Dec 10 '25 18:12 glen-nicol

This is attached by the VisualStudio integration into the VS project system, to automatically set the right locale for users.

That way, localized error messages get applied when used on OS with a different culture. Right now I cannot think of a mechanism to change that without breaking other users.

Changing the script logic to work with that is likely the best option.

T-Gro avatar Dec 11 '25 10:12 T-Gro

Shouldn't that argument be applied before the -- to properly set the compiler setting for the fsi rather than passed to the script that is run by fsi? Is there handling in the generated entry point of a fsx that uses that argument?

glen-nicol avatar Dec 11 '25 16:12 glen-nicol

Ok now I understand the desired change. Yes, that is true.

T-Gro avatar Dec 11 '25 17:12 T-Gro