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

build/test issues on WSL #18258

Closed
25 tasks done
ericeil opened this issue Aug 22, 2016 · 39 comments · Fixed by #53526
Closed
25 tasks done

build/test issues on WSL #18258

ericeil opened this issue Aug 22, 2016 · 39 comments · Fixed by #53526
Labels
area-System.Net enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors os-windows-wsl WSL (Windows Subsystem for Linux) OS - Linux binaries running on Windows
Milestone

Comments

@ericeil
Copy link
Contributor

ericeil commented Aug 22, 2016

Tracking current issues blocking CoreFx testing on Ubuntu on Windows:

(Note that basically nothing works prior to rs_preview build 14905, which introduced "restartable syscall" support.)

rs_preview build 14936 has a known bug that causes a BSOD when running our networking tests.

Still need investigation:

  • NuGet package restore occasionally hangs. Killing it and retrying usually gets past this.
  • Intermittent hangs in System.Net.Http tests.
@ericeil ericeil self-assigned this Aug 22, 2016
@ericeil ericeil removed their assignment Nov 3, 2016
@danmoseley
Copy link
Member

Complete support for bash on windows is not a 2.0 goal

@tarekgh
Copy link
Member

tarekgh commented Mar 2, 2017

marked as test bug as the failures we currently have are in tests. the other issues are external to WSL

@joshfree joshfree self-assigned this Dec 7, 2017
@ViktorHofer
Copy link
Member

51 tests are currently failing in WSL 1803. Attached the logs as txt.

/home/vihofer/corefx/Tools/tests.targets(588,5): warning :    System.IO.FileSystem.Tests  Total: 4027, Errors: 0, Failed: 11, Skipped: 15, Time: 146.386s [/home/vihofer/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning MSB3073: The command "/home/vihofer/corefx/bin/tests/System.IO.FileSystem.Tests/netcoreapp-Linux-Debug-x64/RunTests.sh /home/vihofer/corefx/bin/testhost/netcoreapp-Linux-Debug-x64/" exited with code 1. [/home/vihofer/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning :    System.IO.Pipes.Tests  Total: 507, Errors: 0, Failed: 6, Skipped: 0, Time: 13.152s [/home/vihofer/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning MSB3073: The command "/home/vihofer/corefx/bin/tests/System.IO.Pipes.Tests/netcoreapp-Linux-Debug-x64/RunTests.sh /home/vihofer/corefx/bin/testhost/netcoreapp-Linux-Debug-x64/" exited with code 1. [/home/vihofer/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning :    System.Net.Http.Unit.Tests  Total: 1626, Errors: 0, Failed: 17, Skipped: 0, Time: 114.423s [/home/vihofer/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning MSB3073: The command "/home/vihofer/corefx/bin/tests/System.Net.Http.Unit.Tests/netcoreapp-Linux-Debug-x64/RunTests.sh /home/vihofer/corefx/bin/testhost/netcoreapp-Linux-Debug-x64/" exited with code 1. [/home/vihofer/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning :    System.Net.Sockets.Tests  Total: 798, Errors: 0, Failed: 17, Skipped: 8, Time: 29.163s [/home/vihofer/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(588,5): warning MSB3073: The command "/home/vihofer/corefx/bin/tests/System.Net.Sockets.Tests/netcoreapp-Linux-Debug-x64/RunTests.sh /home/vihofer/corefx/bin/testhost/netcoreapp-Linux-Debug-x64/" exited with code 1. [/home/vihofer/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(596,5): error : One or more tests failed while running tests from 'System.IO.FileSystem.Tests' please check /home/vihofer/corefx/bin/tests/System.IO.FileSystem.Tests/netcoreapp-Linux-Debug-x64/testResults.xml for details! [/home/vihofer/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(596,5): error : One or more tests failed while running tests from 'System.IO.Pipes.Tests' please check /home/vihofer/corefx/bin/tests/System.IO.Pipes.Tests/netcoreapp-Linux-Debug-x64/testResults.xml for details! [/home/vihofer/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(596,5): error : One or more tests failed while running tests from 'System.Net.Http.Unit.Tests' please check /home/vihofer/corefx/bin/tests/System.Net.Http.Unit.Tests/netcoreapp-Linux-Debug-x64/testResults.xml for details! [/home/vihofer/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj]
/home/vihofer/corefx/Tools/tests.targets(596,5): error : One or more tests failed while running tests from 'System.Net.Sockets.Tests' please check /home/vihofer/corefx/bin/tests/System.Net.Sockets.Tests/netcoreapp-Linux-Debug-x64/testResults.xml for details! [/home/vihofer/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj]
/home/vihofer/corefx/dir.traversal.targets(77,5): error : (No message specified) [/home/vihofer/corefx/src/tests.builds]    8 Warning(s)

System.Net.Http.Unit.Tests.txt
System.Net.Sockets.Tests.txt
System.IO.FileSystem.Tests.txt
System.IO.Pipes.Tests.txt

@ViktorHofer
Copy link
Member

ViktorHofer commented Sep 25, 2018

What is left to do here:

  1. Somebody should go through the remaining failures and either a) disable them, b) fix them if possible or c) create issues in the WSL repo and disable them temporarily with comments to the external tracking issues.
  2. Go through the existing disabled WSL tests and re-enable them as most of them have been fixed and even more of them will be fixed with the next iteration of Windows 10.
  3. Add WSL Ubuntu leg to CI that builds and tests. (cc @mmitche)

Marking as 3.0.

cc @joshfree @danmosemsft @Anipik

@danmoseley
Copy link
Member

Remaining list, I took out the GetSetTimes ones that @Anipik fixed.

System.IO.Pipes.Tests.NamedPipeTest_Simple_ServerIn_ClientOut.Unix_OperationsOnNamedServerWithDisposedClient
System.IO.Pipes.Tests.NamedPipeTest_Simple_ServerInOut_ClientIn.Unix_OperationsOnNamedServerWithDisposedClient
System.IO.Pipes.Tests.NamedPipeTest_Simple_ServerInOut_ClientOut.Unix_OperationsOnNamedServerWithDisposedClient
System.IO.Pipes.Tests.NamedPipeTest_Simple_ServerInOutRead_ClientInOutWrite.Unix_OperationsOnNamedServerWithDisposedClient
System.IO.Pipes.Tests.NamedPipeTest_Simple_ServerInOutWrite_ClientInOutRead.Unix_OperationsOnNamedServerWithDisposedClient
System.IO.Pipes.Tests.NamedPipeTest_Simple_ServerOut_ClientIn.Unix_OperationsOnNamedServerWithDisposedClient
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 0, firstLength: 10, secondPosition: 1, secondLength: 2)
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 3, firstLength: 5, secondPosition: 2, secondLength: 4)
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 3, firstLength: 5, secondPosition: 2, secondLength: 6)
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 3, firstLength: 5, secondPosition: 3, secondLength: 4)
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 3, firstLength: 5, secondPosition: 3, secondLength: 5)
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 3, firstLength: 5, secondPosition: 4, secondLength: 5)
System.IO.Tests.FileStream_LockUnlock.OverlappingRegionsFromOtherProcess_ThrowsException(fileLength: 10, firstPosition: 3, firstLength: 5, secondPosition: 4, secondLength: 6)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://127.0.0.1/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://128.0.0.1/\", shouldBypass: False)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://162.1.1.1/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://[2002::11]/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://[2607:f8B0:4005:80A::200E]/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://[2607:f8b0:4005:80a::200e]/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://[2a01:5b40:0:248::52]/\", shouldBypass: False)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://[::1]/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://bar.com/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://BAR.COM/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://bébé.eu/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://foo.com/\", shouldBypass: False)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://foo/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://localhost/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://www.bébé.eu/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://WWW.FOO.COM/\", shouldBypass: True)
System.Net.Http.Tests.HttpSystemProxyTest.HttpProxy_Local_Bypassed(name: \"http://www.foo.com/\", shouldBypass: True)
System.Net.Sockets.Tests.ExecutionContextFlowTest.SocketAsyncEventArgs_ExecutionContextFlowsAcrossSendAsyncOperation(suppressContext: True, sendMode: 2)
System.Net.Sockets.Tests.OSSupportTest.IOControl_SIOCATMARK_Unix_Success
System.Net.Sockets.Tests.SelectTest.Select_Error_OneReadyAtATime
System.Net.Sockets.Tests.SendReceive.ReceiveIovMaxUdp_SuccessOrMessageSize
System.Net.Sockets.Tests.SendReceive.SendIovMaxUdp_SuccessOrMessageSize
System.Net.Sockets.Tests.SendReceive.SocketSendWouldBlock_ReturnsBytesSent
System.Net.Sockets.Tests.SocketOptionNameTest.ExclusiveAddress_Default_Unix
System.Net.Sockets.Tests.SocketOptionNameTest.ExclusiveAddressUseTcp
System.Net.Sockets.Tests.SocketOptionNameTest.ReuseAddress(exclusiveAddressUse: null, firstSocketReuseAddress: True, secondSocketReuseAddress: True, expectFailure: False)
System.Net.Sockets.Tests.SocketOptionNameTest.SettingExclusiveAddress_SetsReuseAddress(value: 0)
System.Net.Sockets.Tests.SocketOptionNameTest.SettingExclusiveAddress_SetsReuseAddress(value: 1)
System.Net.Sockets.Tests.TcpClientTest.Roundtrip_ExclusiveAddressUse_GetEqualsSet_False
System.Net.Sockets.Tests.TcpClientTest.Roundtrip_ExclusiveAddressUse_GetEqualsSet_True
System.Net.Sockets.Tests.TcpListenerTest.Active_TrueWhileRunning(ctor: 0)
System.Net.Sockets.Tests.TcpListenerTest.Active_TrueWhileRunning(ctor: 1)
System.Net.Sockets.Tests.TcpListenerTest.Active_TrueWhileRunning(ctor: 2)
System.Net.Sockets.Tests.UdpClientTest.EnableBroadcast_Roundtrips

@danmoseley danmoseley changed the title build/test issues on Ubuntu on Windows build/test issues on WSL Jan 30, 2019
@ViktorHofer
Copy link
Member

Changing milestone to future. Would be great to get test failures to zero but not a high-prio.

@ViktorHofer
Copy link
Member

WSL2 runs on a fully supported Linux kernel which should behave like all other distros. I believe we don't need this work here anymore.

nit: we should remove the existing WSL conditions in source code.

@wfurt
Copy link
Member

wfurt commented Aug 20, 2019

We still have tests disabled agains this issue.
We should clean that up before closing this again.

@wfurt wfurt reopened this Aug 20, 2019
@ViktorHofer ViktorHofer reopened this Oct 21, 2019
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 5.0 milestone Jan 31, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@danmoseley
Copy link
Member

The remaining ones are all networking except 1. Moving to networking area. We'd welcome anyone who would like to take the attributes off and see which now pass in WSL2.

C:\git\runtime\src\libraries\Common\tests\System\Net\Http\HttpClientHandlerTest.cs:
 2544:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\Common\tests\System\Net\Http\HttpClientHandlerTest.Proxy.cs:
  223:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.HttpListener\tests\HttpResponseStreamTests.cs:
  458:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  498:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.NetworkInformation\tests\FunctionalTests\IPGlobalPropertiesTest.cs:
   30:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
   55:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
   81:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  112:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\ExecutionContextFlowTest.cs:
  339:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\OSSupport.cs:
   68:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\SelectTest.cs:
  181:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\SendReceive.cs:
 1199:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
 1240:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
 1312:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
 1341:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\SocketOptionNameTest.cs:
  384:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  396:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  420:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\TcpClientTest.cs:
  261:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  271:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\TcpListenerTest.cs:
   26:         [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Net.Sockets\tests\FunctionalTests\UdpClientTest.cs:
  286:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Private.Xml\tests\XmlReader\Tests\AsyncReaderLateInitTests.cs:
   90:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

C:\git\runtime\src\libraries\System.Text.Encoding\tests\Encoder\EncoderConvert2.cs:
  212:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  232:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
  254:         [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]

@danmoseley danmoseley added area-System.Net and removed area-Meta untriaged New issue has not been triaged by the area owner labels Feb 28, 2020
@bitcrazed
Copy link

@danmosemsft - do let @craigloewen-msft know if you need any assistance etc. from WSL

@danmoseley
Copy link
Member

It's @bitcrazed himself 😃

Sure, although I don't plan to look at this in the near future - these are just test failures, they may not be failing because of issues that would actually impact a customer.

These attributes were all added on WSL1. First task here is for a volunteer to just remove the attributes and see how many pass on WSL2.

@tarekgh
Copy link
Member

tarekgh commented Mar 1, 2020

@danmosemsft I'll try that with WSL2 during next week or so and will report what I find.

@tarekgh
Copy link
Member

tarekgh commented Mar 2, 2020

@danmosemsft looking at the method PlatformDetection.IsNotWindowsSubsystemForLinux used in the attribute, this method detect if we are running inside WSL by checking the content of the /proc/version

        private static bool GetIsWindowsSubsystemForLinux()
        {
            // https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
            if (IsLinux)
            {
                const string versionFile = "/proc/version";
                if (File.Exists(versionFile))
                {
                    string s = File.ReadAllText(versionFile);

                    if (s.Contains("Microsoft") || s.Contains("WSL"))
                    {
                        return true;
                    }
                }
            }

            return false;
        }

on WSL2 (Ubuntu 18.04), I am seeing the content of the file is

Linux version 4.19.84-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Nov 13 11:44:37 UTC 2019

Which will make the detection always fail. note that String.Contains is case sensitive, which means "Microsoft" will not equal "microsoft".

in another word, setting the attribute will have the same effect as removing it when running on WSL2.

@danmoseley
Copy link
Member

@tarekgh I guess we need to decide whether we want to have a separate condition for WSL1 vs WSL2. It would be nice if tests run clean on both but WSL2 is more interesting I think.

@tarekgh
Copy link
Member

tarekgh commented Mar 2, 2020

I ran all the tests and looks they are passing. I didn't remove the attributes manually because is not really affecting the run and I am not seeing any test skipped because of this attribute.

I am seeing the run of some of the networking tests (e.g. System.Net.Http.Functional.Tests) has skipped many tests because we are not running stress mode.

@wfurt
Copy link
Member

wfurt commented Mar 3, 2020

I don't think we need to build on or for WSL1. We shall triage bug reports from official releases and prioritize them accordingly. (and the priority may be low)

@ManickaP
Copy link
Member

ManickaP commented Mar 3, 2020

Yep, WSL2 is not considered as "WSL" in our tests (the conditional attribute is not hit and these tests are executed). AFAIK, we don't have any tests disabled against it, the list above is for WSL1.

We have also already decided in some issues that we're not making changes just to support WSL1 (e.g. #26730)

Lastly, WSL2 is not without its issues, e.g. microsoft/WSL#4322 hit in here #687

@danmoseley
Copy link
Member

If the goal is simply "make sure developers working on our libraries can get a clean test run on WSL2" then if I understand @tarekgh correctly, there is nothing to do, except remove the attributes (purely for tidiness)

@tarekgh
Copy link
Member

tarekgh commented Mar 3, 2020

if I understand @tarekgh correctly, there is nothing to do, except remove the attributes (purely for tidiness)

Right, in addition to closing all WSL1 issues. I don't know if there are any specific build/test scripts handle WSL1 though. @ViktorHofer may know better about that.

@ViktorHofer
Copy link
Member

No there's is no infra related to WSL1 except the PlatformDetection.IsWindowsSubsystem property. FWIW I think Santi did some networking work in the past specifically for WSL1 in the product.

@ManickaP
Copy link
Member

ManickaP commented Mar 3, 2020

@danmosemsft I'd personally keep the attributes until WSL2 is officially out. If you get rid of them now, the only thing it will do is to make test failing on WSL1. We're not running them anywhere, it's just for people working on WSL1, who usually do not want to do Insider Preview. And we might see some issues pop up due to it.

Though we should be clear on not supporting WSL1 and decide to what extent we will support WSL2 and be unified in this towards community.

@danmoseley
Copy link
Member

Either seems reasonable

@wfurt
Copy link
Member

wfurt commented Mar 3, 2020

I'm wondering if it would make sense to update the name to *1 for clarity as well as add some explicit notes to building instructions to avoid wasted time for people who may try on WSL1 ... and fail.

@ManickaP
Copy link
Member

ManickaP commented Mar 3, 2020

@wfurt That's actually a great idea. We might need detection for WSL2 in the future and this would make it easier and more clear.

@tarekgh
Copy link
Member

tarekgh commented Mar 3, 2020

I think we don't want this detection. users can run wsl -l -v and that will give them the needed information. We'll need the detection if we need to special-case WSL2 code which I think we'll not need it. the detection should be easy to write though.

@ViktorHofer
Copy link
Member

ViktorHofer commented Mar 3, 2020

Sure we could do that or what I prefer, wait another month until Win10 2004 is released and remove the property and all the attributes with it.

@ManickaP
Copy link
Member

ManickaP commented Mar 4, 2020

So let's wait for official WSL2 rollout, then get rid of the PlatformDetection.IsNotWindowsSubsystemForLinux and if any issues for WSL1 pops up afterwards, we'll steer the users to use WSL2.

@karelz karelz modified the milestones: 5.0, Future May 6, 2020
@geoffkizer
Copy link
Contributor

WSL2 is generally available now, right? Should we address this issue now?

There are a bunch of tests in System.Net.Sockets that are disabled via IsNotWindowsSubsystemForLinux; I'm concerned that I'm missing test coverage when I develop with WSL2.

@ViktorHofer
Copy link
Member

There are a bunch of tests in System.Net.Sockets that are disabled via IsNotWindowsSubsystemForLinux; I'm concerned that I'm missing test coverage when I develop with WSL2.

Those conditions don't apply on WSL2 anyway so it shouldn't be a concern but as we don't support WSL1 officially we should just get rid off them.

@geoffkizer
Copy link
Contributor

Those conditions don't apply on WSL2 anyway so it shouldn't be a concern

I'm running WSL2 and I saw that these tests were skipped. So it looks to me like the conditions apply to WSL2 as well.

@wfurt
Copy link
Member

wfurt commented May 31, 2021

private static bool GetIsWindowsSubsystemForLinux()
{
// https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
if (IsLinux)
{
const string versionFile = "/proc/version";
if (File.Exists(versionFile))
{
string s = File.ReadAllText(versionFile);
if (s.Contains("Microsoft") || s.Contains("WSL"))
{
return true;
}

This could possibly misfire for Azure cloud linux https://en.wikipedia.org/wiki/CBL-Mariner

My suggestion would be to either bound WindowsSubsystemForLinux to WSL1 or simply remove it completely and live with fact that some tests would fail on WSL1

@ViktorHofer
Copy link
Member

We don't support WSL1 both from an infra and product code perspective and should just remove these attributes entirely.

@ViktorHofer
Copy link
Member

So here's the proc/version string on my Ubuntu WSL2 instance: Linux version 5.10.16.3-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Fri Apr 2 22:23:49 UTC 2021.

The condition applies to WSL2 as well because the code checks for "WSL". I will submit a PR to remove this check and the attributes entirely.

ViktorHofer added a commit to ViktorHofer/runtime that referenced this issue Jun 1, 2021
WSL1 isn't a supported build or execution environment for dotnet/runtime.
Because of that removing the checks and platform detection for it as
that code path isn't necessary for WSL2 anymore as it contains a fully
featured kernel which behaves just a like a usual Linux distro.

Fixes dotnet#18258
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 1, 2021
@ghost ghost closed this as completed in #53526 Jun 1, 2021
ghost pushed a commit that referenced this issue Jun 1, 2021
WSL1 isn't a supported build or execution environment for dotnet/runtime.
Because of that removing the checks and platform detection for it as
that code path isn't necessary for WSL2 anymore as it contains a fully
featured kernel which behaves just a like a usual Linux distro.

Fixes #18258
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 1, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 1, 2021
@karelz karelz modified the milestones: Future, 6.0.0 Jul 15, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors os-windows-wsl WSL (Windows Subsystem for Linux) OS - Linux binaries running on Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.