Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Intermittent exceptions during concurrent custom-rule execution

Aberta
#2,222 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
32/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
csharp, powershell

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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?

Linguagem predominante
C#
Estrelas
2.2k
Forks
423
Merge médio
17h 27min
PRs com merge (30d)
14

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PowerShell/PSScriptAnalyzer

Todas as issues de PowerShell/PSScriptAnalyzer

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.