Skip to content

Expected path System.Collections.Hashtable to exist, but it did not exist. #2422

Answered by fflaten
riosengineer asked this question in Q&A
Discussion options

You must be logged in to vote

Hi. $testFiles = @($testFiles) + @($testFile) adds a null-element at the start of your array due to $testFiles being undefined on the first foreach-iteration. The test generated for the $null-element has $_ set to an empty hashtable atm. Related #2320.

To avoid the null-element, you can either:

  • Declare $testFiles = @() before the loop
  • Or avoid the array merging in the first place. It is inefficient anyways. Try:
    $testFiles = foreach ($moduleFile in $moduleFiles) {
        Join-Path $testPath ($moduleFile.BaseName + '.tests.bicep')
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@riosengineer
Comment options

Answer selected by riosengineer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants