Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Intermittent exceptions during concurrent custom-rule execution

Offen
#2,222 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
32/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
csharp, powershell

Rechercherichtung

Start from how Invoke-ScriptAnalyzer runs external/custom rules concurrently (AstVisitor2 and $ScriptBlockAst.Visit) on Windows PowerShell 5.1, using the reported Visit NRE and collection-modified exceptions as the failure mode. Trace the custom-rule execution path and any shared visitor or AST state; done means those intermittent errors no longer appear on the same sources while default and custom rules still run.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Before submitting a bug report:

  • Make sure you are able to repro it on the latest released version
  • Perform a quick search for existing issues to check if this bug has already been reported

Steps to reproduce


...\PSScriptAnalyzer-Run.ps1" -Path C:\_work\1\s -Recurse -Settings C:\_work\1\.gdn\rs\psscriptanalyzer\63df5559-3449-4d0b-a8b9-8c97aa98fe3b.ruleset -IgnorePattern .gdn -IncludeDefaultRules -RecurseCustomRulePath -BuildInCustomRules SDLRules -OutputFilePath C:\_work\1\.gdn\.r\psscriptanalyzer\001\psscriptanalyzer.sarif

Expected behavior

Executing PSScriptAnalyzer without any errors

Actual behavior

A customer is intermittently seeing errors from "Invoke-ScriptAnalyzer" while PSScriptAnalyzer runs external SDL rules:

Exception calling "Visit" with "1" argument(s):
"Object reference not set to an instance of an object."

They have also seen:

Exception calling "Visit" with "1" argument(s):
"Collection was modified; enumeration operation may not execute."

The affected rules use a PowerShell class derived from "AstVisitor2" and call "$ScriptBlockAst.Visit($customVisitor)". The problem is intermittent: the same source can fail in one run and pass when rerun. PSScriptAnalyzer reports the exception as a non-terminating error and the process still exits with code 0.

Environment data

Environment: Windows PowerShell 5.1 and PSScriptAnalyzer 1.19.1.

Is this a known concurrency issue in PSScriptAnalyzer’s external-rule execution path or in "Ast.Visit()" under Windows PowerShell 5.1?

Vorherrschende Sprache
C#
Sterne
2.2k
Forks
423
Ø Merge
17 Std. 27 Min.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus PowerShell/PSScriptAnalyzer

Alle Issues in PowerShell/PSScriptAnalyzer

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.