If you throw with a message containing more than 143 contiguous non-breaking characters, script execution halts without any output.
On Windows (unsure about other platforms), put the following in a test.ps1 file:
throw 'This will not throw because it contains more than 143 contiguous non-breaking characters: C:\Users\foo\bar\really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really\filename'
Run the script: .\test.ps1.
~\Desktop> .\test.ps1
Exception: C:\Users\me\Desktop\test.ps1:1
Line |
1 | throw 'This will not throw because it contains more than 143 contiguo …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| This will not throw because it contains more than 143 contiguous non-breaking characters:
| C:\Users\foo\bar\really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really\filename
The script exits without any information at all and a good exit code.
~\Desktop> .\test.ps1
~\Desktop> $LASTEXITCODE
0
Name Value
---- -----
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.19041
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
# This will not throw because it contains more than 143 contiguous non-breaking characters
throw 'This will not throw because it contains more than 143 contiguous non-breaking characters: C:\Users\foo\bar\really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really\filename'
# Same result
throw 'C:\Users\foo\bar\really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really\filename'
# Subtracting a sinlge character results in expected behavior
throw 'C:\Users\foo\bar\really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really.really\filenam'
I can not able to reproduce. Please start pwsh -NoProfile and check again.
Yep. Repros with pwsh -NoProfile. I've got a co-worker who can repro it as well.
Make sure you run it from a file! I can't repro it otherwise.
Yes, I try from file and can not repo.
Could you please check with 7.0 Preview1?
Can you repo with command like throw 'a'*500?
Yes, I can repro with throw 'a'*500.
Interesting, it does appear to be throwing correctly with 7.1.0-preview.1.
I can also repro on Ubuntu with 7.0.0.
/cc @SteveL-MSFT Do we want to have a servicing fix for 7.0 LTS?
Quick update. I'm only able to repro this in 7.0.0. 6.2.4 and 7.1.0-preview.1 do not appear to have this issue.
I'm no longer able to repro in 7.0.1. Looks like the underlying cause was fixed.