From 96505128ef3f89f3f3f6aefeef7d9b544293c686 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:32:11 +0100 Subject: [PATCH 01/17] Update .gitignore Ignore coverage.* files. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0fc91b84..5db82efd 100644 --- a/.gitignore +++ b/.gitignore @@ -276,6 +276,9 @@ _TeamCity* *.coverage *.coveragexml +# Coverlet +coverage.* + # NCrunch _NCrunch_* .*crunch*.local.xml From 8338a4c405a8abf777f68398e358dc10e93eddb9 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:33:13 +0100 Subject: [PATCH 02/17] Bump version to 4.1.0 Bump version to 4.1.0 for change to target frameworks. --- appveyor.yml | 2 +- version.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 79eb6b4e..ee3426ce 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ os: Visual Studio 2017 -version: 4.0.1.{build} +version: 4.1.0.{build} configuration: Release environment: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true diff --git a/version.props b/version.props index b68a2e4a..cb0531ed 100644 --- a/version.props +++ b/version.props @@ -2,7 +2,7 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 4.0.0.0 - 4.0.1 + 4.1.0 $(APPVEYOR_BUILD_NUMBER) From 01172d8c38fc9d12f7d14381ed262b9ca3efef83 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:36:03 +0100 Subject: [PATCH 03/17] Use .NET Core 3.0 SDK Use preview 8 of the .NET Core 3.0 SDK. Swap net451 for net461. Use Microsoft.NETFramework.ReferenceAssemblies to build on non-Windows platforms. Remove redundant MSBuildAllProjects properties. --- Build.ps1 | 8 ++++---- Directory.Build.props | 7 ++----- Directory.Build.targets | 5 +---- JustEat.StatsD.sln | 1 - README.md | 5 +++-- build.sh | 5 +++-- global.json | 2 +- .../Buffered/StatsDUtf8Formatter.cs | 4 ---- src/JustEat.StatsD/JustEat.StatsD.csproj | 19 +++++++------------ src/JustEat.StatsD/SocketFactory.cs | 4 ---- .../StatsDServiceCollectionExtensions.cs | 2 -- tests/Benchmark/Benchmark.csproj | 2 +- .../JustEat.StatsD.Tests.csproj | 6 +++--- .../WhenRegisteringStatsD.cs | 2 -- version.props | 1 - 15 files changed, 25 insertions(+), 48 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index da1f7f08..6914d30b 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -59,8 +59,8 @@ else { } function DotNetBuild { - param([string]$Project, [string]$Configuration, [string]$Framework) - & $dotnet build $Project --output (Join-Path $OutputPath $Framework) --framework $Framework --configuration $Configuration + param([string]$Project, [string]$Configuration) + & $dotnet build $Project --output $OutputPath --configuration $Configuration if ($LASTEXITCODE -ne 0) { throw "dotnet build failed with exit code $LASTEXITCODE" } @@ -131,8 +131,8 @@ $packageProjects = @( Write-Host "Building $($projects.Count) projects..." -ForegroundColor Green ForEach ($project in $projects) { - DotNetBuild $project $Configuration "netstandard2.0" - DotNetBuild $project $Configuration "net451" + DotNetBuild $project $Configuration + DotNetBuild $project $Configuration } if ($SkipTests -eq $false) { diff --git a/Directory.Build.props b/Directory.Build.props index 65a9ec55..31ada6c2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,12 +7,10 @@ + - - - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb $(MSBuildThisFileDirectory)justeat-oss.snk @@ -23,8 +21,7 @@ true false true - latest - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + preview en-US https://avatars3.githubusercontent.com/u/1516790?s=64 Apache-2.0 diff --git a/Directory.Build.targets b/Directory.Build.targets index 4a635631..8c211f79 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,8 +1,5 @@ - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - + diff --git a/JustEat.StatsD.sln b/JustEat.StatsD.sln index 37d30d49..e43d39a9 100644 --- a/JustEat.StatsD.sln +++ b/JustEat.StatsD.sln @@ -19,7 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{06BE4D JustEat.StatsD.ruleset = JustEat.StatsD.ruleset LICENSE = LICENSE README.md = README.md - ReferenceAssemblies.props = ReferenceAssemblies.props version.props = version.props EndProjectSection EndProject diff --git a/README.md b/README.md index d2af0f07..d5223ebc 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,11 @@ We use this library within our components to publish [StatsD](http://github.com/ ### Supported platforms -`JustEat.Statsd` version 4 is built for these target frameworks: +`JustEat.StatsD` version 4.1.0 is built for these target frameworks: -* `net451` +* `net461` * `netstandard2.0` +* `netstandard2.1` * `netcoreapp2.1` * `netcoreapp2.2` diff --git a/build.sh b/build.sh index 3cb33222..61f34395 100755 --- a/build.sh +++ b/build.sh @@ -40,8 +40,9 @@ if [ "$dotnet_version" != "$CLI_VERSION" ]; then curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" fi -dotnet build src/JustEat.StatsD/JustEat.StatsD.csproj --output $artifacts --configuration $configuration || exit 1 +dotnet build ./JustEat.StatsD.sln --output $artifacts --configuration $configuration || exit 1 +dotnet pack ./src/JustEat.StatsD/JustEat.StatsD.csproj --output $artifacts --configuration $configuration || exit 1 if [ $skipTests == 0 ]; then - dotnet test tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj --output $artifacts --configuration $configuration --framework "netcoreapp2.2" || exit 1 + dotnet test ./tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj --output $artifacts --configuration $configuration || exit 1 fi diff --git a/global.json b/global.json index 3d26ee65..4201a8ff 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "2.2.401" + "version": "3.0.100-preview8-013656" } } diff --git a/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs b/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs index ff1a067a..9ee3e151 100644 --- a/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs +++ b/src/JustEat.StatsD/Buffered/StatsDUtf8Formatter.cs @@ -11,11 +11,7 @@ internal sealed class StatsDUtf8Formatter public StatsDUtf8Formatter(string prefix) { _utf8Prefix = string.IsNullOrWhiteSpace(prefix) ? -#if NET451 - new byte[0] : -#else Array.Empty() : -#endif Encoding.UTF8.GetBytes(prefix + "."); } diff --git a/src/JustEat.StatsD/JustEat.StatsD.csproj b/src/JustEat.StatsD/JustEat.StatsD.csproj index 992cbd87..1030cc65 100644 --- a/src/JustEat.StatsD/JustEat.StatsD.csproj +++ b/src/JustEat.StatsD/JustEat.StatsD.csproj @@ -1,5 +1,4 @@ - - + A .NET library for publishing metrics to StatsD. true @@ -8,20 +7,16 @@ JustEat.StatsD JustEat.StatsD A .NET library for publishing metrics to StatsD. - net451;netstandard2.0;netcoreapp2.1;netcoreapp2.2 + net461;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp2.2 - - - - - - + + - - + + - + diff --git a/src/JustEat.StatsD/SocketFactory.cs b/src/JustEat.StatsD/SocketFactory.cs index 9c8aacfc..f9bb379d 100644 --- a/src/JustEat.StatsD/SocketFactory.cs +++ b/src/JustEat.StatsD/SocketFactory.cs @@ -25,15 +25,11 @@ internal static Socket ForUdp() { var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); -#if !NET451 // See https://github.com/dotnet/corefx/pull/17853#issuecomment-291371266 if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { socket.SendBufferSize = 0; } -#else - socket.SendBufferSize = 0; -#endif return socket; } diff --git a/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs b/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs index a609b005..65e150ba 100644 --- a/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs +++ b/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs @@ -1,4 +1,3 @@ -#if !NET451 using System; using JustEat.StatsD.EndpointLookups; using Microsoft.Extensions.DependencyInjection; @@ -132,4 +131,3 @@ private static IStatsDTransport ResolveStatsDTransport(IServiceProvider provider } } } -#endif diff --git a/tests/Benchmark/Benchmark.csproj b/tests/Benchmark/Benchmark.csproj index 88ea6bab..6b25c852 100644 --- a/tests/Benchmark/Benchmark.csproj +++ b/tests/Benchmark/Benchmark.csproj @@ -2,7 +2,7 @@ $(NoWarn);CA1001;CA1822 Exe - netcoreapp2.0;netcoreapp2.1;netcoreapp2.2 + netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0 true diff --git a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj index 9a97efc7..7ac15bd3 100644 --- a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj +++ b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj @@ -2,7 +2,7 @@ $(NoWarn);CA1707;CA2007 JustEat.StatsD - netcoreapp2.2 + netcoreapp3.0 @@ -11,8 +11,8 @@ - - + + diff --git a/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs b/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs index 92c5cfe4..4c41ee1d 100644 --- a/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs +++ b/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs @@ -1,4 +1,3 @@ -#if !NET451 using System; using JustEat.StatsD.EndpointLookups; using Microsoft.Extensions.DependencyInjection; @@ -354,4 +353,3 @@ public void Send(in ArraySegment metrics) #pragma warning restore CA1812 } } -#endif diff --git a/version.props b/version.props index cb0531ed..d0b5d849 100644 --- a/version.props +++ b/version.props @@ -1,6 +1,5 @@ - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 4.0.0.0 4.1.0 From 394d19283d153a96d13fca0d15e0567d1acf3386 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:44:29 +0100 Subject: [PATCH 04/17] Revert minimum System.Memory version Revert back to a minimum version of System.Memory for net461 and netstandard2.0. --- src/JustEat.StatsD/JustEat.StatsD.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JustEat.StatsD/JustEat.StatsD.csproj b/src/JustEat.StatsD/JustEat.StatsD.csproj index 1030cc65..d91252b8 100644 --- a/src/JustEat.StatsD/JustEat.StatsD.csproj +++ b/src/JustEat.StatsD/JustEat.StatsD.csproj @@ -14,7 +14,7 @@ - + From 428531d9029dce31309963942233f32007e581a9 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:58:51 +0100 Subject: [PATCH 05/17] Fix preprocessor directive Make .NET Standard 2.0 and .NET 4.6.1 the exception, rather than the default. Disable code analysis warning. --- src/JustEat.StatsD/Buffered/BufferExtensions.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/JustEat.StatsD/Buffered/BufferExtensions.cs b/src/JustEat.StatsD/Buffered/BufferExtensions.cs index 9b610abe..42cd7caf 100644 --- a/src/JustEat.StatsD/Buffered/BufferExtensions.cs +++ b/src/JustEat.StatsD/Buffered/BufferExtensions.cs @@ -25,13 +25,18 @@ public static bool TryWriteBytes(this ref Buffer src, Span destination) public static bool TryWriteUtf8String(this ref Buffer src, string str) { -#if NETCOREAPP2_1 || NETCOREAPP2_2 +#if NETSTANDARD2_0 || NET461 + var bucketBytes = Encoding.UTF8.GetBytes(str); + return src.TryWriteBytes(bucketBytes); +#else int written = 0; try { written = Encoding.UTF8.GetBytes(str, src.Tail); } +#pragma warning disable CA1031 catch (ArgumentException) +#pragma warning restore CA1031 { return false; } @@ -39,9 +44,6 @@ public static bool TryWriteUtf8String(this ref Buffer src, string str) src.Tail = src.Tail.Slice(written); src.Written += written; return true; -#else - var bucketBytes = Encoding.UTF8.GetBytes(str); - return src.TryWriteBytes(bucketBytes); #endif } From 483bb055dbdf455dbe67b63a3922445bb8cf728a Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:59:31 +0100 Subject: [PATCH 06/17] Use C#8 features Use C# 8 features as suggested by Visual Studio, where approriate. --- src/JustEat.StatsD/SocketFactory.cs | 13 +++--- .../Extensions/SimpleTimerStatNameTests.cs | 22 ++++----- .../JustEat.StatsD.Tests/IntegrationTests.cs | 9 ++-- .../SocketTransportTests.cs | 41 +++++++---------- .../WhenCreatingStatsDPublisher.cs | 4 +- .../WhenRegisteringStatsD.cs | 1 + .../WhenUsingUdpTransport.cs | 45 +++++++++---------- 7 files changed, 59 insertions(+), 76 deletions(-) diff --git a/src/JustEat.StatsD/SocketFactory.cs b/src/JustEat.StatsD/SocketFactory.cs index f9bb379d..9e260490 100644 --- a/src/JustEat.StatsD/SocketFactory.cs +++ b/src/JustEat.StatsD/SocketFactory.cs @@ -8,17 +8,14 @@ internal static class SocketFactory { internal static Socket For(SocketProtocol socketProtocol) { - switch (socketProtocol) + return socketProtocol switch { - case SocketProtocol.IP: - return ForIp(); + SocketProtocol.IP => ForIp(), - case SocketProtocol.Udp: - return ForUdp(); + SocketProtocol.Udp => ForUdp(), - default: - throw new InvalidOperationException($"Unknown {nameof(SocketProtocol)} value {socketProtocol} specified."); - } + _ => throw new InvalidOperationException($"Unknown {nameof(SocketProtocol)} value {socketProtocol} specified."), + }; } internal static Socket ForUdp() diff --git a/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs b/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs index e08c2cb3..9a2d8e94 100644 --- a/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs +++ b/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs @@ -66,11 +66,11 @@ public static void StatWithoutNameAtEndThrows() Assert.Throws(() => { - using (var timer = publisher.StartTimer("valid.Stat")) - { - Delay(); - timer.Bucket = null; - } + using var timer = publisher.StartTimer("valid.Stat"); + + Delay(); + + timer.Bucket = null; }); publisher.CallCount.ShouldBe(0); @@ -85,13 +85,15 @@ public static void StatNameIsInitialValueWhenExceptionIsThrown() try { - using (var timer = publisher.StartTimer("initialStat")) - { - Fail(); - timer.Bucket = "changedValue"; - } + using var timer = publisher.StartTimer("initialStat"); + + Fail(); + + timer.Bucket = "changedValue"; } +#pragma warning disable CA1031 catch (InvalidOperationException) +#pragma warning restore CA1031 { failCount++; } diff --git a/tests/JustEat.StatsD.Tests/IntegrationTests.cs b/tests/JustEat.StatsD.Tests/IntegrationTests.cs index 3ca159c1..3afe835b 100644 --- a/tests/JustEat.StatsD.Tests/IntegrationTests.cs +++ b/tests/JustEat.StatsD.Tests/IntegrationTests.cs @@ -30,11 +30,10 @@ public static async Task Can_Send_Metrics_To_StatsD_Using_Udp( SocketProtocol = socketProtocol, }; - using (var publisher = new StatsDPublisher(config)) - { - // Act and Assert - await AssertMetrics(config, publisher); - } + using var publisher = new StatsDPublisher(config); + + // Act and Assert + await AssertMetrics(config, publisher); } private static async Task AssertMetrics(StatsDConfiguration config, IStatsDPublisher publisher) diff --git a/tests/JustEat.StatsD.Tests/SocketTransportTests.cs b/tests/JustEat.StatsD.Tests/SocketTransportTests.cs index 9d1356ef..a7050a55 100644 --- a/tests/JustEat.StatsD.Tests/SocketTransportTests.cs +++ b/tests/JustEat.StatsD.Tests/SocketTransportTests.cs @@ -12,29 +12,26 @@ public static class SocketTransportTests [Fact] public static void ValidSocketTransportCanBeConstructed() { - using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp)) - { - transport.ShouldNotBeNull(); - } + using var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp); + transport.ShouldNotBeNull(); } [Fact] public static void SocketTransportCanSendOverUdpWithoutError() { - // using block not used here so the finalizer gets some code coverage - using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp)) - { - transport.Send("teststat:1|c"); - } + // Using block not used here so the finalizer gets some code coverage +#pragma warning disable CA2000 + var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.Udp); +#pragma warning restore CA2000 + + transport.Send("teststat:1|c"); } [Fact] public static void SocketTransportCanSendOverIPWithoutError() { - using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP)) - { - transport.Send("teststat:1|c"); - } + using var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP); + transport.Send("teststat:1|c"); } [Fact] @@ -60,19 +57,15 @@ public static void InvalidSocketProtocolThrowsInConstructor() [Fact] public static void SocketTransportIsNoopForNullArray() { - using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP)) - { - transport.Send(new ArraySegment()); - } + using var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP); + transport.Send(new ArraySegment()); } [Fact] public static void SocketTransportIsNoopForEmptyArray() { - using (var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP)) - { - transport.Send(new ArraySegment(Array.Empty())); - } + using var transport = new SocketTransport(LocalStatsEndpoint(), SocketProtocol.IP); + transport.Send(new ArraySegment(Array.Empty())); } [Fact] @@ -80,10 +73,8 @@ public static void SocketTransportIsNoopForNullEndpoint() { var endpointSource = Mock.Of(); - using (var transport = new SocketTransport(endpointSource, SocketProtocol.IP)) - { - transport.Send("teststat:1|c"); - } + using var transport = new SocketTransport(endpointSource, SocketProtocol.IP); + transport.Send("teststat:1|c"); } private static IEndPointSource LocalStatsEndpoint() diff --git a/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs b/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs index c35a25b2..bf55a33d 100644 --- a/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs +++ b/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs @@ -26,9 +26,7 @@ public void ConfigurationIsValidWithHostIp() Host = "10.0.1.2" }; - using (var stats = new StatsDPublisher(validConfig)) - { - } + using var stats = new StatsDPublisher(validConfig); } [Fact] diff --git a/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs b/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs index 4c41ee1d..e5514c8e 100644 --- a/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs +++ b/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs @@ -341,6 +341,7 @@ private sealed class MyTransport : IStatsDTransport { #pragma warning disable CA1801 // Used to validate that IEndPointSource is in DI +#pragma warning disable IDE0060 public MyTransport(IEndPointSource endpointSource) { } diff --git a/tests/JustEat.StatsD.Tests/WhenUsingUdpTransport.cs b/tests/JustEat.StatsD.Tests/WhenUsingUdpTransport.cs index 5295bf83..2193344f 100644 --- a/tests/JustEat.StatsD.Tests/WhenUsingUdpTransport.cs +++ b/tests/JustEat.StatsD.Tests/WhenUsingUdpTransport.cs @@ -24,11 +24,10 @@ public void AMetricCanBeSentWithoutAnExceptionBeingThrown() UdpListeners.EndpointA, null); - using (var target = new SocketTransport(endPointSource, SocketProtocol.Udp)) - { - // Act and Assert - target.Send("mycustommetric"); - } + using var target = new SocketTransport(endPointSource, SocketProtocol.Udp); + + // Act and Assert + target.Send("mycustommetric"); } [Fact] @@ -39,13 +38,12 @@ public void MultipleMetricsCanBeSentWithoutAnExceptionBeingThrownSerial() UdpListeners.EndpointA, null); - using (var target = new SocketTransport(endPointSource, SocketProtocol.Udp)) + using var target = new SocketTransport(endPointSource, SocketProtocol.Udp); + + for (int i = 0; i < 10_000; i++) { - for (int i = 0; i < 10_000; i++) - { - // Act and Assert - target.Send("mycustommetric:1|c"); - } + // Act and Assert + target.Send("mycustommetric:1|c"); } } @@ -57,14 +55,13 @@ public void MultipleMetricsCanBeSentWithoutAnExceptionBeingThrownParallel() UdpListeners.EndpointA, null); - using (var target = new SocketTransport(endPointSource, SocketProtocol.Udp)) - { - Parallel.For(0, 10_000, _ => + using var target = new SocketTransport(endPointSource, SocketProtocol.Udp); + + Parallel.For(0, 10_000, _ => { // Act and Assert target.Send("mycustommetric:1|c"); }); - } } [Fact] @@ -79,13 +76,12 @@ public static void EndpointSwitchShouldNotCauseExceptionsSequential() UdpListeners.EndpointB, null); - using (var target = new SocketTransport(new MillisecondSwitcher(endPointSource2, endPointSource1), SocketProtocol.Udp)) + using var target = new SocketTransport(new MillisecondSwitcher(endPointSource2, endPointSource1), SocketProtocol.Udp); + + for (int i = 0; i < 10_000; i++) { - for (int i = 0; i < 10_000; i++) - { - // Act and Assert - target.Send("mycustommetric:1|c"); - } + // Act and Assert + target.Send("mycustommetric:1|c"); } } @@ -101,14 +97,13 @@ public static void EndpointSwitchShouldNotCauseExceptionsParallel() UdpListeners.EndpointB, null); - using (var target = new SocketTransport(new MillisecondSwitcher(endPointSource2, endPointSource1), SocketProtocol.Udp)) - { - Parallel.For(0, 10_000, _ => + using var target = new SocketTransport(new MillisecondSwitcher(endPointSource2, endPointSource1), SocketProtocol.Udp); + + Parallel.For(0, 10_000, _ => { // Act and Assert target.Send("mycustommetric"); }); - } } private class MillisecondSwitcher : IEndPointSource From 04b2cc80b0de33a0d6e7d799c91850f050ad71c6 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 09:59:59 +0100 Subject: [PATCH 07/17] Fix CA2000 warnings Fix warnings about disposable resources in the benchmarks. --- tests/Benchmark/StatSendingBenchmark.cs | 38 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tests/Benchmark/StatSendingBenchmark.cs b/tests/Benchmark/StatSendingBenchmark.cs index b2b1a48e..7a0a4ac4 100644 --- a/tests/Benchmark/StatSendingBenchmark.cs +++ b/tests/Benchmark/StatSendingBenchmark.cs @@ -7,13 +7,41 @@ namespace Benchmark { [MemoryDiagnoser] - public class StatSendingBenchmark + public class StatSendingBenchmark : IDisposable { + private bool _disposed; + private SocketTransport _udpTransport; private BufferBasedStatsDPublisher _udpSender; + private SocketTransport _ipTransport; private BufferBasedStatsDPublisher _ipSender; private static readonly TimeSpan Timed = TimeSpan.FromMinutes(1); + ~StatSendingBenchmark() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + _udpTransport?.Dispose(); + _ipTransport?.Dispose(); + } + + _disposed = true; + } + } + [GlobalSetup] public void Setup() { @@ -28,12 +56,12 @@ public void Setup() var endpointSource = EndPointFactory.MakeEndPointSource( config.Host, config.Port, config.DnsLookupInterval); - var ipTransport = new SocketTransport(endpointSource, SocketProtocol.IP); - _ipSender = new BufferBasedStatsDPublisher(config, ipTransport); + _ipTransport = new SocketTransport(endpointSource, SocketProtocol.IP); + _ipSender = new BufferBasedStatsDPublisher(config, _ipTransport); _ipSender.Increment("startup.i"); - var udpTransport = new SocketTransport(endpointSource, SocketProtocol.Udp); - _udpSender = new BufferBasedStatsDPublisher(config, udpTransport); + _udpTransport = new SocketTransport(endpointSource, SocketProtocol.Udp); + _udpSender = new BufferBasedStatsDPublisher(config, _udpTransport); _udpSender.Increment("startup.u"); } From d8a79e5a9b045df1cd3fb5b2fa3f6eafa37b4da4 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 10:04:10 +0100 Subject: [PATCH 08/17] Fix benchmark compilation Fix compilation of the benchmarks project on non-Windows platforms. --- Directory.Build.props | 1 + src/JustEat.StatsD/JustEat.StatsD.csproj | 2 +- tests/Benchmark/Benchmark.csproj | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 31ada6c2..94664172 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,6 +2,7 @@ 2.9.4 + 1.0.0-preview.2 diff --git a/src/JustEat.StatsD/JustEat.StatsD.csproj b/src/JustEat.StatsD/JustEat.StatsD.csproj index d91252b8..8742564f 100644 --- a/src/JustEat.StatsD/JustEat.StatsD.csproj +++ b/src/JustEat.StatsD/JustEat.StatsD.csproj @@ -10,7 +10,7 @@ net461;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp2.2 - + diff --git a/tests/Benchmark/Benchmark.csproj b/tests/Benchmark/Benchmark.csproj index 6b25c852..32c404eb 100644 --- a/tests/Benchmark/Benchmark.csproj +++ b/tests/Benchmark/Benchmark.csproj @@ -6,6 +6,7 @@ true + From 5494eba3828c56b5c3bc9cc8b294b551d0473738 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 10:08:40 +0100 Subject: [PATCH 09/17] Drop benchmarks for netcoreapp2.0 Drop TFM for StatsD benchmarks with .NET Core 2.0 as I don't think they're compiling properly on non-Windows platforms. --- tests/Benchmark/Benchmark.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Benchmark/Benchmark.csproj b/tests/Benchmark/Benchmark.csproj index 32c404eb..c497853c 100644 --- a/tests/Benchmark/Benchmark.csproj +++ b/tests/Benchmark/Benchmark.csproj @@ -2,7 +2,7 @@ $(NoWarn);CA1001;CA1822 Exe - netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0 + netcoreapp2.1;netcoreapp2.2;netcoreapp3.0 true From a7b3ad7c41170c33133f568736aaf1f7f8181e3c Mon Sep 17 00:00:00 2001 From: martincostello Date: Sun, 25 Aug 2019 10:11:58 +0100 Subject: [PATCH 10/17] Fix coverage filter Fix the expression to ignore the benchmarks. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 94664172..3514b6d9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -42,7 +42,7 @@ true $(OutputPath)\ cobertura,json - [*.Benchmark]*,[*.Tests]*,[xunit.*]* + [Benchmark]*,[*.Tests]*,[xunit.*]* System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute 90 From 971529136e097aad326f3de6653cd1af71615666 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 31 Aug 2019 12:00:28 +0100 Subject: [PATCH 11/17] Enable nullable reference types Enable nullable reference types. Fix violations and add annotations. --- Directory.Build.props | 1 + .../Buffered/BufferBasedStatsDPublisher.cs | 9 +++-- src/JustEat.StatsD/ConnectedSocketPool.cs | 2 +- src/JustEat.StatsD/DisposableTimer.cs | 11 +++--- .../EndpointLookups/CachedEndpointSource.cs | 5 +-- .../DnsLookupIpEndpointSource.cs | 2 +- src/JustEat.StatsD/IDisposableTimer.cs | 2 +- src/JustEat.StatsD/SocketTransport.cs | 4 +-- src/JustEat.StatsD/StatsDConfiguration.cs | 4 +-- .../StatsDServiceCollectionExtensions.cs | 4 +-- tests/Benchmark/StatSendingBenchmark.cs | 28 +++++++-------- tests/Benchmark/UdpStatSendingBenchmark.cs | 14 ++++---- tests/Benchmark/UdpTransportBenchmark.cs | 8 ++--- .../BufferBasedStatsDPublisherTests.cs | 2 +- .../BufferBasedStatsDPublisherTests.cs | 2 +- .../CachedEndpointSourceTests.cs | 4 +-- .../DnsLookupIpEndpointSourceTests.cs | 6 ++-- .../EndpointLookups/EndPointFactoryTests.cs | 8 ++--- .../EndpointLookups/SimpleEndpointTests.cs | 4 +-- .../IStatsDTransportExtensionsTests.cs | 16 ++++----- .../SocketTransportTests.cs | 2 +- .../StatsDPublisherTests.cs | 12 +++---- .../TimerExtensionsTests.cs | 36 +++++++++---------- .../WhenCreatingStatsDPublisher.cs | 4 +-- .../WhenRegisteringStatsD.cs | 20 +++++------ .../WhenTheTransportThrows.cs | 2 +- 26 files changed, 108 insertions(+), 104 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3514b6d9..70d0802d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,6 +24,7 @@ true preview en-US + enable https://avatars3.githubusercontent.com/u/1516790?s=64 Apache-2.0 https://github.com/justeat/JustEat.StatsD diff --git a/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs b/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs index 3be5072b..b34effec 100644 --- a/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs +++ b/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs @@ -17,10 +17,15 @@ internal sealed class BufferBasedStatsDPublisher : IStatsDPublisher private readonly StatsDUtf8Formatter _formatter; private readonly IStatsDTransport _transport; - private readonly Func _onError; + private readonly Func? _onError; - public BufferBasedStatsDPublisher(StatsDConfiguration configuration, IStatsDTransport transport) + internal BufferBasedStatsDPublisher(StatsDConfiguration configuration, IStatsDTransport transport) { + if (configuration == null) + { + throw new ArgumentNullException(nameof(configuration)); + } + _onError = configuration.OnError; _transport = transport; _formatter = new StatsDUtf8Formatter(configuration.Prefix); diff --git a/src/JustEat.StatsD/ConnectedSocketPool.cs b/src/JustEat.StatsD/ConnectedSocketPool.cs index 38a956da..b34358cb 100644 --- a/src/JustEat.StatsD/ConnectedSocketPool.cs +++ b/src/JustEat.StatsD/ConnectedSocketPool.cs @@ -46,7 +46,7 @@ private Socket CreateSocket() /// Retrieves an object from the pool if one is available. /// return null if the pool is empty /// An object from the pool. - private Socket Pop() + private Socket? Pop() { if (_pool.TryTake(out Socket result)) { diff --git a/src/JustEat.StatsD/DisposableTimer.cs b/src/JustEat.StatsD/DisposableTimer.cs index 0931bcb4..15a5a90b 100644 --- a/src/JustEat.StatsD/DisposableTimer.cs +++ b/src/JustEat.StatsD/DisposableTimer.cs @@ -5,12 +5,12 @@ namespace JustEat.StatsD { internal sealed class DisposableTimer : IDisposableTimer { - private bool _disposed; + private readonly IStatsDPublisher _publisher; + private readonly Stopwatch _stopwatch; - private IStatsDPublisher _publisher; - private Stopwatch _stopwatch; + private bool _disposed; - public string Bucket { get; set; } + public string? Bucket { get; set; } public DisposableTimer(IStatsDPublisher publisher, string bucket) { @@ -38,9 +38,6 @@ public void Dispose() } _publisher.Timing(_stopwatch.Elapsed, Bucket); - - _stopwatch = null; - _publisher = null; } } } diff --git a/src/JustEat.StatsD/EndpointLookups/CachedEndpointSource.cs b/src/JustEat.StatsD/EndpointLookups/CachedEndpointSource.cs index 8b8d59b1..78d1a67b 100644 --- a/src/JustEat.StatsD/EndpointLookups/CachedEndpointSource.cs +++ b/src/JustEat.StatsD/EndpointLookups/CachedEndpointSource.cs @@ -11,7 +11,7 @@ public class CachedEndpointSource : IEndPointSource { private readonly IEndPointSource _inner; private readonly TimeSpan _cacheDuration; - private EndPoint _cachedValue; + private EndPoint? _cachedValue; private DateTime _expiry; /// @@ -46,7 +46,8 @@ public EndPoint GetEndpoint() _cachedValue = _inner.GetEndpoint(); _expiry = DateTime.UtcNow.Add(_cacheDuration); } - return _cachedValue; + + return _cachedValue!; } private bool NeedsRead() diff --git a/src/JustEat.StatsD/EndpointLookups/DnsLookupIpEndpointSource.cs b/src/JustEat.StatsD/EndpointLookups/DnsLookupIpEndpointSource.cs index a820844e..18a9bb72 100644 --- a/src/JustEat.StatsD/EndpointLookups/DnsLookupIpEndpointSource.cs +++ b/src/JustEat.StatsD/EndpointLookups/DnsLookupIpEndpointSource.cs @@ -44,7 +44,7 @@ private static IPAddress GetIpAddressOfHost(string hostName) throw new Exception($"Failed to resolve any IP addresses for StatsD host '${hostName}' using DNS."); } - IPAddress result = null; + IPAddress? result = null; if (endpoints.Length > 1) { diff --git a/src/JustEat.StatsD/IDisposableTimer.cs b/src/JustEat.StatsD/IDisposableTimer.cs index 9f60575e..a2230b1e 100644 --- a/src/JustEat.StatsD/IDisposableTimer.cs +++ b/src/JustEat.StatsD/IDisposableTimer.cs @@ -10,6 +10,6 @@ public interface IDisposableTimer : IDisposable /// /// Gets or sets the StatsD bucket associated with the timer. /// - string Bucket { get; set; } + string? Bucket { get; set; } } } diff --git a/src/JustEat.StatsD/SocketTransport.cs b/src/JustEat.StatsD/SocketTransport.cs index 8e5b8460..9187be82 100644 --- a/src/JustEat.StatsD/SocketTransport.cs +++ b/src/JustEat.StatsD/SocketTransport.cs @@ -13,9 +13,9 @@ namespace JustEat.StatsD /// public sealed class SocketTransport : IStatsDTransport, IDisposable { - private ConnectedSocketPool _pool; private readonly IEndPointSource _endpointSource; private readonly SocketProtocol _socketProtocol; + private ConnectedSocketPool? _pool; /// /// Initializes a new instance of the class. @@ -96,7 +96,7 @@ private ConnectedSocketPool GetPool(EndPoint endPoint) else { newPool.Dispose(); - return _pool; + return _pool!; } } } diff --git a/src/JustEat.StatsD/StatsDConfiguration.cs b/src/JustEat.StatsD/StatsDConfiguration.cs index 192e7472..e02cd2e8 100644 --- a/src/JustEat.StatsD/StatsDConfiguration.cs +++ b/src/JustEat.StatsD/StatsDConfiguration.cs @@ -23,7 +23,7 @@ public class StatsDConfiguration /// /// A value must be provided for this property. /// - public string Host { get; set; } + public string? Host { get; set; } /// /// Gets or sets the port on the StatsD server to use. @@ -62,6 +62,6 @@ public class StatsDConfiguration /// /// The default behaviour is to ignore the exception. /// - public Func OnError { get; set; } + public Func? OnError { get; set; } } } diff --git a/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs b/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs index 65e150ba..2a7704f5 100644 --- a/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs +++ b/src/JustEat.StatsD/StatsDServiceCollectionExtensions.cs @@ -45,7 +45,7 @@ public static IServiceCollection AddStatsD(this IServiceCollection services) /// /// or is . /// - public static IServiceCollection AddStatsD(this IServiceCollection services, string host, string prefix = null) + public static IServiceCollection AddStatsD(this IServiceCollection services, string host, string? prefix = null) { if (services == null) { @@ -111,7 +111,7 @@ private static IEndPointSource ResolveEndPointSource(IServiceProvider provider) var config = provider.GetRequiredService(); return EndPointFactory.MakeEndPointSource( - config.Host, + config.Host!, config.Port, config.DnsLookupInterval); } diff --git a/tests/Benchmark/StatSendingBenchmark.cs b/tests/Benchmark/StatSendingBenchmark.cs index 7a0a4ac4..0b1f5fd3 100644 --- a/tests/Benchmark/StatSendingBenchmark.cs +++ b/tests/Benchmark/StatSendingBenchmark.cs @@ -10,10 +10,10 @@ namespace Benchmark public class StatSendingBenchmark : IDisposable { private bool _disposed; - private SocketTransport _udpTransport; - private BufferBasedStatsDPublisher _udpSender; - private SocketTransport _ipTransport; - private BufferBasedStatsDPublisher _ipSender; + private SocketTransport? _udpTransport; + private BufferBasedStatsDPublisher? _udpSender; + private SocketTransport? _ipTransport; + private BufferBasedStatsDPublisher? _ipSender; private static readonly TimeSpan Timed = TimeSpan.FromMinutes(1); @@ -69,34 +69,34 @@ public void Setup() [Benchmark] public void RunIp() { - _ipSender.Increment("hello.i"); - _ipSender.Increment(20, "increment.i"); - _ipSender.Timing(Timed, "timer.i"); - _ipSender.Gauge(354654, "gauge.i"); + _ipSender!.Increment("hello.i"); + _ipSender!.Increment(20, "increment.i"); + _ipSender!.Timing(Timed, "timer.i"); + _ipSender!.Gauge(354654, "gauge.i"); _ipSender.Gauge(25.1, "free-space.i"); } [Benchmark] public void RunIPWithSampling() { - _ipSender.Increment(2, 0.2, "increment.i"); + _ipSender!.Increment(2, 0.2, "increment.i"); _ipSender.Timing(2, 0.2, "increment.i"); } [Benchmark] public void RunUdp() { - _udpSender.Increment("hello.u"); - _udpSender.Increment(20, "increment.u"); - _udpSender.Timing(Timed, "timer.u"); - _udpSender.Gauge(354654, "gauge.u"); + _udpSender!.Increment("hello.u"); + _udpSender!.Increment(20, "increment.u"); + _udpSender!.Timing(Timed, "timer.u"); + _udpSender!.Gauge(354654, "gauge.u"); _udpSender.Gauge(25.1, "free-space.u"); } [Benchmark] public void RunUdpWithSampling() { - _udpSender.Increment(2, 0.2, "increment.u"); + _udpSender!.Increment(2, 0.2, "increment.u"); _udpSender.Timing(2, 0.2, "increment.u"); } } diff --git a/tests/Benchmark/UdpStatSendingBenchmark.cs b/tests/Benchmark/UdpStatSendingBenchmark.cs index b4d08002..075aeb17 100644 --- a/tests/Benchmark/UdpStatSendingBenchmark.cs +++ b/tests/Benchmark/UdpStatSendingBenchmark.cs @@ -11,9 +11,9 @@ public class UdpStatSendingBenchmark { private static readonly TimeSpan Timed = TimeSpan.FromMinutes(1); - private SocketTransport _transport; - private BufferBasedStatsDPublisher _udpSender; - private StatsDPublisher _adaptedStatsDPublisher; + private SocketTransport? _transport; + private BufferBasedStatsDPublisher? _udpSender; + private StatsDPublisher? _adaptedStatsDPublisher; [GlobalSetup] public void Setup() @@ -50,15 +50,15 @@ public void Cleanup() [Benchmark] public void SendStatUdp() { - _udpSender.Increment("increment.ud"); - _udpSender.Timing(Timed, "timer.ud"); + _udpSender!.Increment("increment.ud"); + _udpSender!.Timing(Timed, "timer.ud"); } [Benchmark] public void SendStatUdpCoveredByAdapter() { - _adaptedStatsDPublisher.Increment("increment.ud"); - _adaptedStatsDPublisher.Timing(Timed, "timer.ud"); + _adaptedStatsDPublisher!.Increment("increment.ud"); + _adaptedStatsDPublisher!.Timing(Timed, "timer.ud"); } } } diff --git a/tests/Benchmark/UdpTransportBenchmark.cs b/tests/Benchmark/UdpTransportBenchmark.cs index 0a0088d8..be391f83 100644 --- a/tests/Benchmark/UdpTransportBenchmark.cs +++ b/tests/Benchmark/UdpTransportBenchmark.cs @@ -11,8 +11,8 @@ public class UdpTransportBenchmark { private const string MetricName = "this.is.a.metric:1|c"; - private SocketTransport _transport; - private SocketTransport _transportSwitched; + private SocketTransport? _transport; + private SocketTransport? _transportSwitched; private class MillisecondSwitcher : IEndPointSource { @@ -67,13 +67,13 @@ public void Cleanup() [Benchmark] public void Send() { - _transport.Send(MetricName); + _transport!.Send(MetricName); } [Benchmark] public void SendWithSwitcher() { - _transportSwitched.Send(MetricName); + _transportSwitched!.Send(MetricName); } } } diff --git a/tests/JustEat.StatsD.Tests/BufferBasedStatsDPublisherTests.cs b/tests/JustEat.StatsD.Tests/BufferBasedStatsDPublisherTests.cs index 621a9d7c..fa39818d 100644 --- a/tests/JustEat.StatsD.Tests/BufferBasedStatsDPublisherTests.cs +++ b/tests/JustEat.StatsD.Tests/BufferBasedStatsDPublisherTests.cs @@ -58,7 +58,7 @@ private class FakeTransport : IStatsDTransport public void Send(in ArraySegment metric) { - Messages.Add(Encoding.UTF8.GetString(metric.Array, metric.Offset, metric.Count)); + Messages.Add(Encoding.UTF8.GetString(metric.Array!, metric.Offset, metric.Count)); } } } diff --git a/tests/JustEat.StatsD.Tests/Buffered/BufferBasedStatsDPublisherTests.cs b/tests/JustEat.StatsD.Tests/Buffered/BufferBasedStatsDPublisherTests.cs index af583819..497820af 100644 --- a/tests/JustEat.StatsD.Tests/Buffered/BufferBasedStatsDPublisherTests.cs +++ b/tests/JustEat.StatsD.Tests/Buffered/BufferBasedStatsDPublisherTests.cs @@ -16,7 +16,7 @@ public static void Increment_Is_Noop_If_Bucket_Is_Null() var publisher = new BufferBasedStatsDPublisher(configuration, transport.Object); // Act - publisher.Increment(1, 1, null); + publisher.Increment(1, 1, null!); // Assert transport.Verify((p) => p.Send(It.Ref>.IsAny), Times.Never()); diff --git a/tests/JustEat.StatsD.Tests/EndpointLookups/CachedEndpointSourceTests.cs b/tests/JustEat.StatsD.Tests/EndpointLookups/CachedEndpointSourceTests.cs index 7684a0af..4c027240 100644 --- a/tests/JustEat.StatsD.Tests/EndpointLookups/CachedEndpointSourceTests.cs +++ b/tests/JustEat.StatsD.Tests/EndpointLookups/CachedEndpointSourceTests.cs @@ -81,11 +81,11 @@ public static void ConstructorThrowsIfCacheDurationIsInvalid(long ticks) public static void ConstructorThrowsIfInnerIsNull() { // Arrange - IEndPointSource inner = null; + IEndPointSource? inner = null; var cacheDuration = TimeSpan.FromHours(1); // Act and Assert - Assert.Throws("inner", () => new CachedEndpointSource(inner, cacheDuration)); + Assert.Throws("inner", () => new CachedEndpointSource(inner!, cacheDuration)); } private static IPEndPoint MakeTestIpEndPoint() diff --git a/tests/JustEat.StatsD.Tests/EndpointLookups/DnsLookupIpEndpointSourceTests.cs b/tests/JustEat.StatsD.Tests/EndpointLookups/DnsLookupIpEndpointSourceTests.cs index 780bf31d..ee713ddf 100644 --- a/tests/JustEat.StatsD.Tests/EndpointLookups/DnsLookupIpEndpointSourceTests.cs +++ b/tests/JustEat.StatsD.Tests/EndpointLookups/DnsLookupIpEndpointSourceTests.cs @@ -24,7 +24,7 @@ public static void GetEndpointPrefersIPV4WhenHostnameIsLocalhost() var ipActual = actual as IPEndPoint; ipActual.ShouldNotBeNull(); - ipActual.Address.ShouldBe(IPAddress.Parse("127.0.0.1")); + ipActual!.Address.ShouldBe(IPAddress.Parse("127.0.0.1")); ipActual.Port.ShouldBe(8125); } @@ -32,11 +32,11 @@ public static void GetEndpointPrefersIPV4WhenHostnameIsLocalhost() public static void ConstructorThrowsIfHostNameIsNull() { // Arrange - string hostName = null; + string? hostName = null; int port = 123; // Act and Assert - Assert.Throws("hostName", () => new DnsLookupIpEndpointSource(hostName, port)); + Assert.Throws("hostName", () => new DnsLookupIpEndpointSource(hostName!, port)); } } } diff --git a/tests/JustEat.StatsD.Tests/EndpointLookups/EndPointFactoryTests.cs b/tests/JustEat.StatsD.Tests/EndpointLookups/EndPointFactoryTests.cs index 01378c24..8dd53cb4 100644 --- a/tests/JustEat.StatsD.Tests/EndpointLookups/EndPointFactoryTests.cs +++ b/tests/JustEat.StatsD.Tests/EndpointLookups/EndPointFactoryTests.cs @@ -70,23 +70,23 @@ public static void CanParseCachedLocalhostValueNoPort() public static void MakeEndPointSourceThrowsIfEndpointIsNull() { // Arrange - EndPoint endpoint = null; + EndPoint? endpoint = null; var endpointCacheDuration = TimeSpan.FromHours(1); // Act and Assert - Assert.Throws("endpoint", () => EndPointFactory.MakeEndPointSource(endpoint, endpointCacheDuration)); + Assert.Throws("endpoint", () => EndPointFactory.MakeEndPointSource(endpoint!, endpointCacheDuration)); } [Fact] public static void MakeEndPointSourceThrowsIfHostIsNull() { // Arrange - string host = null; + string? host = null; int port = 8125; var endpointCacheDuration = TimeSpan.FromHours(1); // Act and Assert - Assert.Throws("host", () => EndPointFactory.MakeEndPointSource(host, port, endpointCacheDuration)); + Assert.Throws("host", () => EndPointFactory.MakeEndPointSource(host!, port, endpointCacheDuration)); } } } diff --git a/tests/JustEat.StatsD.Tests/EndpointLookups/SimpleEndpointTests.cs b/tests/JustEat.StatsD.Tests/EndpointLookups/SimpleEndpointTests.cs index b56110fa..f6ab1fbb 100644 --- a/tests/JustEat.StatsD.Tests/EndpointLookups/SimpleEndpointTests.cs +++ b/tests/JustEat.StatsD.Tests/EndpointLookups/SimpleEndpointTests.cs @@ -28,10 +28,10 @@ public static void ValueIsConsistent() public static void ConstructorThrowsIfValueIsNull() { // Arrange - EndPoint value = null; + EndPoint? value = null; // Act and Assert - Assert.Throws("value", () => new SimpleEndpointSource(value)); + Assert.Throws("value", () => new SimpleEndpointSource(value!)); } private static IPEndPoint MakeTestIpEndPoint() diff --git a/tests/JustEat.StatsD.Tests/IStatsDTransportExtensionsTests.cs b/tests/JustEat.StatsD.Tests/IStatsDTransportExtensionsTests.cs index b7b46e25..86c0bbea 100644 --- a/tests/JustEat.StatsD.Tests/IStatsDTransportExtensionsTests.cs +++ b/tests/JustEat.StatsD.Tests/IStatsDTransportExtensionsTests.cs @@ -11,22 +11,22 @@ public static class IStatsDTransportExtensionsTests public static void SendThrowsIfTransportIsNullMetric() { // Arrange - IStatsDTransport transport = null; + IStatsDTransport? transport = null; string metric = "metric"; // Act and Assert - Assert.Throws("transport", () => transport.Send(metric)); + Assert.Throws("transport", () => transport!.Send(metric)); } [Fact] public static void SendThrowsIfTransportIsNullMetrics() { // Arrange - IStatsDTransport transport = null; + IStatsDTransport? transport = null; IEnumerable metrics = Array.Empty(); // Act and Assert - Assert.Throws("transport", () => transport.Send(metrics)); + Assert.Throws("transport", () => transport!.Send(metrics)); } [Fact] @@ -34,10 +34,10 @@ public static void SendThrowsIfTransportIfMetricIsNull() { // Arrange var transport = Mock.Of(); - string metric = null; + string? metric = null; // Act and Assert - Assert.Throws("metric", () => transport.Send(metric)); + Assert.Throws("metric", () => transport.Send(metric!)); } [Fact] @@ -45,10 +45,10 @@ public static void SendThrowsIfMetricsIsNull() { // Arrange var transport = Mock.Of(); - IEnumerable metrics = null; + IEnumerable? metrics = null; // Act and Assert - Assert.Throws("metrics", () => transport.Send(metrics)); + Assert.Throws("metrics", () => transport.Send(metrics!)); } [Fact] diff --git a/tests/JustEat.StatsD.Tests/SocketTransportTests.cs b/tests/JustEat.StatsD.Tests/SocketTransportTests.cs index a7050a55..65f764b8 100644 --- a/tests/JustEat.StatsD.Tests/SocketTransportTests.cs +++ b/tests/JustEat.StatsD.Tests/SocketTransportTests.cs @@ -39,7 +39,7 @@ public static void NullEndpointSourceThrowsInConstructor() { Assert.Throws( "endPointSource", - () => new SocketTransport(null, SocketProtocol.IP)); + () => new SocketTransport(null!, SocketProtocol.IP)); } [Fact] diff --git a/tests/JustEat.StatsD.Tests/StatsDPublisherTests.cs b/tests/JustEat.StatsD.Tests/StatsDPublisherTests.cs index e6ed55e9..a283d5df 100644 --- a/tests/JustEat.StatsD.Tests/StatsDPublisherTests.cs +++ b/tests/JustEat.StatsD.Tests/StatsDPublisherTests.cs @@ -27,7 +27,6 @@ public static void Decrement_Sends_Multiple_Metrics() publisher.Decrement(-10, 1, "orange"); publisher.Decrement(10, 1, new[] { "white", "blue" }); publisher.Decrement(10, 1, new List() { "green", "red" }); - publisher.Decrement(10, 1, null as IEnumerable); } // Assert @@ -54,7 +53,6 @@ public static void Increment_Sends_Multiple_Metrics() publisher.Increment(-10, 1, "orange"); publisher.Increment(10, 1, new[] { "white", "blue" }); publisher.Increment(10, 1, new List() { "green", "red" }); - publisher.Increment(10, 1, null as IEnumerable); } // Assert @@ -71,6 +69,7 @@ public static void Metrics_Not_Sent_If_Array_Is_Null_Or_Empty() using (var publisher = new StatsDPublisher(config, mock.Object)) { // Act +#nullable disable publisher.Decrement(-1, 1, null as string[]); publisher.Increment(-1, 1, null as string[]); publisher.Decrement(1, 1, null as string[]); @@ -85,6 +84,7 @@ public static void Metrics_Not_Sent_If_Array_Is_Null_Or_Empty() publisher.Increment(1, 1, null as IEnumerable); publisher.Decrement(1, 1, new[] { string.Empty }); publisher.Increment(1, 1, new[] { string.Empty }); +#nullable enable } // Assert @@ -113,13 +113,13 @@ public static void Metrics_Not_Sent_If_No_Metrics() public static void Constructor_Throws_If_Configuration_Is_Null() { // Arrange - StatsDConfiguration configuration = null; + StatsDConfiguration? configuration = null; var transport = Mock.Of(); // Act and Assert Assert.Throws( "configuration", - () => new StatsDPublisher(configuration, transport)); + () => new StatsDPublisher(configuration!, transport)); } [Fact] @@ -127,12 +127,12 @@ public static void Constructor_Throws_If_Transport_Is_Null() { // Arrange var configuration = new StatsDConfiguration(); - IStatsDTransport transport = null; + IStatsDTransport? transport = null; // Act and Assert Assert.Throws( "transport", - () => new StatsDPublisher(configuration, transport)); + () => new StatsDPublisher(configuration, transport!)); } } } diff --git a/tests/JustEat.StatsD.Tests/TimerExtensionsTests.cs b/tests/JustEat.StatsD.Tests/TimerExtensionsTests.cs index 3bd1952f..be234208 100644 --- a/tests/JustEat.StatsD.Tests/TimerExtensionsTests.cs +++ b/tests/JustEat.StatsD.Tests/TimerExtensionsTests.cs @@ -12,11 +12,11 @@ public static class TimerExtensionsTests public static void StartTimerThrowsIfPublisherIsNull() { // Arrange - IStatsDPublisher publisher = null; + IStatsDPublisher? publisher = null; string bucket = "bucket"; // Act and Assert - Assert.Throws("publisher", () => publisher.StartTimer(bucket)); + Assert.Throws("publisher", () => publisher!.StartTimer(bucket)); } [Fact] @@ -26,10 +26,10 @@ public static void TimeThrowsIfActionIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Action action = null; + Action? action = null; // Act and Assert - Assert.Throws("action", () => publisher.Time(bucket, action)); + Assert.Throws("action", () => publisher.Time(bucket, action!)); } [Fact] @@ -39,10 +39,10 @@ public static void TimeThrowsIfActionForTimerIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Action action = null; + Action? action = null; // Act and Assert - Assert.Throws("action", () => publisher.Time(bucket, action)); + Assert.Throws("action", () => publisher.Time(bucket, action!)); } [Fact] @@ -52,10 +52,10 @@ public static async Task TimeThrowsIfFuncForTaskIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Func action = null; + Func? action = null; // Act and Assert - await Assert.ThrowsAsync("action", () => publisher.Time(bucket, action)); + await Assert.ThrowsAsync("action", () => publisher.Time(bucket, action!)); } [Fact] @@ -65,10 +65,10 @@ public static async Task TimeThrowsIfFuncForTaskWithTimerIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Func action = null; + Func? action = null; // Act and Assert - await Assert.ThrowsAsync("action", () => publisher.Time(bucket, action)); + await Assert.ThrowsAsync("action", () => publisher.Time(bucket, action!)); } [Fact] @@ -78,10 +78,10 @@ public static void TimeThrowsIfFuncOfTIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Func func = null; + Func? func = null; // Act and Assert - Assert.Throws("func", () => publisher.Time(bucket, func)); + Assert.Throws("func", () => publisher.Time(bucket, func!)); } [Fact] @@ -91,10 +91,10 @@ public static void TimeThrowsIfFuncOfTWithTimerIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Func func = null; + Func? func = null; // Act and Assert - Assert.Throws("func", () => publisher.Time(bucket, func)); + Assert.Throws("func", () => publisher.Time(bucket, func!)); } [Fact] @@ -104,10 +104,10 @@ public static async Task TimeThrowsIfFuncForTaskOfTIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Func> func = null; + Func>? func = null; // Act and Assert - await Assert.ThrowsAsync("func", () => publisher.Time(bucket, func)); + await Assert.ThrowsAsync("func", () => publisher.Time(bucket, func!)); } [Fact] @@ -117,10 +117,10 @@ public static async Task TimeThrowsIfFuncForTaskOfTWithTimerIsNull() var publisher = Mock.Of(); string bucket = "bucket"; - Func> func = null; + Func>? func = null; // Act and Assert - await Assert.ThrowsAsync("func", () => publisher.Time(bucket, func)); + await Assert.ThrowsAsync("func", () => publisher.Time(bucket, func!)); } [Fact] diff --git a/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs b/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs index bf55a33d..b6565665 100644 --- a/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs +++ b/tests/JustEat.StatsD.Tests/WhenCreatingStatsDPublisher.cs @@ -32,11 +32,11 @@ public void ConfigurationIsValidWithHostIp() [Fact] public void ConfigurationIsNull() { - StatsDConfiguration configuration = null; + StatsDConfiguration? configuration = null; Assert.Throws( "configuration", - () => new StatsDPublisher(configuration)); + () => new StatsDPublisher(configuration!)); } [Fact] diff --git a/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs b/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs index e5514c8e..4233f5b7 100644 --- a/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs +++ b/tests/JustEat.StatsD.Tests/WhenRegisteringStatsD.cs @@ -232,20 +232,20 @@ public static void CanRegisterServicesWithoutFirstConfiguringTheHost() public static void ParametersAreCheckedForNull() { // Arrange - IServiceCollection services = new ServiceCollection(); - Func configurationFactory = null; - string host = null; + IServiceCollection? services = new ServiceCollection(); + Func? configurationFactory = null; + string? host = null; // Act and Assert - Should.Throw(() => services.AddStatsD(configurationFactory)).ParamName.ShouldBe("configurationFactory"); - Should.Throw(() => services.AddStatsD(host)).ParamName.ShouldBe("host"); + Should.Throw(() => services.AddStatsD(configurationFactory!)).ParamName.ShouldBe("configurationFactory"); + Should.Throw(() => services.AddStatsD(host!)).ParamName.ShouldBe("host"); // Arrange services = null; // Act and Assert - Should.Throw(() => services.AddStatsD(configurationFactory)).ParamName.ShouldBe("services"); - Should.Throw(() => services.AddStatsD(host)).ParamName.ShouldBe("services"); + Should.Throw(() => services!.AddStatsD(configurationFactory!)).ParamName.ShouldBe("services"); + Should.Throw(() => services!.AddStatsD(host!)).ParamName.ShouldBe("services"); } [Fact] @@ -316,10 +316,10 @@ public static void CanRegisterServicesWithIPTransport() public static void AddStatsDThrowsIfServicesIsNull() { // Arrange - IServiceCollection services = null; + IServiceCollection? services = null; // Act and Assert - Assert.Throws("services", () => services.AddStatsD()); + Assert.Throws("services", () => services!.AddStatsD()); } private static IServiceProvider Configure(Action registration) @@ -333,7 +333,7 @@ private static IServiceProvider Configure(Action registratio private sealed class MyOptions { - public string StatsDHost { get; set; } + public string? StatsDHost { get; set; } } #pragma warning disable CA1812 // Instantiated via DI diff --git a/tests/JustEat.StatsD.Tests/WhenTheTransportThrows.cs b/tests/JustEat.StatsD.Tests/WhenTheTransportThrows.cs index 9f6d1400..e61f8e25 100644 --- a/tests/JustEat.StatsD.Tests/WhenTheTransportThrows.cs +++ b/tests/JustEat.StatsD.Tests/WhenTheTransportThrows.cs @@ -111,7 +111,7 @@ public void FalseReturningErrorHandlerThrowsExceptions(string name, Func factory) { var validConfig = MakeValidConfig(); - Exception capturedEx = null; + Exception? capturedEx = null; validConfig.OnError = e => { capturedEx = e; From 7819f44589a8e6e8543db73aca3355c57846d206 Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 31 Aug 2019 12:09:56 +0100 Subject: [PATCH 12/17] Fix-up nullable annotations Fix misreported nullable annotations. --- src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs | 4 ++-- src/JustEat.StatsD/DisposableTimer.cs | 2 +- src/JustEat.StatsD/IDisposableTimer.cs | 2 +- src/JustEat.StatsD/StatsDPublisher.cs | 2 +- .../Extensions/SimpleTimerStatNameTests.cs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs b/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs index b34effec..d27fb217 100644 --- a/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs +++ b/src/JustEat.StatsD/Buffered/BufferBasedStatsDPublisher.cs @@ -8,11 +8,11 @@ internal sealed class BufferBasedStatsDPublisher : IStatsDPublisher private const int SafeUdpPacketSize = 512; [ThreadStatic] - private static byte[] _buffer; + private static byte[]? _buffer; private static byte[] Buffer => _buffer ?? (_buffer = new byte[SafeUdpPacketSize]); [ThreadStatic] - private static Random _random; + private static Random? _random; private static Random Random => _random ?? (_random = new Random()); private readonly StatsDUtf8Formatter _formatter; diff --git a/src/JustEat.StatsD/DisposableTimer.cs b/src/JustEat.StatsD/DisposableTimer.cs index 15a5a90b..beb83e52 100644 --- a/src/JustEat.StatsD/DisposableTimer.cs +++ b/src/JustEat.StatsD/DisposableTimer.cs @@ -10,7 +10,7 @@ internal sealed class DisposableTimer : IDisposableTimer private bool _disposed; - public string? Bucket { get; set; } + public string Bucket { get; set; } public DisposableTimer(IStatsDPublisher publisher, string bucket) { diff --git a/src/JustEat.StatsD/IDisposableTimer.cs b/src/JustEat.StatsD/IDisposableTimer.cs index a2230b1e..9f60575e 100644 --- a/src/JustEat.StatsD/IDisposableTimer.cs +++ b/src/JustEat.StatsD/IDisposableTimer.cs @@ -10,6 +10,6 @@ public interface IDisposableTimer : IDisposable /// /// Gets or sets the StatsD bucket associated with the timer. /// - string? Bucket { get; set; } + string Bucket { get; set; } } } diff --git a/src/JustEat.StatsD/StatsDPublisher.cs b/src/JustEat.StatsD/StatsDPublisher.cs index 2d170a02..293a42ca 100644 --- a/src/JustEat.StatsD/StatsDPublisher.cs +++ b/src/JustEat.StatsD/StatsDPublisher.cs @@ -71,7 +71,7 @@ public StatsDPublisher(StatsDConfiguration configuration) } var endpointSource = EndPointFactory.MakeEndPointSource( - configuration.Host, configuration.Port, configuration.DnsLookupInterval); + configuration.Host!, configuration.Port, configuration.DnsLookupInterval); var transport = new SocketTransport(endpointSource, configuration.SocketProtocol); diff --git a/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs b/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs index 9a2d8e94..c8a04980 100644 --- a/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs +++ b/tests/JustEat.StatsD.Tests/Extensions/SimpleTimerStatNameTests.cs @@ -70,7 +70,7 @@ public static void StatWithoutNameAtEndThrows() Delay(); - timer.Bucket = null; + timer.Bucket = null!; }); publisher.CallCount.ShouldBe(0); From 83916a351e8b450a08a853b1b025dd6590b8264d Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 31 Aug 2019 17:22:44 +0100 Subject: [PATCH 13/17] Use Visual Studio 2019 Use Visual Studio 2019 in AppVeyor CI. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index ee3426ce..ef61c11a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -os: Visual Studio 2017 +os: Visual Studio 2019 version: 4.1.0.{build} configuration: Release environment: From a4e2c0babace7464d2ecbb6ceee2a2f56af0b32d Mon Sep 17 00:00:00 2001 From: martincostello Date: Wed, 4 Sep 2019 20:26:40 +0100 Subject: [PATCH 14/17] Update to .NET Core 3.0 preview 9 Update to preview 9 of .NET Core 3.0. --- global.json | 2 +- tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 4201a8ff..79a76ed5 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.0.100-preview8-013656" + "version": "3.0.100-preview9-014004" } } diff --git a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj index 7ac15bd3..ddbc4987 100644 --- a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj +++ b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj @@ -11,7 +11,7 @@ - + From c651eed0f362c3951ad0129f695e855c4c1088fe Mon Sep 17 00:00:00 2001 From: martincostello Date: Wed, 4 Sep 2019 20:27:27 +0100 Subject: [PATCH 15/17] Remove PackageIconUrl Use PackageIcon instead of PackageIconUrl as described by https://github.com/NuGet/Home/wiki/Packaging-Icon-within-the-nupkg. --- Directory.Build.props | 5 ++++- package-icon.png | Bin 0 -> 3740 bytes 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 package-icon.png diff --git a/Directory.Build.props b/Directory.Build.props index 70d0802d..fea7e34f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,6 +12,9 @@ + + + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb $(MSBuildThisFileDirectory)justeat-oss.snk @@ -25,7 +28,7 @@ preview en-US enable - https://avatars3.githubusercontent.com/u/1516790?s=64 + package-icon.png Apache-2.0 https://github.com/justeat/JustEat.StatsD $(PackageProjectUrl)/releases diff --git a/package-icon.png b/package-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c8af7ebd38f74d9f18273134e9d6a8ae65e7ac48 GIT binary patch literal 3740 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 Date: Mon, 16 Sep 2019 19:05:06 +0100 Subject: [PATCH 16/17] Update to .NET Core 3.0 RC1 Update to release candidate 1 of .NET Core 3.0. --- global.json | 2 +- tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 79a76ed5..c33f6a5e 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.0.100-preview9-014004" + "version": "3.0.100-rc1-014190" } } diff --git a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj index ddbc4987..ef363376 100644 --- a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj +++ b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj @@ -11,7 +11,7 @@ - + From cafec6cbe46660b3cb889f827684471293f72199 Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 23 Sep 2019 17:26:51 +0100 Subject: [PATCH 17/17] Update to .NET Core 3.0.0 SDK Update to the final release of the .NET Core 3.0 SDK. Use stable release of NuGet packages. Use stable release of C#. --- Directory.Build.props | 2 +- global.json | 2 +- tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0526c234..ea19d29b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,7 +25,7 @@ true false true - preview + latest en-US enable package-icon.png diff --git a/global.json b/global.json index c33f6a5e..79422f0c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.0.100-rc1-014190" + "version": "3.0.100" } } diff --git a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj index 40d44473..235d410b 100644 --- a/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj +++ b/tests/JustEat.StatsD.Tests/JustEat.StatsD.Tests.csproj @@ -11,7 +11,7 @@ - +