Vscode-powershell: Powershell terminal randomly crashes with "Access to the Path e:\ is denied"

Created on 7 Sep 2018  路  5Comments  路  Source: PowerShell/vscode-powershell

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|;

Area-Pester Issue-Bug

All 5 comments

@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"

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

Logs_DiagnosticOn.zip

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

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:\' !!!!!

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

Was this page helpful?
0 / 5 - 0 ratings