Skip to content

Test-Connection.Tests.ps1 - Ping Fake host fails due to different InnerException.ErrorCode on Centos7 #7590

Closed

Description

On non-Windows, 'Ping Fake host' expects an error code of 6 in the error.Exception.InnerException.ErrorCode. On CentOS, the ErrorCode is 11 (Resource temporarily unavailable).

Steps to reproduce

Start-PSPester -Path ./test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1

Expected behavior

All Tests pass.

Actual behavior

The InnerException reports ErrorCode 11 when 6 was expected.

PSMessageDetails      :
Exception             : System.Net.NetworkInformation.PingException: Testing connection to computer 'fakeHost' failed: Cannot resolve
                        the target name. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Resource temporarily
                        unavailable
                           at System.Net.Dns.InternalGetHostByName(String hostName)
                           at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
                           at Microsoft.PowerShell.Commands.TestConnectionCommand.InitProcessPing(String targetNameOrAddress, String&
                        resolvedTargetName, IPAddress& targetAddress) in /home/dantra/powershell/src/Microsoft.PowerShell.Commands.Manag
                        ement/commands/management/TestConnectionCommand.cs:line 835
                           --- End of inner exception stack trace ---
TargetObject          : fakeHost
CategoryInfo          : ResourceUnavailable: (fakeHost:String) [Test-Connection], PingException
FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

InnerException:

Message         : Resource temporarily unavailable
SocketErrorCode : TryAgain
ErrorCode       : 11
NativeErrorCode : 11
Data            : {}
InnerException  :
TargetSite      : System.Net.IPHostEntry InternalGetHostByName(System.String)
StackTrace      :    at System.Net.Dns.InternalGetHostByName(String hostName)
                     at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
                     at Microsoft.PowerShell.Commands.TestConnectionCommand.InitProcessPing(String targetNameOrAddress, String&
                  resolvedTargetName, IPAddress& targetAddress) in /home/dantra/powershell/src/Microsoft.PowerShell.Commands.Management/
                  commands/management/TestConnectionCommand.cs:line 835
HelpLink        :
Source          : System.Net.NameResolution
HResult         : 1

Activity

  1. iSazonov commented on Aug 22, 2018

    @iSazonov
    Collaborator

    Dan Travison (@dantraMSFT) The API have unpredictable behavior on Unixes. I opened a issue https://github.com/dotnet/corefx/issues/28934 without progress.

  2. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  3. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  4. added
    Resolution-No Activity
    on Nov 16, 2023
  5. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release-TestingResolution-No ActivityWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions