vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

`ContentViewTest.ps1` example broken

Open StevenBucher98 opened this issue 3 years ago • 3 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] I have searched all issues to ensure it has not already been reported.
  • [X] I have read the troubleshooting guide.
  • [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

The ContentViewTest.ps1 does not work as expected when running on either the 2022.2.0 preview or 2021.12.0 Stable extension. The expected output is a second column with some

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.22000
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.64.1
d6ee99e4c045a6716e5c653d7da8e9ae6f5a8b03
x64

Extension Version

[email protected]
[email protected]

Steps to Reproduce

Open examples folder via PowerShell.OpenExamplesFolder command pallet command.

Run ./CommandViewTest.ps1

Second column opens but is blank. It is expected to have a simple page that says "Hello from JavaScript"

Visuals

image

Logs

No response

StevenBucher98 avatar Feb 10 '22 21:02 StevenBucher98

Found this old post when this feature was introduced. The examples don't work in stable nor preview:

https://www.reddit.com/r/PowerShell/comments/6imtps/just_released_powershell_for_vs_code_140_with_new/

SteveL-MSFT avatar Feb 10 '22 21:02 SteveL-MSFT

New-VSCodeHtmlContentView: C:\Users\stevenbucher\.vscode-insiders\extensions\ms-vscode.powershell-preview-2022.2.0\examples\ContentViewTest.ps1:7:9
Line |
   7 |  $view = New-VSCodeHtmlContentView -Title "Test View" -ShowInColumn Tw …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Object reference not set to an instance of an object.

Set-VSCodeHtmlContentView: C:\Users\stevenbucher\.vscode-insiders\extensions\ms-vscode.powershell-preview-2022.2.0\examples\ContentViewTest.ps1:8:33
Line |
   8 |  Set-VSCodeHtmlContentView -View $view @params
     |                                  ~~~~~
     | Cannot validate argument on parameter 'HtmlContentView'. The argument is null. Provide a valid value for the argument, and then try running the command again.
```

StevenBucher98 avatar Feb 10 '22 21:02 StevenBucher98

I also get the same behavior of a blank window appearing, but I dont get any errors. @SteveL-MSFT Any ideas on this?

jklosinski avatar Mar 16 '23 13:03 jklosinski