Skip to content

Incorrect uninitialized variable warning on variable that has been initialized #134

@rkeithhill

Description

@rkeithhill

Here's my script:

$manifest = [xml](Get-Content -Path $ManifestPath)
$product = $manifest.Products.Product | Where-Object {$_.name -eq $ProductName}
if ($null -eq $product)
{
    throw "The value for the ProductName parameter '$ProductName' does not exist in the manifest file $ManifestPath"
}

$productSrcPath = $ExecutionContext.InvokeCommand.ExpandString($product.source)

Results in this warning:

Variable 'product' is not initialized. Non-global
variables must be initialized. To fix a violation of
this rule, please initialize non-global variables.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions