Skip to content
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

Powershell terminal randomly crashes with "Access to the Path e:\ is denied" #1518

Closed
MayPLaY opened this issue Sep 7, 2018 · 5 comments · Fixed by PowerShell/PowerShellEditorServices#749 or PowerShell/PowerShellEditorServices#750
Assignees
Labels
Area-Pester Issue-Bug A bug to squash.

Comments

@MayPLaY
Copy link

MayPLaY commented Sep 7, 2018

Issue Description

Hi!

A coworker gave me one of his file to review it. The file got this line:
installCAIS_Traitement -ConfigurationData "E:\Sources\DSQ_INSTALL_CAIS_Traitement_LabFrancois.psd1" -OutputPath "./MOF"

It randomly (2-3 times/day) makes my Powershell terminal (EditorServices) crashes with this error :
System.AggregateException: One or more errors occurred. ---> System.UnauthorizedAccessException: Access to the path 'e:\' is denied.

  • I do have an e:\ drive mapped.
  • I do not have a folder name "Sources" nor the specified file on my computer.
  • My powershell terminal has no problem accessing the e:\ drive.
  • Running a get-content command with the specified path gives the expected because it does not exist message
  • Security on drive is basic stuff.
  • See the logs below.

I didn't find a way to reproduce it. I haven't try to create the specified folder/file since my gut tells me the problem isn't there . Removing the line seems to fix the problem.

Thanks.

Attached Logs

Log.zip

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17134
VSCode 1.27.1
PowerShell Extension Version 1.8.4

PowerShell Information

Name Value
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.17134.228
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
PowerShell ms-vscode 1.8.4
python ms-python 2018.8.0
@TylerLeonhardt
Copy link
Member

@MayPLaY thanks for this! We will handle that exception better. Can you do me a favor though - can you send me the logs with Diagnostic logging turned on? It's a setting:

"powershell.developer.editorServicesLogLevel": "Diagnostic"

@MayPLaY
Copy link
Author

MayPLaY commented Sep 19, 2018

@tylerl0706 There you go, fresh logs from this morning.

Logs_DiagnosticOn.zip

@rjmholt
Copy link
Contributor

rjmholt commented Sep 19, 2018

This looks like two bugs happening here!

The PR above fixes the behaviour you're seeing (because it catches the UnauthorizedAccessException.

But it's resolving the wrong path too here. You send through "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" and a moment later it logs Resolved path: e:\! I'll have a look into it

@rjmholt
Copy link
Contributor

rjmholt commented Sep 19, 2018

Ok here's a fun repro:

$path = 'file:///e%3A/%23Libraries/iCloudDrive'
$uri = [uri]::new([uri]::UnescapeDataString($path))
$uri.AbsoluteUri # 'file:///e:/#Libraries/iCloudDrive/' :)
$uri.LocalPath # 'e:\' !!!!!

@rjmholt
Copy link
Contributor

rjmholt commented Sep 19, 2018

It looks like we need to not unescape the data string... LocalPath already does that

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
3 participants