diff --git a/.editorconfig b/.editorconfig
index f92acc7da..e107f2173 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -32,6 +32,9 @@ dotnet_diagnostic.S101.severity = none
# This is a duplicate of CA2201 and MA0012.
dotnet_diagnostic.S112.severity = none
+# S125: Remove this commented out code
+dotnet_diagnostic.S125.severity = silent
+
# S127: "for" loop stop conditions should be invariant
# https://rules.sonarsource.com/csharp/RSPEC-127
#
@@ -324,6 +327,23 @@ dotnet_diagnostic.S4487.severity = none
# This is a partial duplicate of MA0067, and we do not want to report the use of 'default' for a Guid as error.
dotnet_diagnostic.S4581.severity = none
+# S4790: Weak hashing algorithms should not be used
+dotnet_diagnostic.S4790.severity = none
+
+# S5766: Serializable objects should validate data during deserialization
+dotnet_diagnostic.S5766.severity = none
+
+# S6444: Pass a regex timeout
+dotnet_diagnostic.S6444.severity = silent
+
+# S8949: The overload accepting a 'CancellationToken' should be used
+dotnet_diagnostic.S8949.severity = silent
+
+# S8969: Remove unnecessary suppression
+#
+# Dupe of IDE0370
+dotnet_diagnostic.S8969.severity = none
+
# S4830: Server certificates should be verified during SSL/TLS connections
# https://rules.sonarsource.com/csharp/RSPEC-4830/
dotnet_diagnostic.S4830.severity = none
@@ -612,6 +632,9 @@ MA0053.exceptions_should_be_sealed = true
# Also report diagnostic for types that define (new) virtual members.
MA0053.class_with_virtual_member_shoud_be_sealed = true
+# MA0071: Avoid using redundant else
+dotnet_diagnostic.MA0071.severity = silent
+
# MA0112: Use 'Count > 0' instead of 'Any()'
#
# This rule is disabled by default, hence we need to explicitly enable it.
@@ -635,6 +658,9 @@ dotnet_diagnostic.MA0190.severity = none
# MA0192 - Use HasFlag instead of bitwise checks
dotnet_diagnostic.MA0192.severity = none
+# MA0219: Set the language attribute in XML comment
+dotnet_diagnostic.MA0219.severity = none
+
#### MSTest rules ####
# MSTEST0015: Test method should not be ignored
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 0ffc049d3..687954d8c 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -6,22 +6,22 @@
-
-
+
+
-
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
+
+
\ No newline at end of file
diff --git a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs
index dfa2c9935..7a526de0f 100644
--- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs
+++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs
@@ -232,9 +232,12 @@ public static int Read(Socket socket, byte[] buffer, int offset, int size, TimeS
if (ex.SocketErrorCode == SocketError.TimedOut)
{
- throw new SshOperationTimeoutException(string.Format(CultureInfo.InvariantCulture,
- "Socket read operation has timed out after {0:F0} milliseconds.",
- readTimeout.TotalMilliseconds));
+ throw new SshOperationTimeoutException(
+ string.Format(
+ CultureInfo.InvariantCulture,
+ "Socket read operation has timed out after {0:F0} milliseconds.",
+ readTimeout.TotalMilliseconds),
+ ex);
}
throw;
diff --git a/src/Renci.SshNet/Messages/Transport/IKeyExchangedAllowed.cs b/src/Renci.SshNet/Messages/Transport/IKeyExchangedAllowed.cs
index 1f06aeb31..1c8a56756 100644
--- a/src/Renci.SshNet/Messages/Transport/IKeyExchangedAllowed.cs
+++ b/src/Renci.SshNet/Messages/Transport/IKeyExchangedAllowed.cs
@@ -4,8 +4,6 @@
/// Indicates that message that implement this interface is allowed during key exchange phase.
///
#pragma warning disable CA1040 // Avoid empty interfaces
- public interface IKeyExchangedAllowed
+ public interface IKeyExchangedAllowed;
#pragma warning restore CA1040 // Avoid empty interfaces
- {
- }
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs
index 817cc27a3..46fc1e384 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs
@@ -119,7 +119,6 @@ protected override void Act()
[TestMethod]
public void ConnectShouldHaveThrownSshOperationTimeoutException()
{
- Assert.IsNull(_actualException.InnerException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs
index e325c88f8..b72007ccb 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs
@@ -95,7 +95,6 @@ protected override void Act()
[TestMethod]
public void ConnectShouldHaveThrownSshOperationTimeoutException()
{
- Assert.IsNull(_actualException.InnerException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs
index 82fc25419..9dde3563f 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs
@@ -88,7 +88,6 @@ protected void Act()
public void StartShouldHaveThrownSshOperationTimeoutException()
{
Assert.IsNotNull(_actualException);
- Assert.IsNull(_actualException.InnerException);
Assert.AreEqual(string.Format("Socket read operation has timed out after {0} milliseconds.", _timeout.TotalMilliseconds), _actualException.Message);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs
index 35fe071ae..f390b854f 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs
@@ -97,7 +97,6 @@ protected override void Act()
[TestMethod]
public void ConnectShouldHaveThrownSshOperationTimeoutException()
{
- Assert.IsNull(_actualException.InnerException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs
index e101b9035..fb0c992a7 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs
@@ -93,7 +93,6 @@ protected override void Act()
[TestMethod]
public void ConnectShouldHaveThrownSshOperationTimeoutException()
{
- Assert.IsNull(_actualException.InnerException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs
index d01b1c562..4e1bda469 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs
@@ -85,7 +85,6 @@ protected override void Act()
[TestMethod]
public void ConnectShouldHaveThrownSshOperationTimeoutException()
{
- Assert.IsNull(_actualException.InnerException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs
index a1dfb236b..11546750a 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs
@@ -95,7 +95,6 @@ protected override void Act()
[TestMethod]
public void ConnectShouldHaveThrownSshOperationTimeoutException()
{
- Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType(_actualException);
}