Steps to reproduce
$namedTuple = [Range]::new(0, 0).GetOffsetAndLength(0)
$namedTuple.Offset
$namedTuple.Length
Expected behavior
Offset is translated to Item1 and Length is translated to Item2
Actual behavior
Tuple items must be referred to by their real property names (e.g. Item1 and Item2).
Environment data
Name Value
---- -----
PSVersion 7.0.0-preview.3
PSEdition Core
GitCommitId 7.0.0-preview.3
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Notes
Named tuples are implemented in metadata. The method that returns the tuple is annotated with the TupleElementNames attribute. In the example, the method is annotated with this attribute:
[return: TupleElementNames(new string[] { "Offset", "Length" })]
public ValueTuple<int, int> GetOffsetAndLength(int length);
The item names cannot be inferred from the value itself, but PSInvokeMemberBinder could attach PSAliasProperty's to the tuple after invocation.
Currently this probably isn't all that important. In the version of Core included in7.0.0-preview.3, there are only two public API's in the BCL that return named tuples (the other is Enumerable.Zip<,>(IEnumerable<>,IEnumerable<>)).
Steps to reproduce
Expected behavior
Offsetis translated toItem1andLengthis translated toItem2Actual behavior
Tuple items must be referred to by their real property names (e.g.
Item1andItem2).Environment data
Notes
Named tuples are implemented in metadata. The method that returns the tuple is annotated with the
TupleElementNamesattribute. In the example, the method is annotated with this attribute:The item names cannot be inferred from the value itself, but
PSInvokeMemberBindercould attachPSAliasProperty's to the tuple after invocation.Currently this probably isn't all that important. In the version of Core included in7.0.0-preview.3, there are only two public API's in the BCL that return named tuples (the other is
Enumerable.Zip<,>(IEnumerable<>,IEnumerable<>)).