Skip to content

Preserve Get-TypeData hidden members#27185

Open
badgerbees wants to merge 5 commits intoPowerShell:masterfrom
badgerbees:fix/typedata-preserve-ishidden
Open

Preserve Get-TypeData hidden members#27185
badgerbees wants to merge 5 commits intoPowerShell:masterfrom
badgerbees:fix/typedata-preserve-ishidden

Conversation

@badgerbees
Copy link
Copy Markdown

PR Summary

Preserve hidden type data members when Get-TypeData reconstructs TypeData from the live type table. This fixes issue #27131 and adds a regression test to verify that hidden note properties stay hidden after an Update-TypeData and Get-TypeData round-trip.

PR Context

Get-TypeData was dropping the IsHidden flag when it converted live PSMemberInfo instances back into TypeMemberData. The underlying type table already preserved the hidden state, so this change corrects the reconstruction path rather than changing the storage model or the way hidden members behave at runtime.

PR Checklist

Copilot AI review requested due to automatic review settings April 3, 2026 12:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Get-TypeData reconstruction from the live type table so that hidden extended members keep their IsHidden state when converted back into TypeMemberData, and adds a regression test covering the Update-TypeDataGet-TypeData round-trip.

Changes:

  • Preserve IsHidden when converting live PSMemberInfo instances back into NotePropertyData, AliasPropertyData, ScriptPropertyData, CodePropertyData, and MemberSetData.
  • Add a Pester regression test verifying hidden note properties remain hidden after an Update-TypeData/Get-TypeData round-trip.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/System.Management.Automation/engine/TypeTable.cs Updates the reconstruction path from live members to TypeMemberData to carry the IsHidden flag.
test/powershell/Modules/Microsoft.PowerShell.Utility/typedata.tests.ps1 Adds regression coverage for IsHidden preservation across Update-TypeData/Get-TypeData.

@badgerbees badgerbees marked this pull request as draft April 3, 2026 12:21
@badgerbees badgerbees marked this pull request as ready for review April 3, 2026 12:55
@badgerbees badgerbees requested a review from a team as a code owner April 3, 2026 12:55
@badgerbees
Copy link
Copy Markdown
Author

hello, if any maintainer could approve of the workflow again that would be awesome thanks

@badgerbees
Copy link
Copy Markdown
Author

I found the actual failure: PSMemberSet.Copy() was not preserving inheritMembers, so Get-TypeData round-trips reset MemberSetData.InheritMembers back to true. I pushed a follow-up fix that copies inheritMembers correctly, so the failing typedata.tests.ps1 case should be covered now unless I'm wrong.

@badgerbees
Copy link
Copy Markdown
Author

macOS-CI / xUnit Tests / Run xUnit Tests should normally finish in minutes, not hours. Since Windows and Linux completed and the logs never show a test failure, this looks like the macOS job got stuck or hit an Actions/runtime issue rather than a regression from this PR. If any maintainer did a re-run it should complete normally.

@badgerbees
Copy link
Copy Markdown
Author

all tests passed, ready for a review from any maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants