Object reference not set to an instance of an object.

Aperta
#1,867 18 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
powershell
Ambito
devtools

Direzione di ricerca

Inizia riproducendo l’errore di riferimento null con il modulo PowerShell segnalato e PSScriptAnalyzer 1.21.0, confrontando le esecuzioni normali e -Verbose di Invoke-ScriptAnalyzer. Restringi il problema a una funzione o a un’operazione specifica dell’analizzatore usando le versioni del modulo e dello strumento di build elencate nel report; il lavoro è completato quando la causa è stata identificata e l’eccezione viene impedita senza richiedere un output dettagliato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area - Engine Issue - Discussion Issue-Bug

Good morning,
I have a PowerShell module at work with almost 400 functions. Recently I switched from PSScriptAnalyzer version 1.13.0 to version 1.21.0, fixed a lot of problems, but I have one left. On random functions I get the error:

Exception: Object reference not set to an instance of an object.

If I use the Invoke-ScriptAnalyzer function with the -Verbose switch, the error does not occur. I discovered this by accident while looking for which function is causing the error.

Please advise how to trace the cause.
Somewhere I found information that this can be caused by the Export-ModuleMember function, but I don't want to get rid of it because I would have to fiddle with building the manifest file and that's how Psake does it for me.

For building and checking a powershell module I use
TeamCity and
Psake = '4.9.0'
Pester = '5.3.3'
BuildHelpers = '2.0.16'
PSScriptAnalyzer = '1.21.0'
PSDepend = '0.3.8'

image

Lingua principale
C#
Stelle
2.2k
Fork
415
Merge medio
13h 1m
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PowerShell/PSScriptAnalyzer

Tutte le issue di PowerShell/PSScriptAnalyzer

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.