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
A .psd1 file that doesn't contain a valid hash table will result in Invoke-ScriptAnalyzer throwing a null reference exception.