Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions and fix assertion #1073

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ jobs:
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
7.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 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 net7.0
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net7.0 src/NetMQ.Tests/NetMQ.Tests.csproj
windows:
runs-on: windows-latest
env:
Expand All @@ -29,22 +26,19 @@ jobs:
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
7.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 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: test net7.0
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net7.0 src\NetMQ.Tests\NetMQ.Tests.csproj
- name: test net48
run: dotnet test -v n -p:ParallelizeTestCollections=false --configuration Release --no-build -f net48 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 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
OpenCover.Console.exe -register:user -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:"test --no-build --configuration Release -f net7.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"
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" PrivateAssets="All" />
</ItemGroup>

<!-- Workaround for https://github.com/dotnet/sourcelink/issues/572 -->
Expand Down
2 changes: 1 addition & 1 deletion src/NetMQ.Tests/ClientServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async void AsyncWithCancellationToken()
await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await server.ReceiveStringAsync(source.Token));
}

#if NETCOREAPP3_1
#if NET

[Fact(Timeout = 120)]
public async void AsyncEnumerableCanceled()
Expand Down
6 changes: 3 additions & 3 deletions src/NetMQ.Tests/CurveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using NetMQ.Sockets;
using Xunit;

#if NET47
#if NETFRAMEWORK
using ZeroMQ;
#endif

Expand Down Expand Up @@ -38,8 +38,8 @@ public void CurveTest()


}
#if NET47

#if NETFRAMEWORK
[Fact]
public void WithLibzmqClient()
{
Expand Down
2 changes: 1 addition & 1 deletion src/NetMQ.Tests/MessageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void Issue52_ReqToRouterBug()

var msg = router.ReceiveMultipartMessage();
Assert.Equal(3, msg.FrameCount);
Assert.Equal(msg[2].ConvertToString(), testmessage);
Assert.Equal(testmessage, msg[2].ConvertToString());
}
}

Expand Down
17 changes: 10 additions & 7 deletions src/NetMQ.Tests/NetMQ.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsTestProject>true</IsTestProject>
<TargetFrameworks>net6.0;netcoreapp3.1;net47</TargetFrameworks>
<TargetFrameworks>net7.0;net48</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -26,7 +26,7 @@
<AssemblySearchPaths Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">$(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)</AssemblySearchPaths>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -39,13 +39,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="xunit" Version="2.4.2-pre.13" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PackageReference Include="ZeroMQ" Version="4.1.0.31" />
</ItemGroup>

Expand Down
2 changes: 0 additions & 2 deletions src/NetMQ.Tests/NetMQMonitorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void Monitoring()
}
}

#if !NET35
[Fact]
public void StartAsync()
{
Expand All @@ -71,7 +70,6 @@ public void StartAsync()
Assert.True(task.Wait(TimeSpan.FromMilliseconds(1000)));
}
}
#endif

[Fact]
public void NoHangWhenMonitoringUnboundInprocAddress()
Expand Down
11 changes: 2 additions & 9 deletions src/NetMQ.Tests/NetMQPollerTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
Expand All @@ -8,10 +9,6 @@
using NetMQ.Sockets;
using Xunit;

#if !NET35
using System.Collections.Concurrent;
#endif

// ReSharper disable AccessToDisposedClosure

namespace NetMQ.Tests
Expand Down Expand Up @@ -863,7 +860,6 @@ public void NativeSocket()

#region TaskScheduler tests

#if !NET35
[Fact]
public void OneTask()
{
Expand Down Expand Up @@ -990,13 +986,11 @@ public void TwoThreads()
Assert.Equal(100, count2);
}
}
#endif

#endregion

#region ISynchronizeInvoke tests

#if NET451
[Fact]
public void ISynchronizeInvokeWorks()
{
Expand All @@ -1018,8 +1012,7 @@ public void ISynchronizeInvokeWorks()
Assert.True(isCorrectThread);
}
}
#endif

#endregion
#endregion
}
}
4 changes: 1 addition & 3 deletions src/NetMQ.Tests/NetMQQueueTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !NET35
using System;
using System;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -81,4 +80,3 @@ public void WithPoller()
}
}
}
#endif
4 changes: 1 addition & 3 deletions src/NetMQ.Tests/RequestWithRetryTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !NET35
using System;
using System;
using System.Diagnostics;
using NetMQ.Sockets;
using Xunit;
Expand Down Expand Up @@ -205,4 +204,3 @@ public void RequestResponseStringWithRetrySucceedsNotOnFirstTry()
}
}
}
#endif
2 changes: 1 addition & 1 deletion src/NetMQ.Tests/RouterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void ReceiveReadyDot35Bug()
using (var server = new RouterSocket())
{
server.BindRandomPort("tcp://127.0.0.1");
server.ReceiveReady += (s, e) => Assert.True(false, "Should not receive");
server.ReceiveReady += (s, e) => Assert.Fail("Should not receive");

Assert.False(server.Poll(TimeSpan.FromMilliseconds(1500)));
}
Expand Down
6 changes: 3 additions & 3 deletions src/NetMQ.Tests/XPubSubTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public void Manual()
sub.SendFrame(new byte[] { 1, (byte)'A' });
var subscription = pub.ReceiveFrameBytes();

Assert.Equal(subscription[1], (byte)'A');
Assert.Equal((byte)'A', subscription[1]);

pub.Subscribe("B");
pub.SendFrame("A");
Expand All @@ -356,7 +356,7 @@ public void WelcomeMessage()

var subscription = pub.ReceiveFrameBytes();

Assert.Equal(subscription[1], (byte)'W');
Assert.Equal((byte)'W', subscription[1]);

Assert.Equal("W", sub.ReceiveFrameString());
}
Expand All @@ -377,7 +377,7 @@ public void ClearWelcomeMessage()

var subscription = pub.ReceiveFrameBytes();

Assert.Equal(subscription[1], (byte)'W');
Assert.Equal((byte)'W', subscription[1]);

Assert.False(sub.TrySkipFrame());
}
Expand Down
5 changes: 2 additions & 3 deletions src/NetMQ.Tests/ZMTPTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using NetMQ.Sockets;
using Xunit;

#if NET47
#if NETFRAMEWORK
using ZeroMQ;
#endif

Expand Down Expand Up @@ -156,7 +156,7 @@ public void V3Test()
}
}

#if NET47
#if NETFRAMEWORK
[Fact]
public void WithLibzmq()
{
Expand All @@ -176,7 +176,6 @@ public void WithLibzmq()
Assert.Equal("Hello", frame.ReadString());
}
}

#endif
}
}
2 changes: 1 addition & 1 deletion src/NetMQ/AsyncReceiveExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_0 || NETSTANDARD2_1 || NET47
#if NETSTANDARD2_0_OR_GREATER || NET47_OR_GREATER

using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion src/NetMQ/Core/Mechanisms/CurveClientMechanism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ PullMsgResult ProduceInitiate(ref Msg msg)

VouchNoncePrefix.CopyTo(vouchNonce);
using var rng = RandomNumberGenerator.Create();
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER
rng.GetBytes(vouchNonce.Slice(8));
#else
byte[] temp = new byte[16];
Expand Down
4 changes: 2 additions & 2 deletions src/NetMQ/Core/Mechanisms/CurveServerMechanism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ PullMsgResult ProduceWelcome(ref Msg msg)
// 8-byte prefix plus 16-byte random nonce
CookieNoncePrefix.CopyTo(cookieNonce);
using var rng = RandomNumberGenerator.Create();
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER
rng.GetBytes(cookieNonce.Slice(8));
#else
byte[] temp = new byte[16];
Expand All @@ -184,7 +184,7 @@ PullMsgResult ProduceWelcome(ref Msg msg)
// Create full nonce for encryption
// 8-byte prefix plus 16-byte random nonce
WelcomeNoncePrefix.CopyTo(welcomeNonce);
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER
rng.GetBytes(welcomeNonce.Slice(8));
#else
rng.GetBytes(temp);
Expand Down
2 changes: 1 addition & 1 deletion src/NetMQ/Core/Transports/Pgm/PgmSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ internal void Init()
Debug.WriteLine(xMsg);

// If running on Microsoft Windows, suggest to the developer that he may need to install MSMQ in order to get PGM socket support.
#if NETSTANDARD1_1_OR_GREATER
#if NETSTANDARD2_0_OR_GREATER
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
#else
bool isWindows = true;
Expand Down
6 changes: 3 additions & 3 deletions src/NetMQ/Core/Transports/Tcp/TcpListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License
using System;
using System.Diagnostics;
using System.Net.Sockets;
#if NETSTANDARD2_0 || NETSTANDARD2_1
#if NETSTANDARD2_0_OR_GREATER
using System.Runtime.InteropServices;
#endif
using AsyncIO;
Expand Down Expand Up @@ -123,7 +123,7 @@ public virtual void SetAddress(string addr)
m_address.Resolve(addr, m_options.IPv4Only);

Assumes.NotNull(m_address.Address);
Assumes.NotNull(m_handle);
Assumes.Null(m_handle);

try
{
Expand All @@ -141,7 +141,7 @@ public virtual void SetAddress(string addr)
}
}

#if NETSTANDARD2_0 || NETSTANDARD2_1
#if NETSTANDARD2_0_OR_GREATER
// This command is failing on linux
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
m_handle.ExclusiveAddressUse = false;
Expand Down
2 changes: 1 addition & 1 deletion src/NetMQ/Core/Utils/OpCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static bool Open()
string val = Environment.GetEnvironmentVariable("NETQM_SUPPRESS_RDTSC");
if (!string.IsNullOrEmpty(val))
return false;
#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
#if NETSTANDARD || NET471_OR_GREATER
if (RuntimeInformation.ProcessArchitecture != Architecture.X86 &&
RuntimeInformation.ProcessArchitecture != Architecture.X64)
{
Expand Down
8 changes: 0 additions & 8 deletions src/NetMQ/Core/Utils/Signaler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,14 @@ public void Close()

try
{
#if NET35
m_writeSocket.Close();
#else
m_writeSocket.Dispose();
#endif
}
catch (SocketException)
{}

try
{
#if NET35
m_readSocket.Close();
#else
m_readSocket.Dispose();
#endif
}
catch (SocketException)
{}
Expand Down
Loading
Loading