runtime: .NET 5 RC1 breaks string CompareTo

Description

Run this code:

using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            // The quotes are required for this repro
            var string1 = "'delegate'";
            var string2 = "'delegate sub'";
            Console.WriteLine(string1.CompareTo(string2));
        }
    }
}

On .NET 5 P7 and .NET 472, it prints -1. On .NET 5 RC1, it prints 1. This is preventing Roslyn from updating to a new version.

Configuration

.NET 5 RC1

Regression?

From .NET 5 P7

I’m not entirely sure if this was a regression in P8 or RC1: the Roslyn move to P8 has been delayed by other issues we’ve been working through.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

This seems related with the use of ICU. Configuring the runtime to use NLS fixes the issue:

❯ $env:DOTNET_SYSTEM_GLOBALIZATION_USENLS
true
gotos@SURFACEBOOK  ~\source\repos\icurepro                                                                   [10:38]
❯ dotnet run
-1
gotos@SURFACEBOOK  ~\source\repos\icurepro                                                                   [10:38]
❯ $env:DOTNET_SYSTEM_GLOBALIZATION_USENLS = "false"
gotos@SURFACEBOOK  ~\source\repos\icurepro                                                                   [10:38]
❯ dotnet run
1

(Windows 10 Education Insiders, Build 20211, ko-KR)