Skip to content

Import-Module 7.6.0 and 7.6.1 throws error in disconnected environments #466

@PeterLefebvre

Description

@PeterLefebvre

Steps to reproduce

Get-NetAdapter Ethernet | ft Name, Status
test-connection github.com -count 1 | ft Address, IPV4Address, ReplySize, ResponseTime

Get-NetAdapter Ethernet | Disable-NetAdapter -Confirm:$false
start-sleep -Seconds 10
Get-NetAdapter Ethernet | ft Name, Status
test-connection github.com -count 1 | ft Address, IPV4Address, ReplySize, ResponseTime

get-module vsteam | ft
import-module vsteam -RequiredVersion 7.6.1 
(get-vsteaminfo).ModuleVersion | ft
remove-module vsteam 

get-module vsteam | ft
import-module vsteam -RequiredVersion 7.6.0
(get-vsteaminfo).ModuleVersion  | ft
remove-module vsteam 

Expected behavior

I expected that...

in disconnected environments, the import-module does not fail.

Actual behavior?

I had the following actual outcome...

==> for 7.6.1
Exception calling "Send" with "2" argument(s): "An exception occurred during a Ping request."
At D:\Users\XXX\Documents\WindowsPowerShell\Modules\vsteam\7.6.1\vsteam.functions.ps1:1050 char:4
+    [System.Net.NetworkInformation.PingReply]$reply = $pingGh.Send('gi ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PingException
 
Exception calling "Send" with "2" argument(s): "An exception occurred during a Ping request."
At D:\Users\XXX\Documents\WindowsPowerShell\Modules\vsteam\7.6.1\vsteam.functions.ps1:1050 char:4
+    [System.Net.NetworkInformation.PingReply]$reply = $pingGh.Send('gi ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PingException


==> For 7.6.0
Exception calling "Send" with "2" argument(s): "An exception occurred during a Ping request."
At D:\Users\XXX\Documents\WindowsPowerShell\Modules\vsteam\7.6.0\vsteam.functions.ps1:1050 char:4
+    [System.Net.NetworkInformation.PingReply]$reply = $pingGh.Send('gi ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PingException
 
Exception calling "Send" with "2" argument(s): "An exception occurred during a Ping request."
At D:\Users\XXX\Documents\WindowsPowerShell\Modules\vsteam\7.6.0\vsteam.functions.ps1:1050 char:4
+    [System.Net.NetworkInformation.PingReply]$reply = $pingGh.Send('gi ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PingException

I encountered this first at work, as we have a rather restricted environment.
Ping and test-connection to github.com gets blocked or the DNS cannot be resolved correctly.
Using a Browser I can go to github.com, but we pass a forced proxy.

In 'interactive mode', I can ignore the errors, but when running in a CI/CD pipeline, I fear this could be problematic.

Have not seen this behaviour yet in versions below 7.6.0.

PS: Above steps to reproduce is from my home workstation, where I just simulated the behaviour with a disabled network adapter.

On Which OS have you tried it?

Windows

What was your server version?

other (specify)

Other server version

not even connected to server yet, error message thrown at import

Log output of used API

N/A yet, during import-module

Log output of $PSVersionTable

Name                           Value                                                                                                                                                                                     
----                           -----                                                                                                                                                                                     
PSVersion                      5.1.19041.1320                                                                                                                                                                            
PSEdition                      Desktop                                                                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                   
BuildVersion                   10.0.19041.1320                                                                                                                                                                           
CLRVersion                     4.0.30319.42000                                                                                                                                                                           
WSManStackVersion              3.0                                                                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                                                                       
SerializationVersion           1.1.0.1

Metadata

Metadata

Labels

bugwhen a bug has been identified or filed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions