You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 10 CU
VSCode 1.12.2
Extension 1.2.0
PS 5.1.15063.296
Issue Description
This is the error I get in the PSIC:
PowerShell Integrated Console
~\Documents\WindowsPowerShell
1:74ms>
A terminating error occurred in PowerShell Editor Services:
One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.WaitForExit()
at CallSite.Target(Closure , CallSite , Object )
One or more errors occurred.
Could not find file 'C:\Users\hillr\Documents\WindowsPowerShell\Untitled-1'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServerEditorOperations.ConvertClientEditorContext(ClientEditorContext clientCont
ext)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleInvokeExtensionCommandRequest(InvokeExtensionCommandRequest command
Details, RequestContext`1 requestContext)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass3_0`4.<SetRequestHandler>b__0(Message reques
tMessage, MessageWriter messageWriter)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
at System.Threading.Tasks.Task.Execute()
It might actually be failing on accessing CurrentFile.
Here are the contents of my Microsoft.VSCode_profile.ps1 file:
# Lame semicolon remover - doesn't understand here strings or commentsfunctionRemove-TrailingSemicolon {
param(
[Parameter()]
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]
$editorContext=$psEditor.GetEditorContext()
)
$currentFile=$editorContext.CurrentFile;
$lines=$currentFile.GetTextLines();
for ($i=0; $i-lt$lines.Count; $i++) {
$line=$lines[$i]
if ($line-match'^(.*?);(\s*)$') {
$startCol=$matches[1].Length +1$currentFile.InsertText('',$i+1,$startCol,$i+1,$startCol+1)
}
}
}
$params=@{
Name='KH.RemoveUnnecessarySemicolons'DisplayName='Remove unnecessary semicolons'Function='Remove-TrailingSemicolon'SuppressOutput=$true
}
Register-EditorCommand@params
Attached Logs
5/31/2017 4:35:21 PM [VERBOSE] - Method "ReadMessage" at line 111 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs
READ MESSAGE:
{
"jsonrpc": "2.0",
"id": 17,
"method": "powerShell/invokeExtensionCommand",
"params": {
"name": "KH.RemoveUnnecessarySemicolons",
"context": {
"currentFilePath": "Untitled-1",
"cursorPosition": {
"line": 9,
"character": 0
},
"selectionRange": {
"start": {
"line": 9,
"character": 0
},
"end": {
"line": 9,
"character": 0
}
}
}
}
}
5/31/2017 4:35:21 PM [VERBOSE] - Method "ResolveFilePath" at line 316 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Workspace\Workspace.cs
Resolved path: C:\Users\hillr\Documents\WindowsPowerShell\Untitled-1
5/31/2017 4:35:21 PM [ERROR] - Method "OnListenTaskCompleted" at line 494 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs
MessageDispatcher loop terminated due to unhandled exception:
System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not find file 'C:\Users\hillr\Documents\WindowsPowerShell\Untitled-1'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServerEditorOperations.ConvertClientEditorContext(ClientEditorContext clientContext)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleInvokeExtensionCommandRequest(InvokeExtensionCommandRequest commandDetails, RequestContext`1 requestContext)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass3_0`4.<SetRequestHandler>b__0(Message requestMessage, MessageWriter messageWriter)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.FileNotFoundException: Could not find file 'C:\Users\hillr\Documents\WindowsPowerShell\Untitled-1'.
File name: 'C:\Users\hillr\Documents\WindowsPowerShell\Untitled-1'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServerEditorOperations.ConvertClientEditorContext(ClientEditorContext clientContext)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleInvokeExtensionCommandRequest(InvokeExtensionCommandRequest commandDetails, RequestContext`1 requestContext)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<>c__DisplayClass3_0`4.<SetRequestHandler>b__0(Message requestMessage, MessageWriter messageWriter)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
at System.Threading.Tasks.Task.Execute()<---
The text was updated successfully, but these errors were encountered:
This change fixes an issue which causes the language server to crash
when running a registered $psEditor command from within an untitled
file. This happens because the workspace code in the language server
expects to receive Uri paths instead of local file paths when referring
to an editor buffer. The fix is to send the untitled file's Uri instead
of its non-existent file path.
ResolvesPowerShell#810.
Resolves PowerShell/PowerShellEditorServices PowerShell#434.
This change fixes an issue which causes the language server to crash
when running a registered $psEditor command from within an untitled
file. This happens because the workspace code in the language server
expects to receive Uri paths instead of local file paths when referring
to an editor buffer. The fix is to send the untitled file's Uri instead
of its non-existent file path.
Resolves#810.
Resolves PowerShell/PowerShellEditorServices #434.
System Details
Issue Description
This is the error I get in the PSIC:
It might actually be failing on accessing
CurrentFile
.Here are the contents of my Microsoft.VSCode_profile.ps1 file:
Attached Logs
The text was updated successfully, but these errors were encountered: