Skip to content

PowerShell crashes when selecting file from Explorer Pane #1843

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
mpearon opened this issue Apr 3, 2019 · 4 comments
Closed

PowerShell crashes when selecting file from Explorer Pane #1843

mpearon opened this issue Apr 3, 2019 · 4 comments
Assignees
Labels
Area-Pester Issue-Bug A bug to squash.

Comments

@mpearon
Copy link

mpearon commented Apr 3, 2019

System Details

System Details Output

### VSCode version: 1.32.3 a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4 x64

### VSCode extensions:
aaron-bond.better-comments@2.0.3
alexcvzz.vscode-sqlite@0.6.0
Compulim.vscode-clock@0.0.1
DotJoshJohnson.xml@2.4.0
eamodio.gitlens@9.5.1
earshinov.sort-lines-by-selection@0.0.3
fabiospampinato.vscode-github-notifications-bell@2.1.5
formulahendry.vscode-mysql@0.4.0
GrapeCity.gc-excelviewer@2.1.29
hoovercj.vscode-power-mode@2.2.0
idleberg.applescript@0.14.2
johnstoncode.svn-scm@1.47.12
Kelvin.vscode-sshfs@1.14.6
le0zh.vscode-regexp-preivew@0.0.3
mkloubert.vscode-remote-workspace@0.42.0
ms-mssql.mssql@1.5.0
ms-vscode.powershell-preview@2.0.1
ms-vsliveshare.vsliveshare@1.0.18
ms-vsliveshare.vsliveshare-audio@0.1.48
nonoroazoro.syncing@2.1.5
rafaelmaiolla.remote-vscode@1.1.0
shyykoserhiy.git-autoconfig@0.0.1
softwaredotcom.swdc-vscode@0.14.2
Tyriar.sort-lines@1.8.0
WakaTime.vscode-wakatime@1.2.13
yzhang.markdown-all-in-one@2.2.0

### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value                                                                                                             
----                           -----                                                                                                             
PSVersion                      5.1.17763.316                                                                                                     
PSEdition                      Desktop                                                                                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                           
BuildVersion                   10.0.17763.316                                                                                                    
CLRVersion                     4.0.30319.42000                                                                                                   
WSManStackVersion              3.0                                                                                                               
PSRemotingProtocolVersion      2.3                                                                                                               
SerializationVersion           1.1.0.1                                                                                                           

Issue Description

PowerShell Session Reliability

Expected Behaviour

PowerShell Session should remain active during file operations

Actual Behaviour

When selecting files from the Explorer Pane, the PowerShell session crashes.

Other Info

  • If I create a new file, the PowerShell session remains functional.
  • If I restart the session after opening from the Explorer Pane, it crashes again.
  • To rule out compatibility issues I've taken the following steps:
    • Disabled all extensions other than PowerShell
    • Removed PowerShell Preview and reverted to PowerShell

Attached Logs

vsCode-ESLogs.zip
vCode-PSCrash

@rkeithhill
Copy link
Contributor

Thanks for attaching log files. Here is the relevant bit of the log:

2019-04-03 09:11:21.945 [VERBOSE] tid:18 in 'ReadMessageAsync' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs: line 138
    Received Request 'codeLens/resolve' with id 7
    
    {
      "jsonrpc": "2.0",
      "id": 7,
      "method": "codeLens/resolve",
      "params": {
        "range": {
          "start": {
            "line": 4,
            "character": 0
          },
          "end": {
            "line": 22,
            "character": 1
          }
        },
        "data": {
          "uri": "file:///file%3A%2F%2FREDACTED-SERVERNAME%2FS%2524%2FScripts%2FPowershellProfile%2FPAM.ps1",
          "providerId": "Microsoft.PowerShell.EditorServices.CodeLenses.ReferencesCodeLensProvider"
        }
      }
    }

2019-04-03 09:11:22.558 [ERROR] tid:6 in 'OnListenTaskCompleted' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: line 391
    ProtocolEndpoint message loop terminated due to unhandled exception:
    
    System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: The given path's format is not supported.
       at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
       at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
       at Microsoft.PowerShell.EditorServices.Workspace.ResolveFilePath(String filePath)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.CodeLenses.CodeLensFeature.<HandleCodeLensResolveRequestAsync>d__6.MoveNext()

I think I know what is going on here. We made a change to make file URIs returned to the LSP client (VSCode) use the proper document URI format. That part is corrrect. But it looks like the internals of the CodeLensFeature code is not expecting that URI format. I think it should not be using ClientFilePath in this case but FilePath instead.

@rkeithhill rkeithhill self-assigned this Apr 3, 2019
@rkeithhill rkeithhill added Area-Pester Issue-Bug A bug to squash. labels Apr 3, 2019
@rjmholt
Copy link
Contributor

rjmholt commented Apr 3, 2019

Looks like this is a duplicate of #1830

@rjmholt rjmholt closed this as completed Apr 3, 2019
@mpearon
Copy link
Author

mpearon commented Apr 3, 2019

Thank you for your quick response, @rkeithhill!

@rjmholt Yep, you're right. Sorry - I don't think my query terms found that. I'll watch the other issue,

@mpearon
Copy link
Author

mpearon commented Apr 3, 2019

Another related issue: #887

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

No branches or pull requests

3 participants