Fix NRE when custom rules omit optional properties in diagnostics by rjmholt · Pull Request #1715 · PowerShell/PSScriptAnalyzer

@rjmholt

PR Summary

Fixes #1714.

These changes allow custom rules to emit diagnostics (or PSObjects that turn into diagnostics) with optional properties unset.

PR Checklist

bergmeister

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, only suggestion is to replace hard-coded property names with code references using things like e.g. nameof. Also, should we try to make the property query case insensitive for the property name itself as I think at the moment it'd be case sensitive

JamesWTruher