Skip to content

PowerShell extension fails to start inside container #3466

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
4 tasks done
pcgeek86 opened this issue Jul 19, 2021 · 7 comments
Closed
4 tasks done

PowerShell extension fails to start inside container #3466

pcgeek86 opened this issue Jul 19, 2021 · 7 comments
Labels
Area-Startup Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.

Comments

@pcgeek86
Copy link
Contributor

pcgeek86 commented Jul 19, 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 have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

When attaching VSCode to a container, using the Remote - Containers extension, an exception is thrown in the logs, and the extension fails to startup. I'm using Docker Desktop to spin up a PowerShell 7.1.3 container "locally," and then attempting to attach to it.

PowerShell Version

PowerShell 7.1.3
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Linux 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021
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.58.2
c3f126316369cd610563c75b1b1725e0679adfb3
x64

Extension Version

Steps to Reproduce

  1. Run a new PowerShell container with Docker Desktop docker run --rm --interactive --tty mcr.microsoft.com/powershell
  2. Connect VSCode to container using Attach to Running Container command
  3. Create a new PowerShell script file
  4. Observe how extension fails to load. Starting PowerShell... text stays active in lower-right corner of VSCode window.

Visuals

image

Logs

[Warn  - 2:57:53 PM] OmniSharp.Extensions.LanguageServer.Server.LspServerOutputFilter: Tried to send request or notification before initialization was completed and will be sent later OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  } | @Request='OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  }'
[Warn  - 2:57:53 PM] OmniSharp.Extensions.LanguageServer.Server.LspServerOutputFilter: Tried to send request or notification before initialization was completed and will be sent later OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  } | @Request='OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  }'
[Warn  - 2:57:53 PM] OmniSharp.Extensions.LanguageServer.Server.LspServerOutputFilter: Tried to send request or notification before initialization was completed and will be sent later OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  } | @Request='OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  }'
[Warn  - 2:57:53 PM] OmniSharp.Extensions.LanguageServer.Server.LspServerOutputFilter: Tried to send request or notification before initialization was completed and will be sent later OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  } | @Request='OutgoingNotification { Method = powerShell/executionStatusChanged, Params = Microsoft.PowerShell.EditorServices.Services.PowerShellContext.ExecutionStatusChangedEventArgs, TraceParent = , TraceState =  }'
[Warn  - 2:57:53 PM] OmniSharp.Extensions.LanguageServer.Server.LspServerOutputFilter: Tried to send request or notification before initialization was completed and will be sent later OmniSharp.Extensions.JsonRpc.Server.Messages.InternalError | @Request='OmniSharp.Extensions.JsonRpc.Server.Messages.InternalError'
[Error - 2:57:53 PM] OmniSharp.Extensions.JsonRpc.InputHandler: Unknown error handling request - Newtonsoft.Json.JsonSerializationException: Error setting value to 'RootPath' on 'OmniSharp.Extensions.LanguageServer.Protocol.Models.InternalInitializeParams'.
 ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.String.get_Chars(Int32 index)
   at OmniSharp.Extensions.LanguageServer.Protocol.DocumentUri.File(String path)
   at lambda_method99(Closure , Object , Object )
   at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter.FindDescriptor(String method, JToken params)
   at OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter.FindDescriptor(IMethodWithParams instance)
   at OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter.GetDescriptors(Request request)
   at OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter.OmniSharp.Extensions.JsonRpc.IRequestRouter<OmniSharp.Extensions.JsonRpc.IHandlerDescriptor>.GetDescriptors(Request request)
   at OmniSharp.Extensions.JsonRpc.InputHandler.HandleRequest(ReadOnlySequence`1& request) | 
@pcgeek86 pcgeek86 added the Issue-Bug A bug to squash. label Jul 19, 2021
@ghost ghost added the Needs: Triage Maintainer attention needed! label Jul 19, 2021
@andyleejordan andyleejordan added Area-Startup and removed Needs: Triage Maintainer attention needed! labels Jul 19, 2021
@andyleejordan andyleejordan added this to the Consider-vNext milestone Jul 19, 2021
@andyleejordan
Copy link
Member

andyleejordan commented Jul 19, 2021

That looks like a pretty clear cut bug! I'll try to reproduce. Thanks for the report.

@andyleejordan
Copy link
Member

This will probably be fixed when we finish #3796 to fix #2153 and stop using the deprecated field rootPath.

@SydneyhSmith
Copy link
Collaborator

This reproed for me today

[Error - 6:48:27 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 6:48:27 PM] Connection to PowerShell Editor Services (the Extension Terminal) was closed. See below prompt to restart!
[Error - 6:48:27 PM] PowerShell Editor Services client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 

@SydneyhSmith SydneyhSmith removed their assignment Mar 13, 2023
@andyleejordan
Copy link
Member

@SydneyhSmith do you have any more detailed logs? Would love to know what the server said.

@SydneyhSmith
Copy link
Collaborator

SydneyhSmith commented Mar 13, 2023

Retested and got it running no problem 😄 -- looks resolved to me

@andyleejordan
Copy link
Member

Hurray!

@andyleejordan andyleejordan added the Resolution-Fixed Will close automatically. label Mar 13, 2023
@ghost ghost closed this as completed Mar 14, 2023
@ghost
Copy link

ghost commented Mar 14, 2023

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Startup Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.
Projects
None yet
Development

No branches or pull requests

3 participants