Skip to content

ScriptCallDepthException thrown during Pester-tests only in PS5.1 Integrated Console #3962

Closed
PowerShell/PowerShellEditorServices
#1797
@fflaten

Description

@fflaten

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

Powershell throws ScriptCallDepthException when invoking Pester-tests. This was reported as an issue in Pester-repo, but I'm only able to reproduce it using vscode-powershell integrated console with PS5.1

Running in PS 5.1 standalone or integrated console with PS7 works fine.
Not sure how to troubleshoot this further on our end. Tips?

PowerShell Version

=====> PowerShell Integrated Console v2022.5.1 <=====

PS C:\Users\Frode\Git\Pester> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22000.613
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22000.613
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visual Studio Code Version

code --version
1.67.0
57fd6d0195bb9b9d1b49f6da5db789060795de47
x64

Extension Version

code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2022.5.1
ms-vscode.powershell-preview@2022.5.1
TylerLeonhardt.vscode-inline-values-powershell@0.0.5

(Preview-extension is disabled.)

Steps to Reproduce

See pester/Pester#2174 for repro.

  • Running the repro using a file + F5 makes it fail mid-run as issue mentions.
  • Running 0..10 | ForEach-Object { Invoke-Pester 'C:\Samples\demoIssue2174\Pester.Tests.ps1' -Output Detailed } in Integrated Console work the first time, but once you run the loop again it fails on first.

Visuals

Broken in Integrated Console using F5:
calldepth-f5

Broken in Integrated Console using console:
calldepth-manual

Working in PS7 Integrated Console with F5:
working-ps7vscode

Working in PS5.1 terminal:
working-ps51terminal

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions