-
Notifications
You must be signed in to change notification settings - Fork 410
Fix NullReferenceException in AvoidAssignmentToAutomaticVariable rule when assigning a .Net property and only look at the LHS #1008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3701e65
9910fda
e4d1c72
8136638
f818df7
9fbe4e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,21 @@ Describe "AvoidAssignmentToAutomaticVariables" { | |
| $warnings.Count | Should -Be 0 | ||
| } | ||
|
|
||
| It "Does not throw a NullReferenceException when using assigning a .Net property to a .Net property (Bug in 1.17.0 - issue 1007)" { | ||
| $exceptionThrown = $false | ||
| try | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this just be:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pester only works with terminating errors. PSSA throws non-terminating errors, see pester/Pester#366
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would have thought that |
||
| { | ||
| Invoke-ScriptAnalyzer -ScriptDefinition '[foo]::bar = [baz]::qux' -ErrorAction Stop | ||
| } | ||
| catch | ||
| { | ||
| $exceptionThrown = $true | ||
| } | ||
|
|
||
| $exceptionThrown | Should -Be $false | ||
| } | ||
|
|
||
|
|
||
| It "Setting Variable <VariableName> throws exception in applicable PowerShell version to verify the variables is read-only" -TestCases $testCases_ReadOnlyVariables { | ||
| param ($VariableName, $ExpectedSeverity, $OnlyPresentInCoreClr) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only this null check was added, all the code diff below is only the added indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from a flow perspective, this could also be
and the indenting is preserved :)