From d373d5e38504af061c1de78c31208e2bea4c9f58 Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 29 Jul 2021 02:00:58 +0100 Subject: [PATCH] Partial revert 7ead1374072c2664f5830fceb6b281a500196d0a --- .../HelpWindow/HelpViewModel.cs | 3 --- .../HelpWindow/ParagraphBuilder.cs | 8 -------- .../ManagementList/Common/DismissiblePopup.cs | 2 -- .../ManagementList/Common/ListOrganizerItem.cs | 2 -- .../Common/ReadOnlyObservableAsyncCollection.cs | 5 ----- .../ManagementList/CommonControls/Resizer.cs | 3 --- .../FilterCore/DefaultFilterRuleCustomizationFactory.cs | 4 ---- .../ManagementList/FilterCore/FilterEvaluator.cs | 5 ----- .../ManagementList/FilterCore/ValidatingValue.cs | 2 -- .../FilterProviders/AddFilterRulePicker.cs | 3 --- .../FilterProviders/InputFieldBackgroundTextConverter.cs | 3 --- .../ManagementList/ManagementList/Innerlist.cs | 4 ---- .../ManagementList/PropertyValueComparer.cs | 2 -- .../ManagementList/ManagementList/PropertyValueGetter.cs | 2 -- .../ManagementList/ManagementList/managementlist.cs | 2 -- .../ShowCommand/Controls/ParameterSetControl.xaml.cs | 3 --- .../ShowCommand/ViewModel/AllModulesViewModel.cs | 9 --------- .../ShowCommand/ViewModel/ModuleViewModel.cs | 9 --------- .../commandHelpers/OutGridView.cs | 1 - .../commandHelpers/ShowCommandHelper.cs | 7 ++----- 20 files changed, 2 insertions(+), 77 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs index de62923614d..7cbe4b0c74e 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs @@ -4,7 +4,6 @@ using System; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Management.Automation; using System.Windows.Documents; @@ -274,13 +273,11 @@ private void SetMatchesLabel() /// Property name. private void OnNotifyPropertyChanged(string propertyName) { - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } - #pragma warning restore IDE1005s } } } diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs index 16b1be82f67..822e4c05026 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using System.Text; using System.Windows.Documents; using System.Windows.Media; @@ -108,15 +107,10 @@ internal void BuildParagraph() bool newHighlighted = false; ParagraphBuilder.MoveSpanToPosition(ref currentBoldIndex, ref currentBoldSpan, i, this.boldSpans); - - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified newBold = currentBoldSpan == null ? false : currentBoldSpan.Value.Contains(i); - #pragma warning restore IDE0075 ParagraphBuilder.MoveSpanToPosition(ref currentHighlightedIndex, ref currentHighlightedSpan, i, this.highlightedSpans); - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified newHighlighted = currentHighlightedSpan == null ? false : currentHighlightedSpan.Value.Contains(i); - #pragma warning restore IDE0075 if (newBold != currentBold || newHighlighted != currentHighlighted) { @@ -307,13 +301,11 @@ private void AddHighlight(int start, int length) /// Property name. private void OnNotifyPropertyChanged(string propertyName) { - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.s PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } - #pragma warning restore IDE1005 } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs index 97038e71665..582be1c7ecd 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs @@ -3,7 +3,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Automation; using System.Windows.Controls.Primitives; @@ -80,7 +79,6 @@ protected override void OnClosed(EventArgs e) } } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private void SetFocus(UIElement element) { if (element.Focusable) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs index 276cbba283a..469ed5aec77 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs @@ -35,9 +35,7 @@ public bool IsInEditMode { get { - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified return (this.renameButton != null) ? this.renameButton.IsChecked.Value : false; - #pragma warning restore IDE0075 } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs index 1c3e7bffb27..7734bc4903c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs @@ -6,7 +6,6 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { @@ -98,8 +97,6 @@ public Exception OperationError #endregion IAsyncProgress #region Private Methods - - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. private void OnCollectionChanged(NotifyCollectionChangedEventArgs args) { NotifyCollectionChangedEventHandler eh = this.CollectionChanged; @@ -120,8 +117,6 @@ private void OnPropertyChanged(PropertyChangedEventArgs args) } } - #pragma warning restore IDE1005 - // forward CollectionChanged events from the base list to our listeners private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs index 36ed7e62e3d..19c0671bf21 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs @@ -4,7 +4,6 @@ using System; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; @@ -203,7 +202,6 @@ private double GetNewWidth(ResizeGripLocation location, double horzDelta) return this.GetConstrainedValue(newWidth, this.MaxWidth, this.MinWidth); } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private double GetHorizontalDelta(ResizeGripLocation location, double horzDelta) { double realDelta; @@ -221,7 +219,6 @@ private double GetHorizontalDelta(ResizeGripLocation location, double horzDelta) return realDelta; } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private double GetConstrainedValue(double value, double max, double min) { return Math.Min(max, Math.Max(value, min)); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs index 2fa13516bde..bd5faf32d63 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Reflection; @@ -197,7 +196,6 @@ public override string GetErrorMessageForInvalidValue(string value, Type typeToP #region Helpers - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private bool TryGetGenericParameterForComparableValueFilterRule(FilterRule rule, out Type genericParameter) { genericParameter = null; @@ -219,7 +217,6 @@ private bool TryGetGenericParameterForComparableValueFilterRule(FilterRule rule, return true; } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private object GetValueFromValidatingValue(FilterRule rule, string propertyName) { Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName), "rule and propertyname are not null"); @@ -239,7 +236,6 @@ private object GetValueFromValidatingValue(FilterRule rule, string propertyName) return property.GetValue(validatingValue, null); } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private void SetValueOnValidatingValue(FilterRule rule, string propertyName, object value) { Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName), "rule and propertyname are not null"); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index 46ada50ebef..2b33153a983 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -5,7 +5,6 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { @@ -174,8 +173,6 @@ public void RemoveFilterExpressionProvider(IFilterExpressionProvider provider) #region NotifyPropertyChanged - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. - /// /// Notifies listeners that a property has changed. /// @@ -217,8 +214,6 @@ protected virtual void NotifyFilterExpressionChanged() } } - #pragma warning restore IDE1005 - private void FilterProvider_FilterExpressionChanged(object sender, EventArgs e) { // Update HasFilterExpression \\ diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index 62bb3ca7517..cf9c553f6b4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -3,7 +3,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace Microsoft.Management.UI.Internal @@ -191,7 +190,6 @@ private bool TryGetCastValue(object rawValue, out T castValue) } } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private bool TryGetEnumValue(object rawValue, out T castValue) { Debug.Assert(rawValue != null, "rawValue not null"); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs index a4e13c6c9f5..d41b0a3e532 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs @@ -4,7 +4,6 @@ using System; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using System.Windows.Controls; namespace Microsoft.Management.UI.Internal @@ -50,11 +49,9 @@ public ObservableCollection ColumnFilterRules partial void OnOkAddFilterRulesCanExecuteImplementation(System.Windows.Input.CanExecuteRoutedEventArgs e) { - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified e.CanExecute = (this.AddFilterRulesCommand != null) ? CommandHelper.CanExecuteCommand(this.AddFilterRulesCommand, null, this.AddFilterRulesCommandTarget) : false; - #pragma warning restore IDE0075 } partial void OnOkAddFilterRulesExecutedImplementation(System.Windows.Input.ExecutedRoutedEventArgs e) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs index e19eae34a3e..0017f2a4340 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; using System.Windows.Data; @@ -70,7 +69,6 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste #region Helpers - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private bool IsOfTypeValidatingValue(object value) { Debug.Assert(value != null, "not null"); @@ -94,7 +92,6 @@ private Type GetGenericParameter(object value, CultureInfo culture) return value.GetType().GetGenericArguments()[0]; } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private object GetBackgroundTextForType(Type inputType) { if (typeof(DateTime) == inputType) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs index a01435b2414..78a8da29c65 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs @@ -8,7 +8,6 @@ using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; using System.Windows; @@ -402,14 +401,12 @@ private static void InnerList_OnViewChanged(DependencyObject obj, DependencyProp /// The exception to be thrown when using Items. private static NotSupportedException GetItemsException() { - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. return new NotSupportedException( string.Format( CultureInfo.InvariantCulture, InvariantResources.NotSupportAddingToItems, nameof(InnerList), ItemsControl.ItemsSourceProperty.Name)); - #pragma warning restore IDE1005s } #endregion static private methods @@ -608,7 +605,6 @@ private string GetClipboardTextLineForSelectedItem(object value) return entryText.ToString(); } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private void SetClipboardWithSelectedItemsText(string text) { if (string.IsNullOrEmpty(text)) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs index 996eb8b72de..5c9f56daa81 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Management.Automation; namespace Microsoft.Management.UI.Internal @@ -89,7 +88,6 @@ private void GetPropertyValues(string propertyName, object a, object b, out obje } } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private int CompareData(object firstValue, object secondValue, StringComparison stringComparison) { // If both values are null, do nothing; otherwise, if one is null promote the other \\ diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs index 8ec9e5ecb7d..61a1a71938c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs @@ -4,7 +4,6 @@ using System; using System.ComponentModel; using System.Data; -using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace Microsoft.Management.UI.Internal @@ -111,7 +110,6 @@ private PropertyDescriptor GetPropertyDescriptor(string propertyName, object val return descriptor; } - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private bool TryGetPropertyValueInternal(PropertyDescriptor descriptor, object value, out object propertyValue) { propertyValue = null; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs index fab4e721bec..7c36244e0f1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs @@ -5,7 +5,6 @@ using System.Collections; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Windows; using System.Windows.Controls; @@ -309,7 +308,6 @@ partial void OnClearFilterExecutedImplementation(ExecutedRoutedEventArgs e) #region View Manager Callbacks - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] partial void OnSaveViewCanExecuteImplementation(CanExecuteRoutedEventArgs e) { string viewName = (string)e.Parameter; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs index a38e4003af3..08f9df29337 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs @@ -4,7 +4,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Management.Automation; using System.Windows; @@ -345,7 +344,6 @@ private void CheckBox_Click(object sender, RoutedEventArgs e) /// Creates a RowDefinition for MainGrid. /// /// Return a RowDefinition object. - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private RowDefinition CreateNewRow() { RowDefinition row = new RowDefinition(); @@ -384,7 +382,6 @@ private void CreateAndAddLabel(ParameterViewModel parameterViewModel, int rowNum /// DataContext object. /// Row number. /// Return a Label control. - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private Label CreateLabel(ParameterViewModel parameterViewModel, int rowNumber) { Label label = new Label(); diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs index 8040c4cb45a..34159c8f837 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Management.Automation; @@ -80,12 +79,10 @@ public class AllModulesViewModel : INotifyPropertyChanged /// Commands to show. public AllModulesViewModel(Dictionary importedModules, IEnumerable commands) { - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified if (commands == null || !commands.GetEnumerator().MoveNext()) { throw new ArgumentNullException("commands"); } - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified this.Initialization(importedModules, commands, true); } @@ -403,13 +400,11 @@ public string GetScript() /// internal void OnRefresh() { - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. EventHandler handler = this.Refresh; if (handler != null) { handler(this, new EventArgs()); } - #pragma warning restore IDE1005s } #region Private Methods @@ -598,8 +593,6 @@ private void SelectedModule_SelectedCommandNeedsImportModule(object sender, Impo this.OnSelectedCommandInSelectedModuleNeedsImportModule(e); } - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. - /// /// Triggers SelectedCommandInSelectedModuleNeedsHelp. /// @@ -661,8 +654,6 @@ private void OnNotifyPropertyChanged(string propertyName) handler(this, new PropertyChangedEventArgs(propertyName)); } } - - #pragma warning restore IDE1005s #endregion } } diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs index d6a2e57c051..38925e458a9 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; using System.Management.Automation; using System.Windows; @@ -77,8 +76,6 @@ public ModuleViewModel(string name, Dictionary im this.commands = new List(); this.filteredCommands = new ObservableCollection(); - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified - // This check looks to see if the given module name shows up in // the set of modules that are known to be imported in the current // session. In remote PowerShell sessions, the core cmdlet module @@ -89,8 +86,6 @@ public ModuleViewModel(string name, Dictionary im importedModules == null ? true : name.Length == 0 || importedModules.ContainsKey(name) || string.Equals("Microsoft.PowerShell.Core", name, StringComparison.OrdinalIgnoreCase); - - #pragma warning restore IDE0075 } #endregion @@ -377,8 +372,6 @@ internal void RefreshFilteredCommands(string filter) } } - #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified. - /// /// Callled in response to a GUI event that requires the command to be run. /// @@ -534,7 +527,5 @@ private void OnNotifyPropertyChanged(string propertyName) handler(this, new PropertyChangedEventArgs(propertyName)); } } - - #pragma warning restore IDE1005 } } diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index 2135877655a..f38a8a70945 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -246,7 +246,6 @@ private void ZoomEventHandlerMinus(object sender, ExecutedRoutedEventArgs e) /// /// Output mode of the out-gridview. /// A new ManagementList. - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private ManagementList CreateManagementList(string outputMode) { ManagementList newList = new ManagementList(); diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs index 5ac2321cded..873f15e2c41 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs @@ -643,9 +643,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode ModuleViewModel moduleToSelect = returnValue.Modules.Find( new Predicate((module) => { - #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified - return module.Name.Equals(selectedModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase); - #pragma warning restore IDE0075 + return module.Name.Equals(selectedModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false; })); if (moduleToSelect == null) @@ -659,7 +657,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode new Predicate((command) => { return command.ModuleName.Equals(parentModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) && - command.Name.Equals(commandNeedingImportModule, StringComparison.OrdinalIgnoreCase); + command.Name.Equals(commandNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false; })); if (commandToSelect == null) @@ -1246,7 +1244,6 @@ private void CloseWindow() /// Showing a MessageBox when user type a invalidate command name. /// /// Error message. - [SuppressMessage("Performance", "CA1822: Mark members as static", Justification = "Potential breaking change")] private void ShowErrorString(string errorString) { if (errorString != null && errorString.Trim().Length > 0)