-
Notifications
You must be signed in to change notification settings - Fork 53
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
I can use $null value with the 'DependsOn' parameter, but not an array that contains $null value : #191
Comments
@LaurentDardenne Fair points. For use case 1, what do you expect the behaviour to be? For use case 2, agree.
|
To leave as-is is possible but it is necessary to know this behavior. $Name-Get-MyDependency -Context xyz
if ($Null -eq $Name)
{Throw '$Name is $null'}
Rule Dependency1 -DependsOn $Name {
...
} Hard to say, we could also want to cancel a dependency by assigning, by design, $null to $Name. What I found 'strange' is to accept $null in one case but not in the other. |
@LaurentDardenne Thanks for your feedback. As you mentioned, it is strange as this behaviour isn't commonly used in PowerShell. While in some cases it is required, in this cases it probably does more harm then good, and it wasn't orignally intended. I think allowing a If there was a need to make a dependency optional in code, which seems unlikely, splating the |
Use case: I declare a dependency using a variable that contains $null :
No error.
Is it by design that $null can be passed to the 'DependsOn' parameter?
Use case: I declare a dependency using a variable that contains an array of one element that has the value $null:
Invoke-PsRrule triggers an expected exception.
In my opinion, to prohibit the value $null in this case does not facilitate the memorization of the rules of behavior of this parameter.
Use case: I declare a dependency that does not exist.
Here the error message should indicate which rule declares a non-existent dependency and indicate the name of this non-existent dependency.
This would facilitate the rules debug.
The text was updated successfully, but these errors were encountered: