Title: Enabling PSUseCorrectCasing causes error while processing code that doesn't violate it · Issue #1881 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Enabling PSUseCorrectCasing causes error while processing code that doesn't violate it · Issue #1881 · PowerShell/PSScriptAnalyzer
X Title: Enabling PSUseCorrectCasing causes error while processing code that doesn't violate it · Issue #1881 · PowerShell/PSScriptAnalyzer
Description: Steps to reproduce '@{ Rules = @{ PSUseCorrectCasing = @{ Enable = $true } } }' > rules.psd1 Invoke-ScriptAnalyzer -Settings rules.psd1 -ScriptDefinition 'Update-VisualStudioSolutionNuGetPackages' Update: It turned out that our Update-Vi...
Open Graph Description: Steps to reproduce '@{ Rules = @{ PSUseCorrectCasing = @{ Enable = $true } } }' > rules.psd1 Invoke-ScriptAnalyzer -Settings rules.psd1 -ScriptDefinition 'Update-VisualStudioSolutionNuGetPackages' ...
X Description: Steps to reproduce '@{ Rules = @{ PSUseCorrectCasing = @{ Enable = $true } } }' > rules.psd1 Invoke-ScriptAnalyzer -Settings rules.psd1 -ScriptDefinition 'Update-VisualStudioSolution...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/1881
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enabling PSUseCorrectCasing causes error while processing code that doesn't violate it","articleBody":"Steps to reproduce\r\n------------------\r\n\r\n```PowerShell\r\n'@{ Rules = @{ PSUseCorrectCasing = @{ Enable = $true } } }' > rules.psd1\r\nInvoke-ScriptAnalyzer -Settings rules.psd1 -ScriptDefinition 'Update-VisualStudioSolutionNuGetPackages'\r\n```\r\n\r\nUpdate: It turned out that our `Update-VisualStudioSolutionNuGetPackages` cmdlet actually had a problem (incorrectly parameterized analyzer suppression), although it's important to note that that cmdlet was not subject to code analysis when the problem arose (but the same runtime error appears too when executing that cmdlet), only the script that was calling it.\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nNo output.\r\n\r\nActual behavior\r\n---------------\r\n\r\nThe following error details in both Windows PowerShell and PowerShell Core:\r\n```none\r\nwriteErrorStream : True\r\nPSMessageDetails :\r\nException : System.Management.Automation.MethodException: Cannot find an overload for \".ctor\" and the argument count: \"1\".\r\n at System.Management.Automation.Language.Compiler.GetAttribute(AttributeAst attributeAst)\r\n at System.Management.Automation.Language.ScriptBlockAst.\u003cSystem-Management-Automation-Language-IParameterMetadataProvider-GetScriptBlockAttributes>d__68.MoveNext()\r\n at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n at System.Management.Automation.CompiledScriptBlockData.InitializeMetadata()\r\n at System.Management.Automation.CompiledScriptBlockData.get_CmdletBindingAttribute()\r\n at System.Management.Automation.CommandMetadata.Init(ScriptBlock scriptBlock, String name, Boolean shouldGenerateCommonParameters)\r\n at System.Management.Automation.CommandMetadata..ctor(CommandInfo commandInfo, Boolean shouldGenerateCommonParameters)\r\n at System.Management.Automation.CommandInfo.get_Parameters()\r\n at Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseCorrectCasing.\u003cAnalyzeScript>d__0.MoveNext()\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n at Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.\u003c>c__DisplayClass85_1.\u003cAnalyzeSyntaxTree>b__2()\r\nTargetObject :\r\nCategoryInfo : InvalidOperation: (:) [Invoke-ScriptAnalyzer], MethodException\r\nFullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand\r\nErrorDetails :\r\nInvocationInfo : System.Management.Automation.InvocationInfo\r\nScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 1\r\nPipelineIterationInfo : {0, 1}\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\nWindows PowerShell\r\n\r\n```PowerShell\r\n> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 5.1.19041.2364\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.19041.2364\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n\r\n> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n\r\n1.21.0\r\n```\r\n\r\nPowerShell Core\r\n\r\n```PowerShell\r\n> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.3.1\r\nPSEdition Core\r\nGitCommitId 7.3.1\r\nOS Microsoft Windows 10.0.19045\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n\r\n> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n\r\n1.21.0\r\n```\r\n","author":{"url":"https://github.com/BenedekFarkas","@type":"Person","name":"BenedekFarkas"},"datePublished":"2023-01-11T16:08:01Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1881"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7d229246-3f5d-bc6f-1c6a-6f1023c7ca6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 843C:24CDFB:616E8:83BD8:6AFCE81F |
| html-safe-nonce | 2a927e1fe5efa3497767595e40ce012f9780ec4bd9e0a7bf09adaaa816099b66 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDNDOjI0Q0RGQjo2MTZFODo4M0JEODo2QUZDRTgxRiIsInZpc2l0b3JfaWQiOiI2OTAwMzc2NTE0ODk4NzQ5NDcxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2179cdda00d3beacf1ad831206e3e3f36f6a9867bcc6e373d6db64804a4f78bb |
| hovercard-subject-tag | issue:1529309168 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PSScriptAnalyzer/1881/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a9c7eb38379331129223c9261cecf971949a5a2f8e8b18f93272a1473c65a634/PowerShell/PSScriptAnalyzer/issues/1881 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a9c7eb38379331129223c9261cecf971949a5a2f8e8b18f93272a1473c65a634/PowerShell/PSScriptAnalyzer/issues/1881 |
| og:image:alt | Steps to reproduce '@{ Rules = @{ PSUseCorrectCasing = @{ Enable = $true } } }' > rules.psd1 Invoke-ScriptAnalyzer -Settings rules.psd1 -ScriptDefinition 'Update-VisualStudioSolutionNuGetPackages' ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BenedekFarkas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 99aede4c5f55ec5cf06666a8c9e03ebf9f85f7231223e7f1c38c16e5504835b3 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 33149177 |
| octolytics-dimension-repository_nwo | PowerShell/PSScriptAnalyzer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33149177 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PSScriptAnalyzer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ecfd63ca125ec74b42f74eeb158b3fa081c8c497 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width