Title: Scan multiple times a module throw System.InvalidOperationException · Issue #900 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Scan multiple times a module throw System.InvalidOperationException · Issue #900 · PowerShell/PSScriptAnalyzer
X Title: Scan multiple times a module throw System.InvalidOperationException · Issue #900 · PowerShell/PSScriptAnalyzer
Description: Steps to reproduce Run a scan multiple times on a module : ipmo PSScriptAnalyzer $res=Invoke-ScriptAnalyzer -path 'C:\Program Files\WindowsPowerShell\Modules\InvokeBuild\5.1.0' Expected behavior No error. Actual behavior throw System.Inv...
Open Graph Description: Steps to reproduce Run a scan multiple times on a module : ipmo PSScriptAnalyzer $res=Invoke-ScriptAnalyzer -path 'C:\Program Files\WindowsPowerShell\Modules\InvokeBuild\5.1.0' Expected behavior No...
X Description: Steps to reproduce Run a scan multiple times on a module : ipmo PSScriptAnalyzer $res=Invoke-ScriptAnalyzer -path 'C:\Program Files\WindowsPowerShell\Modules\InvokeBuild\5.1.0' Expected beh...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/900
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Scan multiple times a module throw System.InvalidOperationException","articleBody":"Steps to reproduce\r\n------------------\r\nRun a scan multiple times on a module :\r\n```powershell\r\nipmo PSScriptAnalyzer\r\n$res=Invoke-ScriptAnalyzer -path 'C:\\Program Files\\WindowsPowerShell\\Modules\\InvokeBuild\\5.1.0'\r\n```\r\n\r\n\r\n\r\nExpected behavior\r\n-----------------\r\nNo error.\r\n\r\nActual behavior\r\n---------------\r\nthrow System.InvalidOperationException:\r\nCollection was modified; enumeration operation may not execute.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- Provide the output of the following 2 commands -->\r\n\r\n```powershell\r\n$psversiontable\r\nName Value\r\n---- -----\r\nPSVersion 5.1.14409.1012\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14409.1012}\r\nBuildVersion 10.0.14409.1012\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n\r\n\r\n (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n1.16.1\r\n1.16.0\r\n1.15.0\r\n1.12.0\r\n1.11.1\r\n```\r\n\r\nLog:\r\n```\r\n[STA] C:\\temp> rver\r\n\r\nwriteErrorStream : True\r\nPSMessageDetails :\r\nException : System.Management.Automation.CmdletInvocationException: La collection a été modifiée;\r\n l'opération d'énumération peut ne pas s'exécuter. ---> System.InvalidOperationException: La\r\n collection a été modifiée; l'opération d'énumération peut ne pas s'exécuter.\r\n à System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)\r\n à System.Collections.Generic.List`1.Enumerator.MoveNextRare()\r\n à Microsoft.PowerShell.Commands.ModuleCmdletBase.UpdateCommandCollection(Collection`1 list,\r\n List`1 patterns)\r\n à Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String\r\n moduleManifestPath, ExternalScriptInfo scriptInfo, Hashtable data, Hashtable localizedData,\r\n ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version\r\n maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions&\r\n options, Boolean& containedErrors)\r\n à Microsoft.PowerShell.Commands.TestModuleManifestCommand.ProcessRecord()\r\n à System.Management.Automation.CommandProcessor.ProcessRecord()\r\n --- Fin de la trace de la pile d'exception interne ---\r\n à System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)\r\n à System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs,\r\n Boolean performSyncInvoke)\r\n à System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace\r\n rsToUse, Boolean isSync)\r\n à\r\n System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1\r\n input, PSDataCollection`1 output, PSInvocationSettings settings)\r\n à System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1\r\n input, PSDataCollection`1 output, PSInvocationSettings settings)\r\n à System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings\r\n settings)\r\n à Microsoft.Windows.PowerShell.ScriptAnalyzer.Helper.GetModuleManifest(String filePath,\r\n IEnumerable`1& errorRecord)\r\n à Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.MissingModuleManifestField.\u003cAnaly\r\n zeScript>d__0.MoveNext()\r\n à System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n à System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n à Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.\u003c>c__DisplayClass78_0.\u003cAnalyzeS\r\n yntaxTree>b__1()\r\nTargetObject : C:\\Program Files\\WindowsPowerShell\\Modules\\InvokeBuild\\5.1.0\\InvokeBuild.psd1\r\nCategoryInfo : InvalidOperation: (C:\\Program File...nvokeBuild.psd1:String) [Invoke-ScriptAnalyzer],\r\n CmdletInvocationException\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\nMyCommand : Invoke-ScriptAnalyzer\r\nBoundParameters : {}\r\nUnboundArguments : {}\r\nScriptLineNumber : 1\r\nOffsetInLine : 6\r\nHistoryId : 9\r\nScriptName :\r\nLine : $res=Invoke-ScriptAnalyzer -path 'C:\\Program\r\n Files\\WindowsPowerShell\\Modules\\InvokeBuild\\5.1.0'\r\nPositionMessage : At line:1 char:6\r\n + $res=Invoke-ScriptAnalyzer -path 'C:\\Program Files\\WindowsPowerShell\\ ...\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nPSScriptRoot :\r\nPSCommandPath :\r\nInvocationName : Invoke-ScriptAnalyzer\r\nPipelineLength : 0\r\nPipelinePosition : 0\r\nExpectingInput : False\r\nCommandOrigin : Internal\r\nDisplayScriptPosition :\r\n\r\nException at nesting level 0 ---------------------------------------------------\r\n\r\nErrorRecord : La collection a été modifiée ; l'opération d'énumération peut ne pas s'exécuter.\r\nWasThrownFromThrowStatement : False\r\nMessage : La collection a été modifiée ; l'opération d'énumération peut ne pas s'exécuter.\r\nData : {}\r\nInnerException : System.InvalidOperationException: La collection a été modifiée; l'opération\r\n d'énumération peut ne pas s'exécuter.\r\n à System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)\r\n à System.Collections.Generic.List`1.Enumerator.MoveNextRare()\r\n à Microsoft.PowerShell.Commands.ModuleCmdletBase.UpdateCommandCollection(Collection`1\r\n list, List`1 patterns)\r\n à Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String\r\n moduleManifestPath, ExternalScriptInfo scriptInfo, Hashtable data, Hashtable\r\n localizedData, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion,\r\n Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid,\r\n ImportModuleOptions& options, Boolean& containedErrors)\r\n à Microsoft.PowerShell.Commands.TestModuleManifestCommand.ProcessRecord()\r\n à System.Management.Automation.CommandProcessor.ProcessRecord()\r\nTargetSite : System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject]\r\n Invoke(System.Collections.IEnumerable)\r\nStackTrace : à System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)\r\n à System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace\r\n rs, Boolean performSyncInvoke)\r\n à\r\n System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace\r\n rsToUse, Boolean isSync)\r\n à System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataColle\r\n ction`1 input, PSDataCollection`1 output, PSInvocationSettings settings)\r\n à\r\n System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1\r\n input, PSDataCollection`1 output, PSInvocationSettings settings)\r\n à System.Management.Automation.PowerShell.Invoke(IEnumerable input,\r\n PSInvocationSettings settings)\r\n à Microsoft.Windows.PowerShell.ScriptAnalyzer.Helper.GetModuleManifest(String\r\n filePath, IEnumerable`1& errorRecord)\r\n à Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.MissingModuleManifestField.\r\n \u003cAnalyzeScript>d__0.MoveNext()\r\n à System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n à System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n à Microsoft.Windows.PowerShell.ScriptAnalyzer.ScriptAnalyzer.\u003c>c__DisplayClass78_0.\u003cAn\r\n alyzeSyntaxTree>b__1()\r\nHelpLink :\r\nSource : System.Management.Automation\r\nHResult : -2146233087\r\n\r\nException at nesting level 1 ---------------------------------------------------\r\n\r\nMessage : La collection a été modifiée ; l'opération d'énumération peut ne pas s'exécuter.\r\nData : {}\r\nInnerException :\r\nTargetSite : Void ThrowInvalidOperationException(System.ExceptionResource)\r\nStackTrace : à System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)\r\n à System.Collections.Generic.List`1.Enumerator.MoveNextRare()\r\n à Microsoft.PowerShell.Commands.ModuleCmdletBase.UpdateCommandCollection(Collection`1 list, List`1\r\n patterns)\r\n à Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath,\r\n ExternalScriptInfo scriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags\r\n manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion,\r\n Nullable`1 requiredModuleGuid, ImportModuleOptions& options, Boolean& containedErrors)\r\n à Microsoft.PowerShell.Commands.TestModuleManifestCommand.ProcessRecord()\r\n à System.Management.Automation.CommandProcessor.ProcessRecord()\r\nHelpLink :\r\nSource : mscorlib\r\nHResult : -2146233079\r\n\r\n[STA] C:\\temp> $stacktrace\r\n à System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin,\r\nPSHost host)\r\n à System.Management.Automation.CommandDiscovery.ShouldRun(ExecutionContext context, PSHost host, CommandInfo commandI\r\nnfo, CommandOrigin commandOrigin)\r\n à System.Management.Automation.CommandDiscovery.LookupCommandProcessor(CommandInfo commandInfo, CommandOrigin command\r\nOrigin, Nullable`1 useLocalScope, SessionStateInternal sessionState)\r\n à System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigi\r\nn, Nullable`1 useLocalScope)\r\n à System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)\r\n à System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandEleme\r\nnts, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)\r\n à System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal\r\n[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcCon\r\ntext)\r\n à System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n à System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\n```","author":{"url":"https://github.com/LaurentDardenne","@type":"Person","name":"LaurentDardenne"},"datePublished":"2018-02-20T12:51:00Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/900"}
| 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:da9feb6a-641e-6d7f-5dee-a2ff9703e56d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C756:2013BF:43E4A2:59EDF7:6AFCEAD9 |
| html-safe-nonce | eb57c347ef6160963bd51a5f96d4b63790487ea7f875d7d127ffc5a8cd553481 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzU2OjIwMTNCRjo0M0U0QTI6NTlFREY3OjZBRkNFQUQ5IiwidmlzaXRvcl9pZCI6IjgzMzA4OTA4NzQwNjE2NDY1NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a21f8c307fc1d619d36d112fdfb0812283623c706b6b0ccb480afcd4950884f7 |
| hovercard-subject-tag | issue:298582477 |
| 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/900/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7401634f35d16e76e7e0fe4de2b08df5742b59cb57b9feea302431c4c2548f76/PowerShell/PSScriptAnalyzer/issues/900 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7401634f35d16e76e7e0fe4de2b08df5742b59cb57b9feea302431c4c2548f76/PowerShell/PSScriptAnalyzer/issues/900 |
| og:image:alt | Steps to reproduce Run a scan multiple times on a module : ipmo PSScriptAnalyzer $res=Invoke-ScriptAnalyzer -path 'C:\Program Files\WindowsPowerShell\Modules\InvokeBuild\5.1.0' Expected behavior No... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LaurentDardenne |
| 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