diff --git a/src/Microsoft.DotNet.Wpf/src/.editorconfig b/src/Microsoft.DotNet.Wpf/src/.editorconfig index 27d970fb0af..0eb94a72579 100644 --- a/src/Microsoft.DotNet.Wpf/src/.editorconfig +++ b/src/Microsoft.DotNet.Wpf/src/.editorconfig @@ -317,21 +317,12 @@ dotnet_diagnostic.SA1121.severity = suggestion # SA1129: Do not use default value type constructor dotnet_diagnostic.SA1129.severity = suggestion -# SA1131: Constant values should appear on the right-hand side of comparisons -dotnet_diagnostic.SA1131.severity = suggestion - # SA1206: Keyword ordering dotnet_diagnostic.SA1206.severity = suggestion # SA1400: Member should declare an access modifier dotnet_diagnostic.SA1400.severity = suggestion -# SA1404: Code analysis suppression should have justification -dotnet_diagnostic.SA1404.severity = suggestion - -# SA1408: Conditional expressions should declare precedence -dotnet_diagnostic.SA1408.severity = suggestion - # SA1500: Braces for multi-line statements should not share line dotnet_diagnostic.SA1500.severity = suggestion diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs index e08c8c8ed5b..93a4db5c30f 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs @@ -238,7 +238,7 @@ public override FrugalListStoreState Add(T value) { // If we don't have any entries or the existing entry is being overwritten, // then we can use this store. Otherwise we have to promote. - if (0 == _count) + if (_count == 0) { _loneEntry = value; ++_count; @@ -319,7 +319,7 @@ public override T EntryAt(int index) public override void Promote(FrugalListBase oldList) { - if (SIZE == oldList.Count) + if (oldList.Count == SIZE) { SetCount(SIZE); SetAt(0, oldList.EntryAt(0)); @@ -421,7 +421,7 @@ public override void Clear() public override bool Contains(T value) { - return (-1 != IndexOf(value)); + return (IndexOf(value) != -1); } public override int IndexOf(T value) @@ -436,7 +436,7 @@ public override int IndexOf(T value) { return 1; } - if ((3 == _count) && EqualityComparer.Default.Equals(_entry2, value)) + if ((_count == 3) && EqualityComparer.Default.Equals(_entry2, value)) { return 2; } @@ -514,7 +514,7 @@ public override bool Remove(T value) RemoveAt(1); return true; } - else if ((3 == _count) && EqualityComparer.Default.Equals(_entry2, value)) + else if ((_count == 3) && EqualityComparer.Default.Equals(_entry2, value)) { RemoveAt(2); return true; @@ -570,7 +570,7 @@ public override T EntryAt(int index) public override void Promote(FrugalListBase oldList) { int oldCount = oldList.Count; - if (SIZE >= oldCount) + if (oldCount <= SIZE) { SetCount(oldList.Count); @@ -758,7 +758,7 @@ public override void Clear() public override bool Contains(T value) { - return (-1 != IndexOf(value)); + return (IndexOf(value) != -1); } public override int IndexOf(T value) @@ -791,7 +791,7 @@ public override int IndexOf(T value) { return 4; } - if ((6 == _count) && EqualityComparer.Default.Equals(_entry5, value)) + if ((_count == 6) && EqualityComparer.Default.Equals(_entry5, value)) { return 5; } @@ -929,7 +929,7 @@ public override bool Remove(T value) RemoveAt(4); return true; } - else if ((6 == _count) && EqualityComparer.Default.Equals(_entry5, value)) + else if ((_count == 6) && EqualityComparer.Default.Equals(_entry5, value)) { RemoveAt(5); return true; @@ -1019,7 +1019,7 @@ public override T EntryAt(int index) public override void Promote(FrugalListBase oldList) { int oldCount = oldList.Count; - if (SIZE >= oldCount) + if (oldCount <= SIZE) { SetCount(oldList.Count); @@ -1082,7 +1082,7 @@ public override void Promote(FrugalListBase oldList) public void Promote(ThreeItemList oldList) { int oldCount = oldList.Count; - if (SIZE <= oldCount) + if (oldCount >= SIZE) { SetCount(oldList.Count); @@ -1393,7 +1393,7 @@ public override void Promote(FrugalListBase oldList) { for (int index = 0; index < oldList.Count; ++index) { - if (FrugalListStoreState.Success == Add(oldList.EntryAt(index))) + if (Add(oldList.EntryAt(index)) == FrugalListStoreState.Success) { continue; } @@ -1615,7 +1615,7 @@ public int Capacity { get { - if (null != _listStore) + if (_listStore != null) { return _listStore.Capacity; } @@ -1624,7 +1624,7 @@ public int Capacity set { int capacity = 0; - if (null != _listStore) + if (_listStore != null) { capacity = _listStore.Capacity; } @@ -1650,7 +1650,7 @@ public int Capacity newStore = new ArrayItemList(value); } - if (null != _listStore) + if (_listStore != null) { // Move entries in the old store to the new one newStore.Promote(_listStore); @@ -1665,7 +1665,7 @@ public int Count { get { - if (null != _listStore) + if (_listStore != null) { return _listStore.Count; } @@ -1679,7 +1679,7 @@ public T this[int index] get { // If no entry, default(T) is returned - if ((null != _listStore) && ((index < _listStore.Count) && (index >= 0))) + if ((_listStore != null) && ((index < _listStore.Count) && (index >= 0))) { return _listStore.EntryAt(index); } @@ -1689,7 +1689,7 @@ public T this[int index] set { // Ensure write success - if ((null != _listStore) && ((index < _listStore.Count) && (index >= 0))) + if ((_listStore != null) && ((index < _listStore.Count) && (index >= 0))) { _listStore.SetAt(index, value); return; @@ -1700,7 +1700,7 @@ public T this[int index] public int Add(T value) { - if (null != _listStore) + if (_listStore != null) { // This is done because forward branches // default prediction is not to be taken @@ -1713,7 +1713,7 @@ public int Add(T value) } FrugalListStoreState myState = _listStore.Add(value); - if (FrugalListStoreState.Success == myState) + if (myState == FrugalListStoreState.Success) { } else @@ -1722,7 +1722,7 @@ public int Add(T value) // Allocate the store, promote, and add using the derived classes // to avoid virtual method calls - if (FrugalListStoreState.ThreeItemList == myState) + if (myState == FrugalListStoreState.ThreeItemList) { ThreeItemList newStore = new ThreeItemList(); @@ -1733,7 +1733,7 @@ public int Add(T value) newStore.Add(value); _listStore = newStore; } - else if (FrugalListStoreState.SixItemList == myState) + else if (myState == FrugalListStoreState.SixItemList) { SixItemList newStore = new SixItemList(); @@ -1745,7 +1745,7 @@ public int Add(T value) newStore.Add(value); _listStore = newStore; } - else if (FrugalListStoreState.Array == myState) + else if (myState == FrugalListStoreState.Array) { ArrayItemList newStore = new ArrayItemList(_listStore.Count + 1); @@ -1767,7 +1767,7 @@ public int Add(T value) public void Clear() { - if (null != _listStore) + if (_listStore != null) { _listStore.Clear(); } @@ -1775,7 +1775,7 @@ public void Clear() public bool Contains(T value) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.Contains(value); } @@ -1784,7 +1784,7 @@ public bool Contains(T value) public int IndexOf(T value) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.IndexOf(value); } @@ -1793,12 +1793,12 @@ public int IndexOf(T value) public void Insert(int index, T value) { - if ((index == 0) || ((null != _listStore) && ((index <= _listStore.Count) && (index >= 0)))) + if ((index == 0) || ((_listStore != null) && ((index <= _listStore.Count) && (index >= 0)))) { // Make sure we have a place to put the item int minCapacity = 1; - if ((null != _listStore) && (_listStore.Count == _listStore.Capacity)) + if ((_listStore != null) && (_listStore.Count == _listStore.Capacity)) { // Store is full minCapacity = Capacity + 1; @@ -1815,7 +1815,7 @@ public void Insert(int index, T value) public bool Remove(T value) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.Remove(value); } @@ -1824,7 +1824,7 @@ public bool Remove(T value) public void RemoveAt(int index) { - if ((null != _listStore) && ((index < _listStore.Count) && (index >= 0))) + if ((_listStore != null) && ((index < _listStore.Count) && (index >= 0))) { _listStore.RemoveAt(index); return; @@ -1854,7 +1854,7 @@ public void EnsureIndex(int index) public T[] ToArray() { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.ToArray(); } @@ -1863,7 +1863,7 @@ public T[] ToArray() public void CopyTo(T[] array, int index) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { _listStore.CopyTo(array, index); } @@ -1873,7 +1873,7 @@ public FrugalObjectList Clone() { FrugalObjectList myClone = new FrugalObjectList(); - if (null != _listStore) + if (_listStore != null) { myClone._listStore = (FrugalListBase)_listStore.Clone(); } @@ -1987,7 +1987,7 @@ public int Capacity { get { - if (null != _listStore) + if (_listStore != null) { return _listStore.Capacity; } @@ -1996,7 +1996,7 @@ public int Capacity set { int capacity = 0; - if (null != _listStore) + if (_listStore != null) { capacity = _listStore.Capacity; } @@ -2022,7 +2022,7 @@ public int Capacity newStore = new ArrayItemList(value); } - if (null != _listStore) + if (_listStore != null) { // Move entries in the old store to the new one newStore.Promote(_listStore); @@ -2037,7 +2037,7 @@ public int Count { get { - if (null != _listStore) + if (_listStore != null) { return _listStore.Count; } @@ -2051,7 +2051,7 @@ public T this[int index] get { // If no entry, default(T) is returned - if ((null != _listStore) && ((index < _listStore.Count) && (index >= 0))) + if ((_listStore != null) && ((index < _listStore.Count) && (index >= 0))) { return _listStore.EntryAt(index); } @@ -2061,7 +2061,7 @@ public T this[int index] set { // Ensure write success - if ((null != _listStore) && ((index < _listStore.Count) && (index >= 0))) + if ((_listStore != null) && ((index < _listStore.Count) && (index >= 0))) { _listStore.SetAt(index, value); return; @@ -2072,7 +2072,7 @@ public T this[int index] public int Add(T value) { - if (null != _listStore) + if (_listStore != null) { // This is done because forward branches // default prediction is not to be taken @@ -2085,7 +2085,7 @@ public int Add(T value) } FrugalListStoreState myState = _listStore.Add(value); - if (FrugalListStoreState.Success == myState) + if (myState == FrugalListStoreState.Success) { } else @@ -2094,7 +2094,7 @@ public int Add(T value) // Allocate the store, promote, and add using the derived classes // to avoid virtual method calls - if (FrugalListStoreState.ThreeItemList == myState) + if (myState == FrugalListStoreState.ThreeItemList) { ThreeItemList newStore = new ThreeItemList(); @@ -2105,7 +2105,7 @@ public int Add(T value) newStore.Add(value); _listStore = newStore; } - else if (FrugalListStoreState.SixItemList == myState) + else if (myState == FrugalListStoreState.SixItemList) { SixItemList newStore = new SixItemList(); @@ -2117,7 +2117,7 @@ public int Add(T value) newStore.Add(value); _listStore = newStore; } - else if (FrugalListStoreState.Array == myState) + else if (myState == FrugalListStoreState.Array) { ArrayItemList newStore = new ArrayItemList(_listStore.Count + 1); @@ -2139,7 +2139,7 @@ public int Add(T value) public void Clear() { - if (null != _listStore) + if (_listStore != null) { _listStore.Clear(); } @@ -2147,7 +2147,7 @@ public void Clear() public bool Contains(T value) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.Contains(value); } @@ -2156,7 +2156,7 @@ public bool Contains(T value) public int IndexOf(T value) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.IndexOf(value); } @@ -2165,12 +2165,12 @@ public int IndexOf(T value) public void Insert(int index, T value) { - if ((index == 0) || ((null != _listStore) && ((index <= _listStore.Count) && (index >= 0)))) + if ((index == 0) || ((_listStore != null) && ((index <= _listStore.Count) && (index >= 0)))) { // Make sure we have a place to put the item int minCapacity = 1; - if ((null != _listStore) && (_listStore.Count == _listStore.Capacity)) + if ((_listStore != null) && (_listStore.Count == _listStore.Capacity)) { // Store is full minCapacity = Capacity + 1; @@ -2187,7 +2187,7 @@ public void Insert(int index, T value) public bool Remove(T value) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.Remove(value); } @@ -2196,7 +2196,7 @@ public bool Remove(T value) public void RemoveAt(int index) { - if ((null != _listStore) && ((index < _listStore.Count) && (index >= 0))) + if ((_listStore != null) && ((index < _listStore.Count) && (index >= 0))) { _listStore.RemoveAt(index); return; @@ -2226,7 +2226,7 @@ public void EnsureIndex(int index) public T[] ToArray() { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { return _listStore.ToArray(); } @@ -2235,7 +2235,7 @@ public T[] ToArray() public void CopyTo(T[] array, int index) { - if ((null != _listStore) && (_listStore.Count > 0)) + if ((_listStore != null) && (_listStore.Count > 0)) { _listStore.CopyTo(array, index); } @@ -2245,7 +2245,7 @@ public FrugalStructList Clone() { FrugalStructList myClone = new FrugalStructList(); - if (null != _listStore) + if (_listStore != null) { myClone._listStore = (FrugalListBase)_listStore.Clone(); } diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs index 134b9cfb7dc..bf3ae2f0d46 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs @@ -126,7 +126,7 @@ internal static bool IsNullableType(Type type) internal static bool IsInternalType(Type type) { Type origType = type; - Debug.Assert(null != type, "Type passed to IsInternalType is null"); + Debug.Assert(type != null, "Type passed to IsInternalType is null"); // If this is an internal nested type or a parent nested public type, walk up the declaring types. while (type.IsNestedAssembly || type.IsNestedFamORAssem || (origType != type && type.IsNestedPublic)) @@ -147,7 +147,7 @@ internal static bool IsInternalType(Type type) /// True if type is public internal static bool IsPublicType(Type type) { - Debug.Assert(null != type, "Type passed to IsPublicType is null"); + Debug.Assert(type != null, "Type passed to IsPublicType is null"); // If this is a nested internal type, walk up the declaring types. while (type.IsNestedPublic) diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs index 3f52a4e6fc5..62d59d6a7b0 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs @@ -707,7 +707,7 @@ public bool Normalization XmlTextReader xmlTextReader = Reader as XmlTextReader; // review, what if not the XmlTextReader. - if (null != xmlTextReader) + if (xmlTextReader != null) { xmlTextReader.Normalization = value; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs index 5a5d06cd6c3..0628b1be9af 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs @@ -24,12 +24,12 @@ #endregion #region Microsoft.Performance suppressions -[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "MS.Internal.Xaml.Context.ObjectWriterFrame")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "MS.Internal.Xaml.Context.ObjectWriterFrame", Justification = "Non-Breaking")] // New since v4 RTM: //this is used by subclasses, bad FxCop detection -[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Xaml.MS.Impl.FrugalObjectList`1+Compacter")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Xaml.MS.Impl.FrugalObjectList`1+Compacter", Justification = "Non-Breaking")] #endregion #region Microsoft.Naming Suppressions @@ -42,39 +42,39 @@ [assembly: SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "System.Windows.Markup.ArrayExtension.#Type", Justification = "Kept for compatibility.")] [assembly: SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "System.Windows.Markup.TypeExtension.#Type", Justification = "Kept for compatibility.")] [assembly: SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "System.Windows.Markup.NameScopePropertyAttribute.#Type", Justification = "Kept for compatibility.")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uid", Scope = "type", Target = "System.Windows.Markup.UidPropertyAttribute")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uid", Scope = "member", Target = "System.Xaml.XamlLanguage.#Uid")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Namescope", Scope = "member", Target = "System.Xaml.XamlObjectWriterSettings.#RegisterNamesOnExternalNamescope")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uids", Scope = "member", Target = "System.Xaml.XamlReaderSettings.#IgnoreUidsOnPropertyElements")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Arity", Scope = "member", Target = "System.Xaml.XamlSchemaContext.#SupportMarkupExtensionsWithDuplicateArity")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Arity", Scope = "member", Target = "System.Xaml.XamlSchemaContextSettings.#SupportMarkupExtensionsWithDuplicateArity")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Arity", Scope = "resource", Target = "ExceptionStringTable.resources")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#String")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Double")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Int32")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Object")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Char")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Single")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Int16")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Int64")] -[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Decimal")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uid", Scope = "type", Target = "System.Windows.Markup.UidPropertyAttribute", Justification = "Short for unique identifiers.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uid", Scope = "member", Target = "System.Xaml.XamlLanguage.#Uid", Justification = "Short for unique identifiers.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Namescope", Scope = "member", Target = "System.Xaml.XamlObjectWriterSettings.#RegisterNamesOnExternalNamescope", Justification ="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uids", Scope = "member", Target = "System.Xaml.XamlReaderSettings.#IgnoreUidsOnPropertyElements", Justification = "Short for unique identifiers.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Arity", Scope = "member", Target = "System.Xaml.XamlSchemaContext.#SupportMarkupExtensionsWithDuplicateArity", Justification ="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Arity", Scope = "member", Target = "System.Xaml.XamlSchemaContextSettings.#SupportMarkupExtensionsWithDuplicateArity", Justification ="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Arity", Scope = "resource", Target = "ExceptionStringTable.resources", Justification="Alligns with other instances of same resource.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#String", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Double", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Int32", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Object", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Char", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Single", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Int16", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Int64", Justification="Will require changes in public API contract.")] +[assembly: SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Scope = "member", Target = "System.Xaml.XamlLanguage.#Decimal", Justification="Will require changes in public API contract.")] #endregion #region Microsoft.Usage Suppressions -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ThreeItemList`1.Promote(System.Xaml.MS.Impl.ThreeItemList`1):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ThreeItemList`1.SetCount(System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ThreeItemList`1.Promote(System.Xaml.MS.Impl.FrugalListBase`1):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ArrayItemList`1.Promote(System.Xaml.MS.Impl.SixItemList`1):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ArrayItemList`1.SetCount(System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SingleItemList`1.SetCount(System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.Promote(System.Xaml.MS.Impl.SixItemList`1):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.Promote(System.Xaml.MS.Impl.ThreeItemList`1):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.SetCount(System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.Promote(System.Xaml.MS.Impl.FrugalListBase`1):System.Void")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ThreeItemList`1.Promote(System.Xaml.MS.Impl.ThreeItemList`1):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ThreeItemList`1.SetCount(System.Int32):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ThreeItemList`1.Promote(System.Xaml.MS.Impl.FrugalListBase`1):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ArrayItemList`1.Promote(System.Xaml.MS.Impl.SixItemList`1):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.ArrayItemList`1.SetCount(System.Int32):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SingleItemList`1.SetCount(System.Int32):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.Promote(System.Xaml.MS.Impl.SixItemList`1):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.Promote(System.Xaml.MS.Impl.ThreeItemList`1):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.SetCount(System.Int32):System.Void", Justification = "Kept for compatibility.")] +[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "System.Xaml.MS.Impl.SixItemList`1.Promote(System.Xaml.MS.Impl.FrugalListBase`1):System.Void", Justification = "Kept for compatibility.")] #endregion #region Microsoft.Reliablity Suppressions [module: SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", Scope = "member", Target = "System.Xaml.Schema.ClrNamespace.#ParseClrNamespaceUri(System.String)", MessageId = "System.Reflection.Assembly.LoadWithPartialName", Justification = "Back compat.")] -[module: SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFile", Scope = "member", Target = "System.Xaml.ReflectionHelper.#LoadAssemblyHelper(System.String,System.String)")] +[module: SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFile", Scope = "member", Target = "System.Xaml.ReflectionHelper.#LoadAssemblyHelper(System.String,System.String)", Justification = "Kept for compatibility.")] [module: SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadWithPartialName", Scope = "member", Target = "System.Xaml.XamlSchemaContext.#ResolveAssembly(System.String)", Justification = "Need to support load of assemblies from GAC by short name.")] #endregion diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/AttachablePropertyServices.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/AttachablePropertyServices.cs index 67ef7cfc9b6..01c2a3883f6 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/AttachablePropertyServices.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/AttachablePropertyServices.cs @@ -82,7 +82,7 @@ public static void SetProperty(object instance, AttachableMemberIdentifier name, attachedProperties.SetProperty(instance, name, value); } - [SuppressMessage("Microsoft.Design", "CA1007")] + [SuppressMessage("Microsoft.Design", "CA1007", Justification = "Kept for compatibility.")] public static bool TryGetProperty(object instance, AttachableMemberIdentifier name, out object value) { return TryGetProperty(instance, name, out value); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs index 18782510e80..e154979c2b8 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs @@ -264,7 +264,7 @@ internal ServiceProviderContext ServiceProviderContext { get { - if (null == _serviceProviderContext) + if (_serviceProviderContext is null) { _serviceProviderContext = new ServiceProviderContext(this); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs index 324ae72ca67..3363d473358 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs @@ -182,7 +182,7 @@ public XamlMember GetNoDotAttributeProperty(XamlType tagType, XamlPropertyName p XamlDirective directive = SchemaContext.GetXamlDirective(propUsageNamespace, propName.Name); if (directive != null) { - if (AllowedMemberLocations.None == (directive.AllowedLocation & AllowedMemberLocations.Attribute)) + if ((directive.AllowedLocation & AllowedMemberLocations.Attribute) == AllowedMemberLocations.None) { // Need a way to surface up this usage error now that // we don't have UnknownProperty.Exception diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs index 85e58e2ae02..2999019742a 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs @@ -38,7 +38,7 @@ public string FindNamespaceByPrefixInParseStack(String prefix) { string xamlNs; - if (null != _prescopeNamespaces) + if (_prescopeNamespaces != null) { if (_prescopeNamespaces.TryGetValue(prefix, out xamlNs)) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/IAttachedPropertyStore.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/IAttachedPropertyStore.cs index 441afb2bd15..61cacc48247 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/IAttachedPropertyStore.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/IAttachedPropertyStore.cs @@ -28,7 +28,7 @@ int PropertyCount // this 'name' then returns false. If the value of the attached property // for this instance with this 'name' cannot be cast to T then returns // false. - [SuppressMessage("Microsoft.Design", "CA1007")] + [SuppressMessage("Microsoft.Design", "CA1007", Justification = "Kept for compatibility.")] bool TryGetProperty(AttachableMemberIdentifier attachableMemberIdentifier, out object value); } } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs index 9cc3484467f..3c936558a99 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs @@ -1094,7 +1094,7 @@ bool IsDirectiveAllowedOnNullInstance(XamlMember xamlMember, XamlType xamlType) } if (xamlMember == XamlLanguage.Uid) { - if (null == xamlType.GetAliasedProperty(XamlLanguage.Uid)) + if (xamlType.GetAliasedProperty(XamlLanguage.Uid) == null) { return true; } @@ -1208,7 +1208,7 @@ private void Logic_ConvertPositionalParamsToArgs(ObjectWriterContext ctx) object[] argInstances = new object[rawArgs.Count]; IList paramTypes = meType.GetPositionalParameters(rawArgs.Count); - if (null == paramTypes) + if (paramTypes == null) { // A constructor with the specified number of arguments doesn't exist string msg = string.Format(TypeConverterHelper.InvariantEnglishUS, SR.NoSuchConstructor, rawArgs.Count, meType.Name); @@ -1685,7 +1685,7 @@ private bool Logic_ProvideValue(ObjectWriterContext ctx) // or it is the live root instance. ME.ProvideValue must be invoked in each case, except where a ME is the // live root instance and _skipProvideValueOnRoot is true. This allows live root instances of templates to // remain as MEs where necessary. - Debug.Assert(parentInstance != null || parentProperty != null && parentProperty.IsDirective || ctx.LiveDepth == 1); + Debug.Assert(parentInstance != null || (parentProperty != null && parentProperty.IsDirective) || ctx.LiveDepth == 1); object value = me; if (ctx.LiveDepth != 1 || !_skipProvideValueOnRoot) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs index a8ff928a66f..8400f0fb238 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs @@ -334,9 +334,9 @@ public List GetAllAttributeContents(Type attributeType) protected static bool? GetFlag(int bitMask, int bitToCheck) { int validBit = GetValidMask(bitToCheck); - if (0 != (bitMask & validBit)) + if ((bitMask & validBit) != 0) { - return 0 != (bitMask & bitToCheck); + return (bitMask & bitToCheck) != 0; } return null; }