Script Content Triggers unhandled Newtonsoft.Json.JsonSerializationException
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp, powershell, vscode
- Lĩnh vực
- developer-experience, devtools
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với đoạn mã PowerShell được cung cấp và xem xét PowerShellEditorServices-14896.log, StartEditorServices-14896.log và vscode-powershell.log. Truy vết lỗi tuần tự hóa chưa được xử lý trong PowerShell Editor Services; công việc được xem là hoàn tất khi ngoại lệ được xử lý và việc liệt kê của Command Explorer cùng IntelliSense tiếp tục hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- C#
- Star
- 767
- Fork
- 266
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PowerShell/PowerShellEditorServices
-
[Bug] None of the string overloads of `EditorExtensionServiceProvider.GetService()` work on .NET. Đang mở
PowerShell/PowerShellEditorServices#2331 · 1 reaction · 2 người được giao ·
-
Area-Language Server Issue-Enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PowerShell/PowerShellEditorServices#2315 · 1 bình luận ·
-
Area-Debugging Issue-Enhancement
PowerShell/PowerShellEditorServices#2294 · 1 reaction · 2 người được giao ·
-
Issue-Bug Needs: Triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PowerShell/PowerShellEditorServices#2293 · 1 bình luận ·
-
PowerShell/PowerShellEditorServices#2282 · 1 bình luận · 1 reaction · 2 người được giao ·
Tất cả issue của PowerShell/PowerShellEditorServices
Issue tương tự
-
Documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cake-build/cake#5024 ·
-
Gå gjennom ESLint-suppressions Đang mởFrontend status/draft TechnicalDebt
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 75/100
Altinn/altinn-auth#4143 ·
-
.NET Flaky Test Testing Tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
getsentry/sentry-dotnet#5617 · 1 bình luận ·
-
Add more to the documentation Đang mở:watch: Not Triaged dotnet-fsharp/svc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Client customer-reported needs-team-attention question Service Attention WebPubSub
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Azure/azure-sdk-for-net#63292 · 3 bình luận · 1 reaction ·