Skip to content
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 #25626

Closed
ppekrol opened this issue Mar 26, 2018 · 1 comment
Milestone

Comments

@ppekrol
Copy link

ppekrol commented Mar 26, 2018

Windows:

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

Ubuntu:

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

Test:

        [Fact]
        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?

@ppekrol
Copy link
Author

ppekrol commented Mar 26, 2018

Found https://github.com/dotnet/coreclr/issues/1734
Closing...

@ppekrol ppekrol closed this as completed Mar 26, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants