You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you debug a script containing nested error handling, any errors thrown by a nested function do not print to the integrated terminal, regardless of ErrorAction preference. Instead, such errors stop execution but do not print to console.
This behavior differs from the behavior of both a standalone powershell terminal, and the behavior of the Integrated Terminal if the script is invoked directly via dot-sourcing.
=====> PowerShell Integrated Console <=====
PS C:\Users\user> ."C:\Users\user\Desktop\test.ps1"
Exception: C:\Users\user\Desktop\test.ps1:11:21
Line |
11 | test-error -str $null -ErrorAction Stop
| ~~~~~
| Cannot validate argument on parameter 'str'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
PS C:\Users\user>
Behavior In Stand-Alone Powershell:
PowerShell 7.0.0
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/powershell
Type 'help' to get help.
PS C:\Users\user> ."C:\Users\user\Desktop\test.ps1"
Exception: C:\Users\user\Desktop\test.ps1:11
Line |
11 | test-error -str $null -ErrorAction Stop
| ~~~~~
| Cannot validate argument on parameter 'str'. The argument is null or empty. Provide an argument that
| is not null or empty, and then try the command again.
PS C:\Users\user>
Issue Description
If you debug a script containing nested error handling, any errors thrown by a nested function do not print to the integrated terminal, regardless of ErrorAction preference. Instead, such errors stop execution but do not print to console.
This behavior differs from the behavior of both a standalone powershell terminal, and the behavior of the Integrated Terminal if the script is invoked directly via dot-sourcing.
Simple Example:
Behavior when debugging in Visual Code:
Behavior when dot-sourcing in Visual Code:
Behavior In Stand-Alone Powershell:
Attached Logs
6-PowerShell Editor Services.zip
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: