diff --git a/src/ClamAV.Net/ClamAV.Net.csproj b/src/ClamAV.Net/ClamAV.Net.csproj index f13ec6d..c97251b 100644 --- a/src/ClamAV.Net/ClamAV.Net.csproj +++ b/src/ClamAV.Net/ClamAV.Net.csproj @@ -1,6 +1,6 @@  - netstandard2.1 + netstandard2.1;netstandard2.0; true petertsu@github ClamAV.Net @@ -19,12 +19,13 @@ Copyright 2020 petertsu@github The ClamAV server .NETStandard client 4E284927-EFC1-443E-BC27-D598404ACE71 + 12.0 ClamAV.Net.xml Off - + \ No newline at end of file diff --git a/src/ClamAV.Net/Commands/InStreamCommand.cs b/src/ClamAV.Net/Commands/InStreamCommand.cs index 2f3e066..8082f19 100644 --- a/src/ClamAV.Net/Commands/InStreamCommand.cs +++ b/src/ClamAV.Net/Commands/InStreamCommand.cs @@ -69,7 +69,11 @@ public ScanResult ProcessRawResponse(byte[] rawResponse) new ClamAvException($"Invalid raw response '{actualResponse}'"); } +#if NETSTANDARD2_0 + return new ScanResult(true, responseParts[responseParts.Length - 2]); +#else return new ScanResult(true, responseParts[^2]); +#endif } } } \ No newline at end of file diff --git a/src/ClamAV.Net/Socket/TcpSocketClient.cs b/src/ClamAV.Net/Socket/TcpSocketClient.cs index 7b37cac..cffac9e 100644 --- a/src/ClamAV.Net/Socket/TcpSocketClient.cs +++ b/src/ClamAV.Net/Socket/TcpSocketClient.cs @@ -44,7 +44,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) private async Task ReadResponse(CancellationToken cancellationToken) { - await using MemoryStream memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new MemoryStream(); do { diff --git a/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj b/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj index 4c6a9d3..536c3d2 100644 --- a/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj +++ b/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj @@ -1,25 +1,25 @@  - netcoreapp3.1 + netcoreapp8.0 false - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs b/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs index b321102..ab98fed 100644 --- a/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs +++ b/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs @@ -23,23 +23,5 @@ public void Ctor_Validation() clamAvException.Message.Should().Be(expectedMessage); clamAvException.InnerException.Should().NotBeNull(); } - - [Fact] - public void Serialization_Test() - { - const string expectedMessage = "Some error"; - ClamAvException clamAvException = new ClamAvException(expectedMessage, new Exception("Error")); - - BinaryFormatter binaryFormatter = new BinaryFormatter(); - - using MemoryStream memoryStream = new MemoryStream(); - binaryFormatter.Serialize(memoryStream, clamAvException); - memoryStream.Seek(0, SeekOrigin.Begin); - - ClamAvException actual = binaryFormatter.Deserialize(memoryStream) as ClamAvException; - - actual.Should().NotBeNull(); - actual.Should().BeEquivalentTo(clamAvException); - } } } \ No newline at end of file