mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove OnDeserialized and Serializable attributes from Microsoft.Management.UI.Internal project (#25548)
Also removed `EnableUnsafeBinaryFormatterSerialization` property from `powershell-win-core.csproj` to disable the use of `BinaryFormatter`.
This commit is contained in:
-1
@@ -13,7 +13,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public abstract class ComparableValueFilterRule<T> : FilterRule where T : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -13,7 +13,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class DoesNotEqualFilterRule<T> : EqualsFilterRule<T> where T : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class EqualsFilterRule<T> : SingleValueComparableValueFilterRule<T> where T : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-2
@@ -9,7 +9,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The base class for all filtering rules.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public abstract class FilterRule : IEvaluate, IDeepCloneable
|
||||
{
|
||||
/// <summary>
|
||||
@@ -69,7 +68,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// <summary>
|
||||
/// Occurs when the values of this rule changes.
|
||||
/// </summary>
|
||||
[field: NonSerialized]
|
||||
public event EventHandler EvaluationResultInvalidated;
|
||||
|
||||
/// <summary>
|
||||
|
||||
-8
@@ -16,7 +16,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class IsBetweenFilterRule<T> : ComparableValueFilterRule<T> where T : IComparable
|
||||
{
|
||||
#region Properties
|
||||
@@ -122,13 +121,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void Initialize(StreamingContext context)
|
||||
{
|
||||
this.StartValue.PropertyChanged += this.Value_PropertyChanged;
|
||||
this.EndValue.PropertyChanged += this.Value_PropertyChanged;
|
||||
}
|
||||
|
||||
#endregion Value Change Handlers
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// is empty or not.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class IsEmptyFilterRule : FilterRule
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class IsGreaterThanFilterRule<T> : SingleValueComparableValueFilterRule<T> where T : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class IsLessThanFilterRule<T> : SingleValueComparableValueFilterRule<T> where T : IComparable
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// is empty or not.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class IsNotEmptyFilterRule : IsEmptyFilterRule
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The IsNotEmptyValidationRule checks a value to see if a value is not empty.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class IsNotEmptyValidationRule : DataErrorInfoValidationRule
|
||||
{
|
||||
#region Properties
|
||||
|
||||
-7
@@ -12,7 +12,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// Represents a filter rule that searches for text within properties on an object.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class PropertiesTextContainsFilterRule : TextFilterRule
|
||||
{
|
||||
private static readonly string TextContainsCharactersRegexPattern = "{0}";
|
||||
@@ -131,11 +130,5 @@ namespace Microsoft.Management.UI.Internal
|
||||
{
|
||||
this.OnEvaluationResultInvalidated();
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void Initialize(StreamingContext context)
|
||||
{
|
||||
this.EvaluationResultInvalidated += this.PropertiesTextContainsFilterRule_EvaluationResultInvalidated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class PropertyValueSelectorFilterRule<T> : SelectorFilterRule where T : IComparable
|
||||
{
|
||||
#region Properties
|
||||
|
||||
-8
@@ -10,7 +10,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The SelectorFilterRule represents a rule composed of other rules.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class SelectorFilterRule : FilterRule
|
||||
{
|
||||
#region Properties
|
||||
@@ -113,13 +112,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
|
||||
#region Private Methods
|
||||
|
||||
[OnDeserialized]
|
||||
private void Initialize(StreamingContext context)
|
||||
{
|
||||
this.AvailableRules.SelectedValueChanged += this.AvailableRules_SelectedValueChanged;
|
||||
this.AvailableRules.SelectedValue.EvaluationResultInvalidated += this.SelectedValue_EvaluationResultInvalidated;
|
||||
}
|
||||
|
||||
private void AvailableRules_SelectedValueChanged(object sender, PropertyChangedEventArgs<FilterRule> e)
|
||||
{
|
||||
this.OnSelectedValueChanged(e.OldValue, e.NewValue);
|
||||
|
||||
-7
@@ -13,7 +13,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The generic parameter.</typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public abstract class SingleValueComparableValueFilterRule<T> : ComparableValueFilterRule<T> where T : IComparable
|
||||
{
|
||||
#region Properties
|
||||
@@ -72,11 +71,5 @@ namespace Microsoft.Management.UI.Internal
|
||||
this.NotifyEvaluationResultInvalidated();
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void Initialize(StreamingContext context)
|
||||
{
|
||||
this.Value.PropertyChanged += this.Value_PropertyChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// check if it is contains the rule's value within it.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class TextContainsFilterRule : TextFilterRule
|
||||
{
|
||||
private static readonly string TextContainsCharactersRegexPattern = "{0}";
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// check if it is does not contain the rule's value within it.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class TextDoesNotContainFilterRule : TextContainsFilterRule
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// check if it is not equal to the rule's value.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class TextDoesNotEqualFilterRule : TextEqualsFilterRule
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// check if it ends with the rule's value.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class TextEndsWithFilterRule : TextFilterRule
|
||||
{
|
||||
private static readonly string TextEndsWithCharactersRegexPattern = "{0}$";
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// check if it is equal to the rule's value.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class TextEqualsFilterRule : TextFilterRule
|
||||
{
|
||||
private static readonly string TextEqualsCharactersRegexPattern = "^{0}$";
|
||||
|
||||
-1
@@ -14,7 +14,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// evaluating string operations.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public abstract class TextFilterRule : SingleValueComparableValueFilterRule<string>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// check if it starts with the rule's value.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class TextStartsWithFilterRule : TextFilterRule
|
||||
{
|
||||
private static readonly string TextStartsWithCharactersRegexPattern = "^{0}";
|
||||
|
||||
-2
@@ -16,7 +16,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class ValidatingSelectorValue<T> : ValidatingValueBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -174,7 +173,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// <summary>
|
||||
/// Notifies listeners that the selected value has changed.
|
||||
/// </summary>
|
||||
[field: NonSerialized]
|
||||
public event EventHandler<PropertyChangedEventArgs<T>> SelectedValueChanged;
|
||||
|
||||
#endregion Events
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// The generic parameter.
|
||||
/// </typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class ValidatingValue<T> : ValidatingValueBase
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// classes to support validation via the IDataErrorInfo interface.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public abstract class ValidatingValueBase : IDataErrorInfo, INotifyPropertyChanged, IDeepCloneable
|
||||
{
|
||||
/// <summary>
|
||||
@@ -47,7 +46,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
private ReadOnlyCollection<DataErrorInfoValidationRule> readonlyValidationRules;
|
||||
private bool isValidationRulesCollectionDirty = true;
|
||||
|
||||
[field: NonSerialized]
|
||||
private DataErrorInfoValidationResult cachedValidationResult;
|
||||
|
||||
/// <summary>
|
||||
@@ -141,7 +139,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// <remarks>
|
||||
/// The listeners attached to this event are not serialized.
|
||||
/// </remarks>
|
||||
[field: NonSerialized]
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
#endregion PropertyChanged
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// Provides a way to create a custom rule in order to check the validity of user input.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public abstract class DataErrorInfoValidationRule : IDeepCloneable
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -12,7 +12,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// a FilterRule value to its DisplayName.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class FilterRuleToDisplayNameConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ namespace Microsoft.Management.UI.Internal
|
||||
/// Allows the state of the ManagementList to be saved and restored.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
|
||||
[Serializable]
|
||||
public class ManagementListStateDescriptor : StateDescriptor<ManagementList>
|
||||
{
|
||||
#region Fields
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<ApplicationManifest>..\..\assets\pwsh.manifest</ApplicationManifest>
|
||||
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>8.0</TargetPlatformVersion>
|
||||
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
|
||||
|
||||
Reference in New Issue
Block a user