-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Milestone
Description
I'm enabling Server Core 20H1 libraries test runs and this test failed with:
Assert.Equal() Failure
Expected: 65001
Actual: 437
at System.Diagnostics.Tests.ProcessStandardConsoleTests.<TestChangesInConsoleEncoding>b__1_0(Int32 expectedCodePage) in /_/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs:line 26
at System.Diagnostics.Tests.ProcessStandardConsoleTests.TestChangesInConsoleEncoding() in /_/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs:line 51
I noted that we have the following comment that for Nano we only support UTF-8 which is 65001 code page:
runtime/src/libraries/System.Diagnostics.Process/tests/ProcessStandardConsoleTests.cs
Line 45 in efafca9
| // Don't test this on Windows Nano, Windows Nano only supports UTF8. |
I went ahead and created a console app:
class Program
{
static void Main(string[] args)
{
Console.WriteLine($"CP: {GetConsoleCP()}");
Console.WriteLine($"Setting CP 437: {SetConsoleCP(437)}");
Console.WriteLine($"CP: {GetConsoleCP()}");
Console.WriteLine($"Setting CP to 65001: {SetConsoleCP(65001)}");
Console.WriteLine($"CP: {GetConsoleCP()}");
}
[DllImport("kernel32.dll")]
internal static extern int SetConsoleCP(int codePage);
[DllImport("kernel32.dll")]
internal static extern int GetConsoleCP();
}Output was:
C:\Work\test>tmpTestCodePageServer.exe
CP: 65001
Setting CP 437: 1
CP: 437
Setting CP to 65001: 1
CP: 65001
I ran this on both a Nano and a Server container and got the same results:
mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-amd64-20200904200251-272704c
mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
cc: @ericstj @danmosemsft @jkotas @adamsitnik @eiriktsarpalis
Reactions are currently unavailable