PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 490 forks source link

`ContentViewTest.ps1` example broken #3821

Open StevenBucher98 opened 2 years ago

StevenBucher98 commented 2 years ago

Prerequisites

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

ms-vscode.powershell@2021.12.0
ms-vscode.powershell-preview@2022.2.0

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

SteveL-MSFT commented 2 years ago

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/

StevenBucher98 commented 2 years ago
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.
jklosinski commented 1 year ago

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