diff --git a/DotnetRuntimeMetadata.json b/DotnetRuntimeMetadata.json
index c1f96b55956..9124e01730e 100644
--- a/DotnetRuntimeMetadata.json
+++ b/DotnetRuntimeMetadata.json
@@ -1,9 +1,9 @@
{
"sdk": {
- "channel": "release/6.0.1xx-preview2",
- "packageVersionPattern": "6.0.0-preview.2",
+ "channel": "release/6.0.1xx-preview4",
+ "packageVersionPattern": "6.0.0-preview.4",
"sdkImageVersion": "6.0.100",
- "nextChannel": "6.0.1xx-preview2/daily"
+ "nextChannel": "6.0.1xx-preview4/daily"
},
"internalfeed" : {
"url": null
diff --git a/PowerShell.Common.props b/PowerShell.Common.props
index 38cd13e007d..b6b627bdf34 100644
--- a/PowerShell.Common.props
+++ b/PowerShell.Common.props
@@ -136,6 +136,7 @@
net6.0
9.0
true
+ false
true
true
diff --git a/assets/wix/files.wxs b/assets/wix/files.wxs
index 6e7f8d6e8af..17f0ca4daa1 100644
--- a/assets/wix/files.wxs
+++ b/assets/wix/files.wxs
@@ -3063,8 +3063,8 @@
-
-
+
+
@@ -4053,7 +4053,7 @@
-
+
diff --git a/global.json b/global.json
index 08135cb47bd..c36bb3376e9 100644
--- a/global.json
+++ b/global.json
@@ -1,5 +1,5 @@
{
"sdk": {
- "version": "6.0.100-preview.3.21202.5"
+ "version": "6.0.100-preview.4.21255.9"
}
}
diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs
index 7cbe4b0c74e..de62923614d 100644
--- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs
+++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs
@@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Management.Automation;
using System.Windows.Documents;
@@ -273,11 +274,13 @@ 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 822e4c05026..16b1be82f67 100644
--- a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs
+++ b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Windows.Documents;
using System.Windows.Media;
@@ -107,10 +108,15 @@ 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)
{
@@ -301,11 +307,13 @@ 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 582be1c7ecd..97038e71665 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs
@@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls.Primitives;
@@ -79,6 +80,7 @@ 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/KeyboardHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs
index 90684f3f6cc..0d174fb25ed 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs
@@ -109,7 +109,7 @@ public static FocusNavigationDirection GetNavigationDirection(DependencyObject e
/// True if a control is is pressed.
public static bool IsControlPressed()
{
- if (ModifierKeys.Control == (Keyboard.Modifiers & ModifierKeys.Control))
+ if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
return true;
}
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs
index 469ed5aec77..276cbba283a 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs
@@ -35,7 +35,9 @@ 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 7734bc4903c..1c3e7bffb27 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs
@@ -6,6 +6,7 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Management.UI.Internal
{
@@ -97,6 +98,8 @@ 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;
@@ -117,6 +120,8 @@ 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 19c0671bf21..36ed7e62e3d 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs
@@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@@ -202,6 +203,7 @@ 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;
@@ -219,6 +221,7 @@ 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 bd5faf32d63..2fa13516bde 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
@@ -196,6 +197,7 @@ 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;
@@ -217,6 +219,7 @@ 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");
@@ -236,6 +239,7 @@ 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 2b33153a983..46ada50ebef 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs
@@ -5,6 +5,7 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Management.UI.Internal
{
@@ -173,6 +174,8 @@ public void RemoveFilterExpressionProvider(IFilterExpressionProvider provider)
#region NotifyPropertyChanged
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
+
///
/// Notifies listeners that a property has changed.
///
@@ -214,6 +217,8 @@ 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/FilterRules/FilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs
index 1c2fc523e86..89b31449ba6 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT License.
using System;
+using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Management.UI.Internal
{
@@ -66,12 +67,14 @@ protected FilterRule()
///
protected void NotifyEvaluationResultInvalidated()
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
var eh = this.EvaluationResultInvalidated;
if (eh != null)
{
eh(this, new EventArgs());
}
+ #pragma warning restore IDE1005
}
#endregion
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs
index ed5389668e6..e86f2020ecc 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Windows.Data;
@@ -214,12 +215,14 @@ protected override DataErrorInfoValidationResult Validate(string columnName)
///
protected void NotifySelectedValueChanged(T oldValue, T newValue)
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
EventHandler> eh = this.SelectedValueChanged;
if (eh != null)
{
eh(this, new PropertyChangedEventArgs(oldValue, newValue));
}
+ #pragma warning restore IDE1005
}
#endregion NotifySelectedValueChanged
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs
index cf9c553f6b4..62bb3ca7517 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs
@@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Microsoft.Management.UI.Internal
@@ -190,6 +191,7 @@ 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/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs
index f3959685349..ea2b255063f 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs
@@ -6,6 +6,7 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Microsoft.Management.UI.Internal
@@ -260,12 +261,14 @@ protected void InvalidateValidationResult()
///
protected void NotifyPropertyChanged(string propertyName)
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
PropertyChangedEventHandler eh = this.PropertyChanged;
if (eh != null)
{
eh(this, new PropertyChangedEventArgs(propertyName));
}
+ #pragma warning restore IDE1005
}
#endregion NotifyPropertyChanged
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs
index d41b0a3e532..a4e13c6c9f5 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using System.Windows.Controls;
namespace Microsoft.Management.UI.Internal
@@ -49,9 +50,11 @@ 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/AddFilterRulePickerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs
index 24c6eec1889..962d4a9665a 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs
@@ -70,12 +70,14 @@ public AddFilterRulePickerItem(FilterRulePanelItem filterRule)
///
protected void NotifyPropertyChanged(string propertyName)
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
PropertyChangedEventHandler eh = this.PropertyChanged;
if (eh != null)
{
eh(this, new PropertyChangedEventArgs(propertyName));
}
+ #pragma warning restore IDE1005
}
#endregion NotifyPropertyChanged
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs
index bcc9a01a92c..35060a1b8ff 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs
@@ -213,11 +213,13 @@ public void ClearContentTemplates()
///
protected virtual void NotifyFilterExpressionChanged()
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
EventHandler eh = this.FilterExpressionChanged;
if (eh != null)
{
eh(this, new EventArgs());
}
+ #pragma warning restore IDE1005
}
private void Controller_FilterExpressionChanged(object sender, EventArgs e)
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs
index dcec5022d98..c4956063aa3 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs
@@ -266,11 +266,13 @@ private void UpdateFilterRulePanelItemTypes()
///
protected virtual void NotifyFilterExpressionChanged()
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
EventHandler eh = this.FilterExpressionChanged;
if (eh != null)
{
eh(this, new EventArgs());
}
+ #pragma warning restore IDE1005
}
#endregion Notify Filter Expression Changed
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs
index a1a873cdbc7..cbafae9d283 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs
@@ -107,11 +107,15 @@ protected void NotifyPropertyChanged(string propertyName)
{
Debug.Assert(!string.IsNullOrEmpty(propertyName), "not null");
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
+
PropertyChangedEventHandler eh = this.PropertyChanged;
if (eh != null)
{
eh(this, new PropertyChangedEventArgs(propertyName));
}
+
+ #pragma warning restore IDE1005s
}
#endregion Public Methods
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs
index 0017f2a4340..e19eae34a3e 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Windows.Data;
@@ -69,6 +70,7 @@ 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");
@@ -92,6 +94,7 @@ 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/FilterProviders/SearchBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs
index 25830150939..b6471b6f653 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs
@@ -60,11 +60,13 @@ public bool HasFilterExpression
///
protected virtual void NotifyFilterExpressionChanged()
{
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
EventHandler eh = this.FilterExpressionChanged;
if (eh != null)
{
eh(this, new EventArgs());
}
+ #pragma warning restore IDE1005s
}
#endregion
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs
index 03c7acdf008..a01435b2414 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs
@@ -8,6 +8,7 @@
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Windows;
@@ -355,7 +356,7 @@ protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
- if ((Key.Left == e.Key || Key.Right == e.Key) &&
+ if ((e.Key == Key.Left || e.Key == Key.Right) &&
Keyboard.Modifiers == ModifierKeys.None)
{
// If pressing Left or Right on a column header, move the focus \\
@@ -388,8 +389,8 @@ private static void InnerList_OnViewChanged(DependencyObject obj, DependencyProp
throw new NotSupportedException(string.Format(
CultureInfo.InvariantCulture,
InvariantResources.ViewSetWithType,
- typeof(GridView).Name,
- typeof(InnerListGridView).Name));
+ nameof(GridView),
+ nameof(InnerListGridView)));
}
((InnerList)obj).innerGrid = innerGrid;
@@ -401,12 +402,14 @@ 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,
- typeof(InnerList).Name,
+ nameof(InnerList),
ItemsControl.ItemsSourceProperty.Name));
+ #pragma warning restore IDE1005s
}
#endregion static private methods
@@ -605,6 +608,7 @@ 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 5c9f56daa81..996eb8b72de 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs
@@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Management.Automation;
namespace Microsoft.Management.UI.Internal
@@ -88,6 +89,7 @@ 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 61a1a71938c..8ec9e5ecb7d 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs
@@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Data;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Microsoft.Management.UI.Internal
@@ -110,6 +111,7 @@ 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 7c36244e0f1..fab4e721bec 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs
@@ -5,6 +5,7 @@
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
@@ -308,6 +309,7 @@ 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 08f9df29337..a38e4003af3 100644
--- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs
+++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Management.Automation;
using System.Windows;
@@ -344,6 +345,7 @@ 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();
@@ -382,6 +384,7 @@ 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 34159c8f837..8040c4cb45a 100644
--- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs
+++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Management.Automation;
@@ -79,10 +80,12 @@ 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);
}
@@ -400,11 +403,13 @@ 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
@@ -593,6 +598,8 @@ private void SelectedModule_SelectedCommandNeedsImportModule(object sender, Impo
this.OnSelectedCommandInSelectedModuleNeedsImportModule(e);
}
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
+
///
/// Triggers SelectedCommandInSelectedModuleNeedsHelp.
///
@@ -654,6 +661,8 @@ 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/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs
index e5eb1be800d..13f3b8507d9 100644
--- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs
+++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs
@@ -438,12 +438,12 @@ public string GetScript()
builder.Append(commandName);
}
- builder.Append(" ");
+ builder.Append(' ');
if (this.SelectedParameterSet != null)
{
builder.Append(this.SelectedParameterSet.GetScript());
- builder.Append(" ");
+ builder.Append(' ');
}
if (this.CommonParameters != null)
@@ -553,6 +553,8 @@ internal static CommandViewModel GetCommandViewModel(ModuleViewModel module, Sho
return returnValue;
}
+ #pragma warning disable IDE1005 // IDE1005: Delegate invocation can be simplified.
+
///
/// Called to trigger the event fired when help is needed for the command.
///
@@ -628,6 +630,8 @@ private void OnNotifyPropertyChanged(string propertyName)
}
}
+ #pragma warning restore IDE1005
+
///
/// Called when the PropertyChanged event is triggered on the SelectedParameterSet.
///
diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs
index 38925e458a9..d6a2e57c051 100644
--- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs
+++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using System.Management.Automation;
using System.Windows;
@@ -76,6 +77,8 @@ 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
@@ -86,6 +89,8 @@ 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
@@ -372,6 +377,8 @@ 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.
///
@@ -527,5 +534,7 @@ private void OnNotifyPropertyChanged(string propertyName)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
+
+ #pragma warning restore IDE1005
}
}
diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs
index 756f58c62c8..f599750d7f9 100644
--- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs
+++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs
@@ -369,11 +369,13 @@ private void EvaluateAllMandatoryParametersHaveValues()
/// The changed property.
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 IDE1005
}
///
diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs
index 2c6931eb08e..ccd2fd635c8 100644
--- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs
+++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs
@@ -268,11 +268,13 @@ internal static string EvaluateTooltip(string typeName, int position, bool manda
/// The changed property.
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 IDE1005
}
}
}
diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs
index 85ecd95a36f..2135877655a 100644
--- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs
+++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs
@@ -213,7 +213,7 @@ private void ZoomEventHandlerPlus(object sender, ExecutedRoutedEventArgs e)
if (this.zoomLevel < ZOOM_MAX)
{
- this.zoomLevel = this.zoomLevel + ZOOM_INCREMENT;
+ this.zoomLevel += ZOOM_INCREMENT;
Grid g = this.gridViewWindow.Content as Grid;
if (g != null)
@@ -232,7 +232,7 @@ private void ZoomEventHandlerMinus(object sender, ExecutedRoutedEventArgs e)
{
if (this.zoomLevel >= ZOOM_MIN)
{
- this.zoomLevel = this.zoomLevel - ZOOM_INCREMENT;
+ this.zoomLevel -= ZOOM_INCREMENT;
Grid g = this.gridViewWindow.Content as Grid;
if (g != null)
{
@@ -246,6 +246,7 @@ 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 5d401fc94c6..5ac2321cded 100644
--- a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs
+++ b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs
@@ -289,7 +289,7 @@ private ShowCommandHelper()
}
///
- /// Finalizes an instance of the ShowCommandHelper class.
+ /// Finalizes an instance of the class.
///
~ShowCommandHelper()
{
@@ -643,7 +643,9 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode
ModuleViewModel moduleToSelect = returnValue.Modules.Find(
new Predicate((module) =>
{
- return module.Name.Equals(selectedModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false;
+ #pragma warning disable IDE0075 // IDE0075: Conditional expression can be simplified
+ return module.Name.Equals(selectedModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase);
+ #pragma warning restore IDE0075
}));
if (moduleToSelect == null)
@@ -657,7 +659,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode
new Predicate((command) =>
{
return command.ModuleName.Equals(parentModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) &&
- command.Name.Equals(commandNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false;
+ command.Name.Equals(commandNeedingImportModule, StringComparison.OrdinalIgnoreCase);
}));
if (commandToSelect == null)
@@ -750,7 +752,7 @@ private static object GetPropertyValue(Type type, object obj, string propertyNam
try
{
- return property.GetValue(obj, new object[] { });
+ return property.GetValue(obj, Array.Empty