Types that implement IDynamicMetaObjectProvider do not have the usual intrinsic members, such as the hidden .psobject and pstypenames properties, or the .Count and .Length properties, which one would expect to be present on any object (other than $null in the case of the reflection properties).
@SeeminglyScience points out that "in most cases PowerShell is going to let JObject [a type that implements IDynamicMetaObjectProvider] decide how it's bound", so the problem may be related to that.
Steps to reproduce
# Instantiate a type that implements IDynamicMetaObjectProvider
$obj = [Newtonsoft.Json.Linq.JObject]::Parse('{"foo":1}')
$obj.psobject | Should -Not -BeNullOrEmpty
$obj.pstypenames | Should -Not -BeNullOrEmpty
$obj.Length | Should -Be 1
Expected behavior
All tests should succeed.
Actual behavior
All tests fail, because these properties unexpectedly don't exist.
Environment data
PowerShell Core 7.0.0-preview.4
Windows PowerShell v5.1.18362.145
Types that implement
IDynamicMetaObjectProviderdo not have the usual intrinsic members, such as the hidden.psobjectandpstypenamesproperties, or the.Countand.Lengthproperties, which one would expect to be present on any object (other than$nullin the case of the reflection properties).@SeeminglyScience points out that "in most cases PowerShell is going to let
JObject[a type that implementsIDynamicMetaObjectProvider] decide how it's bound", so the problem may be related to that.Steps to reproduce
Expected behavior
All tests should succeed.
Actual behavior
All tests fail, because these properties unexpectedly don't exist.
Environment data