diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs index 9e6329e20a..e7ef648e3f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs @@ -13,6 +13,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class ComparableValueFilterRule : FilterRule where T : IComparable { #region Properties @@ -61,19 +62,6 @@ namespace Microsoft.Management.UI.Internal return this.Evaluate(castItem); } - /// - /// Creates a clone of the ComparableValueFilterRule instance. - /// - /// - /// Returns a clone of the ComparableValueFilterRule instance. - /// - public override FilterRule Clone() - { - ComparableValueFilterRule rule = (ComparableValueFilterRule)Activator.CreateInstance(this.GetType()); - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item matches a derived classes criteria. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs index d616d9f5ba..ae209d0e60 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs @@ -13,6 +13,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class DoesNotEqualFilterRule : EqualsFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DefaultNullValueEvaluation = true; } - /// - /// Creates a clone of the DoesNotEqualFilterRule instance. - /// - /// - /// A clone of the DoesNotEqualFilterRule instance. - /// - public override FilterRule Clone() - { - DoesNotEqualFilterRule rule = new DoesNotEqualFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is not equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs index a8a1762730..7bafd53e41 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class EqualsFilterRule : SingleValueComparableValueFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_Equals; } - /// - /// Creates a new EqualsFilterRule that is a clone of the current instance. - /// - /// - /// A new EqualsFilterRule that is a clone of the current instance. - /// - public override FilterRule Clone() - { - EqualsFilterRule rule = new EqualsFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs index b7eec63946..e7717c9a7b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// The base class for all filtering rules. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class FilterRule : IEvaluate { /// @@ -48,12 +49,6 @@ namespace Microsoft.Management.UI.Internal /// Returns true if the item meets the criteria. False otherwise. public abstract bool Evaluate(object item); - /// - /// Creates a clone of this FilterRule. - /// - /// Returns a clone of this FilterRule. - public abstract FilterRule Clone(); - #region EvaluationResultInvalidated /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs index 845d35dd95..bc8e0b02ca 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs @@ -27,7 +27,30 @@ namespace Microsoft.Management.UI.Internal /// public static FilterRule DeepCopy(this FilterRule rule) { - return rule.Clone(); + ArgumentNullException.ThrowIfNull(rule); + +#pragma warning disable SYSLIB0050 + Debug.Assert(rule.GetType().IsSerializable, "rule is serializable"); +#pragma warning disable SYSLIB0011 + BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone)); +#pragma warning restore SYSLIB0011 + MemoryStream ms = new MemoryStream(); + + FilterRule copy = null; + try + { + formatter.Serialize(ms, rule); + + ms.Position = 0; + copy = (FilterRule)formatter.Deserialize(ms); +#pragma warning restore SYSLIB0050 + } + finally + { + ms.Close(); + } + + return copy; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs index 597bafb6db..cbe4a875dd 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsBetweenFilterRule : ComparableValueFilterRule where T : IComparable { #region Properties @@ -50,21 +51,6 @@ namespace Microsoft.Management.UI.Internal protected set; } - /// - /// Creates a clone of the FilterRule. - /// - /// - /// A clone of the FilterRule. - /// - public override FilterRule Clone() - { - IsBetweenFilterRule clone = new IsBetweenFilterRule(); - clone.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - clone.StartValue = this.StartValue; - clone.EndValue = this.EndValue; - return clone; - } - #endregion Properties #region Ctor diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs index d523409e53..5ad2ae1247 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// is empty or not. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsEmptyFilterRule : FilterRule { /// @@ -20,18 +21,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_IsEmpty; } - /// - /// Creates a clone of the IsEmptyFilterRule instance. - /// - /// - /// A clone of IsEmptyFilterRule instance. - /// - public override FilterRule Clone() - { - IsEmptyFilterRule rule = new IsEmptyFilterRule(); - return rule; - } - /// /// Gets a values indicating whether the supplied item is empty. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs index e2cea2d488..d098d2a938 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsGreaterThanFilterRule : SingleValueComparableValueFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_GreaterThanOrEqual; } - /// - /// Creates a new IsGreaterThanFilterRule that is a clone of the current instance. - /// - /// - /// A new IsGreaterThanFilterRule that is a clone of the current instance. - /// - public override FilterRule Clone() - { - IsGreaterThanFilterRule rule = new IsGreaterThanFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is greater than Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs index 905d14648c..8539d6edf0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsLessThanFilterRule : SingleValueComparableValueFilterRule where T : IComparable { /// @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_LessThanOrEqual; } - /// - /// Creates a new IsLessThanFilterRule that is a clone of the current instance. - /// - /// - /// A new IsLessThanFilterRule that is a clone of the current instance. - /// - public override FilterRule Clone() - { - IsLessThanFilterRule rule = new IsLessThanFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if item is less than Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs index b6410917e9..68e501d1f6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// is empty or not. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsNotEmptyFilterRule : IsEmptyFilterRule { /// @@ -20,18 +21,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_IsNotEmpty; } - /// - /// Creates a clone of the IsNotEmptyFilterRule. - /// - /// - /// A clone of the IsNotEmptyFilterRule. - /// - public override FilterRule Clone() - { - IsNotEmptyFilterRule rule = new IsNotEmptyFilterRule(); - return rule; - } - /// /// Gets a values indicating whether the supplied item is not empty. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs index 83734f42f7..31722bfe1f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs @@ -9,6 +9,7 @@ namespace Microsoft.Management.UI.Internal /// The IsNotEmptyValidationRule checks a value to see if a value is not empty. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class IsNotEmptyValidationRule : DataErrorInfoValidationRule { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs index e1be855825..2a1cc576b3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs @@ -12,6 +12,7 @@ namespace Microsoft.Management.UI.Internal /// Represents a filter rule that searches for text within properties on an object. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class PropertiesTextContainsFilterRule : TextFilterRule { private static readonly string TextContainsCharactersRegexPattern = "{0}"; @@ -37,20 +38,6 @@ namespace Microsoft.Management.UI.Internal private set; } - /// - /// Creates a clone of this . - /// - /// - /// A clone of this . - /// - public override FilterRule Clone() - { - PropertiesTextContainsFilterRule clone = new PropertiesTextContainsFilterRule(); - clone.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - clone.PropertyNames = new List(this.PropertyNames); - return clone; - } - /// /// Evaluates whether the specified properties on contain the current value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index 551ae38d45..158ab4e022 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class PropertyValueSelectorFilterRule : SelectorFilterRule where T : IComparable { #region Properties @@ -65,11 +66,6 @@ namespace Microsoft.Management.UI.Internal /// public PropertyValueSelectorFilterRule(string propertyName, string propertyDisplayName, IEnumerable rules) { - ArgumentException.ThrowIfNullOrEmpty(propertyName); - ArgumentException.ThrowIfNullOrEmpty(propertyDisplayName); - - ArgumentNullException.ThrowIfNull(rules); - this.PropertyName = propertyName; this.DisplayName = propertyDisplayName; @@ -120,17 +116,6 @@ namespace Microsoft.Management.UI.Internal return this.AvailableRules.SelectedValue.Evaluate(propertyValue); } - /// - /// Creates a clone of the PropertyValueSelectorFilterRule instance. - /// - /// - /// Returns a clone of the PropertyValueSelectorFilterRule instance. - /// - public override FilterRule Clone() - { - return new PropertyValueSelectorFilterRule(this.PropertyName, this.DisplayName, this.AvailableRules.AvailableValues); - } - #endregion Public Methods #region Private Methods diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs index 6f0042cb48..da4a62b6f6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// The SelectorFilterRule represents a rule composed of other rules. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class SelectorFilterRule : FilterRule { #region Properties @@ -70,23 +71,6 @@ namespace Microsoft.Management.UI.Internal return this.AvailableRules.SelectedValue.Evaluate(item); } - /// - /// Creates a clone of the SelectorFilterRule instance. - /// - /// - /// Returns a clone of the SelectorFilterRule instance. - /// - public override FilterRule Clone() - { - SelectorFilterRule clone = new SelectorFilterRule(); - clone.DisplayName = this.DisplayName; - clone.AvailableRules = this.AvailableRules; - clone.AvailableRules.SelectedValueChanged += clone.AvailableRules_SelectedValueChanged; - clone.AvailableRules.SelectedValue.EvaluationResultInvalidated += clone.SelectedValue_EvaluationResultInvalidated; - - return clone; - } - /// /// Called when the SelectedValue within AvailableRules changes. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs index e716369cb2..9486a12682 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs @@ -13,6 +13,7 @@ namespace Microsoft.Management.UI.Internal /// /// The generic parameter. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class SingleValueComparableValueFilterRule : ComparableValueFilterRule where T : IComparable { #region Properties @@ -53,15 +54,6 @@ namespace Microsoft.Management.UI.Internal #endregion Ctor - /// - /// Creates a clone of the FilterRule. - /// - /// A clone of the FilterRule. - public override FilterRule Clone() - { - return base.Clone(); - } - private void Value_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Value") diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs index db3a6e57e2..fe581ca203 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is contains the rule's value within it. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextContainsFilterRule : TextFilterRule { private static readonly string TextContainsCharactersRegexPattern = "{0}"; @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_Contains; } - /// - /// Creates a clone of the TextContainsFilterRule instance. - /// - /// - /// Returns a clone of the TextContainsFilterRule instance. - /// - public override FilterRule Clone() - { - TextContainsFilterRule rule = new TextContainsFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if Value is contained within data. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs index e211d4ca8b..29bec9b4bb 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is does not contain the rule's value within it. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextDoesNotContainFilterRule : TextContainsFilterRule { /// @@ -21,20 +22,6 @@ namespace Microsoft.Management.UI.Internal this.DefaultNullValueEvaluation = true; } - /// - /// Creates a clone of the TextDoesNotContainFilterRule instance. - /// - /// - /// A clone of the TextDoesNotContainFilterRule instance. - /// - public override FilterRule Clone() - { - TextDoesNotContainFilterRule rule = new TextDoesNotContainFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if Value is not contained within data. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs index f3a8d5353a..4e72fe16e6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs @@ -10,6 +10,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is not equal to the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextDoesNotEqualFilterRule : TextEqualsFilterRule { /// @@ -21,20 +22,6 @@ namespace Microsoft.Management.UI.Internal this.DefaultNullValueEvaluation = true; } - /// - /// Creates a clone of the TextDoesNotEqualFilterRule instance. - /// - /// - /// Returns a clone of the TextDoesNotEqualFilterRule instance. - /// - public override FilterRule Clone() - { - TextDoesNotEqualFilterRule rule = new TextDoesNotEqualFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if data is not equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs index b1ef79bc6b..baca67801b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it ends with the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextEndsWithFilterRule : TextFilterRule { private static readonly string TextEndsWithCharactersRegexPattern = "{0}$"; @@ -24,20 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_TextEndsWith; } - /// - /// Creates a clone of the TextEndsWithFilterRule instance. - /// - /// - /// Returns a clone of the TextEndsWithFilterRule instance. - /// - public override FilterRule Clone() - { - TextEndsWithFilterRule rule = new TextEndsWithFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if data ends with Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs index 5c296dc203..e49dd9b4a0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it is equal to the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextEqualsFilterRule : TextFilterRule { private static readonly string TextEqualsCharactersRegexPattern = "^{0}$"; @@ -23,20 +24,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_Equals; } - /// - /// Creates a clone of the TextEqualsFilterRule instance. - /// - /// - /// Returns a clone of the TextEqualsFilterRule instance. - /// - public override FilterRule Clone() - { - TextEqualsFilterRule rule = new TextEqualsFilterRule(); - rule.Value = this.Value; - rule.DefaultNullValueEvaluation = this.DefaultNullValueEvaluation; - return rule; - } - /// /// Determines if data is equal to Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs index b2ab66a0db..0dc75cf24e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs @@ -14,6 +14,7 @@ namespace Microsoft.Management.UI.Internal /// evaluating string operations. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class TextFilterRule : SingleValueComparableValueFilterRule { /// @@ -60,17 +61,6 @@ namespace Microsoft.Management.UI.Internal } } - /// - /// Creates a clone of the FilterRule. - /// - /// - /// Returns a clone of the FilterRule. - /// - public override FilterRule Clone() - { - return base.Clone(); - } - /// /// Initializes a new instance of the TextFilterRule class. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs index d04079ee01..e97deb0fd4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs @@ -11,6 +11,7 @@ namespace Microsoft.Management.UI.Internal /// check if it starts with the rule's value. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class TextStartsWithFilterRule : TextFilterRule { private static readonly string TextStartsWithCharactersRegexPattern = "^{0}"; @@ -24,17 +25,6 @@ namespace Microsoft.Management.UI.Internal this.DisplayName = UICultureResources.FilterRule_TextStartsWith; } - /// - /// Creates a clone of the TextStartsWithFilterRule instance. - /// - /// - /// Returns a clone of the TextStartsWithFilterRule instance. - /// - public override FilterRule Clone() - { - return base.Clone(); - } - /// /// Determines if data starts with Value. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs index 5f21c186be..f8583e98bc 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs @@ -17,6 +17,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class ValidatingSelectorValue : ValidatingValueBase { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index 49f1640731..fe21d2fee3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -15,6 +15,7 @@ namespace Microsoft.Management.UI.Internal /// The generic parameter. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class ValidatingValue : ValidatingValueBase { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index 0ead40919d..be7584f0ff 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// classes to support validation via the IDataErrorInfo interface. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class ValidatingValueBase : IDataErrorInfo, INotifyPropertyChanged { #region Properties diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs index 162de593a8..652592aec0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs @@ -9,6 +9,7 @@ namespace Microsoft.Management.UI.Internal /// Provides a way to create a custom rule in order to check the validity of user input. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public abstract class DataErrorInfoValidationRule { /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs index 972c19080e..aaca30ff32 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs @@ -12,6 +12,7 @@ namespace Microsoft.Management.UI.Internal /// a FilterRule value to its DisplayName. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class FilterRuleToDisplayNameConverter : IValueConverter { /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs index 9798804bd8..45db449d70 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs @@ -16,6 +16,7 @@ namespace Microsoft.Management.UI.Internal /// Allows the state of the ManagementList to be saved and restored. /// [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Serializable] public class ManagementListStateDescriptor : StateDescriptor { #region Fields diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index 79d9e3fccf..87a8221a68 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -13,6 +13,7 @@ ..\..\assets\pwsh.manifest Windows 8.0 + true