Skip to content

--langversion parser is culture-dependent #7757

@ForNeVeR

Description

@ForNeVeR

Repro steps

  1. Create a new F# project: dotnet new console -lang F#

  2. Add <LangVersion> to the project:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp3.0</TargetFramework>
        <LangVersion>4.7</LangVersion>
      </PropertyGroup>
      <ItemGroup>
        <Compile Include="Program.fs" />
      </ItemGroup>
    </Project>
  3. Now, try to build the project:

    $ dotnet build
    Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      Restore completed in 26,26 ms for T:\Temp\fsproj\fsproj.fsproj.
    FSC : error FS0246: Unrecognized value '4.7' for --langversion use --langversion:? for complete list [T:\Temp\fsproj\fsproj.fsproj]
    

It seems to be linked with my machine's Russian culture (which uses decimal comma instead of decimal point).

Known workarounds

Use <LangVersion>4,7</LangVersion> (yes, with a comma!) — but please never do that, it's totally not portable

Additional info

It's not a dotnet build issue, the same happens if I directly invoke dotnet fsc.exe:

$ cd "C:\Program Files\dotnet\sdk\3.0.100\FSharp"
$ dotnet fsc.exe --langversion:4.7

error FS0246: Unrecognized value '4.7' for --langversion use --langversion:? for complete list

$ dotnet fsc.exe --langversion:4,7
Microsoft (R) F# Compiler version 10.6.0.0 for F# 4.7
Copyright (c) Microsoft Corporation. All Rights Reserved.

error FS0207: No inputs specified

Related information

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions