diff --git a/build.cake b/build.cake index 937e7978..906d5fe3 100644 --- a/build.cake +++ b/build.cake @@ -3,7 +3,7 @@ ////////////////////////////////////////////////////////////////////// #tool "nuget:?package=GitVersion.CommandLine&version=4.0.0" #tool "nuget:?package=gitlink&version=3.1.0" -#tool "nuget:?package=JetBrains.DotMemoryUnit&version=3.0.20171219.105559" +#tool "nuget:?package=JetBrains.DotMemoryUnit&version=3.1.20200127.214830" #addin "Cake.FileHelpers&version=3.2.0" ////////////////////////////////////////////////////////////////////// @@ -95,7 +95,7 @@ Task("Test") args.Append("--no-build"); return args; }, - ToolPath = "./tools/JetBrains.dotMemoryUnit.3.0.20171219.105559/lib/tools/dotMemoryUnit.exe" + ToolPath = "./tools/JetBrains.dotMemoryUnit.3.1.20200127.214830/lib/tools/dotMemoryUnit.exe" }); }); @@ -106,7 +106,7 @@ Task("PublishLinuxTests") DotNetCorePublish("./source/Halibut.Tests/Halibut.Tests.csproj", new DotNetCorePublishSettings { Configuration = configuration, - Framework = "netcoreapp2.2", + Framework = "netcoreapp3.1", Runtime = "linux-x64", OutputDirectory = new DirectoryPath($"{artifactsDir}publish/linux-x64") }); diff --git a/source/Halibut.CertificateGenerator/CertificateGenerator.cs b/source/Halibut.CertificateGenerator/CertificateGenerator.cs index c22600ef..d52cdc0d 100644 --- a/source/Halibut.CertificateGenerator/CertificateGenerator.cs +++ b/source/Halibut.CertificateGenerator/CertificateGenerator.cs @@ -6,6 +6,7 @@ using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Generators; +using Org.BouncyCastle.Crypto.Operators; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Prng; using Org.BouncyCastle.Math; @@ -66,10 +67,11 @@ static X509Certificate2 AttemptToGenerate(string fullName) certGen.SetNotAfter(DateTime.Today.AddYears(100)); certGen.SetSubjectDN(new X509Name(ord, attrs)); certGen.SetPublicKey(cerKp.Public); - certGen.SetSignatureAlgorithm("SHA1WithRSA"); certGen.AddExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false)); certGen.AddExtension(X509Extensions.AuthorityKeyIdentifier, true, new AuthorityKeyIdentifier(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(cerKp.Public))); - var x509 = certGen.Generate(cerKp.Private); + + var signatureFactory = new Asn1SignatureFactory("SHA1WithRSA", cerKp.Private); + var x509 = certGen.Generate(signatureFactory); var x509Certificate = DotNetUtilities.ToX509Certificate(x509); return new X509Certificate2(x509Certificate) diff --git a/source/Halibut.CertificateGenerator/Halibut.CertificateGenerator.csproj b/source/Halibut.CertificateGenerator/Halibut.CertificateGenerator.csproj index 4e8b5bb0..d077e6e2 100644 --- a/source/Halibut.CertificateGenerator/Halibut.CertificateGenerator.csproj +++ b/source/Halibut.CertificateGenerator/Halibut.CertificateGenerator.csproj @@ -14,7 +14,7 @@ - + diff --git a/source/Halibut.SampleClient/Halibut.SampleClient.csproj b/source/Halibut.SampleClient/Halibut.SampleClient.csproj index 8a77598f..1eb81677 100644 --- a/source/Halibut.SampleClient/Halibut.SampleClient.csproj +++ b/source/Halibut.SampleClient/Halibut.SampleClient.csproj @@ -19,9 +19,9 @@ - - - + + + diff --git a/source/Halibut.SampleLoadTest/Halibut.SampleLoadTest.csproj b/source/Halibut.SampleLoadTest/Halibut.SampleLoadTest.csproj index 74521821..a3ee6384 100644 --- a/source/Halibut.SampleLoadTest/Halibut.SampleLoadTest.csproj +++ b/source/Halibut.SampleLoadTest/Halibut.SampleLoadTest.csproj @@ -2,7 +2,7 @@ 0.0.0 - net45;netcoreapp2.0 + net45;netcoreapp3.1 Halibut.SampleLoadTest Exe Halibut.SampleLoadTest @@ -18,8 +18,8 @@ - - + + diff --git a/source/Halibut.SamplePolling/Halibut.SamplePolling.csproj b/source/Halibut.SamplePolling/Halibut.SamplePolling.csproj index 6c6d2483..a5f6e20b 100644 --- a/source/Halibut.SamplePolling/Halibut.SamplePolling.csproj +++ b/source/Halibut.SamplePolling/Halibut.SamplePolling.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + netcoreapp3.1 @@ -10,8 +10,8 @@ - - + + diff --git a/source/Halibut.SampleServer/Halibut.SampleServer.csproj b/source/Halibut.SampleServer/Halibut.SampleServer.csproj index 8c4625b9..9f7545b8 100644 --- a/source/Halibut.SampleServer/Halibut.SampleServer.csproj +++ b/source/Halibut.SampleServer/Halibut.SampleServer.csproj @@ -19,9 +19,9 @@ - - - + + + diff --git a/source/Halibut.Tests/DiscoveryClientFixture.cs b/source/Halibut.Tests/DiscoveryClientFixture.cs index 3f3f931f..a65948d7 100644 --- a/source/Halibut.Tests/DiscoveryClientFixture.cs +++ b/source/Halibut.Tests/DiscoveryClientFixture.cs @@ -38,8 +38,8 @@ public void DiscoverMethodReturnsEndpointDetails() var client = new DiscoveryClient(); var discovered = client.Discover(new ServiceEndPoint(endpoint.BaseUri, "")); - discovered.RemoteThumbprint.ShouldBeEquivalentTo(endpoint.RemoteThumbprint); - discovered.BaseUri.ShouldBeEquivalentTo(endpoint.BaseUri); + discovered.RemoteThumbprint.Should().BeEquivalentTo(endpoint.RemoteThumbprint); + discovered.BaseUri.Should().BeEquivalentTo(endpoint.BaseUri); } [Test] diff --git a/source/Halibut.Tests/FailureModesFixture.cs b/source/Halibut.Tests/FailureModesFixture.cs index 68bd6637..57e0a46b 100644 --- a/source/Halibut.Tests/FailureModesFixture.cs +++ b/source/Halibut.Tests/FailureModesFixture.cs @@ -86,7 +86,8 @@ public void FailOnInvalidHostname() } else { - new [] {"No such device or address", "Resource temporarily unavailable"}.Any(message.Contains).Should().BeTrue(); + // Failed with: An error occurred when sending a request to 'https://sduj08ud9382ujd98dw9fh934hdj2389u982:8000/', before the request could begin: Name or service not known, but found False. + new [] {"No such device or address", "Resource temporarily unavailable", "Name or service not known"}.Any(message.Contains).Should().BeTrue($"Message does not match known strings: {message}"); } } } diff --git a/source/Halibut.Tests/Halibut.Tests.csproj b/source/Halibut.Tests/Halibut.Tests.csproj index 93bc2f9a..ae3f734a 100644 --- a/source/Halibut.Tests/Halibut.Tests.csproj +++ b/source/Halibut.Tests/Halibut.Tests.csproj @@ -8,10 +8,10 @@ false - net462;netcoreapp2.2 + net462;netcoreapp3.1 - netcoreapp2.2 + netcoreapp3.1 @@ -35,26 +35,19 @@ - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + + + + + + + + + diff --git a/source/Halibut.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress.NETCore.approved.cs b/source/Halibut.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress.NETCore.approved.cs index 86fa4dc7..64ef1926 100644 --- a/source/Halibut.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress.NETCore.approved.cs +++ b/source/Halibut.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress.NETCore.approved.cs @@ -609,7 +609,7 @@ public TypeNotAllowedException(Type type, string path) { } public Type DisallowedType { get; } public string Path { get; } } - public class WebSocketStream : Stream, IDisposable + public class WebSocketStream : Stream, IDisposable, IAsyncDisposable { public WebSocketStream(WebSocket context) { } public bool CanRead { get; } diff --git a/source/Halibut.Tests/TcpConnectionFactoryFixture.cs b/source/Halibut.Tests/TcpConnectionFactoryFixture.cs index aef6ad75..e61589dd 100644 --- a/source/Halibut.Tests/TcpConnectionFactoryFixture.cs +++ b/source/Halibut.Tests/TcpConnectionFactoryFixture.cs @@ -25,7 +25,7 @@ public void ShouldCreateIpv4Socket_WhenIPv6Disabled() client.Invoking(c => { var dualMode = c.Client.DualMode; - }).ShouldThrow(); + }).Should().Throw(); } } } \ No newline at end of file diff --git a/source/Halibut.Tests/Util/AsyncEx/TaskExtensionsFixture.cs b/source/Halibut.Tests/Util/AsyncEx/TaskExtensionsFixture.cs index 5f8367b7..60baecb4 100644 --- a/source/Halibut.Tests/Util/AsyncEx/TaskExtensionsFixture.cs +++ b/source/Halibut.Tests/Util/AsyncEx/TaskExtensionsFixture.cs @@ -34,7 +34,7 @@ public async Task When_TaskDoesNotCompleteWithinTimeout_ThrowsTimeoutException() triggered = true; }); Func act = async () => await task.TimeoutAfter(TimeSpan.FromMilliseconds(100), CancellationToken.None); - act.ShouldThrow(); + await act.Should().ThrowAsync(); triggered.Should().Be(false, "we should have stopped waiting on the task when timeout happened"); await Task.Delay(200); triggered.Should().Be(true, "task should have continued executing in the background"); @@ -61,7 +61,7 @@ public async Task When_TaskGetsCancelled_ThrowsTaskCanceledException() }); #pragma warning restore 4014 Func act = async () => await task.TimeoutAfter(TimeSpan.FromMilliseconds(150), cancellationTokenSource.Token); - act.ShouldThrow(); + await act.Should().ThrowAsync(); triggered.Should().Be(false, "we should have stopped waiting on the task when cancellation happened"); await Task.Delay(200); triggered.Should().Be(true, "task should have continued executing in the background (not entirely ideal, but this task is designed to handle non-cancelable tasks)"); @@ -89,7 +89,7 @@ public async Task When_TaskGetsCanceledButStillThrowsExceptionAfterCancellation_ await Task.Delay(TimeSpan.FromMilliseconds(100)); cancellationTokenSource.Cancel(); }); - await VerifyNoUnobservedExceptions(Task.Run(async () => + await VerifyNoUnobservedExceptions(Task.Run(async () => { await Task.Delay(TimeSpan.FromMilliseconds(200)); throw new ApplicationException("this task threw an exception after timeout"); @@ -106,7 +106,7 @@ static async Task VerifyNoUnobservedExceptions(Task task) try { Func act = async () => await task; - act.ShouldThrow(); + await act.Should().ThrowAsync(); //delay long enough to ensure the task throws its exception await Task.Delay(200); diff --git a/source/Halibut/Halibut.csproj b/source/Halibut/Halibut.csproj index 72531462..13314e37 100644 --- a/source/Halibut/Halibut.csproj +++ b/source/Halibut/Halibut.csproj @@ -26,19 +26,15 @@ - - + + + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive -