Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.psobject.baseobject only sometimes returns the undecorated underlying .NET type instance #8866

Closed
mklement0 opened this issue Feb 11, 2019 · 4 comments
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-No Activity Issue has had no activity for 6 months or more WG-Engine core PowerShell engine, interpreter, and runtime

Comments

@mklement0
Copy link
Contributor

Note: Not sure if use of .psobject.BaseObject is officially supported in PowerShell code. It can be handy as a workaround in certain situations, but isn't consistently supported.

Steps to reproduce

# The case that works as expected, with an ETS-decorated [string]
'hi' > t.txt; $str = Get-Content -Raw t.txt
($str | Get-Member -Type NoteProperty).Count
($str.psobject.BaseObject | Get-Member -Type NoteProperty).Count
'---'
# Doesn't seem to work with other types.
(Get-Date  | Get-Member -Type NoteProperty).Count
((Get-Date).psobject.BaseObject  | Get-Member -Type NoteProperty).Count

Expected behavior

6
0
---
1
0

That is, applying .psobject.BaseObject should eliminate the ETS NoteProperty members in both cases.

Actual behavior

6
0
---
1
1

That is, applying .psobject.BaseObject to the [datetime] instance did not eliminate the NoteProperty members.

Environment data

PowerShell Core v6.2.0-preview.4 on macOS 10.14.2
PowerShell Core v6.2.0-preview.4 on Ubuntu 18.04.1 LTS
PowerShell Core v6.2.0-preview.4 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.471)
Windows PowerShell v5.1.17134.407 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.471)
@mklement0 mklement0 added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Feb 11, 2019
@iSazonov iSazonov added the WG-Engine core PowerShell engine, interpreter, and runtime label Jan 15, 2021
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

2 similar comments
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-No Activity Issue has had no activity for 6 months or more labels Nov 16, 2023
Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-No Activity Issue has had no activity for 6 months or more WG-Engine core PowerShell engine, interpreter, and runtime
Projects
None yet
Development

No branches or pull requests

2 participants