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
Thanks so much for the brilliant extension for PowerShell support in Visual Studio Code, i seem to be having a weird error in which the PowerShell Editor Services is trying to access one of the folders under the $RECYCLE.BIN folder in my external usb drive (Which being a system folder is denied access to pretty much everyone but the system).
I am able to reproduce this error on the latest 1.2.0 version of the PowerShell extension, please see the details below and let me know if you'd like any additional info.
Steps to reproduce
I have enabled verbose logging and reproduced the issue a few time to generate some verbose logs, please find those zipped and attached here -> logs.zip
Right click on $computers and select the Find All References option
If i close Visual Studio Code completely or press Ctrl + Shift + P and choose Reload Window and follow the Steps to reproduce the terminating error reoccurs.
Once the error occurs, all PowerShell extension features stop working (Intellisense, PSScriptAnalyzer etc) until i either reload the window or close and reopen Visual Studio Code.
If i continue using Visual Studio Code after the error has occured, about a minute later Visual Studio Code will show an error up the top that says
The PowerShell session has terminated due to an error, would you like to restart it? Yes No Close
Oddly enough, if i follow the Steps to reproduce and skip step 2 the issue does not occur.
Expected behavior
Peek window should come up showing a reference to "foreach ($computer in $computers)"
Actual behavior
Peek window shows up with the text "Loading" and never finishes loading
Terminal shows the following error
PowerShell Integrated Console
PS E:\>
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.
Access to the path 'e:\$RECYCLE.BIN\S-1-5-21-1296309925-1638090579-3947801505-1001' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
at System.IO.FileSystemEnumerableIterator`1.MoveNext()
at Microsoft.PowerShell.EditorServices.Workspace.<EnumeratePSFiles>d__14.MoveNext()
at Microsoft.PowerShell.EditorServices.LanguageService.<FindReferencesOfSymbol>d__15.MoveNext()
---End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.<HandleReferencesRequest>d__31.MoveNext()
---End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc)
at System.Threading.Tasks.Task.Execute()
Environment data
Visual Studio Code 1.12.2
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
Extensions
Auto Fold 1.0.6
C# 1.10.0
C# XML Documentation Comments 0.0.15
Git History 0.2.0
PowerShell 1.2.0
VSCode Simpler icons with Angular 1.3.0
Hey @Bluecakes, thanks for the report! Seems like we aren't handling access denied exceptions correctly when we traverse the workspace path to find symbol references. Since you've used a top-level path as your workspace path, we seem to be digging into that drive's Recycle Bin folder.
Should be a simple fix, just need to catch that exception and ignore the files in that folder. I'll get it fixed for tomorrow's patch update!
daviwil
added a commit
to daviwil/PowerShellEditorServices
that referenced
this issue
Jun 1, 2017
This change fixes an issue where the Workspace's file enumeration logic
would throw an UnauthorizedAccessException when it encounters an
unaccessible file or path. The fix is to make the file enumeration code
more robust so that it catches these exceptions and continues
enumerating as far as it can.
ResolvesPowerShell/vscode-powershell#813.
This change fixes an issue where the Workspace's file enumeration logic
would throw an UnauthorizedAccessException when it encounters an
unaccessible file or path. The fix is to make the file enumeration code
more robust so that it catches these exceptions and continues
enumerating as far as it can.
ResolvesPowerShell/vscode-powershell#813.
Hey PowerShell extension team,
Thanks so much for the brilliant extension for PowerShell support in Visual Studio Code, i seem to be having a weird error in which the PowerShell Editor Services is trying to access one of the folders under the $RECYCLE.BIN folder in my external usb drive (Which being a system folder is denied access to pretty much everyone but the system).
I am able to reproduce this error on the latest 1.2.0 version of the PowerShell extension, please see the details below and let me know if you'd like any additional info.
Steps to reproduce
I have enabled verbose logging and reproduced the issue a few time to generate some verbose logs, please find those zipped and attached here -> logs.zip
If i close Visual Studio Code completely or press Ctrl + Shift + P and choose Reload Window and follow the Steps to reproduce the terminating error reoccurs.
Once the error occurs, all PowerShell extension features stop working (Intellisense, PSScriptAnalyzer etc) until i either reload the window or close and reopen Visual Studio Code.
If i continue using Visual Studio Code after the error has occured, about a minute later Visual Studio Code will show an error up the top that says
Oddly enough, if i follow the Steps to reproduce and skip step 2 the issue does not occur.
Expected behavior
Peek window should come up showing a reference to "foreach ($computer in $computers)"
Actual behavior
Peek window shows up with the text "Loading" and never finishes loading
Terminal shows the following error
Environment data
Visual Studio Code 1.12.2
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
Extensions
Auto Fold 1.0.6
C# 1.10.0
C# XML Documentation Comments 0.0.15
Git History 0.2.0
PowerShell 1.2.0
VSCode Simpler icons with Angular 1.3.0
Powershell PSVersionTable output
The text was updated successfully, but these errors were encountered: