Skip to content

VS Code file preview Uris crash the language server #312

Closed
@daviwil

Description

@daviwil

It appears that when VS Code previews a find/replace in the UI it sends a Uri like this to the language server: private:/c%3A/Github/Posh-Teamviewer/Build.PSDeploy.ps1#preview. It's likely that the language server should just ignore Uris starting with private:/.

Here are the logs from @gerane which show the stack trace:

12/7/2016 9:50:08 AM [VERBOSE] - Method "ReadMessage" at line 111 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    READ MESSAGE:
    
    {
      "jsonrpc": "2.0",
      "method": "textDocument/didOpen",
      "params": {
        "uri": "private:/c%3A/Github/Posh-Teamviewer/Build.PSDeploy.ps1#preview",
        "text": "Deploy Posh-Teamviewer {\r\n    \r\n    By PlatyPS {\r\n        FromSource \"$BHProjectPath\\docs\\Commands\"\r\n        To \"$BHProjectPath\\Posh-Teamviewer\\en-US\"\r\n        Tagged Help\r\n        WithOptions @{\r\n            Force = $true\r\n        }\r\n    }\r\n\r\n    By FileSystem {\r\n        FromSource $ENV:BHProjectName\r\n        To \"$home\\Documents\\WindowsPowerShell\\Modules\\Posh-Teamviewer\"\r\n        Tagged Prod, Module, Local\r\n        WithOptions @{\r\n            Mirror = $true\r\n        }\r\n        WithPostScript {\r\n            Import-Module -Name Posh-Teamviewer -Force\r\n        }\r\n    }\r\n\r\n    By PSGalleryModule {\r\n        FromSource $ENV:BHProjectName\r\n        To PSGallery\r\n        Tagged PSGallery\r\n        WithOptions @{\r\n            ApiKey = $ENV:NugetApiKey\r\n        }\r\n    }\r\n}"
      }
    }

12/7/2016 9:50:08 AM [ERROR] - Method "OnListenTaskCompleted" at line 334 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageDispatcher.cs

    MessageDispatcher 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.GetFileBuffer(String filePath, String initialBuffer)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidOpenTextDocumentNotification(DidOpenTextDocumentNotification openParams, EventContext eventContext)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass27_0`1.<SetEventHandler>b__0(Message eventMessage, MessageWriter messageWriter)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__34.MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions