diff --git a/eng/Analyzers.props b/eng/Analyzers.props index c14a86901948a7..34eb83dff6974d 100644 --- a/eng/Analyzers.props +++ b/eng/Analyzers.props @@ -6,7 +6,7 @@ - + diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index 3726904d2fd7e5..293d25a2161602 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -112,7 +112,7 @@ - + diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs index 26ee3b6515ddb1..a3807e9a430747 100644 --- a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs +++ b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs @@ -105,7 +105,7 @@ internal int Clear() ConcurrentDictionary? oldPoolCollection = null; lock (this) { - if (_poolCollection.Count > 0) + if (!_poolCollection.IsEmpty) { oldPoolCollection = _poolCollection; _poolCollection = new ConcurrentDictionary(); @@ -232,7 +232,7 @@ internal bool Prune() // to avoid conflict with DbConnectionFactory.CreateConnectionPoolGroup replacing pool entry lock (this) { - if (_poolCollection.Count > 0) + if (!_poolCollection.IsEmpty) { var newPoolCollection = new ConcurrentDictionary(); @@ -267,7 +267,7 @@ internal bool Prune() // must be pruning thread to change state and no connections // otherwise pruning thread risks making entry disabled soon after user calls ClearPool - if (0 == _poolCollection.Count) + if (_poolCollection.IsEmpty) { if (PoolGroupStateActive == _state) { diff --git a/src/libraries/Microsoft.Extensions.Http/src/DefaultHttpClientFactory.cs b/src/libraries/Microsoft.Extensions.Http/src/DefaultHttpClientFactory.cs index d3ad266e24862c..059111a2e66b27 100644 --- a/src/libraries/Microsoft.Extensions.Http/src/DefaultHttpClientFactory.cs +++ b/src/libraries/Microsoft.Extensions.Http/src/DefaultHttpClientFactory.cs @@ -324,7 +324,7 @@ internal void CleanupTimer_Tick() } // We didn't totally empty the cleanup queue, try again later. - if (_expiredHandlers.Count > 0) + if (!_expiredHandlers.IsEmpty) { StartCleanupTimer(); } diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs index 792f6e7bc2d4b8..4a77e1c8ff5874 100644 --- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs +++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs @@ -129,7 +129,7 @@ internal int Clear() ConcurrentDictionary? oldPoolCollection = null; lock (this) { - if (_poolCollection.Count > 0) + if (!_poolCollection.IsEmpty) { oldPoolCollection = _poolCollection; _poolCollection = new ConcurrentDictionary(); @@ -266,7 +266,7 @@ internal bool Prune() // to avoid conflict with DbConnectionFactory.CreateConnectionPoolGroup replacing pool entry lock (this) { - if (_poolCollection.Count > 0) + if (!_poolCollection.IsEmpty) { var newPoolCollection = new ConcurrentDictionary(); @@ -309,7 +309,7 @@ internal bool Prune() // must be pruning thread to change state and no connections // otherwise pruning thread risks making entry disabled soon after user calls ClearPool - if (0 == _poolCollection.Count) + if (_poolCollection.IsEmpty) { if (PoolGroupStateActive == _state) { diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs index ea2c83e808fee2..eccd25b2e0c875 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs @@ -115,7 +115,7 @@ public bool Equals(SslCredKey other) // internal static SafeFreeCredentials? TryCachedCredential(byte[]? thumbPrint, SslProtocols sslProtocols, bool isServer, EncryptionPolicy encryptionPolicy) { - if (s_cachedCreds.Count == 0) + if (s_cachedCreds.IsEmpty) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(null, $"Not found, Current Cache Count = {s_cachedCreds.Count}"); return null; diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs index ac4a03726ac133..21cee18d3763d4 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs @@ -318,7 +318,7 @@ public static void Invoke(ParallelOptions parallelOptions, params Action[] actio } // If we have encountered any exceptions, then throw. - if ((exceptionQ != null) && (exceptionQ.Count > 0)) + if ((exceptionQ != null) && (!exceptionQ.IsEmpty)) { ThrowSingleCancellationExceptionOrOtherException(exceptionQ, parallelOptions.CancellationToken, new AggregateException(exceptionQ));