- changed status to resolved
Write-Progress error breaks try/catch
Visual Studio 2019 16.3.8
POSH 5.0.2
\$PSVersionTable
Name Value
PSVersion 5.1.18362.145
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.145
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Write-Progress -Activity "a" -Status "b"
try{
trhow "Exception"
Write-Host "Success"
}catch
{
Write-Host "Catch!"
}
First run in fresh just loaded Visual studio
PS C:\Users\kazakoveo\source\tests\TestPOSH> C:\Users\kazakoveo\source\tests\TestPOSH\TestPOSH\TestPOSH.ps1
[ERROR] Write-Progress : Status(StatusCode=Unknown, Detail="Exception was thrown by han
[ERROR] dler.")
[ERROR] C:\Users\kazakoveo\source\tests\TestPOSH\TestPOSH\TestPOSH.ps1:1 знак:1
[ERROR] + Write-Progress -Activity "a" -Status "b"
[ERROR] + ~~~~~~~~
[ERROR] + FullyQualifiedErrorId : Grpc.Core.RpcException,Microsoft.PowerShell.Comm
[ERROR] + CategoryInfo : NotSpecified: (:) [Write-Progress], RpcException
[ERROR] ands.WriteProgressCommand
[ERROR]
Catch!
The program 'TestPOSH.ps1: PowerShell Script' has exited with code 0 (0x0).
Second run in the same loaded Visual Studio
PS C:\Users\kazakoveo\source\tests\TestPOSH> C:\Users\kazakoveo\source\tests\TestPOSH\TestPOSH\TestPOSH.ps1
Catch!
The program 'TestPOSH.ps1: PowerShell Script' has exited with code 0 (0x0).
Third run in the same loaded Visual Studio (additional new line)
PS C:\Users\kazakoveo\source\tests\TestPOSH> C:\Users\kazakoveo\source\tests\TestPOSH\TestPOSH\TestPOSH.ps1
Catch!
The program 'TestPOSH.ps1: PowerShell Script' has exited with code 0 (0x0).
Fourth run in the same loaded Visual Studio (no catch!)
PS C:\Users\kazakoveo\source\tests\TestPOSH> C:\Users\kazakoveo\source\tests\TestPOSH\TestPOSH\TestPOSH.ps1
The program 'TestPOSH.ps1: PowerShell Script' has exited with code 0 (0x0).
Comments (1)
-
- Log in to comment
I have been unable to reproduce this in 5.0.3. There were some special characters in the script but it may just be bitbucket complaining.