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

PssaCmdletAnalysisEngine fails with "Errors found while formatting file" and no additional data #4942

Open
6 tasks done
cythrault opened this issue Mar 9, 2024 · 3 comments
Labels
Issue-Bug A bug to squash. Needs: Maintainer Attention Maintainer attention needed!

Comments

@cythrault
Copy link

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

Document formatting fails on seemingly random pieces of code. Even if diagnostics enabled, there no meaningful errors aside from the extension logging these:

[Warn  - 2:02:18 PM] Microsoft.PowerShell.EditorServices.Services.Analysis.PssaCmdletAnalysisEngine: Errors found while formatting file: 
     | 

PowerShell Version

[13:45:31] C:\PSWorkspace> $PSVersionTable; $Host

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : ConsoleHost
Version          : 7.4.1
InstanceId       : 5a656068-bb14-4483-9d6a-3245151ecaa0
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-GB
CurrentUICulture : en-GB
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

[14:08:06] C:\PSWorkspace>  code --version 
1.87.0
019f4d1419fbc8219a181fab7892ebccf7ee29a2
x64

Extension Version

[14:08:29] C:\PSWorkspace> code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2024.0.0

Steps to Reproduce

The psm1 file failing to be formatted contains >4000 lines of code which execute without a problem. However, I'm unable to locate the appropriate code that might trigger this issue.

Visuals

No response

Logs

u

@cythrault cythrault added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Mar 9, 2024
@JustinGrote
Copy link
Collaborator

@andyleejordan there was a new PSScriptAnalyzer release, there may be a regression with that. @cythrault do you have the newer psscriptanalyzer installed separate from the extension?

@cythrault
Copy link
Author

cythrault commented Mar 11, 2024

@andyleejordan there was a new PSScriptAnalyzer release, there may be a regression with that. @cythrault do you have the newer psscriptanalyzer installed separate from the extension?

@JustinGrote Negative:
PS D:\PSWorkspace> Get-InstalledModule PSScriptAnalyzer
Get-Package: No match was found for the specified search criteria and module names 'PSScriptAnalyzer'.

And the only PSScriptAnalyzer module folder I see on that system is v1.21.0 which is under $env:USERPROFILE\.vscode\extensions\ms-vscode.powershell-2024.0.0\modules\PSScriptAnalyzer

@JustinGrote
Copy link
Collaborator

JustinGrote commented Mar 11, 2024

@cythrault if you run Invoke-Scriptanalyzer on your script separately does it work fine? As you said it's a 4k+ line module so you may be running into an edge case with ScriptAnalyzer. VSCode is mostly a passthrough to that functionality so the issue would most likely be fixed there if anywhere instead of this repo.
https://github.com/PowerShell/PSScriptAnalyzer

I cannot reproduce without a copy of your module, I'm not seeing any issues ATM.

@JustinGrote JustinGrote added Needs: Author Feedback Please give us the requested feedback! and removed Needs: Triage Maintainer attention needed! labels Mar 11, 2024
@github-actions github-actions bot added Needs: Maintainer Attention Maintainer attention needed! and removed Needs: Author Feedback Please give us the requested feedback! labels Mar 11, 2024
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. Needs: Maintainer Attention Maintainer attention needed!
Projects
None yet
Development

No branches or pull requests

2 participants