Closed
Description
Steps to reproduce
This fault is intermittent and causes me most trouble when it occurs on AppVeyor.
$debugPreference = 'continue'
Invoke-ScriptAnalyzer -Path .\path\to\psm1.psm1 -Verbose
Expected behavior
Script analyzer completes with no errors, there are none in the code I'm testing.
Actual behavior
Script analyzer hangs before or during the PSShouldProcess rule.
2|PS> $debugPreference = 'continue'
3|PS> Invoke-ScriptAnalyzer -Path .\path\to\psm1.psm1 -Verbose
...
VERBOSE: Analyzing file: C:\Development\path\to\psm1.psm1
VERBOSE: Running PSAvoidDefaultValueSwitchParameter rule.
VERBOSE: Running PSAvoidGlobalAliases rule.
VERBOSE: Running PSAvoidDefaultValueForMandatoryParameter rule.
VERBOSE: Running PSAvoidUsingEmptyCatchBlock rule.
VERBOSE: Running PSAvoidGlobalFunctions rule.
VERBOSE: Running PSAvoidGlobalVars rule.
VERBOSE: Running PSAvoidInvokingEmptyMembers rule.
VERBOSE: Running PSAvoidAssignmentToAutomaticVariable rule.
VERBOSE: Running PSAvoidNullOrEmptyHelpMessageAttribute rule.
VERBOSE: Running PSReservedParams rule.
VERBOSE: Running PSAvoidShouldContinueWithoutForce rule.
VERBOSE: Running PSAvoidUsingConvertToSecureStringWithPlainText rule.
VERBOSE: Running PSAvoidUsingComputerNameHardcoded rule.
VERBOSE: Running PSAvoidUsingInvokeExpression rule.
VERBOSE: Running PSAvoidUsingWriteHost rule.
VERBOSE: Running PSAvoidUsingPlainTextForPassword rule.
VERBOSE: Running PSAvoidUsingUsernameAndPasswordParams rule.
VERBOSE: Running PSMissingModuleManifestField rule.
VERBOSE: Running PSAvoidUsingDeprecatedManifestFields rule.
VERBOSE: Running PSPossibleIncorrectUsageOfRedirectionOperator rule.
VERBOSE: Running PSMisleadingBacktick rule.
VERBOSE: Running PSAvoidUsingWMICmdlet rule.
VERBOSE: Running PSUseApprovedVerbs rule.
VERBOSE: Running PSUseCompatibleCmdlets rule.
VERBOSE: Running PSPossibleIncorrectUsageOfAssignmentOperator rule.
VERBOSE: Running PSUseLiteralInitializerForHashtable rule.
VERBOSE: Running PSPossibleIncorrectComparisonWithNull rule.
VERBOSE: Running PSAvoidTrailingWhitespace rule.
VERBOSE: Running PSUseBOMForUnicodeEncodedFile rule.
VERBOSE: Running PSUseToExportFieldsInManifest rule.
VERBOSE: Running PSUseUTF8EncodingForHelpFile rule.
VERBOSE: Running PSUsePSCredentialType rule.
VERBOSE: Running PSUseSupportsShouldProcess rule.
VERBOSE: Running PSUseShouldProcessForStateChangingFunctions rule.
VERBOSE: Running PSUseOutputTypeCorrectly rule.
VERBOSE: Running PSUseDeclaredVarsMoreThanAssignments rule.
VERBOSE: Running PSProvideCommentHelp rule.
VERBOSE: Running PSReservedCmdletChar rule.
VERBOSE: Running PSShouldProcess rule.
Script Analyzer cannot be terminated using Control and C.
Environment data
Tested under PowerShell 5.1 and 6.2 as shown below.
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.18362.145
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.145
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.1
1.18.0
1.17.1
1.16.1
1.4.0
And:
> $PSVersionTable
Name Value
---- -----
PSVersion 6.2.1
PSEdition Core
GitCommitId 6.2.1
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.1
1.18.0
1.17.1
1.16.1