Skip to content

Types that implement IDynamicMetaObjectProvider do not have the standard hidden PSObject members such as .psobject and .pstypenames (intrinsic members) #10668

@mklement0

Description

@mklement0

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions