Update Microsoft.CodeAnalysis.NetAnalyzers version (#68724)

- Delete some now unnecessary pragmas
- Enable the new Dictionary.ContainsKey guard rule
- Address on violation of the new rule
This commit is contained in:
Stephen Toub 2022-05-01 06:22:11 -04:00 committed by GitHub
parent 9299bc47f0
commit 71a73fb24c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 10 deletions

View File

@ -408,6 +408,9 @@ dotnet_diagnostic.CA1851.severity = suggestion
# CA1852: Seal internal types
dotnet_diagnostic.CA1852.severity = warning
# CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)'
dotnet_diagnostic.CA1853.severity = warning
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none

View File

@ -405,6 +405,9 @@ dotnet_diagnostic.CA1851.severity = none
# CA1852: Seal internal types
dotnet_diagnostic.CA1852.severity = none
# CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)'
dotnet_diagnostic.CA1853.severity = none
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
@ -792,7 +795,7 @@ dotnet_diagnostic.CA5383.severity = none
# CA5384: Do Not Use Digital Signature Algorithm (DSA)
dotnet_diagnostic.CA5384.severity = none
# CA5385: Use RivestShamirAdleman (RSA) Algorithm With Sufficient Key Size
# CA5385: Use Rivest-Shamir-Adleman (RSA) Algorithm With Sufficient Key Size
dotnet_diagnostic.CA5385.severity = none
# CA5386: Avoid hardcoding SecurityProtocolType value

View File

@ -44,7 +44,7 @@
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>4.3.0-1.22206.2</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesVersion>4.3.0-1.22206.2</MicrosoftCodeAnalysisCSharpWorkspacesVersion>
<MicrosoftCodeAnalysisCSharpVersion>4.3.0-1.22206.2</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0-preview1.22218.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0-preview1.22229.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisVersion>4.3.0-1.22206.2</MicrosoftCodeAnalysisVersion>
<!--
TODO: Remove pinned version once arcade supplies a 4.3 compiler.

View File

@ -13,8 +13,6 @@ using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
#pragma warning disable CA1852 // TODO InternalsVisibleTo: https://github.com/dotnet/roslyn-analyzers/pull/5972
namespace Microsoft.Extensions.Http
{
internal class DefaultHttpClientFactory : IHttpClientFactory, IHttpMessageHandlerFactory

View File

@ -7,8 +7,6 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.Versioning;
using System.Threading;
#pragma warning disable CA1852 // TODO InternalsVisibleTo: https://github.com/dotnet/roslyn-analyzers/pull/5972
namespace Microsoft.Extensions.Logging.Console
{
[UnsupportedOSPlatform("browser")]

View File

@ -70,10 +70,7 @@ namespace System.Diagnostics.Tracing
lock (m_dispatchControlLock)
{
// Remove the event listener from the list of subscribers.
if (m_subscriptions.ContainsKey(listener))
{
m_subscriptions.Remove(listener);
}
m_subscriptions.Remove(listener);
// Commit the configuration change.
CommitDispatchConfiguration();