Skip to content

Commit

Permalink
Use DotNet 8 (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
DJGosnell authored Nov 29, 2023
1 parent 07eab97 commit 4765b42
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.*
dotnet-version: 8.0.*
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img src="./docs/images/logo-256.png" width="48"> NexNet [![Action Workflow](https://github.com/Dtronix/NexNet/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Dtronix/NexNet/actions) [![NexNet](https://img.shields.io/nuget/v/NexNet.svg?maxAge=60)](https://www.nuget.org/packages/NexNet) [![NexNet.Generator](https://img.shields.io/nuget/v/NexNet.Generator.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Generator) [![NexNet.Quic](https://img.shields.io/nuget/v/NexNet.Quic.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Quic)
# <img src="./docs/images/logo-256.png" width="48"> NexNet [![Action Workflow](https://github.com/Dtronix/NexNet/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Dtronix/NexNet/actions) [![NexNet](https://img.shields.io/nuget/v/NexNet.svg?maxAge=60)](https://www.nuget.org/packages/NexNet) [![NexNet.Generator](https://img.shields.io/nuget/v/NexNet.Generator.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Generator) [![NexNet.Quic](https://img.shields.io/nuget/v/NexNet.Quic.svg?maxAge=60)](https://www.nuget.org/packages/NexNet.Quic)

NexNet is a .NET real-time asynchronous networking library, providing developers with the capability to seamlessly incorporate server and client bidirectional event-driven functionality into their applications. This framework streamlines the transmission of updates bidirectionally between server-side code and connected clients with resilient communication channels.

Expand Down Expand Up @@ -80,23 +80,23 @@ await client.Proxy.UpdateInfoAndWait(1, 2, "Custom Status");
```
## Benchmarks
```
BenchmarkDotNet v0.13.8, Windows 11 (10.0.22621.2283/22H2/2022Update/SunValley2)
AMD Ryzen 9 3900X, 1 CPU, 24 logical and 12 physical cores
.NET SDK 8.0.100-rc.1.23455.8
[Host] : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2
Job-ASQQIE : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2
BenchmarkDotNet v0.13.10, Windows 11 (10.0.23590.1000)
Intel Core i7-10700 CPU 2.90GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK 8.0.100
[Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
Job-JQCICL : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
Platform=X64 Runtime=.NET 7.0 MaxIterationCount=5
Platform=X64 Runtime=.NET 8.0 MaxIterationCount=5
MaxWarmupIterationCount=3 MinIterationCount=3 MinWarmupIterationCount=1
```

| Method | Mean | Error | StdDev | Op/s | Gen0 | Gen1 | Allocated |
|------------------------------------- |---------:|---------:|---------:|---------:|-------:|-------:|----------:|
| InvocationNoArgument | 38.66 us | 2.070 us | 0.537 us | 25,867.9 | 0.0610 | - | 681 B |
| InvocationUnmanagedArgument | 38.35 us | 2.496 us | 0.648 us | 26,078.6 | 0.0610 | - | 737 B |
| InvocationUnmanagedMultipleArguments | 38.98 us | 2.044 us | 0.531 us | 25,654.8 | 0.0610 | - | 785 B |
| InvocationNoArgumentWithResult | 38.22 us | 0.752 us | 0.195 us | 26,166.8 | 0.0610 | - | 721 B |
| InvocationWithDuplexPipe_Upload | 64.48 us | 2.690 us | 0.416 us | 15,509.1 | 2.0752 | 0.4883 | 14142 B |
| Method | Mean | Error | StdDev | Op/s | Gen0 | Gen1| Allocated |
|--------------------------- |---------:|-------:|--------:|-------:|-----:|----:|----------:|
| NoArgument | 38.9 μs | 0.98 μs | 0.25 μs | 25,702 | 0.06 | - | 632 B |
| UnmanagedArgument | 39.8 μs | 1.02 μs | 0.26 μs | 25,110 | 0.06 | - | 689 B |
| UnmanagedMultipleArguments | 38.6 μs | 2.62 μs | 0.40 μs | 25,894 | 0.06 | - | 737 B |
| NoArgumentWithResult | 38.8 μs | 0.89 μs | 0.23 μs | 25,750 | 0.06 | - | 673 B |
| WithDuplexPipe_Upload | 49.6 μs | 2.72 μs | 0.42 μs | 20,138 | 2.07 | 0.4 | 13987 B |

## Method Invocation Table
Some methods are handled differently based upon the arguments passed and there are limitations placed upon the types of arguments which can be used together. Most of these incompatibilities handled with Diagnostic Errors provided by the `NexNet.Generator`. Below is a table which shows valid combinations of arguments and return values.
Expand Down
6 changes: 3 additions & 3 deletions src/NexNet.Generator.Tests/NexNet.Generator.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/NexNet.Generator/NexNet.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
6 changes: 3 additions & 3 deletions src/NexNet.IntegrationTests/NexNet.IntegrationTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
6 changes: 1 addition & 5 deletions src/NexNet.IntegrationTests/NexusServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,7 @@ public async Task ThrowsWhenServerIsAlreadyOpenOnSameTransport(Type type)
catch (TransportException e)
{
// Quic does not return information if a UDP port is already in use or not.
Assert.AreEqual(
e.InnerException is QuicException
? TransportError.InternalError
: TransportError.AddressInUse,
e.Error);
Assert.AreEqual(TransportError.AddressInUse, e.Error);
}
catch (Exception e)
{
Expand Down
10 changes: 5 additions & 5 deletions src/NexNet.Quic/QuicHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public static TransportError GetTransportError(QuicError error)
QuicError.InternalError => TransportError.InternalError,
QuicError.ConnectionAborted => TransportError.ConnectionAborted,
QuicError.StreamAborted => TransportError.StreamAborted,
QuicError.AddressInUse => TransportError.AddressInUse,
QuicError.InvalidAddress => TransportError.InvalidAddress,
QuicError.AlpnInUse => TransportError.AddressInUse,
QuicError.ConnectionTimeout => TransportError.ConnectionTimeout,
QuicError.HostUnreachable => TransportError.Unreachable,
QuicError.ConnectionRefused => TransportError.ConnectionRefused,
QuicError.VersionNegotiationError => TransportError.VersionNegotiationError,
QuicError.ConnectionIdle => TransportError.ConnectionIdle,
QuicError.ProtocolError => TransportError.ProtocolError,
QuicError.OperationAborted => TransportError.OperationAborted,
_ => TransportError.InternalError,
QuicError.Success => TransportError.Success,
QuicError.TransportError => TransportError.ProtocolError,
QuicError.CallbackError => TransportError.InternalError,
_ => TransportError.InternalError
};
}
}
4 changes: 2 additions & 2 deletions src/NexNet.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<Version>0.5.0</Version>
<Version>0.6.0</Version>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Company>Dtronix</Company>
Expand Down
3 changes: 2 additions & 1 deletion src/NexNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{AFD63E22-F3AE-48D4-91F9-53513F176A46}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\dotnet.yml = ..\.github\workflows\dotnet.yml
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NexNet.Quic", "NexNet.Quic\NexNet.Quic.csproj", "{AB75B6D0-0DC0-4E3A-A3A7-320DFB6B09C5}"
Expand All @@ -25,7 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
NexNet.props = NexNet.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexNetBenchmarks", "NexNetBenchmarks\NexNetBenchmarks.csproj", "{601A50B4-E03D-423F-A1FF-99805719C409}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NexNetBenchmarks", "NexNetBenchmarks\NexNetBenchmarks.csproj", "{601A50B4-E03D-423F-A1FF-99805719C409}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 3 additions & 3 deletions src/NexNet/Internals/Pipelines/Buffers/BufferWriter.Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ partial class BufferWriter<T>
internal static int LiveSegmentCount => RefCountedSegment.LiveCount;
partial class RefCountedSegment
{
static partial void IncrLiveCount() => Interlocked.Increment(ref s_LiveCount);
static partial void DecrLiveCount() => Interlocked.Decrement(ref s_LiveCount);
//static partial void IncrLiveCount() => Interlocked.Increment(ref s_LiveCount);
//static partial void DecrLiveCount() => Interlocked.Decrement(ref s_LiveCount);
private static int s_LiveCount;
internal static int LiveCount => Volatile.Read(ref s_LiveCount);
}
}
#endif
#endif
1 change: 1 addition & 0 deletions src/NexNet/Internals/Pipelines/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using NexNet.Internals.Pipelines.Internal;

Expand Down
8 changes: 3 additions & 5 deletions src/NexNet/NexNet.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\NexNet.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);SOCKET_STREAM_BUFFERS;RANGES</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>A real-time asynchronous networking library that provides bidirectional communication between a server and multiple clients.</Description>
Expand All @@ -13,8 +11,8 @@
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MemoryPack" Version="1.9.16" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="System.IO.Pipelines" Version="7.0.0" />
<PackageReference Include="MemoryPack" Version="1.10.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="System.IO.Pipelines" Version="8.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/NexNetBenchmarks/BenchmarkConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static IConfig Get()
return ManualConfig.CreateEmpty()
// Jobs
.AddJob(Job.Default
.WithRuntime(CoreRuntime.Core70)
.WithRuntime(CoreRuntime.Core80)
.WithPlatform(Platform.X64)
.WithMinWarmupCount(1)
.WithMaxWarmupCount(3)
Expand Down
6 changes: 3 additions & 3 deletions src/NexNetBenchmarks/NexNetBenchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
Expand All @@ -14,8 +14,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.8" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.8" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.10" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/NexNetDemo/NexNetDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EventSourceSupport>false</EventSourceSupport>
Expand Down
25 changes: 25 additions & 0 deletions src/tag_release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Ensure that changes are not pending.
$gitChanges = git status --porcelain;
$ChangedFiles = $($gitChanges | Measure-Object | Select-Object -expand Count)
if ($ChangedFiles -gt 0)
{
Write-Output "There are $ChangedFiles uncommited changes in the repository. Must commit prior to tagging. Changed Files:"
Write-Output $gitChanges
Read-Host -Prompt "Press Enter to exit"
exit
}

$projectFile = Get-ChildItem -filter "NexNet.props"
$version = Select-Xml -Path $projectFile -XPath "Project/PropertyGroup/Version" | Select-Object -ExpandProperty Node
$tag = "v" + $version.InnerText

$confirmation = Read-Host "Tag current commit with '$tag' (y/n):"
if ($confirmation -eq 'y') {
git tag $tag
}

$confirmation = Read-Host "Push new tag to origin? (y/n):"
if ($confirmation -eq 'y') {
git push origin $tag
git push origin
}

0 comments on commit 4765b42

Please sign in to comment.