Skip to content

Commit 762ed10

Browse files
authored
Address warnings from MicrosoftCodeAnalysisVersion_LatestVS update (#119077)
Remove warning suppressions and address errors from `MicrosoftCodeAnalysisVersion_LatestVS` update to 4.14.0.
1 parent b297427 commit 762ed10

File tree

133 files changed

+395
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+395
-402
lines changed

Directory.Build.props

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,6 @@
269269
<WarningsNotAsErrors Condition="'$(OfficialBuild)' != 'true' OR '$(NuGetAuditWarnNotError)' == 'true'">$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
270270
<!-- Warnings to always disable -->
271271
<NoWarn>$(NoWarn);CS8500;CS8969</NoWarn>
272-
<!-- Don't warn about redundant equality -->
273-
<NoWarn>$(NoWarn);IDE0100</NoWarn>
274-
<!-- Don't warn about unused parameters -->
275-
<NoWarn>$(NoWarn);IDE0060</NoWarn>
276272
<!-- Suppress "CS1591 - Missing XML comment for publicly visible type or member" compiler errors for private assemblies. -->
277273
<NoWarn Condition="'$(IsPrivateAssembly)' == 'true'">$(NoWarn);CS1591</NoWarn>
278274
<!-- Always pass portable to override arcade sdk which uses embedded for local builds -->

src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ public static RuntimeTypeHandle CreateEEType(TypeDesc type, TypeBuilderState sta
598598
if (type is PointerType || type is ByRefType || type is FunctionPointerType)
599599
{
600600
Debug.Assert(0 == state.NonGcDataSize);
601-
Debug.Assert(false == state.HasStaticConstructor);
601+
Debug.Assert(!state.HasStaticConstructor);
602602
Debug.Assert(0 == state.GcDataSize);
603603
Debug.Assert(0 == state.ThreadStaticOffset);
604604
Debug.Assert(IntPtr.Zero == state.GcStaticDesc);

src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ internal DataRow FindMetaDataCollectionRow(string collectionName)
258258

259259
if (ADP.CompareInsensitiveInvariant(candidateCollectionName, collectionName))
260260
{
261-
if (SupportedByCurrentVersion(row) == false)
261+
if (!SupportedByCurrentVersion(row))
262262
{
263263
versionFailure = true;
264264
}
@@ -291,7 +291,7 @@ internal DataRow FindMetaDataCollectionRow(string collectionName)
291291

292292
if (requestedCollectionRow == null)
293293
{
294-
if (versionFailure == false)
294+
if (!versionFailure)
295295
{
296296
throw ADP.UndefinedCollection(collectionName);
297297
}
@@ -400,7 +400,7 @@ public virtual DataTable GetSchema(DbConnection connection, string collectionNam
400400
requestedCollectionRow = FindMetaDataCollectionRow(collectionName);
401401
exactCollectionName = (requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string)!;
402402

403-
if (ADP.IsEmptyArray(restrictions) == false)
403+
if (!ADP.IsEmptyArray(restrictions))
404404
{
405405

406406
for (int i = 0; i < restrictions.Length; i++)
@@ -429,7 +429,7 @@ public virtual DataTable GetSchema(DbConnection connection, string collectionNam
429429
hiddenColumns = null;
430430
}
431431
// none of the datatable collections support restrictions
432-
if (ADP.IsEmptyArray(restrictions) == false)
432+
if (!ADP.IsEmptyArray(restrictions))
433433
{
434434
throw ADP.TooManyRestrictions(exactCollectionName);
435435
}

src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/BlockingCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ private bool TryAddWithNoTimeValidation(T item, int millisecondsTimeout, Cancell
412412
try
413413
{
414414
waitForSemaphoreWasSuccessful = _freeNodes.Wait(0, default);
415-
if (waitForSemaphoreWasSuccessful == false && millisecondsTimeout != 0)
415+
if (!waitForSemaphoreWasSuccessful && millisecondsTimeout != 0)
416416
{
417417
linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(
418418
cancellationToken, _producersCancellationTokenSource.Token);
@@ -661,7 +661,7 @@ private bool TryTakeWithNoTimeValidation([MaybeNullWhen(false)] out T item, int
661661
try
662662
{
663663
waitForSemaphoreWasSuccessful = _occupiedNodes.Wait(0);
664-
if (waitForSemaphoreWasSuccessful == false && millisecondsTimeout != 0)
664+
if (!waitForSemaphoreWasSuccessful && millisecondsTimeout != 0)
665665
{
666666
// create the linked token if it is not created yet
667667
linkedTokenSource ??= CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _consumersCancellationTokenSource.Token);

src/libraries/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ internal bool GrabChunk_Buffered(KeyValuePair<long, TSource>[] destArray, int re
808808

809809
// If the big buffer seems to be depleted, we will also fill that up while we are under the lock
810810
// Note that this is the only place that _FillBufferCurrentPosition can be reset
811-
if (_sourceDepleted.Value == false && localFillBufferRef != null &&
811+
if (!_sourceDepleted.Value && localFillBufferRef != null &&
812812
_fillBufferCurrentPosition >= localFillBufferRef.Length)
813813
{
814814
for (int i = 0; i < localFillBufferRef.Length; i++)

src/libraries/System.Collections.NonGeneric/src/System/Collections/SortedList.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ public object Key
816816
get
817817
{
818818
if (_version != _sortedList.version) throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
819-
if (_current == false) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
819+
if (!_current) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
820820
return _key;
821821
}
822822
}
@@ -843,7 +843,7 @@ public DictionaryEntry Entry
843843
get
844844
{
845845
if (_version != _sortedList.version) throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
846-
if (_current == false) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
846+
if (!_current) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
847847
return new DictionaryEntry(_key, _value);
848848
}
849849
}
@@ -852,7 +852,7 @@ public object? Current
852852
{
853853
get
854854
{
855-
if (_current == false) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
855+
if (!_current) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
856856

857857
if (_getObjectRetType == Keys)
858858
return _key;
@@ -868,7 +868,7 @@ public object? Value
868868
get
869869
{
870870
if (_version != _sortedList.version) throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
871-
if (_current == false) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
871+
if (!_current) throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
872872
return _value;
873873
}
874874
}

src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected ValidationAttribute(Func<string> errorMessageAccessor)
7373
/// </summary>
7474
private protected ValidationAttribute(bool populateErrorMessageResourceAccessor)
7575
{
76-
Debug.Assert(populateErrorMessageResourceAccessor is false, "Use the default constructor instead");
76+
Debug.Assert(!populateErrorMessageResourceAccessor, "Use the default constructor instead");
7777
}
7878

7979
#endregion

src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/BaseConfigurationRecord.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,7 @@ private void ScanSectionsRecursive(
24662466
if (!factoryRecord.HasErrors)
24672467
{
24682468
// We have a valid factoryRecord for a section
2469-
if (inLocation && (factoryRecord.AllowLocation == false))
2469+
if (inLocation && !factoryRecord.AllowLocation)
24702470
{
24712471
xmlUtil.SchemaErrors.AddError(
24722472
new ConfigurationErrorsException(

src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ protected void SetPropertyValue(ConfigurationProperty prop, object value, bool i
828828
{
829829
if (IsReadOnly()) throw new ConfigurationErrorsException(SR.Config_base_read_only);
830830

831-
if ((ignoreLocks == false) &&
831+
if (!ignoreLocks &&
832832
(((_lockedAllExceptAttributesList != null) && _lockedAllExceptAttributesList.HasParentElements &&
833833
!_lockedAllExceptAttributesList.DefinedInParent(prop.Name)) ||
834834
((_lockedAttributesList != null) &&
@@ -1110,7 +1110,7 @@ protected internal virtual bool SerializeElement(XmlWriter writer, bool serializ
11101110
}
11111111
}
11121112

1113-
if (serializeCollectionKey == false)
1113+
if (!serializeCollectionKey)
11141114
{
11151115
dataToWrite |= SerializeLockList(_lockedAttributesList, LockAttributesKey, writer);
11161116
dataToWrite |= SerializeLockList(_lockedAllExceptAttributesList, LockAllAttributesExceptKey, writer);
@@ -1876,7 +1876,7 @@ internal ConfigurationLockCollection UnMergeLockList(
18761876
ConfigurationLockCollection parentLockList,
18771877
ConfigurationSaveMode saveMode)
18781878
{
1879-
if (sourceLockList.ExceptionList == false)
1879+
if (!sourceLockList.ExceptionList)
18801880
{
18811881
switch (saveMode)
18821882
{

src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElementCollection.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public override bool Equals(object compareTo)
222222
break;
223223
}
224224

225-
if (found == false)
225+
if (!found)
226226
{
227227
// not in the collection must be different
228228
return false;
@@ -293,7 +293,7 @@ protected internal override void Unmerge(ConfigurationElement sourceElement,
293293
EmitClear = ((saveMode == ConfigurationSaveMode.Full) && (_clearElement.Length != 0)) ||
294294
((saveMode == ConfigurationSaveMode.Modified) && _collectionCleared) || sourceCollection.EmitClear;
295295

296-
if ((parentCollection != null) && (EmitClear != true))
296+
if ((parentCollection != null) && !EmitClear)
297297
{
298298
foreach (Entry entry in parentCollection.Items)
299299
if (entry.EntryType != EntryType.Removed)
@@ -349,7 +349,7 @@ protected internal override void Unmerge(ConfigurationElement sourceElement,
349349
}
350350
}
351351

352-
if ((parentCollection != null) && (EmitClear != true))
352+
if ((parentCollection != null) && !EmitClear)
353353
{
354354
foreach (Entry entry in parentCollection.Items)
355355
{
@@ -503,7 +503,7 @@ private void BaseAdd(ConfigurationElement element, bool throwIfExists, bool igno
503503

504504
if (IsReadOnly()) throw new ConfigurationErrorsException(SR.Config_base_read_only);
505505

506-
if (LockItem && (ignoreLocks == false))
506+
if (LockItem && !ignoreLocks)
507507
throw new ConfigurationErrorsException(SR.Format(SR.Config_base_element_locked, _addElement));
508508

509509
object key = GetElementKeyInternal(element);
@@ -513,7 +513,7 @@ private void BaseAdd(ConfigurationElement element, bool throwIfExists, bool igno
513513
Entry entry = (Entry)Items[index];
514514
if (!CompareKeys(key, entry.GetKey(this))) continue;
515515

516-
if ((entry.Value != null) && entry.Value.LockItem && (ignoreLocks == false))
516+
if ((entry.Value != null) && entry.Value.LockItem && !ignoreLocks)
517517
throw new ConfigurationErrorsException(SR.Config_base_collection_item_locked);
518518

519519
if ((entry.EntryType != EntryType.Removed) && throwIfExists)
@@ -553,7 +553,7 @@ private void BaseAdd(ConfigurationElement element, bool throwIfExists, bool igno
553553
}
554554

555555
// check to see if the element is trying to set a locked property.
556-
if (ignoreLocks == false)
556+
if (!ignoreLocks)
557557
{
558558
element.HandleLockedAttributes(entry.Value);
559559
// copy the lock from the removed element before setting the new element
@@ -641,7 +641,7 @@ private void BaseAddInternal(int index, ConfigurationElement element, bool flagA
641641
}
642642
else
643643
{
644-
if ((index > Count + _removedItemCount - _inheritedCount) && (flagAsReplaced == false))
644+
if ((index > Count + _removedItemCount - _inheritedCount) && !flagAsReplaced)
645645
throw new ConfigurationErrorsException(SR.Config_base_cannot_add_items_below_inherited_items);
646646
}
647647
}
@@ -651,7 +651,7 @@ private void BaseAddInternal(int index, ConfigurationElement element, bool flagA
651651
(index < _inheritedCount))
652652
throw new ConfigurationErrorsException(SR.Config_base_cannot_add_items_above_inherited_items);
653653

654-
EntryType entryType = flagAsReplaced == false ? EntryType.Added : EntryType.Replaced;
654+
EntryType entryType = !flagAsReplaced ? EntryType.Added : EntryType.Replaced;
655655

656656
object key = GetElementKeyInternal(element);
657657

@@ -747,7 +747,7 @@ private void BaseRemove(object key, bool throwIfMissing)
747747
if (entry.Value.LockItem)
748748
throw new ConfigurationErrorsException(SR.Format(SR.Config_base_attribute_locked, key));
749749

750-
if (entry.Value.ElementPresent == false)
750+
if (!entry.Value.ElementPresent)
751751
CheckLockedElement(_removeElement, null); // has remove been locked?
752752

753753
switch (entry.EntryType)
@@ -979,7 +979,7 @@ protected internal void BaseRemoveAt(int index)
979979
entry.GetKey(this)));
980980
}
981981

982-
if (entry.Value.ElementPresent == false)
982+
if (!entry.Value.ElementPresent)
983983
CheckLockedElement(_removeElement, null); // has remove been locked?
984984

985985
switch (entry.EntryType)
@@ -1000,7 +1000,7 @@ protected internal void BaseRemoveAt(int index)
10001000
else
10011001
{
10021002
// don't really remove it from the collection just mark it removed
1003-
if (entry.Value.ElementPresent == false)
1003+
if (!entry.Value.ElementPresent)
10041004
CheckLockedElement(_removeElement, null); // has remove been locked?
10051005

10061006
entry.EntryType = EntryType.Removed;

0 commit comments

Comments
 (0)