-
Notifications
You must be signed in to change notification settings - Fork 393
Format Document crashing #1057
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
Comments
@Xaliba101 Were you running your PowerShell commands inside VSCode's integrated PowerShell terminal (which you should in this case) or in a 'normal' PowerShell window?
We should first find out what your environment issues are but at a later stage, I am pretty sure that a |
@rjmholt Yes this is what I'm running inside VSCode.
|
@Xaliba101 I think above you've imported the wrong module -- ScriptAnalyzer.psm1 is a script module, but most of PSScriptAnalyzer comes in binaries. You need to find the directory containing PSScriptAnalyzer.psd1 and import that (the directory). Anyway, I've just opened a PR to fix a possible PSES crash we were seeing. The output in your latest comment looks like you haven't got PSScriptAnalyzer installed on your system anywhere. The version used by the VSCode extension should be at I suspect the empty output you saw before was due to using the PowerShell terminal provided by VSCode and not the PowerShell Integrated Console provided by the PowerShell VSCode extension. |
Documenting my steps here:
Again, didn't really want to say yes but I did anyway. |
Can you see if PSScriptAnalyzer exists here: |
What happens when you try to import that path and then run |
Here is my results:
The Format Document worked. NOTE: I log on to the computer using a standard user account. When I run VSCode I run as a user with admin privilages |
So I guess what I have done to get this resolved is:
|
Actually, yeah it shouldn't come up in Anyway, I think I've addressed the issue you were having in a PR, so hopefully it will be fixed properly in the next release. |
@rjmholt Should we close the issue then? |
@bergmeister yes, I think we've established pretty firmly that this is/was a PSES issue. |
Steps to reproduce
Open any powershell script
Press Alt+Shift+F or right click and select 'Format Document'
Expected behavior
Format document
Actual behavior
Powershell Extension crashes
Turned on verbose logging and this is what it outputs:
8/16/2018 2:07:32 PM [VERBOSE] - Formatting entire document - file://(FILEPATH)/RemoveAllNetworkPrintersv2.ps1...
8/16/2018 2:07:32 PM [VERBOSE] - Document formatting failed in 0.064: Error: Connection got disposed.
8/16/2018 2:07:35 PM [NORMAL] - powershell.exe terminated or terminal UI was closed
Environment data
Windows 7.
Additional Notes
Running Invoke-Formatter command brings up another error:
I think the issue is the PSScriptAnalyzer module is not installed correctly. So I have tried to manually import it. Using command 'Import-Module .\PSScriptAnalyzer.psm1'
I then try to run the Invoke-Formatter command again and get this issue:
Interestingly when I run the Get-Module command after I do the manual import it lists PSSCriptAnalyzer as installed but the version number 0.0
Please let me know if I need to provide anything further
The text was updated successfully, but these errors were encountered: