vscode-powershell: Profiles not loading in lastest preview
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.
Summary
I’ve defined functionality in my $profile but it isn’t run at startup.
I have to work around it with . $profile.
PowerShell Version
Name Value
---- -----
PSVersion 7.1.5
PSEdition Core
GitCommitId 7.1.5
OS Darwin 21.1.0 Darwin Kernel Version 21.1.0: Wed…
Platform Unix
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.61.2
6cba118ac49a1b88332f312a8f67186f7f3c1643
x64
Extension Version
ms-vscode.powershell-preview@2021.10.3
Steps to Reproduce
Put code in profile Start PowerShell extension
Visuals
Logs
2021-10-28 16:02:37.844 -07:00 [VRB] Loading profiles...
2021-10-28 16:02:37.846 -07:00 [INF] Host starting
2021-10-28 16:02:37.874 -07:00 [DBG] Finding descriptors for powerShell/getVersion
2021-10-28 16:02:37.875 -07:00 [DBG] Swapping from "Parallel" to "Serial"
2021-10-28 16:02:37.875 -07:00 [DBG] Cancelling any outstanding requests (switch from parallel to serial)
2021-10-28 16:02:37.875 -07:00 [DBG] Completing existing request process type "Parallel"
2021-10-28 16:02:37.876 -07:00 [DBG] Queueing "Serial":powerShell/getVersion:1 request for processing
2021-10-28 16:02:37.877 -07:00 [DBG] Finding descriptors for textDocument/didOpen
2021-10-28 16:02:37.892 -07:00 [VRB] Created attribute powershell::file:///Users/andschwa/src/test.ps1
2021-10-28 16:02:37.893 -07:00 [VRB] Looking for handler for descriptors textDocument/didOpen
2021-10-28 16:02:37.894 -07:00 [VRB] Checking handler textDocument/didOpen:Microsoft.PowerShell.EditorServices.Handlers.PsesTextDocumentHandler
2021-10-28 16:02:37.894 -07:00 [VRB] Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentOpenRegistrationOptions
2021-10-28 16:02:37.894 -07:00 [VRB] Document Selector [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1]
2021-10-28 16:02:37.896 -07:00 [VRB] Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.PsesTextDocumentHandler via [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcNotificationHandler`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.DidOpenTextDocumentParams, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
2021-10-28 16:02:37.896 -07:00 [DBG] Queueing "Serial":textDocument/didOpen request for processing
2021-10-28 16:02:37.910 -07:00 [DBG] Finding descriptors for textDocument/documentSymbol
2021-10-28 16:02:37.918 -07:00 [VRB] Found attributes 1, ["powershell::file:///Users/andschwa/src/test.ps1"]
2021-10-28 16:02:37.920 -07:00 [VRB] Looking for handler for descriptors textDocument/documentSymbol
2021-10-28 16:02:37.920 -07:00 [VRB] Checking handler textDocument/documentSymbol:Microsoft.PowerShell.EditorServices.Handlers.PsesDocumentSymbolHandler
2021-10-28 16:02:37.920 -07:00 [VRB] Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolRegistrationOptions
2021-10-28 16:02:37.920 -07:00 [VRB] Document Selector [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1]
2021-10-28 16:02:37.921 -07:00 [VRB] Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.PsesDocumentSymbolHandler via [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcRequestHandler`2[[OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolParams, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.SymbolInformationOrDocumentSymbolContainer, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
2021-10-28 16:02:37.921 -07:00 [DBG] Swapping from "Serial" to "Parallel"
2021-10-28 16:02:37.921 -07:00 [DBG] Completing existing request process type "Serial"
2021-10-28 16:02:37.921 -07:00 [DBG] Queueing "Parallel":textDocument/documentSymbol:2 request for processing
2021-10-28 16:02:37.922 -07:00 [DBG] Finding descriptors for textDocument/codeAction
2021-10-28 16:02:37.943 -07:00 [VRB] Found attributes 1, ["powershell::file:///Users/andschwa/src/test.ps1"]
2021-10-28 16:02:37.943 -07:00 [VRB] Looking for handler for descriptors textDocument/codeAction
2021-10-28 16:02:37.943 -07:00 [VRB] Checking handler textDocument/codeAction:Microsoft.PowerShell.EditorServices.Handlers.PsesCodeActionHandler
2021-10-28 16:02:37.943 -07:00 [VRB] Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeActionRegistrationOptions
2021-10-28 16:02:37.943 -07:00 [VRB] Document Selector [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1]
2021-10-28 16:02:37.943 -07:00 [VRB] Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.PsesCodeActionHandler ffc73a6d-5840-4d44-be8f-a1edebeba3eb via [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcRequestHandler`2[[OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeActionParams, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.CommandOrCodeActionContainer, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
2021-10-28 16:02:37.943 -07:00 [DBG] Queueing "Parallel":textDocument/codeAction:3 request for processing
2021-10-28 16:02:38.053 -07:00 [DBG] Finding descriptors for textDocument/foldingRange
2021-10-28 16:02:38.057 -07:00 [VRB] Found attributes 1, ["powershell::file:///Users/andschwa/src/test.ps1"]
2021-10-28 16:02:38.057 -07:00 [VRB] Looking for handler for descriptors textDocument/foldingRange
2021-10-28 16:02:38.062 -07:00 [VRB] Checking handler textDocument/foldingRange:Microsoft.PowerShell.EditorServices.Handlers.PsesFoldingRangeHandler
2021-10-28 16:02:38.062 -07:00 [VRB] Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.FoldingRangeRegistrationOptions
2021-10-28 16:02:38.062 -07:00 [VRB] Document Selector [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1]
2021-10-28 16:02:38.062 -07:00 [VRB] Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.PsesFoldingRangeHandler via [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcRequestHandler`2[[OmniSharp.Extensions.LanguageServer.Protocol.Models.FoldingRangeRequestParam, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.Container`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.FoldingRange, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]], OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
2021-10-28 16:02:38.062 -07:00 [DBG] Queueing "Parallel":textDocument/foldingRange:4 request for processing
2021-10-28 16:02:38.107 -07:00 [DBG] Finding descriptors for textDocument/codeLens
2021-10-28 16:02:38.111 -07:00 [VRB] Found attributes 1, ["powershell::file:///Users/andschwa/src/test.ps1"]
2021-10-28 16:02:38.111 -07:00 [VRB] Looking for handler for descriptors textDocument/codeLens
2021-10-28 16:02:38.111 -07:00 [VRB] Checking handler textDocument/codeLens:Microsoft.PowerShell.EditorServices.Handlers.PsesCodeLensHandlers
2021-10-28 16:02:38.111 -07:00 [VRB] Registration options OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLensRegistrationOptions
2021-10-28 16:02:38.111 -07:00 [VRB] Document Selector [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1]
2021-10-28 16:02:38.111 -07:00 [VRB] Handler Selected: Microsoft.PowerShell.EditorServices.Handlers.PsesCodeLensHandlers ede1680c-30c9-4cb0-9185-74854a155385 via [powershell], [pwsh], [ps1], [psm1], [psd1], [**/*.ps*1] (targeting OmniSharp.Extensions.JsonRpc.IJsonRpcRequestHandler`2[[OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLensParams, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022],[OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLensContainer, OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022]])
2021-10-28 16:02:38.111 -07:00 [DBG] Queueing "Parallel":textDocument/codeLens:5 request for processing
2021-10-28 16:02:38.404 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.PSReadLine2, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.410 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2021-10-28 16:02:38.432 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2021-10-28 16:02:38.434 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2021-10-28 16:02:38.434 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.PSReadLine.Polyfiller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.447 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.PSReadLine.Polyfiller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.483 -07:00 [INF] ReadLine overridden with 'Microsoft.PowerShell.EditorServices.Services.PowerShell.Console.PsrlReadLine'
2021-10-28 16:02:38.856 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.857 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:38.928 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.928 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:38.928 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.928 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:38.929 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.929 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:38.974 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:38.974 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:39.218 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:39.221 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:39.222 -07:00 [VRB] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:39.222 -07:00 [DBG] Loading PSES DLL using new assembly load context
2021-10-28 16:02:39.553 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.EditorServices.VSCode, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:39.646 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Security.Claims, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
2021-10-28 16:02:40.157 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Reflection.Emit, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
2021-10-28 16:02:40.164 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: PowerShell Class Assembly, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:40.350 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
2021-10-28 16:02:40.354 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Drawing.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
2021-10-28 16:02:40.433 -07:00 [VRB] Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: PowerShell Class Assembly, Version=1.0.0.2, Culture=neutral, PublicKeyToken=null
2021-10-28 16:02:41.203 -07:00 [INF] Profiles loaded
2021-10-28 16:02:41.208 -07:00 [VRB] Loaded!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 17 (7 by maintainers)
Just FYI for anyone coming to this issue: we discovered it as we were testing the preview release. We decided that hey, it’s preview anyway, and our plan was to get this out by the end of October. Since we weren’t going to do another release tomorrow (seeing as it’s a Friday, and @rjmholt’s last day at Microsoft), and come Monday it’ll be November, we released regardless. The Preview will, of course have bugs seeing as it contains an entire rewrite of the pipeline execution model and, indeed, PowerShell Editor Services’ architecture as a whole. Please help us find those bugs, squash them, and cover them with regression tests!
Can everyone please test again with
v2021.11.0-preview? The whitespace one I didn’t manage to repro, but I think our fix should have taken care of it. If not, that would be great to know. ThePrivateDatais tracked separately in https://github.com/PowerShell/PowerShellEditorServices/issues/1607. Otherwise the other four issues were fixed in https://github.com/PowerShell/PowerShellEditorServices/pull/1604#issue-1039903784, and the tests are forthcoming (they actually already exist, but are in a suite of tests that needs to be set back up due to the pipeline work).Works like a charm!
The ‘whitespace one’ is also fixed. 😎
I feel like there are several different bugs in this thread, but for what it’s worth, if you keep your Documents in OneDrive and this bug causes them to fail to run, you can load your profile by hand with
. $Profile.CurrentUserAllHosts– or, if you actually have multiple profiles:@andschwa currently working on the Pester debug thing, I’m pretty close.
ConsoleHost:
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxyVisual Studio Code Host:
PrivateData :In my case the profile loads, but $host.privatedata is not settable, I assume maybe because PSES runs as a different host now and this isn’t exposed anymore? Should I be using $PSStyle instead? What about 5.1?
Thanks @kborowinski! Your report is fine there, I’ll be looking at this first thing Monday!
not sure if it’s related to that exact problem, but when I start
VSCode Insiders
on Powershell
with Extension Version
he is also not loading the profile and throwing:
“The term ‘C:\Users\USERPROFILE\OneDrive’ is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.”
interestingly it is not “error-colored”
The real path should be: C:\Users\USERPROFILE\OneDrive - XXXXXXX Corporation\Documents\PowerShell\Microsoft.VSCode_profile.ps1
So in my case there might be somewhere a problem with whitespaces in the path.