Unexpected behavior of AutomationNull in object initializers (hashtable or [pscustomobject]) #19402
Open
5 tasks done
Labels
In-PR
Indicates that a PR is out for the issue
Needs-Triage
The issue is new and needs to be triaged by a work group.


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$nullin 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: