Script Content Triggers unhandled Newtonsoft.Json.JsonSerializationException
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- csharp, powershell, vscode
- Ambito
- developer-experience, devtools
Direzione di ricerca
Iniziate riproducendo il malfunzionamento con lo snippet PowerShell fornito e analizzate PowerShellEditorServices-14896.log, StartEditorServices-14896.log e vscode-powershell.log. Tracciate l’errore di serializzazione non gestito in PowerShell Editor Services; il lavoro è completato quando l’eccezione viene gestita e l’enumerazione di Command Explorer e IntelliSense continuano a funzionare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with PowerShell Editor Services itself and does not reproduce in a standalone PowerShell instance, and is not an issue with my editor.
- I have verified that I am using the latest version of PowerShell Editor Services.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
When the following code snippet is encountered in a user created PowerShell script, and the script's path is in the environment path variable, PowerShellEditorServices fails. This appears to be caused by a Newtonsoft.Json.JsonSerializationException (For additional details, see the included PowerShellEditorServices-14896.log file included below).
Because the PowerShellEditorServices is used by the PowerShell Extension for Visual Studio Code, both the extension's Command Explorer and Intellisense stop working when this exception occurs. Ideally, I feel the PowerShellEditorServices should gracefully handle and report the exception and continue running.
param (
[Parameter(Mandatory=$false)]
[ValidateScript({
if ($_ -is [int] -and $_ -ge 0) {
$true
} else {
throw "The input argument be a positive integer or zero."
}
})]
[int]$DaysBack = 0 # Default value is 0
)
PowerShell Version
PS ~> $PSVersionTable
Name Value
---- -----
PSVersion 7.4.3
PSEdition Core
GitCommitId 7.4.3
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Editor Version
Installed PowerShell Extension for Visual Studio Code.
PowerShell Editor Services Version
N/A
Steps to Reproduce
In Windows 11:
- Insert aforementioned code snippet into any user defined PowerShell script.
- Make sure the script can be found by the PowerShellEditorServices by including its fully qualified path (not file name) in the path environment variable.
- Open Visual Studio Code (with the PowerShell for VS Code extension (by Microsoft) installed.
- Click on the PowerShell icon in the left panel, to show the Command Explorer. (You may need to enable this extension's setting: PowerShell>SideBar: Command Explorer Visibility
- The Command Explorer will fail to enumerate and Intellisense will stop working for PowerShell scripts.
Visuals
No response
Logs
PowerShellEditorServices-14896.log
StartEditorServices-14896.log
vscode-powershell.log
- Lingua principale
- C#
- Stelle
- 767
- Fork
- 266
- Merge medio
- 3g 16h
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PowerShell/PowerShellEditorServices
-
[Bug] None of the string overloads of `EditorExtensionServiceProvider.GetService()` work on .NET. Aperta
PowerShell/PowerShellEditorServices#2331 · 1 reazione · 2 assegnatari ·
-
Area-Language Server Issue-Enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
PowerShell/PowerShellEditorServices#2315 · 1 commento ·
-
Area-Debugging Issue-Enhancement
PowerShell/PowerShellEditorServices#2294 · 1 reazione · 2 assegnatari ·
-
Issue-Bug Needs: Triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
PowerShell/PowerShellEditorServices#2293 · 1 commento ·
-
PowerShell/PowerShellEditorServices#2282 · 1 commento · 1 reazione · 2 assegnatari ·
Tutte le issue di PowerShell/PowerShellEditorServices
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
azurenoops/spin_agent#975 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SubtitleEdit/subtitleedit#15108 · 1 commento ·