Closed
Description
Path is annotated with [ValueFromPipeline] so it should be possible to pipe records to it. But code in BeginProcessing tries to use the value of the path variable, which won't be set at that point if the paths to process are being pipelined.
Steps to reproduce
get-childitem *.ps1 | Invoke-ScriptAnalyzer
Expected behavior
Processes each of the files specified and produces analysis results for each one
Actual behavior
Error: Invoke-ScriptAnalyzer : Cannot process argument because the value of argument "path" is null. Change the
value of argument "path" to a non-null value.
PSMessageDetails :
Exception : System.Management.Automation.PSArgumentNullException: Cannot process argument because
the value of argument "path" is null. Change the value of argument "path" to a
non-null value.
at
System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String
path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider&
providerInstance)
at
System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String
path, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
.ProcessPath()
at Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
.BeginProcessing()
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin()
TargetObject :
CategoryInfo : InvalidArgument: (:) [Invoke-ScriptAnalyzer], PSArgumentNullException
FullyQualifiedErrorId : ArgumentNull,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzer
Command
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.547
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.547
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.17.1
1.16.1