Unexpected behavior of AutomationNull in object initializers (hashtable or [pscustomobject]) #19402
Closed
5 tasks done
Labels
Resolution-Fixed
The issue is fixed.
Prerequisites
Steps to reproduce
In an array-type-constrained variable (as in expressions in general), AutomationNull is treated like
$null
; e.g.:By contrast, using AutomationNull in hashtable /
[pscustomobject]
-based object initializers fails:That the
[pscustomobject]
-based initialization breaks differently is surprising, and reminiscent of #19384 (comment)Expected behavior
Two
[Example]
instances should be constructed, with$null
in the .LogMessage property.Actual behavior
Both initializations fail, albeit differently:
Error details
See above.
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: