THRIFT-5479 Add net 6 support
diff --git a/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs b/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs
index 16dcc76..ae4d545 100644
--- a/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs
+++ b/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs
@@ -28,8 +28,8 @@
     [MemoryDiagnoser]
     public class CompactProtocolBenchmarks
     {
-        private MemoryStream _Stream;
-        private TProtocol _Protocol;
+        private MemoryStream? _Stream;
+        private TProtocol? _Protocol;
 
         [Params(10000)]
         public int NumberOfOperationsPerIteration { get; set; }
@@ -45,16 +45,18 @@
         [GlobalCleanup]
         public void GlobalCleanup()
         {
-            _Protocol.Dispose();
+            _Protocol?.Dispose();
         }
 
         [Benchmark]
         public async Task WriteString()
         {
+            if ((_Protocol is null) || (_Stream is null))
+                throw new System.Exception("unexpected internal state");
+
             for (int i = 0; i < NumberOfOperationsPerIteration; i++)
             {
                 await _Protocol.WriteStringAsync("Thrift String Benchmark");
-
                 _Stream.Seek(0, SeekOrigin.Begin);
             }
         }
@@ -62,12 +64,14 @@
         [Benchmark]
         public async Task ReadString()
         {
+            if ((_Protocol is null) || (_Stream is null))
+                throw new System.Exception("unexpected internal state");
+
             await _Protocol.WriteStringAsync("Thrift String Benchmark");
 
             for (int i = 0; i < NumberOfOperationsPerIteration; i++)
             {
                 _Stream.Seek(0, SeekOrigin.Begin);
-
                 await _Protocol.ReadStringAsync();
             }
         }
diff --git a/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj b/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
index 633850e..0e29b3b 100644
--- a/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
+++ b/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
@@ -23,6 +23,7 @@
     <TargetFramework>net6.0</TargetFramework>
     <TieredCompilation>false</TieredCompilation>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs b/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
index 62ab317..dd9646a 100644
--- a/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
+++ b/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
@@ -25,13 +25,15 @@
 using Thrift.Protocol.Entities;
 using Thrift.Transport.Client;
 
+#pragma warning disable IDE0063  // using
+
 namespace Thrift.IntegrationTests.Protocols
 {
     [TestClass]
     public class ProtocolsOperationsTests
     {
-        private readonly CompareLogic _compareLogic = new CompareLogic();
-        private static readonly TConfiguration Configuration = null;  // or new TConfiguration() if needed
+        private readonly CompareLogic _compareLogic = new();
+        private static readonly TConfiguration Configuration = new();
 
         [DataTestMethod]
         [DataRow(typeof(TBinaryProtocol), TMessageType.Call)]
@@ -496,8 +498,9 @@
         {
             var memoryStream = new MemoryStream();
             var streamClientTransport = new TStreamTransport(memoryStream, memoryStream,Configuration);
-            var protocol = (TProtocol) Activator.CreateInstance(protocolType, streamClientTransport);
-            return new Tuple<Stream, TProtocol>(memoryStream, protocol);
+            if( Activator.CreateInstance(protocolType, streamClientTransport) is TProtocol protocol)
+                return new Tuple<Stream, TProtocol>(memoryStream, protocol);
+            throw new Exception("Unexpected");
         }
     }
 }
diff --git a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
index 6d473e4..56123dd 100644
--- a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
+++ b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
@@ -30,6 +30,7 @@
     <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
     <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
     <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
 
   <ItemGroup>
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 1511274..0d2770d 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
@@ -29,6 +29,7 @@
     <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
     <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
     <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
index 061032a..778d24c 100644
--- a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
@@ -216,9 +216,9 @@
             public int X { get; set; }
 
             // all Thrift-generated classes override Equals(), we do just the same
-            public override bool Equals(object that)
+            public override bool Equals(object? that)
             {
-                if (!(that is ExampleClass other)) return false;
+                if (that is not ExampleClass other) return false;
                 if (ReferenceEquals(this, other)) return true;
 
                 return this.X == other.X;
diff --git a/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs b/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
index f717b4d..84fcab8 100644
--- a/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
+++ b/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
@@ -24,6 +24,8 @@
 using OptReqDefTest;
 using Thrift.Collections;
 
+#nullable disable  // this is just test code, we leave it at that
+
 namespace Thrift.Tests.DataModel
 {
     // ReSharper disable once InconsistentNaming
@@ -289,7 +291,7 @@
             return value;
         }
 
-        private List<Dictionary<sbyte, THashSet<Distance>>> ModifyValue(List<Dictionary<sbyte, THashSet<Distance>>> value)
+        private static List<Dictionary<sbyte, THashSet<Distance>>> ModifyValue(List<Dictionary<sbyte, THashSet<Distance>>> value)
         {
             if (value == null)
                 value = new List<Dictionary<sbyte, THashSet<Distance>>>();
@@ -325,7 +327,7 @@
             return value;
         }
 
-        private THashSet<List<Distance>> ModifyValue(THashSet<List<Distance>> value)
+        private static THashSet<List<Distance>> ModifyValue(THashSet<List<Distance>> value)
         {
             if (value == null)
                 value = new THashSet<List<Distance>>();
@@ -342,7 +344,7 @@
             return value;
         }
 
-        private Dictionary<Distance, Distance> ModifyValue(Dictionary<Distance, Distance> value)
+        private static Dictionary<Distance, Distance> ModifyValue(Dictionary<Distance, Distance> value)
         {
             if (value == null)
                 value = new Dictionary<Distance, Distance>();
@@ -352,7 +354,7 @@
             return value;
         }
 
-        private THashSet<Distance> ModifyValue(THashSet<Distance> value)
+        private static THashSet<Distance> ModifyValue(THashSet<Distance> value)
         {
             if (value == null)
                 value = new THashSet<Distance>();
@@ -375,7 +377,7 @@
             return value;
         }
 
-        private List<Distance> ModifyValue(List<Distance> value)
+        private static List<Distance> ModifyValue(List<Distance> value)
         {
             if (value == null)
                 value = new List<Distance>();
@@ -385,12 +387,12 @@
             return value;
         }
 
-        private bool ModifyValue(bool value)
+        private static bool ModifyValue(bool value)
         {
             return !value;
         }
 
-        private Dictionary<sbyte, short> ModifyValue(Dictionary<sbyte, short> value)
+        private static Dictionary<sbyte, short> ModifyValue(Dictionary<sbyte, short> value)
         {
             if (value == null)
                 value = new Dictionary<sbyte, short>();
@@ -398,7 +400,7 @@
             return value;
         }
 
-        private THashSet<long> ModifyValue(THashSet<long> value)
+        private static THashSet<long> ModifyValue(THashSet<long> value)
         {
             if (value == null)
                 value = new THashSet<long>();
@@ -406,7 +408,7 @@
             return value;
         }
 
-        private List<int> ModifyValue(List<int> value)
+        private static List<int> ModifyValue(List<int> value)
         {
             if (value == null)
                 value = new List<int>();
@@ -414,7 +416,7 @@
             return value;
         }
 
-        private byte[] ModifyValue(byte[] value)
+        private static byte[] ModifyValue(byte[] value)
         {
             if (value == null)
                 value = new byte[1] { 0 };
@@ -423,27 +425,27 @@
             return value;
         }
 
-        private string ModifyValue(string value)
+        private static string ModifyValue(string value)
         {
             return value + "1";
         }
 
-        private double ModifyValue(double value)
+        private static double ModifyValue(double value)
         {
             return value + 1.1;
         }
 
-        private short ModifyValue(short value)
+        private static short ModifyValue(short value)
         {
             return ++value;
         }
 
-        private Distance ModifyValue(Distance value)
+        private static Distance ModifyValue(Distance value)
         {
             return ++value;
         }
 
-        private void VerifyDifferentContent(RaceDetails first, RaceDetails second)
+        private static void VerifyDifferentContent(RaceDetails first, RaceDetails second)
         {
             Assert.AreNotEqual(first, second);
 
@@ -521,7 +523,7 @@
             Assert.AreNotEqual(first.Triplesix, second.Triplesix);
         }
 
-        private void VerifyIdenticalContent(RaceDetails first, RaceDetails second)
+        private static void VerifyIdenticalContent(RaceDetails first, RaceDetails second)
         {
             Assert.AreEqual(first, second);
 
diff --git a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
index 18fce01..38a6a5c 100644
--- a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
+++ b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
@@ -21,6 +21,7 @@
   <PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
     <Version>0.16.0.0</Version>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
 
   <ItemGroup>