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

Discrepancy between Ubuntu and Windows when converting negative numbers to string #28473

ppekrol opened this Issue Mar 26, 2018 · 1 comment


None yet
2 participants
Copy link

ppekrol commented Mar 26, 2018


Product Information:
 Version:            2.1.103
 Commit SHA-1 hash:  60218cecb5

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

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.6
  Build    : 74b1c703813c8910df5b96f304b0f2b78cdf194d


Product Information:
 Version:            2.1.102
 Commit SHA-1 hash:  8d409357db
Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.102/
Microsoft .NET Core Shared Framework Host
  Version  : 2.0.6
  Build    : 74b1c703813c8910df5b96f304b0f2b78cdf194d


        public void ShouldPass()
            long number = -1L;
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-US");
            var s1 = number.ToString();
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("sv-SE");
            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("sv-SE");
            var s2 = number.ToString();
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
            Assert.Equal(s1, s2);

On Windows everything is fine, but on Ubuntu I'm getting:

Assert.Equal() Failure
          ↓ (pos 0)
Expected: -1
Actual:   −1
          ↑ (pos 0)
   at SlowTests.Tests.Spatial.SpatialTest.T1() in /home/ppekrol/Workspaces/ravendb/test/SlowTests/Tests/Spatial/Spatial.cs:line 279

Also when '−1' is used as a header to 'Kestrel' the response status code is set to 400, but this might be expected, because this is a special character?


This comment has been minimized.

Copy link

ppekrol commented Mar 26, 2018

Found dotnet/coreclr#1734

@ppekrol ppekrol closed this Mar 26, 2018

@karelz karelz added this to the 2.1.0 milestone Mar 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment