Allow the PSGetMemberBinder to get value of ByRef property (#16956)

This commit is contained in:
Dongbo Wang
2022-03-04 15:01:18 -08:00
committed by GitHub
parent 4711eb570e
commit a3c4a163ff
4 changed files with 43 additions and 1 deletions
@@ -108,3 +108,21 @@ Describe "Interface static members" -Tags "CI" {
$obj.GetId() | Should -Be 100
}
}
Describe "ByRef property" -Tags "CI" {
It "Get value from ByRef property" {
$list = [System.Collections.Generic.LinkedList[int]]::new()
$node = $list.AddLast(1)
## Get value through language binder.
$node.ValueRef | Should -Be 1
## Get value through .NET adapter.
$property = $node.PSObject.Properties["ValueRef"]
$property.IsSettable | Should -BeFalse
$property.IsGettable | Should -BeTrue
$property.TypeNameOfValue | Should -BeExactly 'System.Int32&'
$property.Value | Should -Be 1
}
}