SeeminglyScience / EditorServicesCommandSuite

Collection of editor commands for use in PowerShell Editor Services.
Other
152 stars 13 forks source link

You cannot call a method on a null-valued expression for Import-EditorCommand -Module EditorServicesCommandSuite #43

Closed SQLDBAWithABeard closed 4 years ago

SQLDBAWithABeard commented 4 years ago

Thank you, the work around in #40 works around :-)

But only with the PowerShell extension.With PowerShell Preview Extension and PowerShell 6.2.3 on Windows when I run Import-EditorCommand -Module EditorServicesCommandSuite I get the below error

You cannot call a method on a null-valued expression.
At C:\Users\Rob\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.11.0\modules\PowerShellEditorServices\Commands\Public\Import-EditorCommand.ps1:61 char:9
+         $extensionService = $psEditor.GetType().
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\Rob\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.11.0\modules\PowerShellEditorServices\Commands\Public\Import-EditorCommand.ps1:65 char:9
+         $editorCommands = $extensionService.GetType().
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

This is also still occuring with the daily release as of today

SeeminglyScience commented 4 years ago

But only with the PowerShell extension.

You sure it works in stable? The error in preview makes sense, but it definitely shouldn't work in stable either o.0

With PowerShell Preview Extension and PowerShell 6.2.3 on Windows when I run Import-EditorCommand -Module EditorServicesCommandSuite I get the below error

You cannot call a method on a null-valued expression.
At C:\Users\Rob\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.11.0\modules\PowerShellEditorServices\Commands\Public\Import-EditorCommand.ps1:61 char:9
+         $extensionService = $psEditor.GetType().
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\Rob\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.11.0\modules\PowerShellEditorServices\Commands\Public\Import-EditorCommand.ps1:65 char:9
+         $editorCommands = $extensionService.GetType().
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

This is also still occuring with the daily release as of today

This was a PSES issue, fixed with PowerShell/PowerShellEditorServices#1114.

That said, you can just remove Import-EditorCommand from your profile. The preview version of this module doesn't (and won't on release) require it anymore.

Maybe replace it with Import-CommandSuite, but tbh I haven't decided if I'm actually going to do anything with that other than just being a shortcut to importing the module.

SeeminglyScience commented 4 years ago

Fixed with v1.0.0-beta1

Install-Module EditorServicesCommandSuite -Scope CurrentUser -AllowPrerelease -Force
SQLDBAWithABeard commented 4 years ago

Thank you - Confirmed :-)