</PropertyGroup>
<ItemGroup Condition="'$(EnableAnalyzers)' == 'true'">
<PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
- <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="3.3.0-beta3.20407.4" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="3.3.0-beta3.20410.1" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" PrivateAssets="all" />
</ItemGroup>
</Project>
<Rule Id="CA1833" Action="Warning" /> <!-- Use AsSpan or AsMemory instead of Range-based indexers when appropriate -->
<Rule Id="CA1834" Action="Warning" /> <!-- Consider using 'StringBuilder.Append(char)' when applicable. -->
<Rule Id="CA1835" Action="Warning" /> <!-- Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' -->
- <Rule Id="CA1836" Action="Info" /> <!-- Prefer IsEmpty over Count -->
+ <Rule Id="CA1836" Action="Warning" /> <!-- Prefer IsEmpty over Count -->
<Rule Id="CA1837" Action="Warning" /> <!-- Use 'Environment.ProcessId' -->
<Rule Id="CA1838" Action="Warning" /> <!-- Avoid 'StringBuilder' parameters for P/Invokes -->
<Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>? oldPoolCollection = null;
lock (this)
{
- if (_poolCollection.Count > 0)
+ if (!_poolCollection.IsEmpty)
{
oldPoolCollection = _poolCollection;
_poolCollection = new ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>();
// to avoid conflict with DbConnectionFactory.CreateConnectionPoolGroup replacing pool entry
lock (this)
{
- if (_poolCollection.Count > 0)
+ if (!_poolCollection.IsEmpty)
{
var newPoolCollection = new ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>();
// 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)
{
}
// We didn't totally empty the cleanup queue, try again later.
- if (_expiredHandlers.Count > 0)
+ if (!_expiredHandlers.IsEmpty)
{
StartCleanupTimer();
}
ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>? oldPoolCollection = null;
lock (this)
{
- if (_poolCollection.Count > 0)
+ if (!_poolCollection.IsEmpty)
{
oldPoolCollection = _poolCollection;
_poolCollection = new ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>();
// to avoid conflict with DbConnectionFactory.CreateConnectionPoolGroup replacing pool entry
lock (this)
{
- if (_poolCollection.Count > 0)
+ if (!_poolCollection.IsEmpty)
{
var newPoolCollection = new ConcurrentDictionary<DbConnectionPoolIdentity, DbConnectionPool>();
// 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)
{
//
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;
}
// 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));