Skip to content

Powershell script with Generic method call cannot be edited in VS Code #4842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 tasks done
hshenMcc opened this issue Nov 19, 2023 · 10 comments
Closed
6 tasks done
Labels
Issue-Bug A bug to squash. Needs: Fix Verification Please verify the fix for us! Resolution-External Will close automatically.

Comments

@hshenMcc
Copy link

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 the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

call [System.Text.Json.JsonSerializer]::Serialize in a powershell script. The script runs ok in VS code. But after editing anything in the script, the script failed at the call of [System.Text.Json.JsonSerializer]::Serialize. No issue if run the modified script in pwsh directly.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.3.9
PSEdition                      Core
GitCommitId                    7.3.9
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64

Extension Version

Steps to Reproduce

testJson.zip
testJson.ps1 in the zip can run no problem in VS Code with output

this1:
{"FirstName":"John","LastName":"Doe"}

But if remove 1 in "this1", and run the script again in VS code, got output as
Line |
24 | $jsonString = [System.Text.Json.JsonSerializer]::Serialize[Person]($p …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Could not find a suitable generic method overload for "Serialize" with "1" type parameters, and the argument count: "1".
this:

No issue to run the modified script in pwsh. Something is wrong in Powershell extension.

Visuals

No response

Logs

No response

@hshenMcc hshenMcc added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Nov 19, 2023
@hshenMcc hshenMcc changed the title Powershell script with Generic method call cannot be edited in VS cCode Powershell script with Generic method call cannot be edited in VS Code Nov 19, 2023
@SydneyhSmith
Copy link
Collaborator

Thanks @hshenMcc can you please also provide a screen shot of what are you are seeing?

@SydneyhSmith SydneyhSmith added Needs: Repro Info and removed Needs: Triage Maintainer attention needed! labels Nov 29, 2023
@hshenMcc
Copy link
Author

first run
second run

@github-actions github-actions bot added the Stale label Dec 2, 2023
Copy link
Contributor

github-actions bot commented Dec 7, 2023

This issue has been labeled as needing feedback and has not had any activity for one or more weeks. It has been closed for housekeeping purposes.

@github-actions github-actions bot closed this as completed Dec 7, 2023
@andyleejordan andyleejordan added Needs: Maintainer Attention Maintainer attention needed! and removed Needs: Repro Info labels Dec 7, 2023
@andyleejordan andyleejordan reopened this Dec 7, 2023
@SydneyhSmith
Copy link
Collaborator

Thanks @hshenMcc are you able to provide your entire script?

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jan 10, 2024
@SeeminglyScience
Copy link
Collaborator

Ah nevermind the above message @hshenMcc, in the triage meeting I didn't see you had already provided the script

@SeeminglyScience SeeminglyScience added the Needs: Maintainer Attention Maintainer attention needed! label Jan 11, 2024
@SydneyhSmith
Copy link
Collaborator

We we're able to reproduce this outside of VSCode so it is a PowerShell issue-- @SeeminglyScience is going to create an issue in PowerShell/PowerShell

@SydneyhSmith SydneyhSmith added Resolution-External Will close automatically. and removed Needs: Maintainer Attention Maintainer attention needed! labels Jan 17, 2024
Copy link
Contributor

This issue has been labeled as resolved, please verify the provided fix (or other reason).

@github-actions github-actions bot added the Needs: Fix Verification Please verify the fix for us! label Jan 17, 2024
Copy link
Contributor

This issue has been labeled as needing fix verification and has not had any activity a week. It has been closed for housekeeping purposes.

@hshenMcc
Copy link
Author

Where ever the issue is, which release on which product (VS Code/Powershell) has the fix? Thanks.

@JustinGrote
Copy link
Collaborator

@hshenMcc there is no fix yet but if there is one, it will land in PowerShell and (hopefully) be available in the next release after that, which is currently PS7.5. The vscode side will "just work" when that's completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. Needs: Fix Verification Please verify the fix for us! Resolution-External Will close automatically.
Projects
None yet
Development

No branches or pull requests

5 participants