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

Visual Studio Code PowerShell Extension crashes when IntelliSense about to pop out on passing param to custom function #1513

Closed
victorwoo opened this issue Sep 3, 2018 · 10 comments
Assignees
Labels
Issue-Bug A bug to squash.

Comments

@victorwoo
Copy link

victorwoo commented Sep 3, 2018

System Details

- Operating system name and version: macOS High Sierra 10.13.6
- VS Code version: 1.26.1
- PowerShell extension version: v1.8.4
- Output from `$PSVersionTable`:
Name                           Value
----                           -----
PSVersion                      6.0.4
PSEdition                      Core
GitCommitId                    v6.0.4
OS                             Darwin 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul  6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS /Users/vichamp> code -v
1.26.1
493869ee8e8a846b0855873886fc79d480d342de
x64
PS /Users/vichamp> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      8      4      0


PS /Users/vichamp> code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
PS /Users/vichamp> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.4
PSEdition                      Core
GitCommitId                    v6.0.4
OS                             Darwin 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul  6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

function mytest {

}

mytest # extension crashes

PowerShell extension for Visual Studio Code crashes when InteliSense about to parse mytest custom function.

Attached Logs

logs.zip

@rjmholt
Copy link
Contributor

rjmholt commented Sep 3, 2018

Thanks for opening an issue @victorwoo. This looks like a crash in the URI class in the CodeLens reference provider.

The workaround is to disable CodeLens: #1174 (comment)

I suspect the non-ASCII characters are causing the crash (it's occurring when the AbsoluteUri property is referenced here). Hopefully we can fix it -- the crash seems to be occurring deep within the Uri class.

@rjmholt rjmholt self-assigned this Sep 3, 2018
@victorwoo
Copy link
Author

victorwoo commented Sep 4, 2018

Yes, the #1174 (comment) workaround works. Thanks!

Further information:
There are really some Chinese characters in the file path. I did some tests, and hope them helps:

PS /Users/vichamp/脚本/Reduce-Directory> (Get-Item ./test.ps1).FullName
/Users/vichamp/脚本/Reduce-Directory/test.ps1
PS /Users/vichamp/脚本/Reduce-Directory> (New-Object System.Uri ((Get-Item ./test.ps1).FullName)).AbsoluteUri
file://file:/Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory/test.ps1
PS /Users/vichamp/脚本/Reduce-Directory> (New-Object System.Uri ("file://" + (Get-Item ./test.ps1).FullName)).AbsoluteUri
# EMPTY OUTPUT HERE!
PS /Users/vichamp/脚本/Reduce-Directory>

@rjmholt
Copy link
Contributor

rjmholt commented Sep 4, 2018

I can't reproduce this on Ubuntu 18.04 LTS. It may be macOS specific.

@rjmholt
Copy link
Contributor

rjmholt commented Sep 19, 2018

I just tried this on my Mac (OS 10.13.6, PS 6.1.0):

PS| rob@Desktop> [uri]::new('file:///Users/vichamp/脚本/Reduce-Directory/test.ps1').AbsoluteUri
file:///Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory/test.ps1/Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory/test.ps1

@TylerLeonhardt
Copy link
Member

@victorwoo it looks like this might have been an issue in .NET Core 2.0 which was what we used in PowerShell Core 6.0.4.

Can you upgrade to PowerShell Core 6.1 and try again?

@TylerLeonhardt
Copy link
Member

PS Core 6.1:

> [Uri]::new("/Users/vichamp/脚本/Reduce-Directory").AbsoluteUri
file:///Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory/Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory

PS Core 6.0.4:

>   [Uri]::new("/Users/vichamp/脚本/Reduce-Directory").AbsoluteUri                                                             
file://file:/Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory

Note the extra file:.

@rjmholt rjmholt removed the OS-macOS label Sep 19, 2018
@victorwoo
Copy link
Author

On macOS 10.13.6 (17G2307)

PS Core 6.0.4:

PS /Users/vichamp> [Uri]::new("/Users/vichamp/脚本/Reduce-Directory").AbsoluteUri                   file://file:/Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory
PS /Users/vichamp> [uri]::new('file:///Users/vichamp/脚本/Reduce-Directory/test.ps1').AbsoluteUri   
# EMPTY

PS Core 6.1.0:

PS /Users/vichamp> [Uri]::new("/Users/vichamp/脚本/Reduce-Directory").AbsoluteUri    
file:///Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory/Users/vichamp/%E8%84%9A%E6%9C%AC/Reduce-Directory

I think the result on PS Core 6.1 still error.

@rjmholt
Copy link
Contributor

rjmholt commented Sep 25, 2018

Yes, try $uri.LocalPath

@victorwoo
Copy link
Author

On macOS 10.13.6 (17G2307) with PS Core 6.1.0:

PS /Users/vichamp> [Uri]::new("/Users/vichamp/脚本/Reduce-Directory").LocalPath
/Users/vichamp/脚本/Reduce-Directory

It seems OK.

@victorwoo
Copy link
Author

Update to PowerShell Extension 1.9.0 and this issue disappears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants