Fix Out-GridView by replacing use of obsolete BinaryFormatter with custom implementation. by mawosoft · Pull Request #25497 · PowerShell/PowerShell
The reason why the original author chose to use Binaryformatter instead of doing the work himself (presumably) is the complexity of the involved generic and non-generic types and how they are nested. If you recall, there also was an attempt at replacing Binaryformatter two years ago - which failed, because it did not fully take that complexity into account.
FilterRule is the base class of a hierarchy of ~20 classes, nested up to six levels. Some of them are generic. Their generic properties are of type ValidatingValue<T> and ValidatingSelectorValue<T>.
That type T can be an "incoming" type corresponding to the columns of the gridview, which I referred to with "some other type like string etc".
But T can also be another class derived from FilterRule like PropertyValueSelectorFilterRule<T2>, or another ValidatingValue<T3>. So you get multiple nested generics, some of which are generated dynamically at runtime via MakeGenericType().