Skip to content

[Bug]: Numeric comparison uses current culture #9757

@akoeplinger

Description

@akoeplinger

Issue Description

We hit this in dotnet/runtime#98550 where a numeric comparison fails in the fi_FI culture because it uses U+2212 : MINUS SIGN instead of - for negative numbers.

I'm not sure whether this is intentional or a bug.

Steps to Reproduce

<Project>

  <PropertyGroup>
    <_value>$([MSBuild]::Subtract(0, 1))</_value>
    <_otherValue Condition="'$(_value)' &gt; -1">true</_otherValue>
  </PropertyGroup>

  <Target Name="Build" />
</Project>

Expected Behavior

No error.

Actual Behavior

$ LANG=fi_FI dotnet msbuild culture.proj
MSBuild version 17.10.0-preview-24101-01+07fd5d51f for .NET
  culture failed with errors (0,0s)
    /Users/alexander/dev/test/culture.proj(5,18): error MSB4086: A numeric comparison was attempted on "$(_value)" that evaluates to "−1" instead of a number, in condition "'$(_value)' > -1". [/Users/alexander/dev/test/culture.proj]

Note that the "−1" in the error message uses U+2212 : MINUS SIGN

Analysis

No response

Versions & Configurations

Fails with both 8.0.100 and 9.0.100 P1 dotnet SDKs.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions