{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/vscode/issues/58985","repository_url":"https://api.github.com/repos/Microsoft/vscode","labels_url":"https://api.github.com/repos/Microsoft/vscode/issues/58985/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode/issues/58985/comments","events_url":"https://api.github.com/repos/Microsoft/vscode/issues/58985/events","html_url":"https://github.com/Microsoft/vscode/issues/58985","id":361935257,"node_id":"MDU6SXNzdWUzNjE5MzUyNTc=","number":58985,"title":"textDocument/hover sends escaped colon after drive letter","user":{"login":"rjmholt","id":7009879,"node_id":"MDQ6VXNlcjcwMDk4Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/7009879?v=4","gravatar_id":"","url":"https://api.github.com/users/rjmholt","html_url":"https://github.com/rjmholt","followers_url":"https://api.github.com/users/rjmholt/followers","following_url":"https://api.github.com/users/rjmholt/following{/other_user}","gists_url":"https://api.github.com/users/rjmholt/gists{/gist_id}","starred_url":"https://api.github.com/users/rjmholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjmholt/subscriptions","organizations_url":"https://api.github.com/users/rjmholt/orgs","repos_url":"https://api.github.com/users/rjmholt/repos","events_url":"https://api.github.com/users/rjmholt/events{/privacy}","received_events_url":"https://api.github.com/users/rjmholt/received_events","type":"User","site_admin":false},"labels":[{"id":272689392,"node_id":"MDU6TGFiZWwyNzI2ODkzOTI=","url":"https://api.github.com/repos/Microsoft/vscode/labels/feature-request","name":"feature-request","color":"dcdcdc","default":false},{"id":578047123,"node_id":"MDU6TGFiZWw1NzgwNDcxMjM=","url":"https://api.github.com/repos/Microsoft/vscode/labels/under-discussion","name":"under-discussion","color":"dcdcdc","default":false},{"id":735145427,"node_id":"MDU6TGFiZWw3MzUxNDU0Mjc=","url":"https://api.github.com/repos/Microsoft/vscode/labels/uri","name":"uri","color":"c5def5","default":false}],"state":"closed","locked":false,"assignee":{"login":"jrieken","id":1794099,"node_id":"MDQ6VXNlcjE3OTQwOTk=","avatar_url":"https://avatars2.githubusercontent.com/u/1794099?v=4","gravatar_id":"","url":"https://api.github.com/users/jrieken","html_url":"https://github.com/jrieken","followers_url":"https://api.github.com/users/jrieken/followers","following_url":"https://api.github.com/users/jrieken/following{/other_user}","gists_url":"https://api.github.com/users/jrieken/gists{/gist_id}","starred_url":"https://api.github.com/users/jrieken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrieken/subscriptions","organizations_url":"https://api.github.com/users/jrieken/orgs","repos_url":"https://api.github.com/users/jrieken/repos","events_url":"https://api.github.com/users/jrieken/events{/privacy}","received_events_url":"https://api.github.com/users/jrieken/received_events","type":"User","site_admin":false},"assignees":[{"login":"jrieken","id":1794099,"node_id":"MDQ6VXNlcjE3OTQwOTk=","avatar_url":"https://avatars2.githubusercontent.com/u/1794099?v=4","gravatar_id":"","url":"https://api.github.com/users/jrieken","html_url":"https://github.com/jrieken","followers_url":"https://api.github.com/users/jrieken/followers","following_url":"https://api.github.com/users/jrieken/following{/other_user}","gists_url":"https://api.github.com/users/jrieken/gists{/gist_id}","starred_url":"https://api.github.com/users/jrieken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrieken/subscriptions","organizations_url":"https://api.github.com/users/jrieken/orgs","repos_url":"https://api.github.com/users/jrieken/repos","events_url":"https://api.github.com/users/jrieken/events{/privacy}","received_events_url":"https://api.github.com/users/jrieken/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/vscode/milestones/78","html_url":"https://github.com/Microsoft/vscode/milestone/78","labels_url":"https://api.github.com/repos/Microsoft/vscode/milestones/78/labels","id":3639536,"node_id":"MDk6TWlsZXN0b25lMzYzOTUzNg==","number":78,"title":"October 2018","description":"","creator":{"login":"Tyriar","id":2193314,"node_id":"MDQ6VXNlcjIxOTMzMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2193314?v=4","gravatar_id":"","url":"https://api.github.com/users/Tyriar","html_url":"https://github.com/Tyriar","followers_url":"https://api.github.com/users/Tyriar/followers","following_url":"https://api.github.com/users/Tyriar/following{/other_user}","gists_url":"https://api.github.com/users/Tyriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Tyriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tyriar/subscriptions","organizations_url":"https://api.github.com/users/Tyriar/orgs","repos_url":"https://api.github.com/users/Tyriar/repos","events_url":"https://api.github.com/users/Tyriar/events{/privacy}","received_events_url":"https://api.github.com/users/Tyriar/received_events","type":"User","site_admin":false},"open_issues":132,"closed_issues":26,"state":"open","created_at":"2018-09-10T14:15:00Z","updated_at":"2018-10-01T11:48:05Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2018-09-19T21:29:53Z","updated_at":"2018-10-01T11:48:05Z","closed_at":"2018-10-01T11:48:05Z","author_association":"MEMBER","body":"<!-- Please search existing issues to avoid creating duplicates. --> \r\n<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: https://code.visualstudio.com/insiders/ -->\r\n\r\n<!-- Use Help > Report Issue to prefill these. -->\r\n- VSCode Version:\r\n```\r\n1.28.0-insider\r\n29e6dce4352db76d8956035990b8630580226588\r\nx64\r\n```\r\n- OS Version:\r\n```\r\n10.0.18242 N/A Build 18242\r\n```\r\n\r\nI work on the PowerShell extension/language service for VSCode, and we have [a bug report](https://github.com/PowerShell/vscode-powershell/issues/1518) where PowerShellEditorServices crashes because we render the wrong path; there's a `#` character in the path and `System.Uri` in C# drops everything after the `#` as a fragment. Easy fix -- we shouldn't escape the path prematurely, but I wondered why it was done in the first place (since it's more effort).\r\n\r\nI was working on [the fix PR](https://github.com/PowerShell/PowerShellEditorServices/pull/750#discussion_r218946581) and @SeeminglyScience noticed I haven't escaped the `:` after drive letters in the URIs in the tests. I escape it and everything crashes.\r\n\r\nBut looking at the [logs](https://github.com/PowerShell/vscode-powershell/files/2361566/Log.zip) I notice that VSCode itself is sending the colon escaped:\r\n```\r\n2018-09-19 09:21:46.574 [DIAGNOSTIC] C:\\PowerShellEditorServices\\src\\PowerShellEditorServices.Protocol\\MessageProtocol\\MessageReader.cs: In method 'ReadMessage', line 114:\r\n    READ MESSAGE:\r\n    \r\n    {\r\n      \"jsonrpc\": \"2.0\",\r\n      \"id\": 18,\r\n      \"method\": \"textDocument/hover\",\r\n      \"params\": {\r\n        \"textDocument\": {\r\n          \"uri\": \"file:///e%3A/%23Libraries/iCloudDrive/%23%23%23Travail%23%23%23/CurrentWork/Powershell/DSC/EssaiDSC/Validation/DSQ_ITEC_CAIS_TRAITEMENT/DSQ_INSTALL_CAIS_Traitement.ps1\"\r\n        },\r\n        \"position\": {\r\n          \"line\": 45,\r\n          \"character\": 34\r\n        }\r\n      }\r\n    }\r\n\r\n2018-09-19 09:21:46.574 [VERBOSE] C:\\PowerShellEditorServices\\src\\PowerShellEditorServices.Protocol\\MessageProtocol\\MessageReader.cs: In method 'ReadMessage', line 123:\r\n    Received Request 'textDocument/hover' with id 18\r\n\r\n2018-09-19 09:21:46.574 [VERBOSE] C:\\PowerShellEditorServices\\src\\PowerShellEditorServices\\Workspace\\Workspace.cs: In method 'ResolveFilePath', line 378:\r\n    Resolved path: e:\\\r\n\r\n2018-09-19 09:21:46.580 [ERROR] C:\\PowerShellEditorServices\\src\\PowerShellEditorServices.Protocol\\MessageProtocol\\ProtocolEndpoint.cs: In method 'OnListenTaskCompleted', line 391:\r\n    ProtocolEndpoint message loop terminated due to unhandled exception:\r\n    \r\n    System.AggregateException: One or more errors occurred. ---> System.UnauthorizedAccessException: Access to the path 'e:\\' is denied.\r\n       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)\r\n       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)\r\n       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleHoverRequest>d__41.MoveNext()\r\n    --- End of stack trace from previous location where exception was thrown ---\r\n       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()\r\n    --- End of stack trace from previous location where exception was thrown ---\r\n       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()\r\n    --- End of stack trace from previous location where exception was thrown ---\r\n       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)\r\n       at System.Threading.Tasks.Task.Execute()\r\n       --- End of inner exception stack trace ---\r\n    ---> (Inner Exception #0) System.UnauthorizedAccessException: Access to the path 'e:\\' is denied.\r\n       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)\r\n       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)\r\n       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleHoverRequest>d__41.MoveNext()\r\n    --- End of stack trace from previous location where exception was thrown ---\r\n       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()\r\n    --- End of stack trace from previous location where exception was thrown ---\r\n       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()\r\n    --- End of stack trace from previous location where exception was thrown ---\r\n       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)\r\n       at System.Threading.Tasks.Task.Execute()<---\r\n    \r\n\r\n2018-09-19 09:21:46.580 [ERROR] C:\\PowerShellEditorServices\\src\\PowerShellEditorServices.Host\\EditorServicesHost.cs: In method 'ProtocolEndpoint_UnhandledException', line 435:\r\n    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.\r\n```\r\n\r\nI notice that in the examples I can find of `file://` scheme URIs, the drive letter's colon is never escaped:\r\n- [RFC 8089 - The \"file\" URI Scheme](https://tools.ietf.org/html/rfc8089#appendix-E.2)\r\n- [IE Blog from 2006 on file URIs](https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/)\r\n- [The Wikipedia article on the file URI scheme](https://en.wikipedia.org/wiki/File_URI_scheme)\r\n- [The IETF draft on the file URI scheme](https://tools.ietf.org/id/draft-kerwin-file-scheme-07.html#drive-letters)\r\n- [Various](https://stackoverflow.com/questions/12685797/drive-letter-from-uri-type-file-path-in-c-sharp/12685924) StackOverflow [posts](https://stackoverflow.com/questions/12685797/drive-letter-from-uri-type-file-path-in-c-sharp)\r\n\r\nThe [only issue I can find on this with VSCode](https://github.com/Microsoft/vscode/issues/2990) is about needing to use the right method on the node `Uri` class to avoid this issue.\r\n\r\nBut we're seeing this problem in the encoding of a message VSCode itself is sending.\r\n\r\nIs this intended behaviour? Is there a standard way to handle this?"}}
{"actor":{"display_login":"jrieken"}}