Skip to content

Commit

Permalink
Merge pull request #999 from drewnoakes/bump-versions
Browse files Browse the repository at this point in the history
Bump package versions and fix up compile warnings
  • Loading branch information
drewnoakes authored Jan 29, 2022
2 parents 4a80a4a + d934760 commit 0b58c23
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 47 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,47 @@ on: [push, pull_request]
jobs:
ununtu:
runs-on: ubuntu-latest
env:
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.0.x
- run: dotnet restore src/NetMQ.sln
- name: build
run: dotnet build src/NetMQ.sln /p:Configuration=Release /verbosity:minimal
- name: test netcoreapp3.1
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp3.1 src/NetMQ.Tests/NetMQ.Tests.csproj
- name: test netcoreapp2.1
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp2.1 src/NetMQ.Tests/NetMQ.Tests.csproj
- name: test net6.0
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net6.0 src/NetMQ.Tests/NetMQ.Tests.csproj
windows:
runs-on: windows-latest
env:
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.0.x
- name: Install codecov
run: |
choco install opencover.portable
choco install codecov
- run: dotnet restore src/NetMQ.sln
- name: build
run: dotnet build src/NetMQ.sln /p:Configuration=Release /verbosity:minimal
- name: test netcoreapp2.1
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp2.1 src\NetMQ.Tests\NetMQ.Tests.csproj
- name: test net6.0
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net6.0 src\NetMQ.Tests\NetMQ.Tests.csproj
- name: test netcoreapp3.1
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f netcoreapp3.1 src\NetMQ.Tests\NetMQ.Tests.csproj
- name: test net47
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net47 src\NetMQ.Tests\NetMQ.Tests.csproj
- name: coverage
run: |
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
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
codecov -f "NetMQ_coverage.xml"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<img src="https://cdn.rawgit.com/zeromq/netmq/master/img/NetMQLogo.svg" width="350" />

[![GitHub Actions CI](https://github.com/zeromq/netmq/actions/workflows/CI.yml/badge.svg)](https://github.com/zeromq/netmq/actions/workflows/CI.yml)
[![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/)

NetMQ is a 100% native C# port of the lightweight messaging library ZeroMQ.
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
</ItemGroup>

<!-- Workaround for https://github.com/dotnet/sourcelink/issues/572 -->
Expand Down
2 changes: 2 additions & 0 deletions src/NetMQ.Tests/ExceptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private static T Clone<T>(T source) where T : class
return Deserialise<T>(Serialise(source));
}

#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete
private static Stream Serialise(object source)
{
var formatter = new BinaryFormatter();
Expand All @@ -122,6 +123,7 @@ private static T Deserialise<T>(Stream stream)
stream.Position = 0;
return (T)formatter.Deserialize(stream);
}
#pragma warning restore SYSLIB0011 // BinaryFormatter is obsolete

#endregion
}
Expand Down
7 changes: 3 additions & 4 deletions src/NetMQ.Tests/NetMQ.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);netcoreapp1.0;portable-net45+win8</PackageTargetFallback>
<IsTestProject>true</IsTestProject>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;net47</TargetFrameworks>
<TargetFrameworks>net6.0;netcoreapp3.1;net47</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -42,8 +41,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit" Version="2.4.2-pre.13" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">
Expand Down
4 changes: 2 additions & 2 deletions src/NetMQ.Tests/NetMQCertificateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void X85()
for (int i = 0; i < 1000; i++)
{
var key = new NetMQCertificate();
var copy = new NetMQCertificate(key.SecretKeyZ85, key.PublicKeyZ85);
var copy = new NetMQCertificate(key.SecretKeyZ85!, key.PublicKeyZ85);

Assert.Equal(key.SecretKeyZ85, copy.SecretKeyZ85);
Assert.Equal(key.PublicKeyZ85, copy.PublicKeyZ85);
Expand All @@ -40,7 +40,7 @@ public void FromPublicKey()
public void FromSecretKey()
{
var key = new NetMQCertificate();
var copy = new NetMQCertificate().FromSecretKey(key.SecretKeyZ85);
var copy = new NetMQCertificate().FromSecretKey(key.SecretKeyZ85!);

Assert.Equal(key.SecretKeyZ85, copy.SecretKeyZ85);
Assert.Equal(key.PublicKeyZ85, copy.PublicKeyZ85);
Expand Down
4 changes: 4 additions & 0 deletions src/NetMQ.Tests/OutgoingSocketExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public void SendFrameEmpty()
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
{
Assert.Equal(SendReceiveConstants.InfiniteTimeout, timeout);
Assert.NotNull(msg.UnsafeData);
Assert.Empty(msg.UnsafeData);
Assert.False(more);
return true;
Expand All @@ -227,6 +228,7 @@ public void SendMoreFrameEmpty()
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
{
Assert.Equal(SendReceiveConstants.InfiniteTimeout, timeout);
Assert.NotNull(msg.UnsafeData);
Assert.Empty(msg.UnsafeData);
Assert.True(more);
return true;
Expand All @@ -242,6 +244,7 @@ public void TrySendFrameEmpty()
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
{
Assert.Equal(TimeSpan.Zero, timeout);
Assert.NotNull(msg.UnsafeData);
Assert.Empty(msg.UnsafeData);
Assert.False(more);
return true;
Expand All @@ -257,6 +260,7 @@ public void TrySendFrameEmptyFailed()
var socket = new MockOutgoingSocket((ref Msg msg, TimeSpan timeout, bool more) =>
{
Assert.Equal(TimeSpan.Zero, timeout);
Assert.NotNull(msg.UnsafeData);
Assert.Empty(msg.UnsafeData);
Assert.False(more);
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/NetMQ.Tests/PgmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void UseInterface()
{
var hostEntry = Dns.GetHostEntry(Dns.GetHostName());

string ip = hostEntry.AddressList
string? ip = hostEntry.AddressList
.Where(addr => addr.AddressFamily == AddressFamily.InterNetwork)
.Select(addr => addr.ToString())
.FirstOrDefault();
Expand Down
6 changes: 3 additions & 3 deletions src/NetMQ.Tests/ThrowingTraceListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ namespace NetMQ.Tests
{
public sealed class ThrowingTraceListener : TraceListener
{
public override void Fail(string message, string detailMessage)
public override void Fail(string? message, string? detailMessage)
{
throw new DebugAssertFailureException((message + Environment.NewLine + detailMessage).Trim());
}

public override void Write(string message)
public override void Write(string? message)
{
}

public override void WriteLine(string message)
public override void WriteLine(string? message)
{
}

Expand Down
8 changes: 4 additions & 4 deletions src/NetMQ/NetMQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@

<ItemGroup>
<PackageReference Include="AsyncIO" Version="0.1.69" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="NaCl.Net" Version="0.1.13" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<Reference Include="System.ServiceModel" />
<Reference Include="System" />
Expand Down
6 changes: 4 additions & 2 deletions src/NetMQ/NetMQActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ private NetMQActor(PairSocket self, PairSocket shim, IShimHandler shimHandler)
m_self = self;
m_shim = shim;

void OnReceive(object sender, NetMQSocketEventArgs e) => m_receiveEvent.Fire(this, new NetMQActorEventArgs(this));
void OnSend (object sender, NetMQSocketEventArgs e) => m_sendEvent .Fire(this, new NetMQActorEventArgs(this));
var args = new NetMQActorEventArgs(this);

void OnReceive(object sender, NetMQSocketEventArgs e) => m_receiveEvent!.Fire(this, args);
void OnSend (object sender, NetMQSocketEventArgs e) => m_sendEvent !.Fire(this, args);

m_receiveEvent = new EventDelegator<NetMQActorEventArgs>(
() => m_self.ReceiveReady += OnReceive,
Expand Down
9 changes: 5 additions & 4 deletions src/NetMQ/NetMQBeacon.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using NetMQ.Sockets;
using System.Runtime.InteropServices;

namespace NetMQ
{
Expand Down Expand Up @@ -199,7 +200,7 @@ private void OnUdpReady(Socket socket)
{
Assumes.NotNull(m_pipe);

if (!TryReceiveUdpFrame(out NetMQFrame frame, out string peerName))
if (!TryReceiveUdpFrame(out NetMQFrame? frame, out string? peerName))
return;

// If filter is set, check that beacon matches it
Expand Down Expand Up @@ -279,7 +280,7 @@ private void SendUdpFrame(NetMQFrame frame)
}
}

private bool TryReceiveUdpFrame(out NetMQFrame frame, out string peerName)
private bool TryReceiveUdpFrame([NotNullWhen(returnValue: true)] out NetMQFrame? frame, [NotNullWhen(returnValue: true)] out string? peerName)
{
Assumes.NotNull(m_udpSocket);

Expand Down Expand Up @@ -321,7 +322,7 @@ public NetMQBeacon()
{
m_actor = NetMQActor.Create(new Shim());

void OnReceive(object sender, NetMQActorEventArgs e) => m_receiveEvent.Fire(this, new NetMQBeaconEventArgs(this));
void OnReceive(object sender, NetMQActorEventArgs e) => m_receiveEvent!.Fire(this, new NetMQBeaconEventArgs(this));

m_receiveEvent = new EventDelegator<NetMQBeaconEventArgs>(
() => m_actor.ReceiveReady += OnReceive,
Expand Down
20 changes: 8 additions & 12 deletions src/NetMQ/NetMQCertificate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private string Z85Encode(byte[] data)
{
byte byte_nbr = 0;
UInt32 value = 0;
string dest = null;
string? dest = null;
while (byte_nbr<data.Length)
{
// Accumulate value in base 256 (binary)
Expand All @@ -53,17 +53,16 @@ private string Z85Encode(byte[] data)
value = 0;
}
}
return dest;
return dest ?? "";
}

/// <summary>
/// Decodes Z85 string
/// </summary>
/// <param name="key">key in Z85 format</param>
/// <exception cref="ArgumentException">If key in invalid</exception>
byte[] Z85Decode(string key)
private byte[] Z85Decode(string key)
{
UInt32 byte_nbr = 0;
UInt32 char_nbr = 0;
UInt32 value = 0;
var dest_ = new List<byte>();
Expand Down Expand Up @@ -253,9 +252,9 @@ public static NetMQCertificate FromPublicKey(string publicKey)


/// <summary>
/// Curve Public key
/// Curve Secret key, encoded.
/// </summary>
public string SecretKeyZ85 => SecretKey != null ? Z85Encode(SecretKey) : null;
public string? SecretKeyZ85 => SecretKey != null ? Z85Encode(SecretKey) : null;


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

/// <summary>
/// Curve Public key
/// Curve Public key.
/// </summary>
public byte[] PublicKey { get; private set; }

/// <summary>
/// Curve Public key
/// Curve Public key, encoded.
/// </summary>
public string PublicKeyZ85
{
get => Z85Encode(PublicKey);
}
public string PublicKeyZ85 => Z85Encode(PublicKey);
}
}
3 changes: 2 additions & 1 deletion src/NetMQ/OutgoingSocketExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,13 @@ public static bool TrySendFrame(this IOutgoingSocket socket, TimeSpan timeout, R
public static IOutgoingSocket SendEmptyRoutingKeys(this IOutgoingSocket socket)
{
return socket.SendMoreFrameEmpty();
}
}

/// <summary>
/// Send a single routing key over <paramref name="socket"/>, append an empty message afterwards.
/// </summary>
/// <param name="socket">the IOutgoingSocket to transmit on</param>
/// <param name="routingKeys">the routing keys to send</param>
public static IOutgoingSocket SendRoutingKeys(this IOutgoingSocket socket, params RoutingKey[] routingKeys)
{
foreach(var routingKey in routingKeys)
Expand Down
2 changes: 1 addition & 1 deletion src/Performance/NetMQ.SimpleTests/NetMQ.SimpleTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Performance/local_lat/local_lat.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Performance/local_thr/local_thr.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Performance/remote_lat/remote_lat.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Performance/remote_thr/remote_thr.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down

0 comments on commit 0b58c23

Please sign in to comment.