dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.9k stars 4.01k forks source link

Incorrect date format in ExpressionEvaluator.UnitTests.ExpansionTests.Primitives #21944

Open gafter opened 7 years ago

gafter commented 7 years ago

The test contains the code

            using (new CultureContext("en-US"))
            {
                Verify(FormatResult("new DateTime()", CreateDkmClrValue(new DateTime())), EvalResult("new DateTime()", "{1/1/0001 12:00:00 AM}", "System.DateTime", "new DateTime()", DkmEvaluationResultFlags.Expandable));
            }

But this program

        CultureInfo.CurrentCulture = new CultureInfo("en-US");
        var s = $"{new DateTime()}";
        Console.WriteLine(s);

Prints 0001-01-01 12:00:00 AM

This causes the test to fail.

EddTheGeek commented 7 years ago

I'll take a look at this now.