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.
because it does not exist messageI 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.
| Name | Version |
| --- | --- |
| Operating System | Windows_NT x64 10.0.17134 |
| VSCode | 1.27.1|
| PowerShell Extension Version | 1.8.4 |
|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(Click to Expand)
|Extension|Author|Version|
|---|---|---|
|PowerShell|ms-vscode|1.8.4|
|python|ms-python|2018.8.0|;
@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.
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