-
Notifications
You must be signed in to change notification settings - Fork 391
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
AvoidReservedCharInCmdlet throws System.NullReferenceException sometimes due to CommandInfo.ResolveParameter issue #1538
Comments
Looks like the old |
We could apply something similar to PR #1523 |
The problem I see is that taking a |
Thanks @LaurentDardenne could you please to run only the PSSA command line when you have the chance and let us know if you are able to reproduce this? Looks like the issue may be coming from PowerShell here, still, PSSA should protect itself from these types of errors/better handle parameter binding especially since we expect PSSA to be backwards compatible...we may want to check for a throw as well here, alternatively this rule could not use the helper function at all |
Hi, I think I am having a very similar issue.
I had no problem yesterday, but today, analyzing doesn't work. I found that it is specifically the PSShouldProcess rule that makes it not work. If excluded, it pass. None of my function uses ShouldProcess. Environment :
By the tag 'Consider 2.0', do you mean I should try 2.0 ? Since it is not on the PSGallery yet, how should I install it ? |
@avezinaATastus that looks like a different issue in this method: PSScriptAnalyzer/Rules/UseShouldProcessCorrectly.cs Lines 344 to 398 in d04c039
Please open a new issue |
Yes I can, but not before a few weeks. |
That tag means we're considering addressing this issue in the 2.0 version, which is still being worked on. |
@SydneyhSmith
The module was not installed via Install-Module but downloaded from the PS Gallery + 'XCopy'. |
I have this bug in 1.22.0. Does anybody know what magical trick can be done to avoid it? It may be that, like OP, I have installed PSScriptAnalyzer in a local directory instead of just install-module and letting module-search handle it. |
I report this error although I cannot reproduce the bug, moreover the analyzed code is private :-/
The exception is random during a build via PSake. I already had this error with the previous version 1.8.
The exception is most often raised when I open a powershell session and then execute my build script.
When, after the triggering of the error, I relaunch my error script, I no longer have an error
I have not yet had time to run only the PSSA command line.
Actual behavior
The first three lines are always the same :
The fourth concerns a rule name which can be different :
The TargetObject property points to a module of the project. The module may not have been modified for several days and may not trigger an error during the previous analysis (10 minutes ago)
Environment data
Test without any error, performed after the error is triggered :
Command line :
The text was updated successfully, but these errors were encountered: