Skip to content

Bug in PSMissingModuleManifestField rule #541

@kapilmb

Description

@kapilmb

A .psd1 file that doesn't contain a valid hash table will result in Invoke-ScriptAnalyzer throwing a null reference exception.

Set-Content -Path .\test.psd1 -Value "hello world"
PS>Invoke-ScriptAnalyzer -Path .\test.psd1 -Verbose -IncludeRule "PSMissingModuleManifestField"
VERBOSE: Analyzing file: C:\tmp\test.psd1
VERBOSE: Running PSMissingModuleManifestField rule.
Invoke-ScriptAnalyzer : Object reference not set to an instance of an object.
At line:1 char:1
+ Invoke-ScriptAnalyzer -Path .\test.psd1 -Verbose -IncludeRule "PSMiss ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (C:\tmp\test.psd1:String) [Invoke-ScriptAnalyzer], Null
   ReferenceException
    + FullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerComm
   and

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions