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

System.Net.NetworkInformation.Functional.Tests fail on iOS #36890

Closed
mdh1418 opened this issue May 22, 2020 · 6 comments · Fixed by #57096
Closed

System.Net.NetworkInformation.Functional.Tests fail on iOS #36890

mdh1418 opened this issue May 22, 2020 · 6 comments · Fixed by #57096
Milestone

Comments

@mdh1418
Copy link
Member

mdh1418 commented May 22, 2020

System.Net.NetworkInformation.Functional.Tests

System.Net.NetworkInformation.Functional.Tests.dll Failed: 6
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpActiveConnections_Succeed(address: 127.0.0.1)
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpActiveConnections_Succeed(address: ::1)
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_AccessAllMethods_NoErrors
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpListeners_Succeed(address: 127.0.0.1)
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpListeners_Succeed(address: ::1)
System.Net.NetworkInformation.Tests.NetworkInterfaceBasicTest.BasicTest_GetIsNetworkAvailable_Success

System.Net.NetworkInformation.Functional.Tests.dll   Failed: 6

Test collection for System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpActiveConnections_Succeed(address: 127.0.0.1)
    Assert.True() Failure\nExpected: True\nActual:   False
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpActiveConnections_Succeed(address: ::1)
    Assert.True() Failure\nExpected: True\nActual:   False
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_AccessAllMethods_NoErrors
    System.Net.NetworkInformation.NetworkInformationException : An error was encountered while querying information from the operating system.
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpListeners_Succeed(address: 127.0.0.1)
    Assert.True() Failure\nExpected: True\nActual:   False
System.Net.NetworkInformation.Tests.IPGlobalPropertiesTest.IPGlobalProperties_TcpListeners_Succeed(address: ::1)
    Assert.True() Failure\nExpected: True\nActual:   False

Test collection for System.Net.NetworkInformation.Tests.NetworkInterfaceBasicTest
System.Net.NetworkInformation.Tests.NetworkInterfaceBasicTest.BasicTest_GetIsNetworkAvailable_Success
    Assert.True() Failure\nExpected: True\nActual:   False
@ghost
Copy link

ghost commented May 22, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label May 22, 2020
@wfurt
Copy link
Member

wfurt commented May 22, 2020

At least some seems to be build problem.

      <test name="System.Net.Http.Json.Functional.Tests.HttpContentJsonExtensionsTests.TestValidMediaTypes(mediaType: \&quot;application/json\&quot;)" type="System.Net.Http.Json.Functional.Tests.HttpContentJsonExtensionsTests" method="TestValidMediaTypes" time="0.0555735" result="Fail">
        <failure exception-type="System.DllNotFoundException">
          <message><![CDATA[System.DllNotFoundException : System.Security.Cryptography.Native.OpenSsl assembly:<unknown assembly> type:<unknown type> member:(null)]]></message>
          <stack-trace><![CDATA[   at System.PlatformDetection.GetOpenSslVersion() in /Users/mdhwang/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs:line 118
   at System.PlatformDetection.get_OpenSslVersion() in /Users/mdhwang/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs:line 53
   at System.PlatformDetection.get_SupportsAlpn() in /Users/mdhwang/runtime/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs:line 112
   at System.Net.Test.Common.GenericLoopbackOptions..ctor() in /Users/mdhwang/runtime/src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs:line 87
   at System.Net.Test.Common.LoopbackServer.Options..ctor() in /Users/mdhwang/runtime/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs:line 393
   at System.Net.Test.Common.LoopbackServer..ctor(Options options) in /Users/mdhwang/runtime/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs:line 25
   at System.Net.Test.Common.LoopbackServer.CreateServerAsync(Func`2 funcAsync, Options options) in /Users/mdhwang/runtime/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs:line 65
   at System.Net.Http.Json.Functional.Tests.HttpContentJsonExtensionsTests.TestValidMediaTypes(String mediaType) in /Users/mdhwang/runtime/src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpContentJsonExtensionsTests.cs:line 241
--- End of stack trace from previous location ---]]></stack-trace>
        </failure>
      </test>

Do you know what OS iOS claims to be @mdh1418 ? We should perhaps update the OS detection helpers.

@wfurt
Copy link
Member

wfurt commented May 24, 2020

        <failure exception-type="System.IO.DirectoryNotFoundException">
          <message><![CDATA[System.IO.DirectoryNotFoundException : Could not find a part of the path '/Users/mdhwang/Library/Developer/CoreSimulator/Devices/AB8A2904-AD12-4CCD-9072-445DC2401264/data/Containers/Bundle/Application/52E908FC-77EF-4EBB-8B73-EC927C0172CC/System.Net.NetworkInformation.Functional.Tests.app/NetworkFiles/snmp6'.]]></message>
          <stack-trace><![CDATA[   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter) in /Users/mdhwang/runtime/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs:line 23
   at Interop.CheckIo(Error error, String path, Boolean isDirectory, Func`2 errorRewriter) in /Users/mdhwang/runtime/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs:line 30
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) in /Users/mdhwang/runtime/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs:line 56
   at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options) in /Users/mdhwang/runtime/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.Unix.cs:line 61
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) in /Users/mdhwang/runtime/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs:line 241
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) in /Users/mdhwang/runtime/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs:line 216
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) in /Users/mdhwang/runtime/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs:line 201
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks) in /Users/mdhwang/runtime/src/libraries/System.Private.CoreLib/src/System/IO/StreamReader.cs:line 196
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at System.Net.NetworkInformation.Tests.FileUtil.NormalizeLineEndings(String source, String normalizedDest) in /Users/mdhwang/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/FileUtil.cs:line 17
   at System.Net.NetworkInformation.Tests.StatisticsParsingTests.Udpv6GlobalStatisticsParsing() in /Users/mdhwang/runtime/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/StatisticsParsingTests.cs:line 129
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /Users/mdhwang/runtime/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 359]]></stack-trace>
        </failure>
      </test>

This suggest that either we did not copy the supporting file to the device or GetTestFilePath() from TestUtilities returns wrong location. I don't know if there is some good way to triage it @mandel-macaque but that does not look like networking issue.

@wfurt
Copy link
Member

wfurt commented May 24, 2020

All the failing mail tests are unicode. Most likely related to #33654 and #33652.

@marek-safar marek-safar added this to the 6.0.0 milestone Jun 24, 2020
@marek-safar marek-safar removed the untriaged New issue has not been triaged by the area owner label Jun 24, 2020
@mdh1418 mdh1418 changed the title System.Net tests fail on iOS System.Net.NetworkInformation.Functional.Tests fail on iOS May 3, 2021
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels May 4, 2021
@mdh1418
Copy link
Member Author

mdh1418 commented May 7, 2021

Updated based on 98ac232

@filipnavara
Copy link
Member

filipnavara commented May 24, 2021

The header file netinet/ip_var.h is missing in iOS SDK. This in turn causes HAVE_NETINET_IP_VAR_H not to be defined and the SystemNative_GetIPv4GlobalStatistics method becomes no-op. I believe the functionality exists on iOS and that someone already filed a bug report about the missing header files.

Similarly, netinet/udp_var.h is missing. Curiously netinet/tcp_var.h exists.

steveisok pushed a commit to steveisok/runtime that referenced this issue Aug 9, 2021
…vailable methods return the correct info

This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.

- GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException.

- GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown.

- GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback.

- NetworkInterface.GetIsNetworkAvailable no longer returns false for every call.

The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK.  This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build.

Fixes dotnet#36890
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 9, 2021
@marek-safar marek-safar modified the milestones: 6.0.0, 7.0.0 Aug 27, 2021
steveisok added a commit that referenced this issue Sep 16, 2021
…vailable methods return the correct info (#57096)

This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.

GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException.

GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown.

GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback.

NetworkInterface.GetIsNetworkAvailable no longer returns false for every call.

The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK. This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build.

Fixes #36890
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 16, 2021
github-actions bot pushed a commit that referenced this issue Sep 16, 2021
…vailable methods return the correct info

This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.

- GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException.

- GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown.

- GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback.

- NetworkInterface.GetIsNetworkAvailable no longer returns false for every call.

The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK.  This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build.

Fixes #36890
github-actions bot pushed a commit that referenced this issue Sep 17, 2021
…vailable methods return the correct info

This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.

- GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException.

- GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown.

- GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback.

- NetworkInterface.GetIsNetworkAvailable no longer returns false for every call.

The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK.  This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build.

Fixes #36890
steveisok pushed a commit that referenced this issue Sep 21, 2021
…face.GetIsNetworkAvailable methods return the correct info (#59258)

Backport of #57096

This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.

GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException.

GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown.

GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback.

NetworkInterface.GetIsNetworkAvailable no longer returns false for every call.

The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK. This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build.

Fixes #36890
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants