Trying to assign a value to an .Item(int index)
method call is quietly ignored; equivalent indexer syntax (e.g. [0]
) does report an error, albeit a misleading one.
#24074
Labels
Issue-Enhancement
the issue is more of a feature request than a bug
Needs-Investigation
The behavior reported in the issue is unexpected and needs further investigation.
WG-Engine
core PowerShell engine, interpreter, and runtime
Prerequisites
Steps to reproduce
PowerShell surfaces even
.Item(int index)
methods (e.g.XmlNodeList.Item
) via indexer syntax, not just parameterized.Item
properties.For instance:
By definition, such an
.Item
method is conceptually read-only; that is, a value can be retrieved, but not assigned:Conceptually related:
Expected behavior
Note:
Property or indexer 'XmlNodeList.this[int]' cannot be assigned to -- it is read only
Actual behavior
That is:
.Item(0)
was quietly ignored.Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: