Fix Propertyless Object not displaying after ETS introspection - Simple Fix#26520
Open
GregoireLD wants to merge 2 commits intoPowerShell:masterfrom
Open
Fix Propertyless Object not displaying after ETS introspection - Simple Fix#26520GregoireLD wants to merge 2 commits intoPowerShell:masterfrom
GregoireLD wants to merge 2 commits intoPowerShell:masterfrom
Conversation
12 tasks
iSazonov
reviewed
Nov 24, 2025
| /// </summary> | ||
| internal static class OutOfBandFormatViewManager | ||
| { | ||
| private static bool IsNotRemotingProperty(string name) |
Collaborator
There was a problem hiding this comment.
It seems we should rename the method. Maybe IsNotPSSpecificProperty
| || name.Equals(RemotingConstants.SourceJobInstanceId, StringComparison.OrdinalIgnoreCase); | ||
| || name.Equals(RemotingConstants.SourceJobInstanceId, StringComparison.OrdinalIgnoreCase) | ||
| || name.Equals(RemotingConstants.EventObject, StringComparison.OrdinalIgnoreCase) | ||
| || name.Equals(PSObject.PSTypeNames, StringComparison.OrdinalIgnoreCase); |
Collaborator
There was a problem hiding this comment.
I'd prefer to cover all code branches by tests.
I suggest using TestCases with ma,es of the properties and manually add the properties (one per test) to propertyless object.
Collaborator
|
@GregoireLD Do you want to continue? |
Author
|
@iSazonov yes, sorry I got busy lately, but I still aim to fix it for good |
Contributor
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Fix #25832
This fix the case where a Propertyless object is rendered undisplayable after being inspected using Get-Member or any similar introspection commands.
PR Context
Propertyless object are usually displayed using a fallback to their ToString() methods.
But the method currently used to evaluate the "Propertyless-ness" of an object relies on a flawed evaluation:
After inspecting the object, one new property gets dynamically attached to the object, rendering it undisplayable, because no longer regarded as Propertyless.
This PR fixes and extend the current
IsNotRemotingPropertyfunction in two ways: adds the currently missingRemotingConstants.EventObjectkind (currently missing from the evaluation), and also adds thePSObject.PSTypeNameskind to the exclusion list to ensure introspected propertyless objects don't get misjudged as "property-full".Also, maybe changing the
IsNotRemotingPropertyinto a new name likeIsNotBlacklistedPropertyorIsNotSkippedPropertycould be a good idea to mach this function extended purpose, but I wanted to get some feedback before any name change.The full rational and discussion prior to making this PR can be found in my issue report :
#25832
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header