PowerShell / PowerShell/vscode-powershell

`pwsh.exe` `$env:PSModulePath` Retained In 5.1 Console When `code.cmd` Called From `pwsh.exe`

Open
#3,886 14 comments 0 reactions 1 assignee View on GitHub

@andyleejordan is already working on this.

Since Aug 3, 2022.

Area-Startup Bug: PowerShell 5.1 Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all 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

Issue found when Import-PowerShellDataFile was not recognized because Microsoft.PowerShell.Utility 7.0.0 is loaded in 5.1 Integrated Console. The libraries version is incorrect within the Visual Studio Code Host ( e.g. $Host ) on powershell.exe 5.1 when user launches code.cmd from pwsh.exe. The $env:PSModulePath is retained from the parent pwsh.exe session and causes issues in the powershell.exe session within code.exe. powershell.exe on it's own purges the pwsh.exe paths from the module path ( e.g. C:\Program Files\PowerShell\Modules and C:\program files\powershell\7\Modules ). See this comment on the code links to the PowerShell code base.

Modules like Terminal-Icons error out. I still need to use this version due to SOAP endpoints like SQL Server Reporting Services ( e.g. ReportingServicesTools module ).

PowerShell Version
PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.1171
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.1171
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Visual Studio Code Version
PS> code --version
1.65.2
c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
x64
Extension Version
PS> code --list-extensions --show-versions | Select-String powershell7:58  

ms-vscode.powershell-preview@2022.3.0
Steps to Reproduce

Set Integrated Console in VS Code to Windows Powershell (x64). Close all instances of VS Code.

pwsh
code file.ps1

Execute below in VS Code Integrated Terminal

Get-Command 'Import-PowershellDataFile'
Get-Command -Module 'Microsoft.PowerShell.Utility' | Select-Object -Unique -Property Version
Visuals

N/A

Logs
Terminal Log Output
DEBUG: Logging started
DEBUG: Beginning EndProcessing block
VERBOSE: Removing PSReadLine        
DEBUG: Creating host configuration  
DEBUG: Determining REPL kind
DEBUG: REPL configured as PSReadLine
DEBUG: Configuring LSP transport  
DEBUG: Configuring debug transport
DEBUG: Session file writer created
VERBOSE: Adding AssemblyResolve event handler for dependency loading
VERBOSE: Loading EditorServices
VERBOSE: PID: 37124
VERBOSE: 
== Build Details ==
- Editor Services version: 3.1.5
- Build origin:            Release
- Build commit:            6e602caf43c37381f42fc4d47b680a9d96271949
- Build time:              3/10/2022 12:00:00 AM
VERBOSE: 
== Host Startup Configuration Details ==
 - Host name:                 Visual Studio Code Host
 - Host version:              2022.3.0
 - Host profile ID:           Microsoft.VSCode
 - PowerShell host type:      System.Management.Automation.Internal.Host.InternalHost

 - REPL setting:              PSReadLine
 - Session details path:
c:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\sessions\PSES-VSCode-35772-736086
 - Bundled modules path:      c:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules
 - Additional modules:        PowerShellEditorServices.VSCode
 - Feature flags:

 - Log path:
c:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\logs\1648066708-6efde32c-da6d-479b-a9dc-f595fa3e5cae16480667 
05294\EditorServices.log
 - Minimum log level:         Diagnostic

 - Profile paths:
   + AllUsersAllHosts:       C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
   + AllUsersCurrentHost:    C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.VSCode_profile.ps1
   + CurrentUserAllHosts:    C:\Users\user\OneDrive - Organization\Documents\WindowsPowerShell\profile.ps1
   + CurrentUserCurrentHost: C:\Users\user\OneDrive - Organizaton
\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1
DEBUG: Loaded 'Microsoft.PowerShell.Commands.Diagnostics, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Diagnostics\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.PowerSh 
ell.Commands.Diagnostics.dll'
DEBUG: Loaded 'System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration.Install\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.Install.d 
ll'
DEBUG: Loaded 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Utility\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.PowerShell. 
Commands.Utility.dll'
DEBUG: Loaded 'Microsoft.PowerShell.Commands.Management, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Management\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.PowerShe 
ll.Commands.Management.dll'
DEBUG: Loaded 'Microsoft.WSMan.Management, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WSMan.Management\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.WSMan.Management.dll'  
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Security.resources, Version=3.0.0.0, Culture=en-US, 
PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Security.resources, Version=3.0.0.0, Culture=en-US, 
PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Version=3.1.5.0, Culture=neutral, PublicKeyToken=null     
DEBUG: Assembly resolve event fired for Microsoft.WSMan.Management.resources, Version=3.0.0.0, Culture=en-US, 
PublicKeyToken=31bf3856ad364e35
DEBUG: Loading Microsoft.PowerShell.EditorServices, Version=3.1.5.0, Culture=neutral, PublicKeyToken=null from PSES dependency dir 
into LoadFile context
DEBUG: Assembly resolve event fired for Microsoft.WSMan.Management.resources, Version=3.0.0.0, Culture=en-US, 
PublicKeyToken=31bf3856ad364e35
DEBUG: Loaded 'Microsoft.PowerShell.EditorServices, Version=3.1.5.0, Culture=neutral, PublicKeyToken=null' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Power 
Shell.EditorServices.dll'
DEBUG: Loaded 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\netstandard\v4.0_2.0.0.0__cc7b13ffcd2ddd51\netstandard.dll'
DEBUG: Assembly resolve event fired for Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, 
PublicKeyToken=adb9793829ddae60
DEBUG: Loading Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 from PSES  
dependency dir into LoadFile context
VERBOSE: 
== Console Details ==
 - Console input encoding: OEM United States
 - Console output encoding: OEM United States
 - PowerShell output encoding: US-ASCII
DEBUG: Loaded 'Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Exten 
sions.Logging.Abstractions.dll'
VERBOSE: 
== PowerShell Details ==
- PowerShell version: 5.1.18362.1171
- Language mode:      FullLanguage
DEBUG: Loaded 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'   
from
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.RuntimeInformation\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Ru 
ntime.InteropServices.RuntimeInformation.dll'
VERBOSE: 
== Environment Details ==
 - OS description:  Microsoft Windows 10.0.18363
 - OS architecture: X64
 - Process bitness: 64
DEBUG: Checking that .NET Framework version is at least 4.6.1
VERBOSE: .NET registry version: 528040
VERBOSE: Updated PSModulePath to: 'C:\Users\user\OneDrive - Organization\Documents\PowerShell\Modules;C:\Program 
Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program
Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files\Veeam\Backup and
Replication\Explorers\Exchange\;C:\Program Files\Veeam\Backup and Replication\Explorers\SharePoint\;C:\Program Files\Veeam\Backup and  
Replication\Explorers\SQL\;C:\Program Files\Veeam\Backup and Replication\Explorers\ActiveDirectory\;C:\Program Files\Veeam\Backup and  
Replication\Explorers\Oracle\;c:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules'
DEBUG: Validating configuration
VERBOSE: Loading PowerShell Editor Services
VERBOSE: Starting EditorServices
DEBUG: Assembly resolve event fired for Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loading Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10 from PSES dependency dir into LoadFile       
context
DEBUG: Loaded 'Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Serilog.dll'    
DEBUG: Assembly resolve event fired for Serilog.Sinks.Async, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loading Serilog.Sinks.Async, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10 from PSES dependency dir into    
LoadFile context
DEBUG: Loaded 'Serilog.Sinks.Async, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Serilog.Sinks.A 
sync.dll'
DEBUG: Assembly resolve event fired for Microsoft.Extensions.Logging, Version=6.0.0.0, Culture=neutral, 
PublicKeyToken=adb9793829ddae60
DEBUG: Loading Microsoft.Extensions.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 from PSES dependency    
dir into LoadFile context
DEBUG: Loaded 'Microsoft.Extensions.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Exten 
sions.Logging.dll'
DEBUG: Assembly resolve event fired for Serilog.Extensions.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10  
DEBUG: Loading Serilog.Extensions.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10 from PSES dependency dir 
into LoadFile context
DEBUG: Loaded 'Serilog.Extensions.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Serilog.Extensi 
ons.Logging.dll'
DEBUG: Assembly resolve event fired for Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=adb9793829ddae60
DEBUG: Loading Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 from PSES  
dependency dir into LoadFile context
DEBUG: Assembly resolve event fired for Serilog.Sinks.File, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loading Serilog.Sinks.File, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10 from PSES dependency dir into 
LoadFile context
DEBUG: Loaded 'Serilog.Sinks.File, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Serilog.Sinks.F 
ile.dll'
DEBUG: Assembly resolve event fired for Microsoft.Extensions.Options, Version=6.0.0.0, Culture=neutral, 
PublicKeyToken=adb9793829ddae60
DEBUG: Loading Microsoft.Extensions.Options, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 from PSES dependency    
dir into LoadFile context
DEBUG: Loaded 'Microsoft.Extensions.Options, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Exten 
sions.Options.dll'
DEBUG: Assembly resolve event fired for Microsoft.Extensions.Logging, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=adb9793829ddae60
DEBUG: Loading Microsoft.Extensions.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 from PSES dependency    
dir into LoadFile context
DEBUG: Assembly resolve event fired for OmniSharp.Extensions.LanguageServer, Version=0.19.0.0, Culture=neutral, 
PublicKeyToken=6d868dff454e6022
DEBUG: Loading OmniSharp.Extensions.LanguageServer, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022 from PSES       
dependency dir into LoadFile context
DEBUG: Loaded 'OmniSharp.Extensions.LanguageServer, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\OmniSharp.Exten 
sions.LanguageServer.dll'
DEBUG: Assembly resolve event fired for OmniSharp.Extensions.JsonRpc, Version=0.19.0.0, Culture=neutral, 
PublicKeyToken=6d868dff454e6022
DEBUG: Loading OmniSharp.Extensions.JsonRpc, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022 from PSES dependency   
dir into LoadFile context
DEBUG: Loaded 'OmniSharp.Extensions.JsonRpc, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\OmniSharp.Exten 
sions.JsonRpc.dll'
DEBUG: Assembly resolve event fired for MediatR, Version=8.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2
DEBUG: Loading MediatR, Version=8.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2 from PSES dependency dir into LoadFile       
context
DEBUG: Loaded 'MediatR, Version=8.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\MediatR.dll'    
DEBUG: Assembly resolve event fired for OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, 
PublicKeyToken=6d868dff454e6022
DEBUG: Loading OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022 from PSES     
dependency dir into LoadFile context
DEBUG: Loaded 'OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022' from 
'C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2022.3.0\modules\PowerShellEditorServices\bin\Common\OmniSharp.Exten 
sions.LanguageProtocol.dll'
DEBUG: Loaded 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' from 
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_11.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll'
DEBUG: Creating/running editor services
DEBUG: Creating startup info object
VERBOSE: Starting server, deregistering host logger and registering shutdown listener
=====> PowerShell Preview Integrated Console v2022.3.0 <=====

Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:210 char:33
+         $hash.Add($_.Basename, (Import-PowerShellDataFile $_.FullName ...
+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:196 char:22
+         $colorData = Import-PowerShellDataFile $_.FullName
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Index operation failed; the array index evaluated to null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:197 char:9
+         $hash[$colorData.Name] = $colorData
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex
 
Index operation failed; the array index evaluated to null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:198 char:9
+         $hash[$colorData.Name].Types.Directories[''] = $colorReset
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex
 
Index operation failed; the array index evaluated to null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:199 char:9
+         $hash[$colorData.Name].Types.Files['']       = $colorReset
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex
 
Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:53 char:34
+                         $theme = Import-PowerShellDataFile $item.Full ...
+                                  ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Exception calling "ContainsKey" with "1" argument(s): "Key cannot be null.
Parameter name: key"
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:58 char:33
+ ...           if (-not $script:colorSequences.ContainsKey($theme.Name)) {
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException
 
You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:63 char:29
+ ...             $theme.Types.Directories.WellKnown.GetEnumerator().ForEac ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:67 char:29
+ ...                $theme.Types.Files.WellKnown.GetEnumerator().ForEach({
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:71 char:29
+ ...             $theme.Types.Files.GetEnumerator().Where({$_.Name -ne 'We ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Index operation failed; the array index evaluated to null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:76 char:25
+ ...              $script:userThemeData.Themes.$Type[$theme.Name] = $theme
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex
 
Save-Theme : Cannot bind argument to parameter 'Theme' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:77 char:43
+                         Save-Theme -Theme $theme -Type $Type
+                                           ~~~~~~
    + CategoryInfo          : InvalidData: (:) [Save-Theme], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Save-Theme
 
Import-PowerShellDataFile : The term 'Import-PowerShellDataFile' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:53 char:34
+                         $theme = Import-PowerShellDataFile $item.Full ...
+                                  ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Import-PowerShellDataFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Index operation failed; the array index evaluated to null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:76 char:25
+ ...              $script:userThemeData.Themes.$Type[$theme.Name] = $theme
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex
 
Save-Theme : Cannot bind argument to parameter 'Theme' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Terminal-Icons\0.9.0\Terminal-Icons.psm1:77 char:43
+                         Save-Theme -Theme $theme -Type $Type
+                                           ~~~~~~
    + CategoryInfo          : InvalidData: (:) [Save-Theme], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Save-Theme
 
 user    ~    ﮫ0ms⠀                                                                  powershell   98  15:18:46  

Attached are the corresponding logs files.
StartEditorServices.log
vscode-powershell.log
EditorServices.log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.