Debugger reports errors when running script with improperly encoded characters
See original GitHub issueSystem Details
- Operating system name and version:
- VS Code version: 1.13.0
- PowerShell extension version: 1.3.2
- Output from
$PSVersionTable:
Name Value
---- -----
PSVersion 5.1.15063.296
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.296
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Copy / paste the below commands into the PowerShell Integrated Terminal, and paste the output here
code -v $pseditor.EditorServicesVersion code --list-extensions --show-versions $PSVersionTable
PS C:\gd\Documents\s\docker\tools\vstsagent> code -v
1.13.0
376c52b955428d205459bea6619fc161fc8faacf
PS C:\gd\Documents\s\docker\tools\vstsagent> $pseditor.EditorServicesVersion
Major Minor Build Revision
----- ----- ----- --------
1 3 2 0
PS C:\gd\Documents\s\docker\tools\vstsagent> code --list-extensions --show-versions
DotJoshJohnson.xml@1.8.0
mkloubert.vs-deploy@9.25.0
ms-vscode.csharp@1.10.0
ms-vscode.PowerShell@1.3.2
PeterJausovec.vscode-docker@0.0.16
Issue Description
Configuration below will throw powershell engine off and will report errors below
Configuration test {
Script DockerConfigFile {
TestScript = {
return $true;
}
GetScript = {
return {@{configValue = "dd"}
}
}
SetScript = {
$dockerConfig | Add-Member –MemberType NoteProperty –Name graph –Value $graphLocation
}
}
}
Test
Errors reported during run
At C:\gd\Documents\s\docker\tools\vstsagent\test.ps1:12 char:82
+ ... ember –MemberTypeNoteProperty –Name graph –Value $graphLocation
+ ~~~~~~~~~~~~~~~~~~~~~
The string is missing the terminator: ".
At C:\gd\Documents\s\docker\tools\vstsagent\test.ps1:11 char:21
+ SetScript = {
+ ~
Missing closing '}' in statement block or type definition.
At C:\gd\Documents\s\docker\tools\vstsagent\test.ps1:17 char:5
+ Test
+ ~
There is an incomplete property assignment block in the instance definition.
At C:\gd\Documents\s\docker\tools\vstsagent\test.ps1:1 char:20
+ Configuration test {
+ ~
Missing closing '}' in statement block or type definition.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Incorrect utf-8 encoding in the console after executing Run or ...
Executing Run or Debug commands on a Python file with characters encoded in utf-8 incorrectly displays said characters in the output console window....
Read more >VSCode debugger having issues with character encoding
This problem can be fixed by running -exec set charset UTF-8 from the debug console while debugging but it is only a temporary...
Read more >21. Error Handling and Debugging - Practical mod_perl [Book]
These messages indicate that Perl thinks there is a problem with your code, but they do not prevent the code from running. Errors...
Read more >Error Messages - Lauterbach
Error Messages Related to Debug Hardware and Software ... escape characters are used for suppressing of name character syntax check.
Read more >A Definitive Guide to Handling Errors in JavaScript - Kinsta
Here is how you can define an error in JavaScript: const wrongTypeError = TypeError("Wrong type found, expected character").
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Great work @tylerl0706! thanks for confirm the bug… I guess it’s time to move to PS Core 😉
Ah. I’ve got a repro!
It’s only on Windows PowerShell and this is, in fact, a Windows PowerShell bug. Here’s why:
let’s say we have @Eickhel’s example:
With the PowerShell ISE, when you have an untitled file and hit F5, it does the same thing as if you selected all the text and hit F8 (aka ctrl-A, F8).
If you save the file to something, like
test.ps1it runs the actual file like so:Notice the bad formatting!
VSCode runs the file that you are F5’ing as well:
If we run that exact line in Windows PowerShell as well we get the same wrong formatting:
If we try this is PowerShell Core 6, the bug was fixed and the output is what we expect:
Moral of the story, this is a bug in Windows PowerShell and not the PowerShell extension for VSCode.