Skip to content

Comments

[release/v7.4] Fix Out-GridView by replacing use of obsolete BinaryFormatter with custom implementation.#26866

Open
TravisEz13 wants to merge 1 commit intoPowerShell:release/v7.4from
TravisEz13:backport/release/v7.4/25497-cbafa5a7f
Open

[release/v7.4] Fix Out-GridView by replacing use of obsolete BinaryFormatter with custom implementation.#26866
TravisEz13 wants to merge 1 commit intoPowerShell:release/v7.4from
TravisEz13:backport/release/v7.4/25497-cbafa5a7f

Conversation

@TravisEz13
Copy link
Member

Backport of #25497 to release/v7.4

Triggered by @TravisEz13 on behalf of @mawosoft

Original CL Label: CL-General

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Fixes #24749 / #14054 where Out-GridView filtering is broken because BinaryFormatter was removed. Expected: filtering works. Actual: filtering fails.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

Regression introduced after switching to .NET 9 in PowerShell 7.5.

Testing

Not run locally; issue is interactive per original PR notes.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

User-facing UI behavior change scoped to Out-GridView filter rules; no broad engine impact.

Copilot AI review requested due to automatic review settings February 20, 2026 21:59
@TravisEz13 TravisEz13 added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Feb 20, 2026
@adityapatwardhan adityapatwardhan added the Needs-Triage The issue is new and needs to be triaged by a work group. label Feb 20, 2026
Copy link
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 backports a fix for Out-GridView filtering from the master branch to release/v7.4. The fix addresses a critical regression where Out-GridView's text search functionality broke after .NET 9 removed BinaryFormatter from the runtime. The solution replaces the obsolete BinaryFormatter-based deep cloning with a custom implementation using a new IDeepCloneable interface and copy constructors.

Changes:

  • Introduced IDeepCloneable interface for custom deep cloning
  • Implemented copy constructors across all FilterRule and ValidatingValue classes
  • Removed BinaryFormatter dependency from FilterRuleExtensions

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
IDeepCloneable.cs New interface defining the DeepClone() method contract
DataErrorInfoValidationRule.cs Added IDeepCloneable interface and abstract DeepClone() method
ValidatingValueBase.cs Added copy constructor to support deep cloning of validation rules
ValidatingValue.cs Implemented copy constructor and DeepClone() method with support for IDeepCloneable values
ValidatingSelectorValue.cs Implemented copy constructor with type-safe deep cloning of available values
FilterRule.cs Added copy constructor and DeepClone() implementation using Activator.CreateInstance
TextStartsWithFilterRule.cs Added copy constructor following the established pattern
TextFilterRule.cs Added copy constructor to propagate IgnoreCase and CultureInvariant properties
TextEqualsFilterRule.cs Added copy constructor
TextEndsWithFilterRule.cs Added copy constructor
TextDoesNotEqualFilterRule.cs Added copy constructor
TextDoesNotContainFilterRule.cs Added copy constructor
TextContainsFilterRule.cs Added copy constructor
SingleValueComparableValueFilterRule.cs Added copy constructor with deep cloning of Value property
SelectorFilterRule.cs Added copy constructor with proper event handler attachment
PropertyValueSelectorFilterRule.cs Added copy constructor to copy PropertyName and initialize DisplayNameConverter
PropertiesTextContainsFilterRule.cs Added copy constructor to copy PropertyNames list
IsNotEmptyValidationRule.cs Implemented DeepClone() method for stateless validation rule
IsNotEmptyFilterRule.cs Added copy constructor
IsLessThanFilterRule.cs Added copy constructor
IsGreaterThanFilterRule.cs Added copy constructor
IsEmptyFilterRule.cs Added copy constructor
IsBetweenFilterRule.cs Added copy constructor with deep cloning of StartValue and EndValue
FilterRuleExtensions.cs Replaced BinaryFormatter implementation with simple call to DeepClone()
EqualsFilterRule.cs Added copy constructor
DoesNotEqualFilterRule.cs Added copy constructor
ComparableValueFilterRule.cs Added copy constructor to propagate DefaultNullValueEvaluation

public override object DeepClone()
{
// Instance is stateless.
// return this;
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

Consider removing the commented-out code. The comment "Instance is stateless" explains the decision, but the commented code (return this;) should be removed to keep the codebase clean.

Suggested change
// return this;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Needs-Triage The issue is new and needs to be triaged by a work group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants