Skip to content

Commit 0b58c23

Browse files
authored
Merge pull request #999 from drewnoakes/bump-versions
Bump package versions and fix up compile warnings
2 parents 4a80a4a + d934760 commit 0b58c23

19 files changed

+64
-47
lines changed

.github/workflows/CI.yml

+19-8
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,47 @@ on: [push, pull_request]
44
jobs:
55
ununtu:
66
runs-on: ubuntu-latest
7+
env:
8+
DOTNET_NOLOGO: true
79
steps:
810
- uses: actions/checkout@v2
11+
- uses: actions/setup-dotnet@v1
12+
with:
13+
dotnet-version: |
14+
3.1.x
15+
6.0.x
916
- run: dotnet restore src/NetMQ.sln
1017
- name: build
1118
run: dotnet build src/NetMQ.sln /p:Configuration=Release /verbosity:minimal
1219
- name: test netcoreapp3.1
1320
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp3.1 src/NetMQ.Tests/NetMQ.Tests.csproj
14-
- name: test netcoreapp2.1
15-
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp2.1 src/NetMQ.Tests/NetMQ.Tests.csproj
21+
- name: test net6.0
22+
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net6.0 src/NetMQ.Tests/NetMQ.Tests.csproj
1623
windows:
1724
runs-on: windows-latest
25+
env:
26+
DOTNET_NOLOGO: true
1827
steps:
1928
- uses: actions/checkout@v2
29+
- uses: actions/setup-dotnet@v1
30+
with:
31+
dotnet-version: |
32+
3.1.x
33+
6.0.x
2034
- name: Install codecov
2135
run: |
2236
choco install opencover.portable
2337
choco install codecov
2438
- run: dotnet restore src/NetMQ.sln
2539
- name: build
2640
run: dotnet build src/NetMQ.sln /p:Configuration=Release /verbosity:minimal
27-
- name: test netcoreapp2.1
28-
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp2.1 src\NetMQ.Tests\NetMQ.Tests.csproj
41+
- name: test net6.0
42+
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net6.0 src\NetMQ.Tests\NetMQ.Tests.csproj
2943
- name: test netcoreapp3.1
3044
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp3.1 src\NetMQ.Tests\NetMQ.Tests.csproj
3145
- name: test net47
3246
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net47 src\NetMQ.Tests\NetMQ.Tests.csproj
3347
- name: coverage
3448
run: |
35-
OpenCover.Console.exe -register:user -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:"test --no-build --configuration Release -f netcoreapp2.1 --logger:trx;LogFileName=results.trx /p:DebugType=full src\NetMQ.Tests\NetMQ.Tests.csproj" -filter:"+[NetMQ*]* -[NetMQ.Tests*]*" -output:".\NetMQ_coverage.xml" -oldStyle
49+
OpenCover.Console.exe -register:user -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:"test --no-build --configuration Release -f net6.0 --logger:trx;LogFileName=results.trx /p:DebugType=full src\NetMQ.Tests\NetMQ.Tests.csproj" -filter:"+[NetMQ*]* -[NetMQ.Tests*]*" -output:".\NetMQ_coverage.xml" -oldStyle
3650
codecov -f "NetMQ_coverage.xml"
37-
38-
39-

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<img src="https://cdn.rawgit.com/zeromq/netmq/master/img/NetMQLogo.svg" width="350" />
22

3+
[![GitHub Actions CI](https://github.com/zeromq/netmq/actions/workflows/CI.yml/badge.svg)](https://github.com/zeromq/netmq/actions/workflows/CI.yml)
34
[![NetMQ AppVeyor Build](https://ci.appveyor.com/api/projects/status/as5fiw8a3suw53iu/branch/master?svg=true)](https://ci.appveyor.com/project/somdoron/netmq-2bhss) [![codecov](https://codecov.io/gh/zeromq/netmq/branch/master/graph/badge.svg)](https://codecov.io/gh/zeromq/netmq) [![NetMQ NuGet version](https://img.shields.io/nuget/v/NetMQ.svg)](https://www.nuget.org/packages/NetMQ/) [![NetMQ NuGet prerelease version](https://img.shields.io/nuget/vpre/NetMQ.svg)](https://www.nuget.org/packages/NetMQ/)
45

56
NetMQ is a 100% native C# port of the lightweight messaging library ZeroMQ.

src/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
9+
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
1010
</ItemGroup>
1111

1212
<!-- Workaround for https://github.com/dotnet/sourcelink/issues/572 -->

src/NetMQ.Tests/ExceptionTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ private static T Clone<T>(T source) where T : class
108108
return Deserialise<T>(Serialise(source));
109109
}
110110

111+
#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete
111112
private static Stream Serialise(object source)
112113
{
113114
var formatter = new BinaryFormatter();
@@ -122,6 +123,7 @@ private static T Deserialise<T>(Stream stream)
122123
stream.Position = 0;
123124
return (T)formatter.Deserialize(stream);
124125
}
126+
#pragma warning restore SYSLIB0011 // BinaryFormatter is obsolete
125127

126128
#endregion
127129
}

src/NetMQ.Tests/NetMQ.Tests.csproj

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
<SignAssembly>true</SignAssembly>
77
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
88
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
9-
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);netcoreapp1.0;portable-net45+win8</PackageTargetFallback>
109
<IsTestProject>true</IsTestProject>
11-
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net47</TargetFrameworks>
10+
<TargetFrameworks>net6.0;netcoreapp3.1;net47</TargetFrameworks>
1211
</PropertyGroup>
1312

1413
<PropertyGroup>
@@ -42,8 +41,8 @@
4241
<ItemGroup>
4342
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
4443
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
45-
<PackageReference Include="xunit" Version="2.4.1" />
46-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
44+
<PackageReference Include="xunit" Version="2.4.2-pre.13" />
45+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
4746
</ItemGroup>
4847

4948
<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">

src/NetMQ.Tests/NetMQCertificateTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void X85()
1313
for (int i = 0; i < 1000; i++)
1414
{
1515
var key = new NetMQCertificate();
16-
var copy = new NetMQCertificate(key.SecretKeyZ85, key.PublicKeyZ85);
16+
var copy = new NetMQCertificate(key.SecretKeyZ85!, key.PublicKeyZ85);
1717

1818
Assert.Equal(key.SecretKeyZ85, copy.SecretKeyZ85);
1919
Assert.Equal(key.PublicKeyZ85, copy.PublicKeyZ85);
@@ -40,7 +40,7 @@ public void FromPublicKey()
4040
public void FromSecretKey()
4141
{
4242
var key = new NetMQCertificate();
43-
var copy = new NetMQCertificate().FromSecretKey(key.SecretKeyZ85);
43+
var copy = new NetMQCertificate().FromSecretKey(key.SecretKeyZ85!);
4444

4545
Assert.Equal(key.SecretKeyZ85, copy.SecretKeyZ85);
4646
Assert.Equal(key.PublicKeyZ85, copy.PublicKeyZ85);

src/NetMQ.Tests/OutgoingSocketExtensionsTests.cs

+4
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ public void SendFrameEmpty()
213213
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
214214
{
215215
Assert.Equal(SendReceiveConstants.InfiniteTimeout, timeout);
216+
Assert.NotNull(msg.UnsafeData);
216217
Assert.Empty(msg.UnsafeData);
217218
Assert.False(more);
218219
return true;
@@ -227,6 +228,7 @@ public void SendMoreFrameEmpty()
227228
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
228229
{
229230
Assert.Equal(SendReceiveConstants.InfiniteTimeout, timeout);
231+
Assert.NotNull(msg.UnsafeData);
230232
Assert.Empty(msg.UnsafeData);
231233
Assert.True(more);
232234
return true;
@@ -242,6 +244,7 @@ public void TrySendFrameEmpty()
242244
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
243245
{
244246
Assert.Equal(TimeSpan.Zero, timeout);
247+
Assert.NotNull(msg.UnsafeData);
245248
Assert.Empty(msg.UnsafeData);
246249
Assert.False(more);
247250
return true;
@@ -257,6 +260,7 @@ public void TrySendFrameEmptyFailed()
257260
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
258261
{
259262
Assert.Equal(TimeSpan.Zero, timeout);
263+
Assert.NotNull(msg.UnsafeData);
260264
Assert.Empty(msg.UnsafeData);
261265
Assert.False(more);
262266
return false;

src/NetMQ.Tests/PgmTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void UseInterface()
8282
{
8383
var hostEntry = Dns.GetHostEntry(Dns.GetHostName());
8484

85-
string ip = hostEntry.AddressList
85+
string? ip = hostEntry.AddressList
8686
.Where(addr => addr.AddressFamily == AddressFamily.InterNetwork)
8787
.Select(addr => addr.ToString())
8888
.FirstOrDefault();

src/NetMQ.Tests/ThrowingTraceListener.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ namespace NetMQ.Tests
66
{
77
public sealed class ThrowingTraceListener : TraceListener
88
{
9-
public override void Fail(string message, string detailMessage)
9+
public override void Fail(string? message, string? detailMessage)
1010
{
1111
throw new DebugAssertFailureException((message + Environment.NewLine + detailMessage).Trim());
1212
}
1313

14-
public override void Write(string message)
14+
public override void Write(string? message)
1515
{
1616
}
1717

18-
public override void WriteLine(string message)
18+
public override void WriteLine(string? message)
1919
{
2020
}
2121

src/NetMQ/NetMQ.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@
3535

3636
<ItemGroup>
3737
<PackageReference Include="AsyncIO" Version="0.1.69" />
38-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
38+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
3939
<PackageReference Include="NaCl.Net" Version="0.1.13" />
4040
</ItemGroup>
4141

4242
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
43-
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
43+
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
4444
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
4545
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
4646
</ItemGroup>
4747

4848
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
49-
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
49+
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
5050
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
5151
</ItemGroup>
5252

5353
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
54-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
54+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
5555
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
5656
<Reference Include="System.ServiceModel" />
5757
<Reference Include="System" />

src/NetMQ/NetMQActor.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,10 @@ private NetMQActor(PairSocket self, PairSocket shim, IShimHandler shimHandler)
149149
m_self = self;
150150
m_shim = shim;
151151

152-
void OnReceive(object sender, NetMQSocketEventArgs e) => m_receiveEvent.Fire(this, new NetMQActorEventArgs(this));
153-
void OnSend (object sender, NetMQSocketEventArgs e) => m_sendEvent .Fire(this, new NetMQActorEventArgs(this));
152+
var args = new NetMQActorEventArgs(this);
153+
154+
void OnReceive(object sender, NetMQSocketEventArgs e) => m_receiveEvent!.Fire(this, args);
155+
void OnSend (object sender, NetMQSocketEventArgs e) => m_sendEvent !.Fire(this, args);
154156

155157
m_receiveEvent = new EventDelegator<NetMQActorEventArgs>(
156158
() => m_self.ReceiveReady += OnReceive,

src/NetMQ/NetMQBeacon.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
using System;
2+
using System.Diagnostics.CodeAnalysis;
23
using System.Net;
34
using System.Net.Sockets;
5+
using System.Runtime.InteropServices;
46
using System.Text;
57
using System.Threading;
68
using NetMQ.Sockets;
7-
using System.Runtime.InteropServices;
89

910
namespace NetMQ
1011
{
@@ -199,7 +200,7 @@ private void OnUdpReady(Socket socket)
199200
{
200201
Assumes.NotNull(m_pipe);
201202

202-
if (!TryReceiveUdpFrame(out NetMQFrame frame, out string peerName))
203+
if (!TryReceiveUdpFrame(out NetMQFrame? frame, out string? peerName))
203204
return;
204205

205206
// If filter is set, check that beacon matches it
@@ -279,7 +280,7 @@ private void SendUdpFrame(NetMQFrame frame)
279280
}
280281
}
281282

282-
private bool TryReceiveUdpFrame(out NetMQFrame frame, out string peerName)
283+
private bool TryReceiveUdpFrame([NotNullWhen(returnValue: true)] out NetMQFrame? frame, [NotNullWhen(returnValue: true)] out string? peerName)
283284
{
284285
Assumes.NotNull(m_udpSocket);
285286

@@ -321,7 +322,7 @@ public NetMQBeacon()
321322
{
322323
m_actor = NetMQActor.Create(new Shim());
323324

324-
void OnReceive(object sender, NetMQActorEventArgs e) => m_receiveEvent.Fire(this, new NetMQBeaconEventArgs(this));
325+
void OnReceive(object sender, NetMQActorEventArgs e) => m_receiveEvent!.Fire(this, new NetMQBeaconEventArgs(this));
325326

326327
m_receiveEvent = new EventDelegator<NetMQBeaconEventArgs>(
327328
() => m_actor.ReceiveReady += OnReceive,

src/NetMQ/NetMQCertificate.cs

+8-12
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private string Z85Encode(byte[] data)
3636
{
3737
byte byte_nbr = 0;
3838
UInt32 value = 0;
39-
string dest = null;
39+
string? dest = null;
4040
while (byte_nbr<data.Length)
4141
{
4242
// Accumulate value in base 256 (binary)
@@ -53,17 +53,16 @@ private string Z85Encode(byte[] data)
5353
value = 0;
5454
}
5555
}
56-
return dest;
56+
return dest ?? "";
5757
}
5858

5959
/// <summary>
6060
/// Decodes Z85 string
6161
/// </summary>
6262
/// <param name="key">key in Z85 format</param>
6363
/// <exception cref="ArgumentException">If key in invalid</exception>
64-
byte[] Z85Decode(string key)
64+
private byte[] Z85Decode(string key)
6565
{
66-
UInt32 byte_nbr = 0;
6766
UInt32 char_nbr = 0;
6867
UInt32 value = 0;
6968
var dest_ = new List<byte>();
@@ -253,9 +252,9 @@ public static NetMQCertificate FromPublicKey(string publicKey)
253252

254253

255254
/// <summary>
256-
/// Curve Public key
255+
/// Curve Secret key, encoded.
257256
/// </summary>
258-
public string SecretKeyZ85 => SecretKey != null ? Z85Encode(SecretKey) : null;
257+
public string? SecretKeyZ85 => SecretKey != null ? Z85Encode(SecretKey) : null;
259258

260259

261260
/// <summary>
@@ -264,16 +263,13 @@ public static NetMQCertificate FromPublicKey(string publicKey)
264263
public bool HasSecretKey => SecretKey != null;
265264

266265
/// <summary>
267-
/// Curve Public key
266+
/// Curve Public key.
268267
/// </summary>
269268
public byte[] PublicKey { get; private set; }
270269

271270
/// <summary>
272-
/// Curve Public key
271+
/// Curve Public key, encoded.
273272
/// </summary>
274-
public string PublicKeyZ85
275-
{
276-
get => Z85Encode(PublicKey);
277-
}
273+
public string PublicKeyZ85 => Z85Encode(PublicKey);
278274
}
279275
}

src/NetMQ/OutgoingSocketExtensions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,13 @@ public static bool TrySendFrame(this IOutgoingSocket socket, TimeSpan timeout, R
695695
public static IOutgoingSocket SendEmptyRoutingKeys(this IOutgoingSocket socket)
696696
{
697697
return socket.SendMoreFrameEmpty();
698-
}
698+
}
699699

700700
/// <summary>
701701
/// Send a single routing key over <paramref name="socket"/>, append an empty message afterwards.
702702
/// </summary>
703703
/// <param name="socket">the IOutgoingSocket to transmit on</param>
704+
/// <param name="routingKeys">the routing keys to send</param>
704705
public static IOutgoingSocket SendRoutingKeys(this IOutgoingSocket socket, params RoutingKey[] routingKeys)
705706
{
706707
foreach(var routingKey in routingKeys)

src/Performance/NetMQ.SimpleTests/NetMQ.SimpleTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

src/Performance/local_lat/local_lat.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

src/Performance/local_thr/local_thr.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

src/Performance/remote_lat/remote_lat.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

src/Performance/remote_thr/remote_thr.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

0 commit comments

Comments
 (0)