Skip to content

powershell.exe terminated or terminal UI was closed #1211

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
yoke88 opened this issue Feb 23, 2018 · 2 comments · Fixed by PowerShell/PowerShellEditorServices#641
Closed
Labels
Issue-Bug A bug to squash.

Comments

@yoke88
Copy link

yoke88 commented Feb 23, 2018

System Details

  • Operating system name and version: deepin linux 15.5
  • VS Code version: 1.19.0-1513245498
  • PowerShell extension version: 6.0.1
  • Output from $PSVersionTable:
PS /> code -v                                                                                               
1.20.1
f88bbf9137d24d36d968ea6b2911786bfe103002
x64
PS /> $pseditor.EditorServicesVersion                                                                       
PS /> code --list-extensions --show-versions                                                                
[email protected]
PS /> $PSVersionTable                                                                                       

Name                           Value                                                                       
----                           -----                                                                       
PSVersion                      6.0.1                                                                       
PSEdition                      Core                                                                        
GitCommitId                    v6.0.1                                                                      
OS                             Linux 4.9.0-deepin13-amd64 #1 SMP PREEMPT Deepin 4.9.57-1 (2017-10-19)      
Platform                       Unix                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                     
PSRemotingProtocolVersion      2.3                                                                         
SerializationVersion           1.1.0.1                                                                     
WSManStackVersion              3.0                                                                         

Issue Description

when i open a script , script content is below: there will be a prompt ask for 'The powershell session has terminated due to an error,would you like to restart it ,if i click yes ,after a few minutes ,the prompt appear again.

function get-key{
    [cmdletbinding(ConfirmImpact="medium",
    SupportsShouldProcess=$true
    )]
    [outputtype( )]
    param(
        [Parameter(ParameterSetName="ps1",Mandatory=$true,Position=1,ValueFromPipeline=$true)]
        [ValidateSet("AA","BB")]
        [string]
        $set
    )
    begin{

    }
    process{
        if($PSCmdlet.ShouldProcess("ouput value of `$set =$set","output")){
            Write-Output $set
        }
    }
    end{

    }
}

"AA","BB" |get-key 

Attached Logs

EditorServices.log

@rkeithhill
Copy link
Contributor

The interesting bits of the log are:

2018-02-23 20:23:14 [WARNING] - Method "GetVersionDetails" at line 153 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellVersionDetails.cs

    Failed to look up PowerShell version, defaulting to version 5.
    
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.PowerShell.EditorServices.PowerShellContext.<>c__56`1.<ExecuteScriptAndGetItem>b__56_0(PSObject pso)
       at System.Linq.Enumerable.SelectIListIterator`2.MoveNext()
       at System.Linq.Enumerable.<OfTypeIterator>d__32`1.MoveNext()
       at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at Microsoft.PowerShell.EditorServices.PowerShellContext.ExecuteScriptAndGetItem[TResult](String scriptToExecute, Runspace runspace, TResult defaultValue)
       at Microsoft.PowerShell.EditorServices.Session.PowerShellVersionDetails.GetVersionDetails(Runspace runspace, ILogger logger)

2018-02-23 20:23:14 [NORMAL] - Method "Initialize" at line 220 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    PowerShell runtime version: 6.0.1, edition: Core

I've seen this "failure to look upPower Shell version, defaulting to version 5" several times now. It needs to be looked into.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Feb 26, 2018

Yeah I can look into this since I repro it consistently.

Thanks for the report @yoke88!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants