This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c7b9fd  THRIFT-5479 Add net 6 support Client: netstd Patch: Jens Geyer
4c7b9fd is described below

commit 4c7b9fd38ad614dbf37c37e45569790b44868458
Author: Jens Geyer <[email protected]>
AuthorDate: Sat Dec 4 22:48:37 2021 +0100

    THRIFT-5479 Add net 6 support
    Client: netstd
    Patch: Jens Geyer
---
 build/docker/README.md                             |  2 +-
 build/docker/old/debian-stretch/Dockerfile         |  8 +-
 build/docker/old/ubuntu-artful/Dockerfile          |  8 +-
 build/docker/ubuntu-bionic/Dockerfile              |  8 +-
 build/docker/ubuntu-disco/Dockerfile               |  8 +-
 build/docker/ubuntu-xenial/Dockerfile              |  8 +-
 debian/control                                     |  4 +-
 doc/install/debian.md                              |  2 +-
 .../Thrift.Benchmarks/Thrift.Benchmarks.csproj     |  8 +-
 .../Thrift.IntegrationTests.csproj                 | 15 ++--
 .../Thrift.PublicInterfaces.Compile.Tests.csproj   | 23 +++---
 lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj  | 14 ++--
 lib/netstd/Thrift/Collections/THashSet.cs          |  2 +-
 lib/netstd/Thrift/Thrift.csproj                    | 14 ++--
 .../Transport/Server/TNamedPipeServerTransport.cs  |  2 +-
 test/netstd/Client/Client.csproj                   |  6 +-
 test/netstd/Server/Server.csproj                   |  6 +-
 tutorial/netstd/Client/Client.csproj               |  4 +-
 tutorial/netstd/Client/Program.cs                  | 87 +++++++++++-----------
 tutorial/netstd/Interfaces/Interfaces.csproj       |  4 +-
 tutorial/netstd/Server/Program.cs                  | 85 +++++++++++----------
 tutorial/netstd/Server/Server.csproj               |  4 +-
 22 files changed, 167 insertions(+), 155 deletions(-)

diff --git a/build/docker/README.md b/build/docker/README.md
index 127de8e..87d58bc 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -183,7 +183,7 @@ Last updated: October 1, 2017
 | java      | 1.8.0_191     | 11.0.3        |       |
 | js        | Node.js 6.17.1, V8 5.1.281.111, npm 3.10.10 | Node.js 10.18.0, 
V8 6.8.275.32, npm 6.13.4 |     |
 | lua       |               | 5.2.4         | Lua 5.3: see THRIFT-4386 |
-| netstd    | 5.0           | 5.0           |       |
+| netstd    | 6.0           | 6.0           |       |
 | nodejs    | 6.16.0        | 10.16.0       |       |
 | ocaml     |               | 4.05.0        | THRIFT-4517: ocaml 4.02.3 on 
xenial appears broken |
 | perl      | 5.22.1        | 5.26.1        |       |
diff --git a/build/docker/old/debian-stretch/Dockerfile 
b/build/docker/old/debian-stretch/Dockerfile
index 541223c..628b626 100644
--- a/build/docker/old/debian-stretch/Dockerfile
+++ b/build/docker/old/debian-stretch/Dockerfile
@@ -102,10 +102,10 @@ ENV PATH /usr/lib/dart/bin:$PATH
 # project isn't ready for this quite yet:
 # RUN apt-get install -y --no-install-recommends \
 # `# dotnet core dependencies` \
-#       dotnet-sdk-5.0 \
-#       dotnet-runtime-5.0 \
-#       aspnetcore-runtime-5.0 \
-#       dotnet-apphost-pack-5.0
+#       dotnet-sdk-6.0 \
+#       dotnet-runtime-6.0 \
+#       aspnetcore-runtime-6.0 \
+#       dotnet-apphost-pack-6.0
 
 RUN apt-get install -y --no-install-recommends \
 `# Erlang dependencies` \
diff --git a/build/docker/old/ubuntu-artful/Dockerfile 
b/build/docker/old/ubuntu-artful/Dockerfile
index 282429a..8068265 100644
--- a/build/docker/old/ubuntu-artful/Dockerfile
+++ b/build/docker/old/ubuntu-artful/Dockerfile
@@ -120,10 +120,10 @@ ENV PATH /usr/lib/dart/bin:$PATH
 
 RUN apt-get install -y --no-install-recommends \
 `# dotnet core dependencies` \
-      dotnet-sdk-5.0 \
-      dotnet-runtime-5.0 \
-      aspnetcore-runtime-5.0 \
-      dotnet-apphost-pack-5.0
+      dotnet-sdk-6.0 \
+      dotnet-runtime-6.0 \
+      aspnetcore-runtime-6.0 \
+      dotnet-apphost-pack-6.0
 
 RUN apt-get install -y --no-install-recommends \
 `# Erlang dependencies` \
diff --git a/build/docker/ubuntu-bionic/Dockerfile 
b/build/docker/ubuntu-bionic/Dockerfile
index bd82225..ac51207 100644
--- a/build/docker/ubuntu-bionic/Dockerfile
+++ b/build/docker/ubuntu-bionic/Dockerfile
@@ -126,10 +126,10 @@ ENV PATH /usr/lib/dart/bin:$PATH
 
 RUN apt-get install -y --no-install-recommends \
 `# dotnet core dependencies` \
-      dotnet-sdk-5.0 \
-      dotnet-runtime-5.0 \
-      aspnetcore-runtime-5.0 \
-      dotnet-apphost-pack-5.0
+      dotnet-sdk-6.0 \
+      dotnet-runtime-6.0 \
+      aspnetcore-runtime-6.0 \
+      dotnet-apphost-pack-6.0
 
 RUN apt-get install -y --no-install-recommends \
 `# Erlang dependencies` \
diff --git a/build/docker/ubuntu-disco/Dockerfile 
b/build/docker/ubuntu-disco/Dockerfile
index 6b35915..9d6996d 100644
--- a/build/docker/ubuntu-disco/Dockerfile
+++ b/build/docker/ubuntu-disco/Dockerfile
@@ -126,10 +126,10 @@ ENV PATH /usr/lib/dart/bin:$PATH
 
 RUN apt-get install -y --no-install-recommends \
 `# dotnet core dependencies` \
-      dotnet-sdk-5.0 \
-      dotnet-runtime-5.0 \
-      aspnetcore-runtime-5.0 \
-      dotnet-apphost-pack-5.0
+      dotnet-sdk-6.0 \
+      dotnet-runtime-6.0 \
+      aspnetcore-runtime-6.0 \
+      dotnet-apphost-pack-6.0
 
 RUN apt-get install -y --no-install-recommends \
 `# Erlang dependencies` \
diff --git a/build/docker/ubuntu-xenial/Dockerfile 
b/build/docker/ubuntu-xenial/Dockerfile
index 1d78a28..9a89b70 100644
--- a/build/docker/ubuntu-xenial/Dockerfile
+++ b/build/docker/ubuntu-xenial/Dockerfile
@@ -113,10 +113,10 @@ ENV PATH /usr/lib/dart/bin:$PATH
 
 RUN apt-get install -y --no-install-recommends \
 `# dotnet core dependencies` \
-      dotnet-sdk-5.0 \
-      dotnet-runtime-5.0 \
-      aspnetcore-runtime-5.0 \
-      dotnet-apphost-pack-5.0
+      dotnet-sdk-6.0 \
+      dotnet-runtime-6.0 \
+      aspnetcore-runtime-6.0 \
+      dotnet-apphost-pack-6.0
 
 RUN apt-get install -y --no-install-recommends \
 `# Erlang dependencies` \
diff --git a/debian/control b/debian/control
index f69f73b..0910a94 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
 Source: thrift
 Section: devel
 Priority: extra
-Build-Depends: dotnet-runtime-5.0, dotnet-sdk-5.0, debhelper (>= 9), 
build-essential, python-dev, ant,
+Build-Depends: dotnet-runtime-6.0, dotnet-sdk-6.0, debhelper (>= 9), 
build-essential, python-dev, ant,
     erlang-base, ruby-dev | ruby1.9.1-dev, ruby-bundler ,autoconf, automake,
     pkg-config, libtool, bison, flex, libboost-dev | libboost1.56-dev | 
libboost1.63-all-dev,
     python-all, python-setuptools, python-all-dev, python-all-dbg,
@@ -129,7 +129,7 @@ Description: Java bindings for Thrift
 Package: libthrift-netstd
 Architecture: all
 Section: netstd
-Depends: dotnet-runtime-5.0, ${misc:Depends}
+Depends: dotnet-runtime-6.0, ${misc:Depends}
 Description: NET Standard bindings for Thrift
  Thrift is a software framework for scalable cross-language services
  development. It combines a software stack with a code generation engine to
diff --git a/doc/install/debian.md b/doc/install/debian.md
index 92d68e9..f1edce5 100644
--- a/doc/install/debian.md
+++ b/doc/install/debian.md
@@ -33,7 +33,7 @@ If you would like to build Apache Thrift libraries for other 
programming languag
  * Erlang
        * erlang-base erlang-eunit erlang-dev rebar
  * NetStd
-       * apt-transport-https dotnet-sdk-5.0 aspnetcore-runtime-5.0
+       * apt-transport-https dotnet-sdk-6.0 aspnetcore-runtime-6.0
  * Thrift Compiler for Windows
        * mingw-w64 mingw-w64-x86-64-dev nsis
  * Rust
diff --git a/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj 
b/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
index d55074f..633850e 100644
--- a/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
+++ b/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
@@ -20,17 +20,21 @@
   
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <TieredCompilation>false</TieredCompilation>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
+    <PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
   </ItemGroup>
 
   <ItemGroup>
     <ProjectReference Include="..\..\Thrift\Thrift.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" 
Version="1.0.2" />
+  </ItemGroup>
+
 </Project>
diff --git 
a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj 
b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
index b47017e..6d473e4 100644
--- a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
+++ b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <AssemblyName>Thrift.IntegrationTests</AssemblyName>
     <PackageId>Thrift.IntegrationTests</PackageId>
     <Version>0.16.0.0</Version>
@@ -33,11 +33,11 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="CompareNETObjects" Version="4.72.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
-    <PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
-    <PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" 
/>
+    <PackageReference Include="CompareNETObjects" Version="4.74.0" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
+    <PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" 
/>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\Thrift\Thrift.csproj" />
@@ -45,5 +45,8 @@
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
+  <ItemGroup>
+    <PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" 
Version="1.0.2" />
+  </ItemGroup>
 
 </Project>
\ No newline at end of file
diff --git 
a/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
 
b/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
index 126635d..1511274 100644
--- 
a/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
+++ 
b/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
@@ -21,7 +21,7 @@
   <PropertyGroup>
     <ThriftVersion>0.16.0</ThriftVersion>
     <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <Version>$(ThriftVersion).0</Version>
     <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
     <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
@@ -36,7 +36,11 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" 
/>
+    <PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" 
/>
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" 
Version="1.0.2" />
   </ItemGroup>
 
   <Target Name="PreBuild" 
BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
@@ -55,22 +59,13 @@
     <CreateProperty 
Condition="Exists('$(ProjectDir)/../../../../compiler/cpp/thrift')" 
Value="$(ProjectDir)/../../../../compiler/cpp/thrift">
       <Output TaskParameter="Value" PropertyName="PathToThrift" />
     </CreateProperty>
-    <Error 
-      Condition="!Exists('$(PathToThrift)')"
-      Text="Thrift executable could not be found."
-    />
+    <Error Condition="!Exists('$(PathToThrift)')" Text="Thrift executable 
could not be found." />
     <!-- Make sure the thrift version found is the same as the projects 
version -->
     <Exec Command="$(PathToThrift) -version" ConsoleToMSBuild="true">
       <Output TaskParameter="ConsoleOutput" PropertyName="ThriftBinaryVersion" 
/>
     </Exec>
-    <Error 
-      
Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == 
true"
-      Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to 
the projects version '$(ThriftVersionOutput)'."
-    />
-    <Message
-      Importance="high"
-      Text="Generating tests with thrift binary: '$(PathToThrift)'"
-    />
+    <Error 
Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == 
true" Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to 
the projects version '$(ThriftVersionOutput)'." />
+    <Message Importance="high" Text="Generating tests with thrift binary: 
'$(PathToThrift)'" />
     <!-- Generate the thrift test files -->
     <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r 
./CassandraTest.thrift" />
     <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial -r 
./optional_required_default.thrift" />
diff --git a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj 
b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
index f1dc731..18fce01 100644
--- a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
+++ b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
@@ -19,15 +19,15 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <Version>0.16.0.0</Version>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="CompareNETObjects" Version="4.72.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
-    <PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
-    <PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
+    <PackageReference Include="CompareNETObjects" Version="4.74.0" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
     <PackageReference Include="NSubstitute" Version="4.2.2" />
   </ItemGroup>
 
@@ -39,4 +39,8 @@
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" 
Version="1.0.2" />
+  </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/lib/netstd/Thrift/Collections/THashSet.cs 
b/lib/netstd/Thrift/Collections/THashSet.cs
index 25fcf10..1c060e5 100644
--- a/lib/netstd/Thrift/Collections/THashSet.cs
+++ b/lib/netstd/Thrift/Collections/THashSet.cs
@@ -32,7 +32,7 @@ namespace Thrift.Collections
 
         public THashSet(int capacity)
         {
-            #if NET5_0
+            #if NET5_0_OR_GREATER
             Items = new HashSet<T>(capacity);
             #elif NETFRAMEWORK || NETSTANDARD
             Items = new HashSet<T>(/*capacity not supported*/);
diff --git a/lib/netstd/Thrift/Thrift.csproj b/lib/netstd/Thrift/Thrift.csproj
index 2454ffd..16e64a1 100644
--- a/lib/netstd/Thrift/Thrift.csproj
+++ b/lib/netstd/Thrift/Thrift.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFrameworks>netstandard2.1;netstandard2.0;net5.0</TargetFrameworks>
+    
<TargetFrameworks>netstandard2.1;netstandard2.0;net5.0;net6.0</TargetFrameworks>
     <AssemblyName>Thrift</AssemblyName>
     <PackageId>ApacheThrift</PackageId>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -56,18 +56,22 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" 
Version="2.2.0" />
-    <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
-    <PackageReference Include="Microsoft.Extensions.Logging.Console" 
Version="5.0.0" />
-    <PackageReference Include="Microsoft.Extensions.Logging.Debug" 
Version="5.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Logging.Console" 
Version="6.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Logging.Debug" 
Version="6.0.0" />
     <PackageReference Include="System.IO.Pipes" Version="[4.3,)" />
     <PackageReference Include="System.IO.Pipes.AccessControl" Version="5.0.0" 
/>
-    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="5.0.0" 
/>
+    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0" 
/>
     <PackageReference Include="System.Net.NameResolution" Version="[4.3,)" />
     <PackageReference Include="System.Net.Requests" Version="[4.3,)" />
     <PackageReference Include="System.Net.Security" Version="4.3.2" />
     <PackageReference Include="System.Threading.Tasks.Extensions" 
Version="4.5.4" />
   </ItemGroup>
 
+  <ItemGroup>
+    <PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" 
Version="1.0.2" />
+  </ItemGroup>
+
   <Target Name="SetTFMAssemblyAttributesPath" 
BeforeTargets="GenerateTargetFrameworkMonikerAttribute">
     <PropertyGroup>
       
<TargetFrameworkMonikerAssemblyAttributesPath>$(IntermediateOutputPath)$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)</TargetFrameworkMonikerAssemblyAttributesPath>
diff --git a/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs 
b/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
index 35a037d..e985a29 100644
--- a/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
@@ -329,7 +329,7 @@ namespace Thrift.Transport.Server
                 var nBytes = Math.Min(15 * 4096, length); // 16 would exceed 
the limit
                 while (nBytes > 0)
                 {
-#if NET5_0
+#if NET5_0_OR_GREATER
                     await PipeStream.WriteAsync(buffer.AsMemory(offset, 
nBytes), cancellationToken);
 #else
                     await PipeStream.WriteAsync(buffer, offset, nBytes, 
cancellationToken);
diff --git a/test/netstd/Client/Client.csproj b/test/netstd/Client/Client.csproj
index a331436..c7d5349 100644
--- a/test/netstd/Client/Client.csproj
+++ b/test/netstd/Client/Client.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <LangVersion>9.0</LangVersion>
     <AssemblyName>Client</AssemblyName>
     <PackageId>Client</PackageId>
@@ -34,9 +34,9 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="5.0.0" 
/>
+    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0" 
/>
     <PackageReference Include="System.Runtime.Serialization.Primitives" 
Version="[4.3,)" />
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" 
/>
+    <PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" 
/>
     <PackageReference Include="System.Threading" Version="[4.3,)" />
   </ItemGroup>
 
diff --git a/test/netstd/Server/Server.csproj b/test/netstd/Server/Server.csproj
index f5ddc0f..7d5eb17 100644
--- a/test/netstd/Server/Server.csproj
+++ b/test/netstd/Server/Server.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <LangVersion>9.0</LangVersion>
     <AssemblyName>Server</AssemblyName>
     <PackageId>Server</PackageId>
@@ -36,9 +36,9 @@
   <ItemGroup>
     <PackageReference Include="System.IO.Pipes" Version="4.3.0" />
     <PackageReference Include="System.IO.Pipes.AccessControl" Version="5.0.0" 
/>
-    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="5.0.0" 
/>
+    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0" 
/>
     <PackageReference Include="System.Runtime.Serialization.Primitives" 
Version="[4.3,)" />
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" 
/>
+    <PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" 
/>
     <PackageReference Include="System.Threading" Version="[4.3,)" />
   </ItemGroup>
 
diff --git a/tutorial/netstd/Client/Client.csproj 
b/tutorial/netstd/Client/Client.csproj
index 1f87751..cf01951 100644
--- a/tutorial/netstd/Client/Client.csproj
+++ b/tutorial/netstd/Client/Client.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <LangVersion>9.0</LangVersion>
     <AssemblyName>Client</AssemblyName>
     <PackageId>Client</PackageId>
@@ -32,7 +32,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection" 
Version="5.0.1" />
+    <PackageReference Include="Microsoft.Extensions.DependencyInjection" 
Version="6.0.0" />
   </ItemGroup>
 
   <ItemGroup>
diff --git a/tutorial/netstd/Client/Program.cs 
b/tutorial/netstd/Client/Program.cs
index 9c47450..f1c5236 100644
--- a/tutorial/netstd/Client/Program.cs
+++ b/tutorial/netstd/Client/Program.cs
@@ -39,10 +39,25 @@ using shared;
 
 namespace Client
 {
+    public static class LoggingHelper
+    {
+        public static ILoggerFactory LogFactory { get; } = 
LoggerFactory.Create(builder => {
+            ConfigureLogging(builder);
+        });
+
+        public static void ConfigureLogging(ILoggingBuilder logging)
+        {
+            logging.SetMinimumLevel(LogLevel.Trace);
+            logging.AddConsole();
+            logging.AddDebug();
+        }
+
+        public static ILogger<T> CreateLogger<T>() => 
LogFactory.CreateLogger<T>();
+    }
+
     public class Program
     {
-        private static readonly ServiceCollection ServiceCollection = new();
-        private static ILogger Logger;
+        private static readonly ILogger Logger = 
LoggingHelper.CreateLogger<Program>();
         private static readonly TConfiguration Configuration = null;  // new 
TConfiguration() if  needed
 
         private static void DisplayHelp()
@@ -86,47 +101,35 @@ Sample:
         {
             args ??= Array.Empty<string>();
 
-            ServiceCollection.AddLogging(logging => ConfigureLogging(logging));
-            using (var serviceProvider = 
ServiceCollection.BuildServiceProvider())
+            if (args.Any(x => x.StartsWith("-help", 
StringComparison.OrdinalIgnoreCase)))
             {
-                Logger = 
serviceProvider.GetService<ILoggerFactory>().CreateLogger(nameof(Client));
-
-                if (args.Any(x => x.StartsWith("-help", 
StringComparison.OrdinalIgnoreCase)))
-                {
-                    DisplayHelp();
-                    return;
-                }
+                DisplayHelp();
+                return;
+            }
 
-                Logger.LogInformation("Starting client...");
+            Logger.LogInformation("Starting client...");
 
-                using (var source = new CancellationTokenSource())
-                {
-                    RunAsync(args, source.Token).GetAwaiter().GetResult();
-                }
+            using (var source = new CancellationTokenSource())
+            {
+                RunAsync(args, source.Token).GetAwaiter().GetResult();
             }
         }
 
-        private static void ConfigureLogging(ILoggingBuilder logging)
-        {
-            logging.SetMinimumLevel(LogLevel.Trace);
-            logging.AddConsole();
-            logging.AddDebug();
-        }
-
+        
         private static async Task RunAsync(string[] args, CancellationToken 
cancellationToken)
         {
             var numClients = GetNumberOfClients(args);
 
-            Logger.LogInformation($"Selected # of clients: {numClients}");
+            Logger.LogInformation("Selected # of clients: {numClients}", 
numClients);
 
             var transport = GetTransport(args);
-            Logger.LogInformation($"Selected client transport: {transport}");
+            Logger.LogInformation("Selected client transport: {transport}", 
transport);
 
             var protocol = MakeProtocol( args, MakeTransport(args));
-            Logger.LogInformation($"Selected client protocol: 
{GetProtocol(args)}");
+            Logger.LogInformation("Selected client protocol: 
{GetProtocol(args)}", GetProtocol(args));
 
             var mplex = GetMultiplex(args);
-            Logger.LogInformation("Multiplex " + (mplex ? "yes" : "no"));
+            Logger.LogInformation("Multiplex {mplex}", mplex);
 
             var tasks = new Task[numClients];
             for (int i = 0; i < numClients; i++)
@@ -240,7 +243,7 @@ Sample:
         {
             var numClients = args.FirstOrDefault(x => 
x.StartsWith("-mc"))?.Split(':')?[1];
 
-            Logger.LogInformation($"Selected # of clients: {numClients}");
+            Logger.LogInformation("Selected # of clients: {numClients}", 
numClients);
 
             if (int.TryParse(numClients, out int c) && (0 < c) && (c <= 100))
                 return c;
@@ -310,7 +313,7 @@ Sample:
                 }
                 catch (Exception ex)
                 {
-                    Logger.LogError(ex.ToString());
+                    Logger.LogError("{ex}",ex);
                 }
                 finally
                 {
@@ -319,7 +322,7 @@ Sample:
             }
             catch (TApplicationException x)
             {
-                Logger.LogError(x.ToString());
+                Logger.LogError("{x}",x);
             }
         }
 
@@ -329,12 +332,12 @@ Sample:
 
             // Async version
 
-            Logger.LogInformation($"{client.ClientId} Ping()");
+            Logger.LogInformation("{client.ClientId} Ping()", client.ClientId);
             await client.ping(cancellationToken);
 
-            Logger.LogInformation($"{client.ClientId} Add(1,1)");
+            Logger.LogInformation("{client.ClientId} Add(1,1)", 
client.ClientId);
             var sum = await client.add(1, 1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} Add(1,1)={sum}");
+            Logger.LogInformation("{client.ClientId} Add(1,1)={sum}", 
client.ClientId, sum);
 
             var work = new Work
             {
@@ -345,13 +348,13 @@ Sample:
 
             try
             {
-                Logger.LogInformation($"{client.ClientId} Calculate(1)");
+                Logger.LogInformation("{client.ClientId} Calculate(1)", 
client.ClientId);
                 await client.calculate(1, work, cancellationToken);
-                Logger.LogInformation($"{client.ClientId} Whoa we can divide 
by 0");
+                Logger.LogInformation("{client.ClientId} Whoa we can divide by 
0", client.ClientId);
             }
             catch (InvalidOperation io)
             {
-                Logger.LogInformation($"{client.ClientId} Invalid operation: " 
+ io);
+                Logger.LogInformation("{client.ClientId} Invalid operation: 
{io}", client.ClientId, io);
             }
 
             work.Op = Operation.SUBTRACT;
@@ -360,20 +363,20 @@ Sample:
 
             try
             {
-                Logger.LogInformation($"{client.ClientId} Calculate(1)");
+                Logger.LogInformation("{client.ClientId} Calculate(1)", 
client.ClientId);
                 var diff = await client.calculate(1, work, cancellationToken);
-                Logger.LogInformation($"{client.ClientId} 15-10={diff}");
+                Logger.LogInformation("{client.ClientId} 15-10={diff}", 
client.ClientId, diff);
             }
             catch (InvalidOperation io)
             {
-                Logger.LogInformation($"{client.ClientId} Invalid operation: " 
+ io);
+                Logger.LogInformation("{client.ClientId} Invalid operation: 
{io}", client.ClientId, io);
             }
 
-            Logger.LogInformation($"{client.ClientId} GetStruct(1)");
+            Logger.LogInformation("{client.ClientId} GetStruct(1)", 
client.ClientId);
             var log = await client.getStruct(1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} Check log: {log.Value}");
+            Logger.LogInformation("{client.ClientId} Check log: {log.Value}", 
client.ClientId, log.Value);
 
-            Logger.LogInformation($"{client.ClientId} Zip() with delay 100mc 
on server side");
+            Logger.LogInformation("{client.ClientId} Zip() with delay 100mc on 
server side", client.ClientId);
             await client.zip(cancellationToken);
         }
 
diff --git a/tutorial/netstd/Interfaces/Interfaces.csproj 
b/tutorial/netstd/Interfaces/Interfaces.csproj
index 989f6db..a288745 100644
--- a/tutorial/netstd/Interfaces/Interfaces.csproj
+++ b/tutorial/netstd/Interfaces/Interfaces.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <AssemblyName>Interfaces</AssemblyName>
     <PackageId>Interfaces</PackageId>
     <Version>0.16.0.0</Version>
@@ -34,7 +34,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" 
/>
+    <PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" 
/>
   </ItemGroup>
 
   <Target Name="PreBuild" 
BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
diff --git a/tutorial/netstd/Server/Program.cs 
b/tutorial/netstd/Server/Program.cs
index 80205d5..d9c9dbf 100644
--- a/tutorial/netstd/Server/Program.cs
+++ b/tutorial/netstd/Server/Program.cs
@@ -38,53 +38,55 @@ using shared;
 using Thrift.Processor;
 using System.Diagnostics;
 
-#pragma warning disable IDE0063  // using
 #pragma warning disable IDE0057  // substr
 
 namespace Server
 {
+    public static class LoggingHelper
+    {
+        public static ILoggerFactory LogFactory { get; } = 
LoggerFactory.Create(builder => {
+            ConfigureLogging(builder);
+        });
+
+        public static void ConfigureLogging(ILoggingBuilder logging)
+        {
+            logging.SetMinimumLevel(LogLevel.Trace);
+            logging.AddConsole();
+            logging.AddDebug();
+        }
+
+        public static ILogger<T> CreateLogger<T>() => 
LogFactory.CreateLogger<T>();
+    }
+
     public class Program
     {
-        private static readonly ServiceCollection ServiceCollection = new();
-        private static ILogger Logger;
+        private static readonly ILogger Logger = 
LoggingHelper.CreateLogger<Program>();
         private static readonly TConfiguration Configuration = null;  // new 
TConfiguration() if  needed
 
         public static void Main(string[] args)
         {
             args ??= Array.Empty<string>();
 
-            ServiceCollection.AddLogging(logging => ConfigureLogging(logging));
-            using (var serviceProvider = 
ServiceCollection.BuildServiceProvider())
+            if (args.Any(x => x.StartsWith("-help", 
StringComparison.OrdinalIgnoreCase)))
             {
-                Logger = 
serviceProvider.GetService<ILoggerFactory>().CreateLogger(nameof(Server));
-
-                if (args.Any(x => x.StartsWith("-help", 
StringComparison.OrdinalIgnoreCase)))
-                {
-                    DisplayHelp();
-                    return;
-                }
-
-                using (var source = new CancellationTokenSource())
-                {
-                    RunAsync(args, source.Token).GetAwaiter().GetResult();
+                DisplayHelp();
+                return;
+            }
 
-                    Logger.LogInformation("Press any key to stop...");
+            using (var source = new CancellationTokenSource())
+            {
+                RunAsync(args, source.Token).GetAwaiter().GetResult();
 
-                    Console.ReadLine();
-                    source.Cancel();
-                }
+                Logger.LogInformation("Press any key to stop...");
 
-                Logger.LogInformation("Server stopped");
+                Console.ReadLine();
+                source.Cancel();
             }
-        }
 
-        private static void ConfigureLogging(ILoggingBuilder logging)
-        {
-            logging.SetMinimumLevel(LogLevel.Trace);
-            logging.AddConsole();
-            logging.AddDebug();
+            Logger.LogInformation("Server stopped");
         }
 
+
         private static void DisplayHelp()
         {
             Logger.LogInformation(@"
@@ -226,15 +228,12 @@ Sample:
             try
             {
                 Logger.LogInformation(
-                    string.Format(
-                        "TSimpleAsyncServer with \n{0} transport\n{1} 
buffering\nmultiplex = {2}\n{3} protocol",
-                        transport,
-                        buffering,
-                        multiplex ? "yes" : "no",
-                        protocol
-                        ));
-
-                var loggerFactory = 
ServiceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
+                    "TSimpleAsyncServer with \n{transport} 
transport\n{buffering} buffering\nmultiplex = {multiplex}\n{protocol} protocol",
+                    transport,
+                    buffering,
+                    multiplex ? "yes" : "no",
+                    protocol
+                    );
 
                 var server = new TSimpleAsyncServer(
                     itProcessorFactory: new 
TSingletonProcessorFactory(processor),
@@ -243,7 +242,7 @@ Sample:
                     outputTransportFactory: transportFactory,
                     inputProtocolFactory: protocolFactory,
                     outputProtocolFactory: protocolFactory,
-                    logger: loggerFactory.CreateLogger<TSimpleAsyncServer>());
+                    logger: LoggingHelper.CreateLogger<TSimpleAsyncServer >());
 
                 Logger.LogInformation("Starting the server...");
 
@@ -251,7 +250,7 @@ Sample:
             }
             catch (Exception x)
             {
-                Logger.LogInformation(x.ToString());
+                Logger.LogInformation("{x}",x);
             }
         }
 
@@ -327,7 +326,7 @@ Sample:
                     .UseUrls("http://localhost:9090";)
                     .UseContentRoot(Directory.GetCurrentDirectory())
                     .UseStartup<Startup>()
-                    .ConfigureLogging((ctx,logging) => 
ConfigureLogging(logging))
+                    .ConfigureLogging((ctx,logging) => 
LoggingHelper.ConfigureLogging(logging))
                     .Build();
 
                 Logger.LogTrace("test");
@@ -379,7 +378,7 @@ Sample:
             public async Task<SharedStruct> getStruct(int key,
                 CancellationToken cancellationToken)
             {
-                Logger.LogInformation("GetStruct({0})", key);
+                Logger.LogInformation("GetStruct({key})", key);
                 return await Task.FromResult(_log[key]);
             }
 
@@ -391,13 +390,13 @@ Sample:
 
             public async Task<int> add(int num1, int num2, CancellationToken 
cancellationToken)
             {
-                Logger.LogInformation($"Add({num1},{num2})");
+                Logger.LogInformation("Add({num1},{num2})", num1, num2);
                 return await Task.FromResult(num1 + num2);
             }
 
             public async Task<int> calculate(int logid, Work w, 
CancellationToken cancellationToken)
             {
-                Logger.LogInformation($"Calculate({logid}, 
[{w.Op},{w.Num1},{w.Num2}])");
+                Logger.LogInformation("Calculate({logid}, 
[{w.Op},{w.Num1},{w.Num2}])", logid, w.Op, w.Num1, w.Num2);
 
                 int val;
                 switch (w.Op)
@@ -462,7 +461,7 @@ Sample:
         {
             public async Task<SharedStruct> getStruct(int key, 
CancellationToken cancellationToken)
             {
-                Logger.LogInformation("GetStruct({0})", key);
+                Logger.LogInformation("GetStruct({key})", key);
                 return await Task.FromResult(new SharedStruct()
                 {
                     Key = key,
diff --git a/tutorial/netstd/Server/Server.csproj 
b/tutorial/netstd/Server/Server.csproj
index e5e54a5..6bee63f 100644
--- a/tutorial/netstd/Server/Server.csproj
+++ b/tutorial/netstd/Server/Server.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <LangVersion>9.0</LangVersion>
     <AssemblyName>Server</AssemblyName>
     <PackageId>Server</PackageId>
@@ -40,6 +40,6 @@
     <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" 
Version="2.2.1" />
     <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" 
Version="2.2.0" />
-    <PackageReference 
Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
+    <PackageReference 
Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
   </ItemGroup>
 </Project>

Reply via email to