Skip to content

"Failed to compare two elements in the array." in combination with Pwsh 7.5.0 #131

Closed
@bijlm

Description

@bijlm

I have a Git repo in Azure DevOps where we develop our own Powershell Module.

Since this week our build agents are updated with Pwsh 7.5.0 and now our tests are failing on the code coverage part.

The building and testing is relying on the Sampler Project which on its part is relying on the Convert-LineNumber.

ERROR: Exception calling "BinarySearch" with "2" argument(s): "Failed to compare two elements in the array."
At C:\Users\xxxxx\Git\MyModule\output\RequiredModules\Sampler\0.118.2\tasks\JaCoCo.coverage.build.ps1:385 char:23
+ … edCommands | Convert-LineNumber -ErrorAction 'Stop' -PassThru | Out-N …                                             
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                       
At C:\Users\xxxxx\Git\MyModule\output\RequiredModules\Sampler\0.118.2\tasks\JaCoCo.coverage.build.ps1:246 char:1
+ task Convert_Pester_Coverage {                                                                                        
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                        
Build FAILED. 16 tasks, 1 errors, 0 warnings 00:02:55.2719609
ConvertTo-SourceLineNumber: C:\Users\xxxxx\Git\MyModule\output\RequiredModules\Sampler\0.118.2\tasks\JaCoCo.coverage.build.ps1:385:23
Line |                                                                                                                  
 385 |  … edCommands | Convert-LineNumber -ErrorAction 'Stop' -PassThru | Out-N …                                       
     |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                 
     | Exception calling "BinarySearch" with "2" argument(s): "Failed to compare two elements in the array."

There are 2 things I can do to prevent the Sample build not to fail (I can test/reproduce it locally):

  1. Disable CodeCoverage by setting the threshold to '0'
  2. Change my Pwsh version back from 7.5.0 to an older version like 7.4.x or earlier.

If someone could have a look at this? That would be great. I didn't see anything that triggered me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions