Explorar el Código

Cleanup and muting of analyzer warnings (#1357)

* Fixed warnings in tests.

* Fixed warnings in main project.

* Fix public key.

* Further warning cleanup.

* Muted remaining warnings.

* Final cleanup.

* Fix warning.

* Fix test classes.

* Fix more internals.

* Revert "internal" in test projects

* Revert more internals.

* Revert all non-analyzer changes.

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Jean-Sebastien Carle hace 1 año
padre
commit
9be67c0c99
Se han modificado 36 ficheros con 336 adiciones y 332 borrados
  1. 0 1
      Renci.SshNet.sln
  2. 29 1
      src/Renci.SshNet/.editorconfig
  3. 0 12
      src/Renci.SshNet/Abstractions/CryptoAbstraction.cs
  4. 0 4
      src/Renci.SshNet/Abstractions/SocketExtensions.cs
  5. 0 6
      src/Renci.SshNet/Common/BigInteger.cs
  6. 0 1
      src/Renci.SshNet/Compression/ZlibStream.cs
  7. 0 2
      src/Renci.SshNet/ForwardedPort.cs
  8. 0 2
      src/Renci.SshNet/ISftpClient.cs
  9. 1 1
      src/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs
  10. 0 4
      src/Renci.SshNet/Messages/Authentication/FailureMessage.cs
  11. 1 1
      src/Renci.SshNet/PasswordAuthenticationMethod.cs
  12. 0 2
      src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs
  13. 2 5
      src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs
  14. 8 1
      src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs
  15. 0 6
      src/Renci.SshNet/Security/Cryptography/HMACMD5.cs
  16. 0 6
      src/Renci.SshNet/Security/Cryptography/HMACSHA1.cs
  17. 3 3
      src/Renci.SshNet/Sftp/SftpFileStream.cs
  18. 0 45
      src/Renci.SshNet/Sftp/SftpSession.cs
  19. 6 7
      src/Renci.SshNet/ShellStream.cs
  20. 0 1
      src/Renci.SshNet/SshClient.cs
  21. 0 2
      src/Renci.SshNet/SshCommand.cs
  22. 35 15
      test/Renci.SshNet.Benchmarks/.editorconfig
  23. 1 1
      test/Renci.SshNet.Benchmarks/Common/ExtensionsBenchmarks.cs
  24. 4 0
      test/Renci.SshNet.IntegrationBenchmarks/.editorconfig
  25. 105 85
      test/Renci.SshNet.IntegrationTests/.editorconfig
  26. 20 4
      test/Renci.SshNet.TestTools.OpenSSH/.editorconfig
  27. 115 95
      test/Renci.SshNet.Tests/.editorconfig
  28. 0 2
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs
  29. 0 2
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_IsEqualTo_ByteArray.cs
  30. 1 4
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs
  31. 0 2
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Reverse.cs
  32. 0 2
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs
  33. 0 2
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs
  34. 0 2
      test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs
  35. 3 3
      test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs
  36. 2 0
      test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs

+ 0 - 1
Renci.SshNet.sln

@@ -29,7 +29,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{D21A4D03-0AC2-4613-BB6D-74D2D16A72CC}"
 	ProjectSection(SolutionItems) = preProject
-		test\.editorconfig = test\.editorconfig
 		test\Directory.Build.props = test\Directory.Build.props
 	EndProjectSection
 EndProject

+ 29 - 1
src/Renci.SshNet/.editorconfig

@@ -108,10 +108,18 @@ MA0053.public_class_should_be_sealed = false
 # TODO: Remove exclusion when issues are fixed
 dotnet_diagnostic.MA0055.severity = none
 
+# MA0089: Optimize string method usage
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0089.md
+dotnet_diagnostic.MA0089.severity = none
+
 # MA0110: Use the Regex source generator
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0110.md
 dotnet_diagnostic.MA0110.severity = none
 
+# MA0026: Fix TODO comment
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md
+dotnet_diagnostic.MA0026.severity = none
+
 #### .NET Compiler Platform analysers rules ####
 
 # CA1030: Use events where appropriate
@@ -152,10 +160,30 @@ dotnet_diagnostic.CA3075.severity = none
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0004
 dotnet_diagnostic.IDE0004.severity = none
 
+# IDE0047: Remove unnecessary parentheses
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0047-ide0048
+dotnet_diagnostic.IDE0047.severity = none
+
 # IDE0048: Add parentheses for clarity
-# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0047
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0047-ide0048
 dotnet_diagnostic.IDE0048.severity = none
 
 # IDE0305: Collection initialization can be simplified
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0305
 dotnet_diagnostic.IDE0305.severity = none
+
+# IDE0046: Use conditional expression for return
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0046
+dotnet_diagnostic.IDE0046.severity = none
+
+# IDE0032: Use auto-implemented property
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0032
+dotnet_diagnostic.IDE0032.severity = none
+
+# CA5350: Do Not Use Weak Cryptographic Algorithms
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca5350
+dotnet_diagnostic.CA5350.severity = none
+
+# CA5351: Do Not Use Broken Cryptographic Algorithms
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca5351
+dotnet_diagnostic.CA5351.severity = none

+ 0 - 12
src/Renci.SshNet/Abstractions/CryptoAbstraction.cs

@@ -39,16 +39,12 @@ namespace Renci.SshNet.Abstractions
 
         public static System.Security.Cryptography.MD5 CreateMD5()
         {
-#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
             return System.Security.Cryptography.MD5.Create();
-#pragma warning restore CA5351 // Do not use broken cryptographic algorithms
         }
 
         public static System.Security.Cryptography.SHA1 CreateSHA1()
         {
-#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
             return System.Security.Cryptography.SHA1.Create();
-#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
         }
 
         public static System.Security.Cryptography.SHA256 CreateSHA256()
@@ -68,30 +64,22 @@ namespace Renci.SshNet.Abstractions
 
         public static System.Security.Cryptography.HMACMD5 CreateHMACMD5(byte[] key)
         {
-#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
             return new System.Security.Cryptography.HMACMD5(key);
-#pragma warning restore CA5351 // Do not use broken cryptographic algorithms
         }
 
         public static HMACMD5 CreateHMACMD5(byte[] key, int hashSize)
         {
-#pragma warning disable CA5351 // Do not use broken cryptographic algorithms
             return new HMACMD5(key, hashSize);
-#pragma warning restore CA5351 // Do not use broken cryptographic algorithms
         }
 
         public static System.Security.Cryptography.HMACSHA1 CreateHMACSHA1(byte[] key)
         {
-#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
             return new System.Security.Cryptography.HMACSHA1(key);
-#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
         }
 
         public static HMACSHA1 CreateHMACSHA1(byte[] key, int hashSize)
         {
-#pragma warning disable CA5350 // Do not use weak cryptographic algorithms
             return new HMACSHA1(key, hashSize);
-#pragma warning restore CA5350 // Do not use weak cryptographic algorithms
         }
 
         public static System.Security.Cryptography.HMACSHA256 CreateHMACSHA256(byte[] key)

+ 0 - 4
src/Renci.SshNet/Abstractions/SocketExtensions.cs

@@ -50,9 +50,7 @@ namespace Renci.SshNet.Abstractions
                 SetCompleted();
             }
 
-#pragma warning disable S1144 // Unused private types or members should be removed
             public AwaitableSocketAsyncEventArgs GetAwaiter()
-#pragma warning restore S1144 // Unused private types or members should be removed
             {
                 return this;
             }
@@ -68,9 +66,7 @@ namespace Renci.SshNet.Abstractions
                 }
             }
 
-#pragma warning disable S1144 // Unused private types or members should be removed
             public void GetResult()
-#pragma warning restore S1144 // Unused private types or members should be removed
             {
                 if (_isCancelled)
                 {

+ 0 - 6
src/Renci.SshNet/Common/BigInteger.cs

@@ -1,5 +1,4 @@
 #pragma warning disable SA1028 // Code should not contain trailing whitespace
-#pragma warning disable SA1515 // Single-line comment should be preceded by blank line
 //
 // System.Numerics.BigInteger
 //
@@ -46,7 +45,6 @@
 *
 *
 * ***************************************************************************/
-#pragma warning restore SA1515 // Single-line comment should be preceded by blank line
 #pragma warning restore SA1028 // Code should not contain trailing whitespace
 
 using System;
@@ -4578,9 +4576,7 @@ namespace Renci.SshNet.Common
 
                     if (needExtra)
                     {
-#pragma warning disable S1854 // Unused assignments should be removed
                         res[j++] = 0xFF;
-#pragma warning restore S1854 // Unused assignments should be removed
                     }
                 }
                 else
@@ -4590,9 +4586,7 @@ namespace Renci.SshNet.Common
                     res[j++] = (byte)(word >> 8);
                     res[j++] = (byte)(word >> 16);
                     res[j++] = (byte)(word >> 24);
-#pragma warning disable S1854 // Unused assignments should be removed
                     res[j++] = 0xFF;
-#pragma warning restore S1854 // Unused assignments should be removed
                 }
             }
 

+ 0 - 1
src/Renci.SshNet/Compression/ZlibStream.cs

@@ -54,5 +54,4 @@ namespace Renci.SshNet.Compression
     }
 }
 
-#pragma warning restore SA1005 // Single line comments should begin with single space
 #pragma warning restore S125 // Sections of code should not be commented out

+ 0 - 2
src/Renci.SshNet/ForwardedPort.cs

@@ -71,9 +71,7 @@ namespace Renci.SshNet
         /// <summary>
         /// Stops port forwarding.
         /// </summary>
-#pragma warning disable CA1716 // Identifiers should not match keywords
         public virtual void Stop()
-#pragma warning restore CA1716 // Identifiers should not match keywords
         {
             if (IsStarted)
             {

+ 0 - 2
src/Renci.SshNet/ISftpClient.cs

@@ -592,9 +592,7 @@ namespace Renci.SshNet
         /// <exception cref="SftpPathNotFoundException"><paramref name="path"/> was not found on the remote host.</exception>
         /// <exception cref="ArgumentNullException"><paramref name="path" /> is <see langword="null"/>.</exception>
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
-#pragma warning disable CA1716 // Identifiers should not match keywords
         ISftpFile Get(string path);
-#pragma warning restore CA1716 // Identifiers should not match keywords
 
         /// <summary>
         /// Gets the <see cref="SftpFileAttributes"/> of the file on the path.

+ 1 - 1
src/Renci.SshNet/KeyboardInteractiveAuthenticationMethod.cs

@@ -15,7 +15,7 @@ namespace Renci.SshNet
     /// </summary>
     public class KeyboardInteractiveAuthenticationMethod : AuthenticationMethod, IDisposable
     {
-        private readonly RequestMessage _requestMessage;
+        private readonly RequestMessageKeyboardInteractive _requestMessage;
         private AuthenticationResult _authenticationResult = AuthenticationResult.Failure;
         private Session _session;
         private EventWaitHandle _authenticationCompleted = new AutoResetEvent(initialState: false);

+ 0 - 4
src/Renci.SshNet/Messages/Authentication/FailureMessage.cs

@@ -68,9 +68,7 @@ namespace Renci.SshNet.Messages.Authentication
         /// </summary>
         protected override void SaveData()
         {
-#pragma warning disable MA0025 // Implement the functionality instead of throwing NotImplementedException
             throw new NotImplementedException();
-#pragma warning restore MA0025 // Implement the functionality instead of throwing NotImplementedException
         }
 
         internal override void Process(Session session)
@@ -81,9 +79,7 @@ namespace Renci.SshNet.Messages.Authentication
         /// <inheritdoc/>
         public override string ToString()
         {
-#pragma warning disable MA0089 // Optimize string method usage
             return $"SSH_MSG_USERAUTH_FAILURE {string.Join(",", AllowedAuthentications)} ({nameof(PartialSuccess)}:{PartialSuccess})";
-#pragma warning restore MA0089 // Optimize string method usage
         }
     }
 }

+ 1 - 1
src/Renci.SshNet/PasswordAuthenticationMethod.cs

@@ -15,7 +15,7 @@ namespace Renci.SshNet
     /// </summary>
     public class PasswordAuthenticationMethod : AuthenticationMethod, IDisposable
     {
-        private readonly RequestMessage _requestMessage;
+        private readonly RequestMessagePassword _requestMessage;
         private readonly byte[] _password;
         private AuthenticationResult _authenticationResult = AuthenticationResult.Failure;
         private Session _session;

+ 0 - 2
src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs

@@ -17,9 +17,7 @@ namespace Renci.SshNet
     {
         private AuthenticationResult _authenticationResult = AuthenticationResult.Failure;
         private EventWaitHandle _authenticationCompleted = new ManualResetEvent(initialState: false);
-#pragma warning disable S1450 // Private fields only used as local variables in methods should become local variables
         private bool _isSignatureRequired;
-#pragma warning restore S1450 // Private fields only used as local variables in methods should become local variables
         private bool _isDisposed;
 
         /// <summary>

+ 2 - 5
src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs

@@ -1,8 +1,5 @@
 using System;
 using System.Globalization;
-#if NETFRAMEWORK
-using System.Security.Cryptography;
-#endif // NETFRAMEWORK
 
 using Renci.SshNet.Common;
 
@@ -45,7 +42,7 @@ namespace Renci.SshNet.Security.Cryptography
             var sig_size = _key.KeyLength == 521 ? 132 : _key.KeyLength / 4;
             var ssh_data = new SshDataSignature(signature, sig_size);
 #if NETFRAMEWORK
-            var ecdsa = (ECDsaCng)_key.Ecdsa;
+            var ecdsa = _key.Ecdsa;
             ecdsa.HashAlgorithm = _key.HashAlgorithm;
             return ecdsa.VerifyData(input, ssh_data.Signature);
 #else
@@ -63,7 +60,7 @@ namespace Renci.SshNet.Security.Cryptography
         public override byte[] Sign(byte[] input)
         {
 #if NETFRAMEWORK
-            var ecdsa = (ECDsaCng)_key.Ecdsa;
+            var ecdsa = _key.Ecdsa;
             ecdsa.HashAlgorithm = _key.HashAlgorithm;
             var signed = ecdsa.SignData(input);
 #else

+ 8 - 1
src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs

@@ -221,10 +221,17 @@ namespace Renci.SshNet.Security
         /// </summary>
         public byte[] PrivateKey { get; private set; }
 
+#if NETFRAMEWORK
+        /// <summary>
+        /// Gets the <see cref="ECDsa"/> object.
+        /// </summary>
+        public ECDsaCng Ecdsa { get; private set; }
+#else
         /// <summary>
         /// Gets the <see cref="ECDsa"/> object.
         /// </summary>
         public ECDsa Ecdsa { get; private set; }
+#endif
 
         /// <summary>
         /// Initializes a new instance of the <see cref="EcdsaKey"/> class.
@@ -371,7 +378,7 @@ namespace Renci.SshNet.Security
                 PrivateKey = privatekey;
             }
 
-            var headerSize = Marshal.SizeOf(typeof(BCRYPT_ECCKEY_BLOB));
+            var headerSize = Marshal.SizeOf<BCRYPT_ECCKEY_BLOB>();
             var blobSize = headerSize + qx.Length + qy.Length;
             if (privatekey != null)
             {

+ 0 - 6
src/Renci.SshNet/Security/Cryptography/HMACMD5.cs

@@ -15,9 +15,7 @@ namespace Renci.SshNet.Security.Cryptography
         /// </summary>
         /// <param name="key">The key.</param>
         public HMACMD5(byte[] key)
-#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
             : base(key)
-#pragma warning restore CA5351 // Do Not Use Broken Cryptographic Algorithms
         {
 #pragma warning disable MA0056 // Do not call overridable members in constructor
             _hashSize = base.HashSize;
@@ -31,9 +29,7 @@ namespace Renci.SshNet.Security.Cryptography
         /// <param name="key">The key.</param>
         /// <param name="hashSize">The size, in bits, of the computed hash code.</param>
         public HMACMD5(byte[] key, int hashSize)
-#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
             : base(key)
-#pragma warning restore CA5351 // Do Not Use Broken Cryptographic Algorithms
         {
             _hashSize = hashSize;
         }
@@ -57,9 +53,7 @@ namespace Renci.SshNet.Security.Cryptography
         /// </returns>
         protected override byte[] HashFinal()
         {
-#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
             var hash = base.HashFinal();
-#pragma warning restore CA5351 // Do Not Use Broken Cryptographic Algorithms
             return hash.Take(HashSize / 8);
         }
     }

+ 0 - 6
src/Renci.SshNet/Security/Cryptography/HMACSHA1.cs

@@ -16,9 +16,7 @@ namespace Renci.SshNet.Security.Cryptography
         /// </summary>
         /// <param name="key">The key.</param>
         public HMACSHA1(byte[] key)
-#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
             : base(key)
-#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
         {
 #pragma warning disable MA0056 // Do not call overridable members in constructor
             _hashSize = base.HashSize;
@@ -31,9 +29,7 @@ namespace Renci.SshNet.Security.Cryptography
         /// <param name="key">The key.</param>
         /// <param name="hashSize">The size, in bits, of the computed hash code.</param>
         public HMACSHA1(byte[] key, int hashSize)
-#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
             : base(key)
-#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
         {
             _hashSize = hashSize;
         }
@@ -57,9 +53,7 @@ namespace Renci.SshNet.Security.Cryptography
         /// </returns>
         protected override byte[] HashFinal()
         {
-#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
             var hash = base.HashFinal();
-#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
             return hash.Take(HashSize / 8);
         }
     }

+ 3 - 3
src/Renci.SshNet/Sftp/SftpFileStream.cs

@@ -13,9 +13,10 @@ namespace Renci.SshNet.Sftp
     /// Exposes a <see cref="Stream"/> around a remote SFTP file, supporting both synchronous and asynchronous read and write operations.
     /// </summary>
     /// <threadsafety static="true" instance="false"/>
-#pragma warning disable CA1844 // Provide memory-based overrides of async methods when subclassing 'Stream'
+#pragma warning disable IDE0079 // We intentionally want to suppress the below warning.
+    [SuppressMessage("Performance", "CA1844: Provide memory-based overrides of async methods when subclassing 'Stream'", Justification = "TODO: This should be addressed in the future.")]
+#pragma warning restore IDE0079
     public class SftpFileStream : Stream
-#pragma warning restore CA1844 // Provide memory-based overrides of async methods when subclassing 'Stream'
     {
         private readonly object _lock = new object();
         private readonly int _readBufferSize;
@@ -88,7 +89,6 @@ namespace Renci.SshNet.Sftp
         /// <exception cref="NotSupportedException">A class derived from Stream does not support seeking. </exception>
         /// <exception cref="ObjectDisposedException">Methods were called after the stream was closed. </exception>
         /// <exception cref="IOException">IO operation failed. </exception>
-        [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "Be design this is the exception that stream need to throw.")]
         public override long Length
         {
             get

+ 0 - 45
src/Renci.SshNet/Sftp/SftpSession.cs

@@ -487,13 +487,10 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
-#pragma warning restore CA1508 // Avoid dead conditional code
 
             return handle;
         }
@@ -625,9 +622,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -851,9 +846,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -952,9 +945,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1041,9 +1032,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1147,9 +1136,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1215,9 +1202,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1249,9 +1234,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1291,9 +1274,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1372,9 +1353,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1450,9 +1429,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1523,9 +1500,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1556,9 +1531,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1600,9 +1573,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1735,9 +1706,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1833,9 +1802,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1925,9 +1892,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -1967,9 +1932,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -2012,9 +1975,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -2066,9 +2027,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -2160,9 +2119,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (!nullOnError && exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }
@@ -2206,9 +2163,7 @@ namespace Renci.SshNet.Sftp
                 WaitOnHandle(wait, OperationTimeout);
             }
 
-#pragma warning disable CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             if (exception is not null)
-#pragma warning restore CA1508 // Avoid dead conditional code; Remove when we upgrade to newer SDK in which bug is fixed
             {
                 throw exception;
             }

+ 6 - 7
src/Renci.SshNet/ShellStream.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Globalization;
 using System.IO;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -68,18 +69,16 @@ namespace Renci.SshNet
             }
         }
 
-#pragma warning disable MA0076 // Do not use implicit culture-sensitive ToString in interpolated strings
         [Conditional("DEBUG")]
         private void AssertValid()
         {
             Debug.Assert(Monitor.IsEntered(_sync), $"Should be in lock on {nameof(_sync)}");
-            Debug.Assert(_readHead >= 0, $"{nameof(_readHead)} should be non-negative but is {_readHead}");
-            Debug.Assert(_readTail >= 0, $"{nameof(_readTail)} should be non-negative but is {_readTail}");
-            Debug.Assert(_readHead <= _readBuffer.Length, $"{nameof(_readHead)} should be <= {nameof(_readBuffer)}.Length but is {_readHead}");
-            Debug.Assert(_readTail <= _readBuffer.Length, $"{nameof(_readTail)} should be <= {nameof(_readBuffer)}.Length but is {_readTail}");
-            Debug.Assert(_readHead <= _readTail, $"Should have {nameof(_readHead)} <= {nameof(_readTail)} but have {_readHead} <= {_readTail}");
+            Debug.Assert(_readHead >= 0, $"{nameof(_readHead)} should be non-negative but is {_readHead.ToString(CultureInfo.InvariantCulture)}");
+            Debug.Assert(_readTail >= 0, $"{nameof(_readTail)} should be non-negative but is {_readTail.ToString(CultureInfo.InvariantCulture)}");
+            Debug.Assert(_readHead <= _readBuffer.Length, $"{nameof(_readHead)} should be <= {nameof(_readBuffer)}.Length but is {_readHead.ToString(CultureInfo.InvariantCulture)}");
+            Debug.Assert(_readTail <= _readBuffer.Length, $"{nameof(_readTail)} should be <= {nameof(_readBuffer)}.Length but is {_readTail.ToString(CultureInfo.InvariantCulture)}");
+            Debug.Assert(_readHead <= _readTail, $"Should have {nameof(_readHead)} <= {nameof(_readTail)} but have {_readHead.ToString(CultureInfo.InvariantCulture)} <= {_readTail.ToString(CultureInfo.InvariantCulture)}");
         }
-#pragma warning restore MA0076 // Do not use implicit culture-sensitive ToString in interpolated strings
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ShellStream"/> class.

+ 0 - 1
src/Renci.SshNet/SshClient.cs

@@ -60,7 +60,6 @@ namespace Renci.SshNet
         /// <exception cref="ArgumentNullException"><paramref name="password"/> is <see langword="null"/>.</exception>
         /// <exception cref="ArgumentException"><paramref name="host"/> is invalid, or <paramref name="username"/> is <see langword="null"/> or contains only whitespace characters.</exception>
         /// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not within <see cref="IPEndPoint.MinPort"/> and <see cref="IPEndPoint.MaxPort"/>.</exception>
-        [SuppressMessage("Microsoft.Reliability", "C2A000:DisposeObjectsBeforeLosingScope", Justification = "Disposed in Dispose(bool) method.")]
         public SshClient(string host, int port, string username, string password)
 #pragma warning disable CA2000 // Dispose objects before losing scope
             : this(new PasswordConnectionInfo(host, port, username, password), ownsConnectionInfo: true)

+ 0 - 2
src/Renci.SshNet/SshCommand.cs

@@ -86,9 +86,7 @@ namespace Renci.SshNet
         /// <returns>
         /// The stream that can be used to transfer data to the command's input stream.
         /// </returns>
-#pragma warning disable CA1859 // Use concrete types when possible for improved performance
         public Stream CreateInputStream()
-#pragma warning restore CA1859 // Use concrete types when possible for improved performance
         {
             if (_channel == null)
             {

+ 35 - 15
test/Renci.SshNet.Benchmarks/.editorconfig

@@ -4,19 +4,19 @@
 
 # S125: Sections of code should not be commented out
 https://rules.sonarsource.com/csharp/RSPEC-125/
-dotnet_diagnostic.S125.severity = suggestion
+dotnet_diagnostic.S125.severity = silent
 
 # S1118: Utility classes should not have public constructors
 # https://rules.sonarsource.com/csharp/RSPEC-1118/
-dotnet_diagnostic.S1118.severity = suggestion
+dotnet_diagnostic.S1118.severity = silent
 
 # S1450: Private fields only used as local variables in methods should become local variables
 # https://rules.sonarsource.com/csharp/RSPEC-1450/
-dotnet_diagnostic.S1450.severity = suggestion
+dotnet_diagnostic.S1450.severity = silent
 
 # S4144: Methods should not have identical implementations
 # https://rules.sonarsource.com/csharp/RSPEC-4144/
-dotnet_diagnostic.S4144.severity = suggestion
+dotnet_diagnostic.S4144.severity = silent
 
 #### SYSLIB diagnostics ####
 
@@ -25,48 +25,68 @@ dotnet_diagnostic.S4144.severity = suggestion
 
 # SA1028: Code must not contain trailing whitespace
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md
-dotnet_diagnostic.SA1028.severity = suggestion
+dotnet_diagnostic.SA1028.severity = silent
 
 # SA1414: Tuple types in signatures should have element names
 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1414.md
-dotnet_diagnostic.SA1414.severity = suggestion
+dotnet_diagnostic.SA1414.severity = silent
 
 # SA1400: Access modifier must be declared
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1400.md
-dotnet_diagnostic.SA1400.severity = suggestion
+dotnet_diagnostic.SA1400.severity = silent
 
 # SA1401: Fields must be private
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
-dotnet_diagnostic.SA1401.severity = suggestion
+dotnet_diagnostic.SA1401.severity = silent
 
 # SA1411: Attribute constructor must not use unnecessary parenthesis
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1411.md
-dotnet_diagnostic.SA1411.severity = suggestion
+dotnet_diagnostic.SA1411.severity = silent
 
 # SA1505: Opening braces must not be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1505.md
-dotnet_diagnostic.SA1505.severity = suggestion
+dotnet_diagnostic.SA1505.severity = silent
 
 # SA1512: Single line comments must not be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1512.md
-dotnet_diagnostic.SA1512.severity = suggestion
+dotnet_diagnostic.SA1512.severity = silent
 
 # SA1513: Closing brace must be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1513.md
-dotnet_diagnostic.SA1513.severity = suggestion
+dotnet_diagnostic.SA1513.severity = silent
 
 #### Meziantou.Analyzer rules ####
 
 # MA0003: Add parameter name to improve readability
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0003.md
-dotnet_diagnostic.MA0003.severity = suggestion
+dotnet_diagnostic.MA0003.severity = silent
 
 # MA0053: Make class sealed
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0053.md
-dotnet_diagnostic.MA0053.severity = suggestion
+dotnet_diagnostic.MA0053.severity = silent
+
+# MA0026: Fix TODO comment
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md
+dotnet_diagnostic.MA0026.severity = silent
 
 #### .NET Compiler Platform analysers rules ####
 
 # CA2000: Dispose objects before losing scope
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2000
-dotnet_diagnostic.CA2000.severity = suggestion
+dotnet_diagnostic.CA2000.severity = silent
+
+# IDE0046: Use conditional expression for return
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0046
+dotnet_diagnostic.IDE0046.severity = silent
+
+# IDE0047: Remove unnecessary parentheses
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0047-ide0048
+dotnet_diagnostic.IDE0047.severity = silent
+
+# IDE0032: Use auto-implemented property
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0032
+dotnet_diagnostic.IDE0032.severity = silent
+
+# CA1515: Consider making public types internal
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca1515
+dotnet_diagnostic.CA1515.severity = silent

+ 1 - 1
test/Renci.SshNet.Benchmarks/Common/ExtensionsBenchmarks.cs

@@ -9,7 +9,7 @@ namespace Renci.SshNet.Benchmarks.Common
         private byte[]? _data;
 
         [Params(1000, 10000)]
-        public int N;
+        public int N { get; set; }
 
         [GlobalSetup]
         public void Setup()

+ 4 - 0
test/Renci.SshNet.IntegrationBenchmarks/.editorconfig

@@ -74,3 +74,7 @@ dotnet_diagnostic.CA2000.severity = suggestion
 # Error CS8892: Method 'TestingPlatformEntryPoint.Main(string[])' will not be used as an entry point because a synchronous entry point 'Program.Main(string[])' was found.
 # https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/warning-waves#cs8892---method-will-not-be-used-as-an-entry-point-because-a-synchronous-entry-point-method-was-found
 dotnet_diagnostic.CS8892.severity = suggestion
+
+# CA1515: Consider making public types internal
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca1515
+dotnet_diagnostic.CA1515.severity = silent

+ 105 - 85
test/Renci.SshNet.IntegrationTests/.editorconfig

@@ -4,341 +4,361 @@
 
 # S108: Nested blocks of code should not be left empty
 # https://rules.sonarsource.com/csharp/RSPEC-108/
-dotnet_diagnostic.S108.severity = none
+dotnet_diagnostic.S108.severity = silent
 
 # S125: Sections of code should not be commented out
 # https://rules.sonarsource.com/csharp/RSPEC-125/
-dotnet_diagnostic.S125.severity = none
+dotnet_diagnostic.S125.severity = silent
 
 # S1118: Utility classes should not have public constructors
 # https://rules.sonarsource.com/csharp/RSPEC-1118/
-dotnet_diagnostic.S1118.severity = none
+dotnet_diagnostic.S1118.severity = silent
 
 # S1155: "Any()" should be used to test for emptiness
 # https://rules.sonarsource.com/csharp/RSPEC-1155/
-dotnet_diagnostic.S1155.severity = none
+dotnet_diagnostic.S1155.severity = silent
 
 # S1607: Tests should not be ignored
 # https://rules.sonarsource.com/csharp/RSPEC-1607/
-dotnet_diagnostic.S1607.severity = none
+dotnet_diagnostic.S1607.severity = silent
 
 # S2925: "Thread.Sleep" should not be used in tests
 # https://rules.sonarsource.com/csharp/RSPEC-2925/
-dotnet_diagnostic.S2925.severity = none
+dotnet_diagnostic.S2925.severity = silent
 
 # 53241: Methods should not return values that are never used
 # https://rules.sonarsource.com/csharp/RSPEC-3241/
-dotnet_diagnostic.S3241.severity = none
+dotnet_diagnostic.S3241.severity = silent
 
 # S3415: Assertion arguments should be passed in the correct order
 # https://rules.sonarsource.com/csharp/RSPEC-3415/
-dotnet_diagnostic.S3415.severity = none
+dotnet_diagnostic.S3415.severity = silent
 
 # S3881: "IDisposable" should be implemented correctly
 # https://rules.sonarsource.com/csharp/RSPEC-3881/
-dotnet_diagnostic.S3881.severity = none
+dotnet_diagnostic.S3881.severity = silent
 
 # S3966: Objects should not be disposed more than once
 # https://rules.sonarsource.com/csharp/RSPEC-3966/
-dotnet_diagnostic.S3966.severity = none
+dotnet_diagnostic.S3966.severity = silent
 
 # S4144: Methods should not have identical implementations
 # https://rules.sonarsource.com/csharp/RSPEC-4144/
-dotnet_diagnostic.S4144.severity = none
+dotnet_diagnostic.S4144.severity = silent
 
 # S6602: "Find" method should be used instead of the "FirstOrDefault" extension
 # https://rules.sonarsource.com/csharp/RSPEC-6602/
-dotnet_diagnostic.S6602.severity = none
+dotnet_diagnostic.S6602.severity = silent
 
 # S6610: "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string"
 # https://rules.sonarsource.com/csharp/RSPEC-6610/
-dotnet_diagnostic.S6610.severity = none
+dotnet_diagnostic.S6610.severity = silent
 
 #### SYSLIB diagnostics ####
 
 # SYSLIB1045: Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time
 #
 # TODO: Remove this when https://github.com/sshnet/SSH.NET/issues/1131 is implemented.
-dotnet_diagnostic.SYSLIB1045.severity = none
+dotnet_diagnostic.SYSLIB1045.severity = silent
 
 ### StyleCop Analyzers rules ###
 
 # SA1000: Keywords must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1000.md
-dotnet_diagnostic.SA1000.severity = suggestion
+dotnet_diagnostic.SA1000.severity = silent
 
 # SA1004: Documentation lines must begin with single space
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1004.md
-dotnet_diagnostic.SA1004.severity = suggestion
+dotnet_diagnostic.SA1004.severity = silent
 
 # SA1005: Single line comments must begin with single space
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1005.md
-dotnet_diagnostic.SA1005.severity = suggestion
+dotnet_diagnostic.SA1005.severity = silent
 
 # SA1012: Opening braces must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1012.md
-dotnet_diagnostic.SA1012.severity = suggestion
+dotnet_diagnostic.SA1012.severity = silent
 
 # SA1025: Code must not contain multiple whitespace in a row
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1025.md
-dotnet_diagnostic.SA1025.severity = suggestion
+dotnet_diagnostic.SA1025.severity = silent
 
 # SA1028: Code must not contain trailing whitespace
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md
-dotnet_diagnostic.SA1028.severity = suggestion
+dotnet_diagnostic.SA1028.severity = silent
 
 # SA1111: Closing parenthesis must be on line of last parameter
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1111.md
-dotnet_diagnostic.SA1111.severity = suggestion
+dotnet_diagnostic.SA1111.severity = silent
 
 # SA1117: Parameters must be on same line or separate lines
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1117.md
-dotnet_diagnostic.SA1117.severity = suggestion
+dotnet_diagnostic.SA1117.severity = silent
 
 # SA1119: Statement must not use unnecessary parenthesis
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md
-dotnet_diagnostic.SA1119.severity = suggestion
+dotnet_diagnostic.SA1119.severity = silent
 
 # SA1122: Use String.Empty for empty strings
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1122.md
-dotnet_diagnostic.SA1122.severity = suggestion
+dotnet_diagnostic.SA1122.severity = silent
 
 # SA1123:Do not place regions within elements
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1123.md
-dotnet_diagnostic.SA1123.severity = suggestion
+dotnet_diagnostic.SA1123.severity = silent
 
 # SA1130: Use lambda syntax
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1130.md
-dotnet_diagnostic.SA1130.severity = suggestion
+dotnet_diagnostic.SA1130.severity = silent
 
 # SA1133: Do not combine attributes
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1133.md
-dotnet_diagnostic.SA1133.severity = suggestion
+dotnet_diagnostic.SA1133.severity = silent
 
 # SA1203: Constants must appear before fields
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1203.md
-dotnet_diagnostic.SA1203.severity = suggestion
+dotnet_diagnostic.SA1203.severity = silent
 
 # SA1204: Static elements must appear before instance elements
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1204.md
-dotnet_diagnostic.SA1204.severity = suggestion
+dotnet_diagnostic.SA1204.severity = silent
 
 # SA1400: Access modifier must be declared
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1400.md
-dotnet_diagnostic.SA1400.severity = suggestion
+dotnet_diagnostic.SA1400.severity = silent
 
 # SA1401: Fields must be private
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
-dotnet_diagnostic.SA1401.severity = suggestion
+dotnet_diagnostic.SA1401.severity = silent
 
 # SA1411: Attribute constructor must not use unnecessary parenthesis
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1411.md
-dotnet_diagnostic.SA1411.severity = suggestion
+dotnet_diagnostic.SA1411.severity = silent
 
 # SA1505: Opening braces must not be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1505.md
-dotnet_diagnostic.SA1505.severity = suggestion
+dotnet_diagnostic.SA1505.severity = silent
 
 # SA1507: Code must not contain multiple blank lines in a row
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1507.md
-dotnet_diagnostic.SA1507.severity = suggestion
+dotnet_diagnostic.SA1507.severity = silent
 
 # SA1508: Closing braces must not be preceded by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1508.md
-dotnet_diagnostic.SA1508.severity = suggestion
+dotnet_diagnostic.SA1508.severity = silent
 
 # SA1510: Chained statement blocks must not be preceded by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1510.md
-dotnet_diagnostic.SA1510.severity = suggestion
+dotnet_diagnostic.SA1510.severity = silent
 
 # SA1512: Single line comments must not be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1512.md
-dotnet_diagnostic.SA1512.severity = suggestion
+dotnet_diagnostic.SA1512.severity = silent
 
 # SA1513: Closing brace must be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1513.md
-dotnet_diagnostic.SA1513.severity = suggestion
+dotnet_diagnostic.SA1513.severity = silent
 
 # SA1514: Element documentation header must be preceded by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1514.md
-dotnet_diagnostic.SA1514.severity = suggestion
+dotnet_diagnostic.SA1514.severity = silent
 
 # SA1515: Single line comment must be preceded by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1515.md
-dotnet_diagnostic.SA1515.severity = suggestion
+dotnet_diagnostic.SA1515.severity = silent
 
 # SA1517: Code must not contain blank lines at start of file
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1517.md
-dotnet_diagnostic.SA1517.severity = suggestion
+dotnet_diagnostic.SA1517.severity = silent
 
 # SA1518: Use line endings correctly at end of file
 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1518.md
-dotnet_diagnostic.SA1518.severity = suggestion
+dotnet_diagnostic.SA1518.severity = silent
 
 # SA1626: Single line comments must not use documentation style slashes
 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1626.md
-dotnet_diagnostic.SA1626.severity = suggestion
+dotnet_diagnostic.SA1626.severity = silent
 
 #### Meziantou.Analyzer rules ####
 
 # MA0001: StringComparison is missing
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0001.md
-dotnet_diagnostic.MA0001.severity = suggestion
+dotnet_diagnostic.MA0001.severity = silent
 
 # MA0003: Add parameter name to improve readability
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0003.md
-dotnet_diagnostic.MA0003.severity = suggestion
+dotnet_diagnostic.MA0003.severity = silent
 
 # MA0004: Use Task.ConfigureAwait(false)
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0004.md
-dotnet_diagnostic.MA0004.severity = suggestion
+dotnet_diagnostic.MA0004.severity = silent
 
 # MA0011: IFormatProvider is missing
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0011.md
-dotnet_diagnostic.MA0011.severity = suggestion
+dotnet_diagnostic.MA0011.severity = silent
 
 # MA0042: Do not use blocking calls in an async method
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0042.md
-dotnet_diagnostic.MA0042.severity = suggestion
+dotnet_diagnostic.MA0042.severity = silent
 
 # MA0043: Use nameof operator in ArgumentException
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0043.md
-dotnet_diagnostic.MA0043.severity = suggestion
+dotnet_diagnostic.MA0043.severity = silent
 
 # MA0046: Use EventHandler<T> to declare events
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0046.md
-dotnet_diagnostic.MA0046.severity = suggestion
+dotnet_diagnostic.MA0046.severity = silent
 
 # MA0053: Make class sealed
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0053.md
-dotnet_diagnostic.MA0053.severity = suggestion
+dotnet_diagnostic.MA0053.severity = silent
 
 # MA0060: The value returned by Stream.Read/Stream.ReadAsync is not used
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0060.md
-dotnet_diagnostic.MA0060.severity = suggestion
+dotnet_diagnostic.MA0060.severity = silent
 
 # MA0074: Avoid implicit culture-sensitive methods
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0074.md
-dotnet_diagnostic.MA0074.severity = suggestion
+dotnet_diagnostic.MA0074.severity = silent
 
 # MA0075: Do not use implicit culture-sensitive ToString
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0075.md
-dotnet_diagnostic.MA0075.severity = suggestion
+dotnet_diagnostic.MA0075.severity = silent
 
 # MA0076: Do not use implicit culture-sensitive ToString in interpolated strings
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0076.md
-dotnet_diagnostic.MA0076.severity = suggestion
+dotnet_diagnostic.MA0076.severity = silent
 
 # MA0099 - Use Explicit enum value instead of 0
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0099.md
-dotnet_diagnostic.MA0099.severity = suggestion
+dotnet_diagnostic.MA0099.severity = silent
 
 # MA0101: String contains an implicit end of line character
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0101.md
-dotnet_diagnostic.MA0101.severity = suggestion
+dotnet_diagnostic.MA0101.severity = silent
 
 # MA0110: Use the Regex source generator
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0110.md
-dotnet_diagnostic.MA0110.severity = suggestion
+dotnet_diagnostic.MA0110.severity = silent
+
+# MA0026: Fix TODO comment
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md
+dotnet_diagnostic.MA0026.severity = silent
+
+# MA0089: Optimize string method usage
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0089.md
+dotnet_diagnostic.MA0089.severity = silent
 
 #### .NET Compiler Platform analysers rules ####
 
 # CA1031: Do not catch general exception types
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1031
-dotnet_diagnostic.CA1031.severity = suggestion
+dotnet_diagnostic.CA1031.severity = silent
 
 # CA1052: Static holder types should be Static or NotInheritable
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1052
-dotnet_diagnostic.CA1052.severity = suggestion
+dotnet_diagnostic.CA1052.severity = silent
 
 # CA1062: Validate arguments of public methods
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1062
-dotnet_diagnostic.CA1062.severity = suggestion
+dotnet_diagnostic.CA1062.severity = silent
 
 # CA1063: Implement IDisposable correctly
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1063
-dotnet_diagnostic.CA1063.severity = suggestion
+dotnet_diagnostic.CA1063.severity = silent
 
 # CA1307: Specify StringComparison for clarity
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1307
-dotnet_diagnostic.CA1307.severity = suggestion
+dotnet_diagnostic.CA1307.severity = silent
 
 # CA1310: Specify StringComparison for correctness
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1310
-dotnet_diagnostic.CA1310.severity = suggestion
+dotnet_diagnostic.CA1310.severity = silent
 
 # CA1507: Use nameof in place of string
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1507
-dotnet_diagnostic.CA1507.severity = suggestion
+dotnet_diagnostic.CA1507.severity = silent
 
 # CA1827: Do not use Count()/LongCount() when Any() can be used
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1827
-dotnet_diagnostic.CA1827.severity = suggestion
+dotnet_diagnostic.CA1827.severity = silent
 
-# CA1812: Avoid uninstantiated internal classes
-# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1812
-dotnet_diagnostic.CA1812.severity = suggestion
+# CA1515: Consider making public types internal
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca1515
+dotnet_diagnostic.CA1515.severity = silent
 
 # CA1816: Call GC.SuppressFinalize correctly
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1816
-dotnet_diagnostic.CA1816.severity = suggestion
+dotnet_diagnostic.CA1816.severity = silent
 
 # CA1822: Mark members as static
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
-dotnet_diagnostic.CA1822.severity = suggestion
+dotnet_diagnostic.CA1822.severity = silent
 
 # CA1840: Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1840
-dotnet_diagnostic.CA1840.severity = suggestion
+dotnet_diagnostic.CA1840.severity = silent
 
 # CA1851: Possible multiple enumerations of IEnumerable collection
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1851
-dotnet_diagnostic.CA1851.severity = suggestion
+dotnet_diagnostic.CA1851.severity = silent
 
 # CA1859: Use concrete types when possible for improved performance
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1859
-dotnet_diagnostic.CA1859.severity = suggestion
+dotnet_diagnostic.CA1859.severity = silent
 
 # CA2000: Dispose objects before losing scope
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2000
-dotnet_diagnostic.CA2000.severity = suggestion
+dotnet_diagnostic.CA2000.severity = silent
 
 # CA2007: Do not directly await a Task
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2007
-dotnet_diagnostic.CA2007.severity = suggestion
+dotnet_diagnostic.CA2007.severity = silent
 
 # CA2008: Do not create tasks without passing a TaskScheduler
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2008
-dotnet_diagnostic.CA2008.severity = suggestion
+dotnet_diagnostic.CA2008.severity = silent
 
 # CA2201: Do not raise reserved exception types
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2201
-dotnet_diagnostic.CA2201.severity = suggestion
+dotnet_diagnostic.CA2201.severity = silent
 
 # CA2213: Disposable fields should be disposed
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2213
-dotnet_diagnostic.CA2213.severity = suggestion
+dotnet_diagnostic.CA2213.severity = silent
 
 # CA2234: Pass System.Uri objects instead of strings
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2234
-dotnet_diagnostic.CA2234.severity = suggestion
+dotnet_diagnostic.CA2234.severity = silent
 
 # IDE0007: Use var instead of explicit type
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0007
-dotnet_diagnostic.IDE0007.severity = suggestion
+dotnet_diagnostic.IDE0007.severity = silent
 
 # IDE0028: Use collection initializers
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0028
-dotnet_diagnostic.IDE0028.severity = suggestion
+dotnet_diagnostic.IDE0028.severity = silent
 
 # IDE0058: Remove unnecessary expression value
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0058
-dotnet_diagnostic.IDE0058.severity = suggestion
+dotnet_diagnostic.IDE0058.severity = silent
 
 # IDE0059: Remove unnecessary value assignment
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0059
-dotnet_diagnostic.IDE0059.severity = suggestion
+dotnet_diagnostic.IDE0059.severity = silent
 
 # IDE0230: Use UTF-8 string literal
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0230
-dotnet_diagnostic.IDE0230.severity = suggestion
+dotnet_diagnostic.IDE0230.severity = silent
+
+# IDE0046: Use conditional expression for return
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0046
+dotnet_diagnostic.IDE0046.severity = silent
+
+# IDE0047: Remove unnecessary parentheses
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0047-ide0048
+dotnet_diagnostic.IDE0047.severity = silent
+
+# IDE0032: Use auto-implemented property
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0032
+dotnet_diagnostic.IDE0032.severity = silent

+ 20 - 4
test/Renci.SshNet.TestTools.OpenSSH/.editorconfig

@@ -6,18 +6,34 @@
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0001.md
 #
 # TODO: Re-enable when issues are fixed
-dotnet_diagnostic.MA0001.severity = suggestion
+dotnet_diagnostic.MA0001.severity = silent
 
 # MA0110: Use the Regex source generator
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0110.md
-dotnet_diagnostic.MA0110.severity = none
+dotnet_diagnostic.MA0110.severity = silent
+
+# MA0026: Fix TODO comment
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md
+dotnet_diagnostic.MA0026.severity = silent
 
 #### .NET Compiler Platform analysers rules ####
 
 # CA1307: Specify StringComparison for clarity
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1307
-dotnet_diagnostic.CA1307.severity = none
+dotnet_diagnostic.CA1307.severity = silent
 
 # CA1822: Mark members as static
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
-dotnet_code_quality.CA1822.api_surface = none
+dotnet_diagnostic.CA1822.severity = silent
+
+# IDE0046: Use conditional expression for return
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0046
+dotnet_diagnostic.IDE0046.severity = silent
+
+# IDE0047: Remove unnecessary parentheses
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0047-ide0048
+dotnet_diagnostic.IDE0047.severity = silent
+
+# IDE0032: Use auto-implemented property
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0032
+dotnet_diagnostic.IDE0032.severity = silent

+ 115 - 95
test/Renci.SshNet.Tests/.editorconfig

@@ -4,381 +4,401 @@
 
 # S108: Nested blocks of code should not be left empty
 # https://rules.sonarsource.com/csharp/RSPEC-108/
-dotnet_diagnostic.S108.severity = suggestion
+dotnet_diagnostic.S108.severity = silent
 
 # S125: Sections of code should not be commented out
 # https://rules.sonarsource.com/csharp/RSPEC-125/
-dotnet_diagnostic.S125.severity = none
+dotnet_diagnostic.S125.severity = silent
 
 # S1144: Unused private types or members should be removed
 # https://rules.sonarsource.com/csharp/RSPEC-1144/
-dotnet_diagnostic.S1144.severity = none
+dotnet_diagnostic.S1144.severity = silent
 
 # S1186: Methods should not be empty
 # https://rules.sonarsource.com/csharp/RSPEC-1186/
-dotnet_diagnostic.S1186.severity = none
+dotnet_diagnostic.S1186.severity = silent
 
 # S1607: Tests should not be ignored
 # https://rules.sonarsource.com/csharp/RSPEC-1607/
-dotnet_diagnostic.S1607.severity = none
+dotnet_diagnostic.S1607.severity = silent
 
 # S2094: Classes should not be empty
 # https://rules.sonarsource.com/csharp/RSPEC-2094/
-dotnet_diagnostic.S2094.severity = none
+dotnet_diagnostic.S2094.severity = silent
 
 # S2187: Test classes should contain at least one test case
 # https://rules.sonarsource.com/csharp/RSPEC-2187/
-dotnet_diagnostic.S2187.severity = none
+dotnet_diagnostic.S2187.severity = silent
 
 # S2292: Trivial properties should be auto-implemented
 # https://rules.sonarsource.com/csharp/RSPEC-2292/
-dotnet_diagnostic.S2292.severity = none
+dotnet_diagnostic.S2292.severity = silent
 
 # S2925: "Thread.Sleep" should not be used in tests
 # https://rules.sonarsource.com/csharp/RSPEC-2925/
-dotnet_diagnostic.S2925.severity = none
+dotnet_diagnostic.S2925.severity = silent
 
 # S3415: Assertion arguments should be passed in the correct order
 # https://rules.sonarsource.com/csharp/RSPEC-3415/
-dotnet_diagnostic.S3415.severity = none
+dotnet_diagnostic.S3415.severity = silent
 
 # S3881: "IDisposable" should be implemented correctly
 # https://rules.sonarsource.com/csharp/RSPEC-3881/
-dotnet_diagnostic.S3881.severity = none
+dotnet_diagnostic.S3881.severity = silent
 
 # S4144: Methods should not have identical implementations
 # https://rules.sonarsource.com/csharp/RSPEC-4144/
-dotnet_diagnostic.S4144.severity = none
+dotnet_diagnostic.S4144.severity = silent
 
 # S4158: Empty collections should not be accessed or iterated
 # https://rules.sonarsource.com/csharp/RSPEC-4158/
-dotnet_diagnostic.S4158.severity = none
+dotnet_diagnostic.S4158.severity = silent
 
 #### SYSLIB diagnostics ####
 
 # SYSLIB1045: Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time
 #
 # TODO: Remove this when https://github.com/sshnet/SSH.NET/issues/1131 is implemented.
-dotnet_diagnostic.SYSLIB1045.severity = none
+dotnet_diagnostic.SYSLIB1045.severity = silent
 
 ### StyleCop Analyzers rules ###
 
 # SA1000: Keywords must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1000.md
-dotnet_diagnostic.SA1000.severity = suggestion
+dotnet_diagnostic.SA1000.severity = silent
 
 # SA1001: Commas must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1001.md
-dotnet_diagnostic.SA1001.severity = suggestion
+dotnet_diagnostic.SA1001.severity = silent
 
 # SA1002: Semicolons must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1002.md
-dotnet_diagnostic.SA1002.severity = suggestion
+dotnet_diagnostic.SA1002.severity = silent
 
 # SA1004: Documentation lines must begin with single space
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1004.md
-dotnet_diagnostic.SA1004.severity = suggestion
+dotnet_diagnostic.SA1004.severity = silent
 
 # SA1005: Single line comments must begin with single space
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1005.md
-dotnet_diagnostic.SA1005.severity = suggestion
+dotnet_diagnostic.SA1005.severity = silent
 
 # SA1012: Opening braces must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1012.md
-dotnet_diagnostic.SA1012.severity = suggestion
+dotnet_diagnostic.SA1012.severity = silent
 
 # SA1013: Closing braces must be spaced correctly
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1013.md
-dotnet_diagnostic.SA1013.severity = suggestion
+dotnet_diagnostic.SA1013.severity = silent
 
 # SA1025: Code must not contain multiple whitespace in a row
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1025.md
-dotnet_diagnostic.SA1025.severity = suggestion
+dotnet_diagnostic.SA1025.severity = silent
 
 # SA1026: Code must not contain space after new keyword in implicitly typed array allocation
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1026.md
-dotnet_diagnostic.SA1026.severity = suggestion
+dotnet_diagnostic.SA1026.severity = silent
 
 # SA1028: Code must not contain trailing whitespace
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md
-dotnet_diagnostic.SA1028.severity = suggestion
+dotnet_diagnostic.SA1028.severity = silent
 
 # SA1111: Closing parenthesis must be on line of last parameter
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1111.md
-dotnet_diagnostic.SA1111.severity = suggestion
+dotnet_diagnostic.SA1111.severity = silent
 
 # SA1117: Parameters must be on same line or separate lines
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md
-dotnet_diagnostic.SA1117.severity = suggestion
+dotnet_diagnostic.SA1117.severity = silent
 
 # SA1119: Statement must not use unnecessary parenthesis
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md
-dotnet_diagnostic.SA1119.severity = suggestion
+dotnet_diagnostic.SA1119.severity = silent
 
 # SA1120: Comments must contain text
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1120.md
-dotnet_diagnostic.SA1120.severity = suggestion
+dotnet_diagnostic.SA1120.severity = silent
 
 # SA1122: Use String.Empty for empty strings
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1122.md
-dotnet_diagnostic.SA1122.severity = suggestion
+dotnet_diagnostic.SA1122.severity = silent
 
 # SA1123:Do not place regions within elements
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1123.md
-dotnet_diagnostic.SA1123.severity = suggestion
+dotnet_diagnostic.SA1123.severity = silent
 
 # SA1124: Do not use regions
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1124.md
-dotnet_diagnostic.SA1124.severity = suggestion
+dotnet_diagnostic.SA1124.severity = silent
 
 # SA1128: Constructor initializer must be on own line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1128.md
-dotnet_diagnostic.SA1128.severity = suggestion
+dotnet_diagnostic.SA1128.severity = silent
 
 # SA1129: Do not use default value type constructor
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1129.md
-dotnet_diagnostic.SA1129.severity = suggestion
+dotnet_diagnostic.SA1129.severity = silent
 
 # SA1133: Do not combine attributes
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1133.md
-dotnet_diagnostic.SA1133.severity = suggestion
+dotnet_diagnostic.SA1133.severity = silent
 
 # SA1137: Elements should have the same indentation
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1137.md
-dotnet_diagnostic.SA1137.severity = suggestion
+dotnet_diagnostic.SA1137.severity = silent
 
 # SA1139: Use literals suffix notation instead of casting
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1139.md
-dotnet_diagnostic.SA1139.severity = suggestion
+dotnet_diagnostic.SA1139.severity = silent
 
 # SA1204: Static elements must appear before instance elements
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1204.md
-dotnet_diagnostic.SA1204.severity = suggestion
+dotnet_diagnostic.SA1204.severity = silent
 
 # SA1208: System using directives must be placed before other using directives
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1208.md
-dotnet_diagnostic.SA1208.severity = suggestion
+dotnet_diagnostic.SA1208.severity = silent
 
 # SA1210: Using directives must be ordered alphabetically by namespace
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1210.md
-dotnet_diagnostic.SA1210.severity = suggestion
+dotnet_diagnostic.SA1210.severity = silent
 
 # SA1214: Readonly elements must appear before non-readonly elements
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1214.md
-dotnet_diagnostic.SA1214.severity = suggestion
+dotnet_diagnostic.SA1214.severity = silent
 
 # SA1306: Field names must begin with lower case letter
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md
-dotnet_diagnostic.SA1306.severity = suggestion
+dotnet_diagnostic.SA1306.severity = silent
 
 # SA1310: Field names must not contain underscore
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1310.md
-dotnet_diagnostic.SA1310.severity = suggestion
+dotnet_diagnostic.SA1310.severity = silent
 
 # SA1400: Access modifier must be declared
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1400.md
-dotnet_diagnostic.SA1400.severity = suggestion
+dotnet_diagnostic.SA1400.severity = silent
 
 # SA1401: Fields must be private
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
-dotnet_diagnostic.SA1401.severity = suggestion
+dotnet_diagnostic.SA1401.severity = silent
 
 # SA1402: File may only contain a single type
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1402.md
-dotnet_diagnostic.SA1402.severity = suggestion
+dotnet_diagnostic.SA1402.severity = silent
 
 # SA1404: Code analysis suppression must have justification
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1404.md
-dotnet_diagnostic.SA1404.severity = suggestion
+dotnet_diagnostic.SA1404.severity = silent
 
 # SA1411: Attribute constructor must not use unnecessary parenthesis
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1411.md
-dotnet_diagnostic.SA1411.severity = suggestion
+dotnet_diagnostic.SA1411.severity = silent
 
 # SA1500: Braces for multiline statements must not share line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1500.md
-dotnet_diagnostic.SA1500.severity = suggestion
+dotnet_diagnostic.SA1500.severity = silent
 
 # SA1501: Statement must not be on single line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1501.md
-dotnet_diagnostic.SA1501.severity = suggestion
+dotnet_diagnostic.SA1501.severity = silent
 
 # SA1505: Opening braces must not be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1505.md
-dotnet_diagnostic.SA1505.severity = suggestion
+dotnet_diagnostic.SA1505.severity = silent
 
 # SA1507: Code must not contain multiple blank lines in a row
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1507.md
-dotnet_diagnostic.SA1507.severity = suggestion
+dotnet_diagnostic.SA1507.severity = silent
 
 # SA1508: Closing braces must not be preceded by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1508.md
-dotnet_diagnostic.SA1508.severity = suggestion
+dotnet_diagnostic.SA1508.severity = silent
 
 # SA1512: Single line comments must not be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1512.md
-dotnet_diagnostic.SA1512.severity = suggestion
+dotnet_diagnostic.SA1512.severity = silent
 
 # SA1513: Closing brace must be followed by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1513.md
-dotnet_diagnostic.SA1513.severity = suggestion
+dotnet_diagnostic.SA1513.severity = silent
 
 # SA1515: Single line comment must be preceded by blank line
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1515.md
-dotnet_diagnostic.SA1515.severity = suggestion
+dotnet_diagnostic.SA1515.severity = silent
 
 # SA1518: Use line endings correctly at end of file
 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1518.md
-dotnet_diagnostic.SA1518.severity = suggestion
+dotnet_diagnostic.SA1518.severity = silent
 
 # SA1636: File header copyright text must match
 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1636.md
-dotnet_diagnostic.SA1636.severity = suggestion
+dotnet_diagnostic.SA1636.severity = silent
 
 # SA1642: Constructor summary documentation must begin with standard text
 # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1642.md
-dotnet_diagnostic.SA1642.severity = suggestion
+dotnet_diagnostic.SA1642.severity = silent
 
 # SA1649: File name must match type name
 https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1649.md
-dotnet_diagnostic.SA1649.severity = suggestion
+dotnet_diagnostic.SA1649.severity = silent
 
 #### Meziantou.Analyzer rules ####
 
 # MA0001: StringComparison is missing
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0001.md
-dotnet_diagnostic.MA0001.severity = suggestion
+dotnet_diagnostic.MA0001.severity = silent
 
 # MA0003: Add parameter name to improve readability
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0003.md
-dotnet_diagnostic.MA0003.severity = suggestion
+dotnet_diagnostic.MA0003.severity = silent
 
 # MA0004: Use Task.ConfigureAwait(false)
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0004.md
-dotnet_diagnostic.MA0004.severity = suggestion
+dotnet_diagnostic.MA0004.severity = silent
 
 # MA0005: Use Array.Empty<T>()
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0005.md
-dotnet_diagnostic.MA0005.severity = suggestion
+dotnet_diagnostic.MA0005.severity = silent
 
 # MA0011: IFormatProvider is missing
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0011.md
-dotnet_diagnostic.MA0011.severity = suggestion
+dotnet_diagnostic.MA0011.severity = silent
 
 # MA0015: Specify the parameter name in ArgumentException
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0015.md
-dotnet_diagnostic.MA0015.severity = suggestion
+dotnet_diagnostic.MA0015.severity = silent
 
 # MA0019: Use EventArgs.Empty
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0019.md
-dotnet_diagnostic.MA0019.severity = suggestion
+dotnet_diagnostic.MA0019.severity = silent
 
 # MA0035: Do not use dangerous threading methods
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0035.md
-dotnet_diagnostic.MA0035.severity = suggestion
+dotnet_diagnostic.MA0035.severity = silent
 
 # MA0040: Forward the CancellationToken parameter to methods that take one
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0040.md
-dotnet_diagnostic.MA0040.severity = suggestion
+dotnet_diagnostic.MA0040.severity = silent
 
 # MA0046: Use EventHandler<T> to declare events
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0046.md
-dotnet_diagnostic.MA0046.severity = suggestion
+dotnet_diagnostic.MA0046.severity = silent
 
 # MA0053: Make class sealed
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0053.md
-dotnet_diagnostic.MA0053.severity = suggestion
+dotnet_diagnostic.MA0053.severity = silent
 
 # MA0060: The value returned by Stream.Read/Stream.ReadAsync is not used
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0060.md
-dotnet_diagnostic.MA0060.severity = suggestion
+dotnet_diagnostic.MA0060.severity = silent
 
 # MA0075: Do not use implicit culture-sensitive ToString
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0075.md
-dotnet_diagnostic.MA0075.severity = suggestion
+dotnet_diagnostic.MA0075.severity = silent
 
 # MA0099 - Use Explicit enum value instead of 0
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0099.md
-dotnet_diagnostic.MA0099.severity = suggestion
+dotnet_diagnostic.MA0099.severity = silent
 
 # MA0110: Use the Regex source generator
 # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0110.md
-dotnet_diagnostic.MA0110.severity = suggestion
+dotnet_diagnostic.MA0110.severity = silent
+
+# MA0026: Fix TODO comment
+# https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md
+dotnet_diagnostic.MA0026.severity = silent
 
 #### .NET Compiler Platform analysers rules ####
 
 # CA1031: Do not catch general exception types
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1031
-dotnet_diagnostic.CA1031.severity = suggestion
+dotnet_diagnostic.CA1031.severity = silent
 
 # CA1062: Validate arguments of public methods
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1062
-dotnet_diagnostic.CA1062.severity = suggestion
+dotnet_diagnostic.CA1062.severity = silent
 
 # CA1063: Implement IDisposable correctly
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1063
-dotnet_diagnostic.CA1063.severity = suggestion
+dotnet_diagnostic.CA1063.severity = silent
 
 # CA1307: Specify StringComparison for clarity
 https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1307
-dotnet_diagnostic.CA1307.severity = suggestion
+dotnet_diagnostic.CA1307.severity = silent
 
 # CA1806: Do not ignore method results
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1806
-dotnet_diagnostic.CA1806.severity = suggestion
+dotnet_diagnostic.CA1806.severity = silent
 
-# CA1812: Avoid uninstantiated internal classes
-# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1812
-dotnet_diagnostic.CA1812.severity = suggestion
+# CA1515: Consider making public types internal
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/quality-rules/ca1515
+dotnet_diagnostic.CA1515.severity = silent
 
 # CA1822: Mark members as static
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
-dotnet_diagnostic.CA1822.severity = suggestion
+dotnet_diagnostic.CA1822.severity = silent
 
 # CA1825: Avoid zero-length array allocations
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1825
-dotnet_diagnostic.CA1825.severity = suggestion
+dotnet_diagnostic.CA1825.severity = silent
 
 # CA1859: Use concrete types when possible for improved performance
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1859
-dotnet_diagnostic.CA1859.severity = suggestion
+dotnet_diagnostic.CA1859.severity = silent
 
 # CA2000: Dispose objects before losing scope
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2000
-dotnet_diagnostic.CA2000.severity = suggestion
+dotnet_diagnostic.CA2000.severity = silent
 
 # CA2007: Do not directly await a Task
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2007
-dotnet_diagnostic.CA2007.severity = suggestion
+dotnet_diagnostic.CA2007.severity = silent
 
 # CA2201: Do not raise reserved exception types
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2201
-dotnet_diagnostic.CA2201.severity = suggestion
+dotnet_diagnostic.CA2201.severity = silent
 
 # CA2213: Disposable fields should be disposed
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2213
-dotnet_diagnostic.CA2213.severity = suggestion
+dotnet_diagnostic.CA2213.severity = silent
 
 # CA2227: Collection properties should be read only
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2227
-dotnet_diagnostic.CA2227.severity = suggestion
+dotnet_diagnostic.CA2227.severity = silent
 
 # IDE0007: Use var instead of explicit type
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0007
-dotnet_diagnostic.IDE0007.severity = suggestion
+dotnet_diagnostic.IDE0007.severity = silent
 
 # IDE0028: Use collection initializers
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0028
-dotnet_diagnostic.IDE0028.severity = suggestion
+dotnet_diagnostic.IDE0028.severity = silent
 
 # IDE0058: Remove unnecessary expression value
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0058
-dotnet_diagnostic.IDE0058.severity = suggestion
+dotnet_diagnostic.IDE0058.severity = silent
 
 # IDE0059: Remove unnecessary value assignment
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0059
-dotnet_diagnostic.IDE0059.severity = suggestion
+dotnet_diagnostic.IDE0059.severity = silent
 
 # IDE0230: Use UTF-8 string literal
 # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0230
-dotnet_diagnostic.IDE0230.severity = suggestion
+dotnet_diagnostic.IDE0230.severity = silent
+
+# IDE0046: Use conditional expression for return
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0046
+dotnet_diagnostic.IDE0046.severity = silent
+
+# IDE0047: Remove unnecessary parentheses
+# https://learn.microsoft.com/en-ca/dotnet/fundamentals/code-analysis/style-rules/ide0047-ide0048
+dotnet_diagnostic.IDE0047.severity = silent
+
+# IDE0032: Use auto-implemented property
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0032
+dotnet_diagnostic.IDE0032.severity = silent
+
+# CA1812: Avoid uninstantiated internal classes
+# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1812
+dotnet_diagnostic.CA1812.severity = silent

+ 0 - 2
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Diagnostics.CodeAnalysis;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_Concat
     {
         private Random _random;

+ 0 - 2
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_IsEqualTo_ByteArray.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Diagnostics.CodeAnalysis;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_IsEqualTo_ByteArray
     {
         private Random _random;

+ 1 - 4
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs

@@ -1,13 +1,10 @@
-using System.Diagnostics.CodeAnalysis;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
 
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_Pad
     {
         [TestMethod]

+ 0 - 2
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Reverse.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Diagnostics.CodeAnalysis;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_Reverse
     {
         [TestMethod]

+ 0 - 2
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Diagnostics.CodeAnalysis;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_Take_Count
     {
         private Random _random;

+ 0 - 2
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Diagnostics.CodeAnalysis;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_Take_OffsetAndCount
     {
         private Random _random;

+ 0 - 2
test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Diagnostics.CodeAnalysis;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Renci.SshNet.Common;
 
 namespace Renci.SshNet.Tests.Classes.Common
 {
     [TestClass]
-    [SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
     public class ExtensionsTest_TrimLeadingZeros
     {
         [TestMethod]

+ 3 - 3
test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs

@@ -207,7 +207,7 @@ namespace Renci.SshNet.Tests.Classes
                 }
                 catch (SshException ex)
                 {
-                    Assert.IsInstanceOfType(ex, typeof(SshException));
+                    Assert.IsInstanceOfType<SshException>(ex);
                     Assert.IsNull(ex.InnerException);
                     Assert.AreEqual("Invalid passphrase.", ex.Message);
                 }
@@ -228,7 +228,7 @@ namespace Renci.SshNet.Tests.Classes
                 }
                 catch (SshPassPhraseNullOrEmptyException ex)
                 {
-                    Assert.IsInstanceOfType(ex, typeof(SshPassPhraseNullOrEmptyException));
+                    Assert.IsInstanceOfType<SshPassPhraseNullOrEmptyException>(ex);
                     Assert.IsNull(ex.InnerException);
                     Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
                 }
@@ -249,7 +249,7 @@ namespace Renci.SshNet.Tests.Classes
                 }
                 catch (SshPassPhraseNullOrEmptyException ex)
                 {
-                    Assert.IsInstanceOfType(ex, typeof(SshPassPhraseNullOrEmptyException));
+                    Assert.IsInstanceOfType<SshPassPhraseNullOrEmptyException>(ex);
                     Assert.IsNull(ex.InnerException);
                     Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
                 }

+ 2 - 0
test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs

@@ -192,7 +192,9 @@ namespace Renci.SshNet.Tests.Classes
             _channelSessionStub.Receive(Encoding.UTF8.GetBytes("Hello World!"));
 
             _shellStream.Dispose();
+#pragma warning disable S3966 // Objects should not be disposed more than once
             _shellStream.Dispose(); // Check that multiple Dispose is OK.
+#pragma warning restore S3966 // Objects should not be disposed more than once
 
             Assert.AreEqual("Hello World!", _shellStream.ReadLine());
             Assert.IsNull(_shellStream.ReadLine());