Closed
Description
Steps to reproduce
save-module -Name xWebAdministration -Version 1.20.0.0 -Path .
Invoke-ScriptAnalyzer .
Expected behavior
some warnings if warranted
Actual behavior
Numerous errors, including the NullReferenceException below:
writeErrorStream : True
PSMessageDetails :
Exception : System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseIdenticalMandatoryPa
rametersDSC.GetKeys(String fileName)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseIdenticalMandatoryPa
rametersDSC.<AnalyzeDSCResource>d__7.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.AnalyzeSyntaxTree(Scr
iptBlockAst scriptAst, Token[] scriptTokens, String filePath)
TargetObject : C:\temp\testpackages\xWebAdministration\1.20.0.0\DSCResources\MSFT_xWebsite\MSFT_xWebs
ite.psm1
CategoryInfo : InvalidOperation: (C:\temp\testpac...T_xWebsite.psm1:String) [Invoke-ScriptAnalyzer],
NullReferenceException
FullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCo
mmand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}
writeErrorStream : True
PSMessageDetails :
Exception : System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseIdenticalMandatoryPa
rametersDSC.GetKeys(String fileName)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseIdenticalMandatoryPa
rametersDSC.<AnalyzeDSCResource>d__7.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.AnalyzeSyntaxTree(Scr
iptBlockAst scriptAst, Token[] scriptTokens, String filePath)
TargetObject : C:\temp\testpackages\xWebAdministration\1.20.0.0\DSCResources\MSFT_xWebApplication\MSF
T_xWebApplication.psm1
CategoryInfo : InvalidOperation: (C:\temp\testpac...pplication.psm1:String) [Invoke-ScriptAnalyzer],
NullReferenceException
FullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCo
mmand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.251
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.251
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.16.1