Skip to content

Profiles not loading in lastest preview #3650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
rjmholt opened this issue Oct 28, 2021 · 17 comments
Closed
5 tasks done

Profiles not loading in lastest preview #3650

rjmholt opened this issue Oct 28, 2021 · 17 comments
Assignees
Labels
Area-Extension Terminal Bug: Pre-release Bugs reproducing only in the pre-release extension. Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.

Comments

@rjmholt
Copy link
Contributor

rjmholt commented Oct 28, 2021

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

Steps to Reproduce

Put code in profile
Start PowerShell extension

Visuals

Screen Shot 2021-10-28 at 4 03 06 PM

Screen Shot 2021-10-28 at 4 03 36 PM

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!
@andyleejordan
Copy link
Member

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!

@WorrenB
Copy link

WorrenB commented Oct 29, 2021

not sure if it's related to that exact problem, but when I start

VSCode Insiders

1.62.0-insider
f961b92f0faec5c68124ab4d89922d38cf6f513d
x64

on Powershell

Name                           Value
----                           -----
PSVersion                      7.2.0-rc.1
PSEdition                      Core
GitCommitId                    7.2.0-rc.1
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

with Extension Version

ms-vscode.powershell-preview@2021.10.3

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.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Oct 29, 2021
@kborowinski
Copy link

kborowinski commented Oct 29, 2021

I found another issue that is related to this problem. The $profile variable is not initialized before the Microsoft.VSCode_profile.ps1 is loaded.

To test it create Microsoft.VSCode_profile.ps1 in folder Documents\WindowsPowerShell for PS 5.1 or Documents\PowerShell for PS 6 and 7 with following content and then start VSC:

Write-Host $profile

PowerShell Preview 2021.10.3:

PowerShell Preview 2021.10.1:

C:\Users\Bukem\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1

@andschwa Should I make separate issue or this is enough?

@andyleejordan
Copy link
Member

Thanks @kborowinski! Your report is fine there, I'll be looking at this first thing Monday!

@JustinGrote
Copy link
Collaborator

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?

{BFAC5364-CE55-46B9-A1B7-23D99ED3C4E5}

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Oct 29, 2021
@JustinGrote
Copy link
Collaborator

ConsoleHost:
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy

Visual Studio Code Host:
PrivateData :

@andyleejordan
Copy link
Member

@JustinGrote Just opened PowerShell/PowerShellEditorServices#1607. Want to take a crack at it? 😁

@JustinGrote
Copy link
Collaborator

@andschwa currently working on the Pester debug thing, I'm pretty close.

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 1, 2021
@andyleejordan andyleejordan self-assigned this Nov 1, 2021
@andyleejordan andyleejordan added this to the Committed-vNext milestone Nov 1, 2021
@Glober777
Copy link

I suspect that the issue is caused by whitespace characters in the path. This is what i see on my machine, when Integrated Console starts:
image

Not sure where it is happening because these errors don't get into the extension logs neither values of $Error contain any references.

@Jaykul
Copy link

Jaykul commented Nov 3, 2021

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:

$profile.PSObject.Properties.Value.Where({ Test-Path $_ }).ForEach({ . $_ })

@andyleejordan
Copy link
Member

@Jaykul, indeed, there are!

@andyleejordan
Copy link
Member

Ok, I believe I've resolved the issues here except @JustinGrote's note of the lack of PrivateData implementation.

@andyleejordan
Copy link
Member

And I'm not sure about whitespace 🤷

@andyleejordan andyleejordan added Resolution-Fixed Will close automatically. and removed Needs: Maintainer Attention Maintainer attention needed! labels Nov 3, 2021
@ghost
Copy link

ghost commented Nov 4, 2021

This issue has been marked as fixed. It has been automatically closed for housekeeping purposes.

@ghost ghost closed this as completed Nov 4, 2021
@andyleejordan
Copy link
Member

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. The PrivateData is tracked separately in PowerShell/PowerShellEditorServices#1607. Otherwise the other four issues were fixed in PowerShell/PowerShellEditorServices#1604 (comment), 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).

@WorrenB
Copy link

WorrenB commented Nov 4, 2021

The 'whitespace one' is also fixed. 😎

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 4, 2021
@Glober777
Copy link

Works like a charm!

@andyleejordan andyleejordan moved this to Done in Sea Biscuit Jan 24, 2022
@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jan 24, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Extension Terminal Bug: Pre-release Bugs reproducing only in the pre-release extension. Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.
Projects
No open projects
Status: Done
Development

No branches or pull requests

7 participants