THRIFT-5746 Upgrade to net8
Client: netstd
Patch: Jens Geyer
diff --git a/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj b/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
index b5afef5..cc2360d 100644
--- a/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
+++ b/lib/netstd/Benchmarks/Thrift.Benchmarks/Thrift.Benchmarks.csproj
@@ -20,7 +20,8 @@
   
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latestMajor</LangVersion>
     <TieredCompilation>false</TieredCompilation>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Nullable>enable</Nullable>
diff --git a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
index 98e8007..3f52a5f 100644
--- a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
+++ b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
@@ -19,7 +19,8 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latestMajor</LangVersion>
     <AssemblyName>Thrift.IntegrationTests</AssemblyName>
     <PackageId>Thrift.IntegrationTests</PackageId>
     <Version>0.20.0.0</Version>
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 6f3abb1..ecde366 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,8 @@
   <PropertyGroup>
     <ThriftVersion>0.20.0</ThriftVersion>
     <ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latestMajor</LangVersion>
     <Version>$(ThriftVersion).0</Version>
     <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
     <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
@@ -68,14 +69,14 @@
     <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,net6 -r ./CassandraTest.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./optional_required_default.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./name_conflicts.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./../../../../test/ThriftTest.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./../../../../contrib/fb303/if/fb303.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./Thrift5253.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./Thrift5320.thrift" />
-    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./Thrift5382.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./CassandraTest.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./optional_required_default.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./name_conflicts.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../test/ThriftTest.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../contrib/fb303/if/fb303.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5253.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5320.thrift" />
+    <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5382.thrift" />
   </Target>
 
 </Project>
diff --git a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
index 49108d1..c6cd22d 100644
--- a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
@@ -56,8 +56,8 @@
         [TestMethod]
         public void TCollection_List_Equals_Objects_Test()
         {
-            var collection1 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
-            var collection2 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+            var collection1 = new List<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
+            var collection2 = new List<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
             Assert.IsTrue(collection1.SequenceEqual(collection2));
         }
@@ -65,8 +65,8 @@
         [TestMethod]
         public void TCollection_List_List_Equals_Objects_Test()
         {
-            var collection1 = new List<List<ExampleClass>> { new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
-            var collection2 = new List<List<ExampleClass>> { new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
+            var collection1 = new List<List<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
+            var collection2 = new List<List<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
             Assert.IsFalse(collection1.SequenceEqual(collection2));  // SequenceEqual() calls Equals() of the inner list instead of SequenceEqual()
         }
@@ -74,7 +74,7 @@
         [TestMethod]
         public void TCollection_List_Equals_OneAndTheSameObject_Test()
         {
-            var collection1 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+            var collection1 = new List<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
             var collection2 = collection1;
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
             Assert.IsTrue(collection1.SequenceEqual(collection2));
@@ -105,8 +105,8 @@
         [TestMethod]
         public void TCollection_Set_Equals_Objects_Test()
         {
-            var collection1 = new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
-            var collection2 = new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+            var collection1 = new HashSet<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
+            var collection2 = new HashSet<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
             Assert.IsTrue(collection1.SequenceEqual(collection2));
         }
@@ -114,8 +114,8 @@
         [TestMethod]
         public void TCollection_Set_Set_Equals_Objects_Test()
         {
-            var collection1 = new HashSet<HashSet<ExampleClass>> { new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
-            var collection2 = new HashSet<HashSet<ExampleClass>> { new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
+            var collection1 = new HashSet<HashSet<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
+            var collection2 = new HashSet<HashSet<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
             Assert.IsFalse(collection1.SequenceEqual(collection2));  // SequenceEqual() calls Equals() of the inner list instead of SequenceEqual()
         }
@@ -123,7 +123,7 @@
         [TestMethod]
         public void TCollection_Set_Equals_OneAndTheSameObject_Test()
         {
-            var collection1 = new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+            var collection1 = new HashSet<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
             var collection2 = collection1;      // references to one and the same collection
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
             Assert.IsTrue(collection1.SequenceEqual(collection2));
@@ -160,13 +160,13 @@
         {
             var collection1 = new Dictionary<int, ExampleClass>
             {
-                [1] = new ExampleClass { X = 1 },
-                [-1] = new ExampleClass { X = 2 }
+                [1] = new() { X = 1 },
+                [-1] = new() { X = 2 }
             };
             var collection2 = new Dictionary<int, ExampleClass>
             {
-                [1] = new ExampleClass { X = 1 },
-                [-1] = new ExampleClass { X = 2 }
+                [1] = new() { X = 1 },
+                [-1] = new() { X = 2 }
             };
 
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
@@ -180,16 +180,16 @@
             {
                 [0] = new Dictionary<int, ExampleClass>
                 {
-                    [1] = new ExampleClass { X = 1 },
-                    [-1] = new ExampleClass { X = 2 }
+                    [1] = new() { X = 1 },
+                    [-1] = new() { X = 2 }
                 }
             };
             var collection2 = new Dictionary<int, Dictionary<int, ExampleClass>>
             {
                 [0] = new Dictionary<int, ExampleClass>
                 {
-                    [1] = new ExampleClass { X = 1 },
-                    [-1] = new ExampleClass { X = 2 }
+                    [1] = new() { X = 1 },
+                    [-1] = new() { X = 2 }
                 }
             };
 
@@ -202,8 +202,8 @@
         {
             var collection1 = new Dictionary<int, ExampleClass>
             {
-                [1] = new ExampleClass { X = 1 },
-                [-1] = new ExampleClass { X = 2 }
+                [1] = new() { X = 1 },
+                [-1] = new() { X = 2 }
             };
             var collection2 = collection1;
             Assert.IsTrue(TCollections.Equals(collection1, collection2));
diff --git a/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs b/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
index 11b5af4..7a43ca8 100644
--- a/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
+++ b/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
@@ -59,7 +59,7 @@
             return instance;
         }
 
-        private jack? MakeNestedUnion(int nesting)
+        private jack.nested_struct? MakeNestedUnion(int nesting)
         {
             if (++nesting > 1)
                 return null;
@@ -148,14 +148,14 @@
 
             if (nesting < 2)
             {
-                instance.Far_list = new List<Distance>() { Distance.foo, Distance.bar, Distance.baz };
-                instance.Far_set = new HashSet<Distance>() { Distance.foo, Distance.bar, Distance.baz };
-                instance.Far_map = new Dictionary<Distance, Distance>() { [Distance.foo] = Distance.foo, [Distance.bar] = Distance.bar, [Distance.baz] = Distance.baz };
+                instance.Far_list = [Distance.foo, Distance.bar, Distance.baz];
+                instance.Far_set = [Distance.foo, Distance.bar, Distance.baz];
+                instance.Far_map = new() { [Distance.foo] = Distance.foo, [Distance.bar] = Distance.bar, [Distance.baz] = Distance.baz };
 
-                instance.Far_set_list = new HashSet<List<Distance>>() { new List<Distance>() { Distance.foo } };
-                instance.Far_list_map_set = new List<Dictionary<sbyte, HashSet<Distance>>>() { new Dictionary<sbyte, HashSet<Distance>>() { [1] = new HashSet<Distance>() { Distance.baz } } };
+                instance.Far_set_list = [[Distance.foo]];
+                instance.Far_list_map_set = [new Dictionary<sbyte, HashSet<Distance>>() { [1] = [Distance.baz] }];
 
-                instance.Far_map_dist_to_rds = new Dictionary<Distance, List<RaceDetails>>() { [Distance.bar] = new List<RaceDetails>()  };
+                instance.Far_map_dist_to_rds = new() { [Distance.bar] = []  };
                 var details = MakeNestedRaceDetails(nesting);
                 if (details != null)
                     instance.Far_map_dist_to_rds[Distance.bar].Add(details);
@@ -265,8 +265,7 @@
             if (++level > 4)
                 return value;
 
-            if (value == null)
-                value = MakeNestedUnion(0);
+            value ??= MakeNestedUnion(0);
             Debug.Assert(value?.As_nested_struct != null);
             ModifyInstance(value.As_nested_struct, level);
             return value;
@@ -277,23 +276,21 @@
             if (++level > 4)
                 return value;
 
-            if (value == null)
-                value = new RaceDetails();
+            value ??= new RaceDetails();
             ModifyInstance(value,level);
             return value;
         }
 
         private Dictionary<Distance, List<RaceDetails>> ModifyValue(Dictionary<Distance, List<RaceDetails>>? value, int level)
         {
-            if (value == null)
-                value = new Dictionary<Distance, List<RaceDetails>>();
+            value ??= [];
 
             if (++level > 4)
                 return value;
 
             var details = new RaceDetails();
             InitializeInstance(details);
-            value[Distance.foo] = new List<RaceDetails>() { details };
+            value[Distance.foo] = [details];
 
             if (value.TryGetValue(Distance.bar, out var list) && (list.Count > 0))
             {
@@ -309,17 +306,16 @@
 
         private static List<Dictionary<sbyte, HashSet<Distance>>> ModifyValue(List<Dictionary<sbyte, HashSet<Distance>>>? value)
         {
-            if (value == null)
-                value = new List<Dictionary<sbyte, HashSet<Distance>>>();
+            value ??= [];
 
             if (value.Count == 0)
-                value.Add(new Dictionary<sbyte, HashSet<Distance>>());
+                value.Add([]);
             //else
             //value.Add(null); --Thrift does not allow null values in containers
 
             sbyte key = (sbyte)(value[0].Count + 10);
             if (value[0].Count == 0)
-                value[0].Add(key, new HashSet<Distance>());
+                value[0].Add(key, []);
             //else
             //value[0].Add(key, null); --Thrift does not allow null values in containers
 
@@ -331,9 +327,7 @@
                     {
                         if (pair.Value != null)
                         {
-                            if (pair.Value.Contains(Distance.baz))
-                                pair.Value.Remove(Distance.baz);
-                            else
+                            if (!pair.Value.Remove(Distance.baz))
                                 pair.Value.Add(Distance.baz);
                         }
                     }
@@ -345,25 +339,22 @@
 
         private static HashSet<List<Distance>> ModifyValue(HashSet<List<Distance>>? value)
         {
-            if (value == null)
-                value = new HashSet<List<Distance>>();
+            value ??= [];
 
             if (value.Count == 0)
-                value.Add(new List<Distance>());
+                value.Add([]);
             //else
             //value.Add(null); -- Thrift does not allow null values in containers
 
             foreach (var entry in value)
-                if( entry != null)
-                    entry.Add(Distance.baz);
+                entry?.Add(Distance.baz);
 
             return value;
         }
 
         private static Dictionary<Distance, Distance> ModifyValue(Dictionary<Distance, Distance>? value)
         {
-            if (value == null)
-                value = new Dictionary<Distance, Distance>();
+            value ??= [];
             value[Distance.foo] = value.ContainsKey(Distance.foo) ? ++value[Distance.foo] : Distance.foo;
             value[Distance.bar] = value.ContainsKey(Distance.bar) ? ++value[Distance.bar] : Distance.bar;
             value[Distance.baz] = value.ContainsKey(Distance.baz) ? ++value[Distance.baz] : Distance.baz;
@@ -372,22 +363,15 @@
 
         private static HashSet<Distance> ModifyValue(HashSet<Distance>? value)
         {
-            if (value == null)
-                value = new HashSet<Distance>();
+            value ??= [];
 
-            if (value.Contains(Distance.foo))
-                value.Remove(Distance.foo);
-            else
+            if (!value.Remove(Distance.foo))
                 value.Add(Distance.foo);
 
-            if (value.Contains(Distance.bar))
-                value.Remove(Distance.bar);
-            else
+            if (!value.Remove(Distance.bar))
                 value.Add(Distance.bar);
 
-            if (value.Contains(Distance.baz))
-                value.Remove(Distance.baz);
-            else
+            if (!value.Remove(Distance.baz))
                 value.Add(Distance.baz);
 
             return value;
@@ -395,8 +379,7 @@
 
         private static List<Distance> ModifyValue(List<Distance>? value)
         {
-            if (value == null)
-                value = new List<Distance>();
+            value ??= [];
             value.Add(Distance.foo);
             value.Add(Distance.bar);
             value.Add(Distance.baz);
@@ -410,36 +393,32 @@
 
         private static Dictionary<sbyte, short> ModifyValue(Dictionary<sbyte, short>? value)
         {
-            if (value == null)
-                value = new Dictionary<sbyte, short>();
+            value ??= [];
             value.Add((sbyte)(value.Count + 10), (short)value.Count);
             return value;
         }
 
         private static HashSet<long> ModifyValue(HashSet<long>? value)
         {
-            if (value == null)
-                value = new HashSet<long>();
+            value ??= [];
             value.Add(value.Count+100);
             return value;
         }
 
         private static List<int> ModifyValue(List<int>? value)
         {
-            if (value == null)
-                value = new List<int>();
+            value ??= [];
             value.Add(value.Count);
             return value;
         }
 
         private static byte[] ModifyValue(byte[]? value)
         {
-            if (value == null)
-                value = new byte[1] { 0 };
+            value ??= [0];
             if (value.Length > 0)
                 value[0] = (value[0] < 0xFF) ? ++value[0] : (byte)0;
             else
-                value = new byte[1] { 0 };
+                value = [0];
             return value;
         }
 
diff --git a/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs b/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs
index 80eacc2..09f7251 100644
--- a/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs
+++ b/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs
@@ -25,6 +25,7 @@
 using OptReqDefTest;
 using Thrift.Collections;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
 #pragma warning disable IDE0017  // init can be simplified - we don't want that here
 
 namespace Thrift.Tests.DataModel
diff --git a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
index 6d39151..03e3efa 100644
--- a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation(ASF) under one
+// Licensed to the Apache Software Foundation(ASF) under one
 // or more contributor license agreements.See the NOTICE file
 // distributed with this work for additional information
 // regarding copyright ownership.The ASF licenses this file
@@ -34,17 +34,17 @@
             // input/output
             var sets = new List<Tuple<TType, byte[]>>
             {
-                new Tuple<TType, byte[]>(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
-                new Tuple<TType, byte[]>(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
-                new Tuple<TType, byte[]>(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
-                new Tuple<TType, byte[]>(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
-                new Tuple<TType, byte[]>(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
-                new Tuple<TType, byte[]>(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
-                new Tuple<TType, byte[]>(TType.String, TJSONProtocolConstants.TypeNames.NameString),
-                new Tuple<TType, byte[]>(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
-                new Tuple<TType, byte[]>(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
-                new Tuple<TType, byte[]>(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
-                new Tuple<TType, byte[]>(TType.List, TJSONProtocolConstants.TypeNames.NameList),
+                new(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
+                new(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
+                new(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
+                new(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
+                new(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
+                new(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
+                new(TType.String, TJSONProtocolConstants.TypeNames.NameString),
+                new(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
+                new(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
+                new(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
+                new(TType.List, TJSONProtocolConstants.TypeNames.NameList),
             };
 
             foreach (var t in sets)
@@ -73,17 +73,17 @@
             // input/output
             var sets = new List<Tuple<TType, byte[]>>
             {
-                new Tuple<TType, byte[]>(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
-                new Tuple<TType, byte[]>(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
-                new Tuple<TType, byte[]>(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
-                new Tuple<TType, byte[]>(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
-                new Tuple<TType, byte[]>(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
-                new Tuple<TType, byte[]>(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
-                new Tuple<TType, byte[]>(TType.String, TJSONProtocolConstants.TypeNames.NameString),
-                new Tuple<TType, byte[]>(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
-                new Tuple<TType, byte[]>(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
-                new Tuple<TType, byte[]>(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
-                new Tuple<TType, byte[]>(TType.List, TJSONProtocolConstants.TypeNames.NameList),
+                new(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
+                new(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
+                new(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
+                new(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
+                new(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
+                new(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
+                new(TType.String, TJSONProtocolConstants.TypeNames.NameString),
+                new(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
+                new(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
+                new(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
+                new(TType.List, TJSONProtocolConstants.TypeNames.NameList),
             };
 
             foreach (var t in sets)
@@ -96,21 +96,21 @@
         [ExpectedException(typeof(TProtocolException))]
         public void GetTypeIdForTypeName_TStopTypeName_Test()
         {
-            TJSONProtocolHelper.GetTypeIdForTypeName(new []{(byte)TType.Stop, (byte)TType.Stop});
+            TJSONProtocolHelper.GetTypeIdForTypeName([(byte)TType.Stop, (byte)TType.Stop]);
         }
 
         [TestMethod]
         [ExpectedException(typeof(TProtocolException))]
         public void GetTypeIdForTypeName_NonExistingTypeName_Test()
         {
-            TJSONProtocolHelper.GetTypeIdForTypeName(new byte[]{100});
+            TJSONProtocolHelper.GetTypeIdForTypeName([100]);
         }
 
         [TestMethod]
         [ExpectedException(typeof(TProtocolException))]
         public void GetTypeIdForTypeName_EmptyName_Test()
         {
-            TJSONProtocolHelper.GetTypeIdForTypeName(new byte[] {});
+            TJSONProtocolHelper.GetTypeIdForTypeName([]);
         }
 
         [TestMethod]
@@ -169,4 +169,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
index 4054a29..4f14ba7 100644
--- a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
@@ -51,12 +51,8 @@
             Assert.IsTrue(result.WrappedReader.GetType().Name.Equals("LookaheadReader", StringComparison.OrdinalIgnoreCase));
         }
 
-        private class TJSONProtocolWrapper : TJsonProtocol
+        private class TJSONProtocolWrapper(TTransport trans) : TJsonProtocol(trans)
         {
-            public TJSONProtocolWrapper(TTransport trans) : base(trans)
-            {
-            }
-
             public object WrappedContext => Context;
             public object WrappedReader => Reader;
             public int WrappedRecursionDepth => RecursionDepth;
diff --git a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
index 94b7b09..54ce1e8 100644
--- a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
+++ b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
@@ -19,7 +19,8 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latestMajor</LangVersion>
     <Version>0.20.0.0</Version>
     <Nullable>enable</Nullable>
   </PropertyGroup>
diff --git a/lib/netstd/Thrift/.editorconfig b/lib/netstd/Thrift/.editorconfig
index 54b698c..82ff4a3 100644
--- a/lib/netstd/Thrift/.editorconfig
+++ b/lib/netstd/Thrift/.editorconfig
@@ -2,3 +2,8 @@
 
 # CS1591: missing XML comment for public element
 dotnet_diagnostic.CS1591.severity = silent
+
+# silence certain yet unfixed false positives for net8
+dotnet_diagnostic.IDE0290.severity = silent
+dotnet_diagnostic.CA1510.severity = silent
+dotnet_diagnostic.CA1513.severity = silent
diff --git a/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs b/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs
index 9759058..5fc1fda 100644
--- a/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs
+++ b/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs
@@ -23,6 +23,11 @@
 using Thrift.Protocol;
 using Thrift.Protocol.Entities;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0028 // net8 - simplified collection init 
+#pragma warning disable IDE0300 // net8 - simplified collection init 
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Processor
 {
     // ReSharper disable once InconsistentNaming
@@ -30,8 +35,7 @@
     {
         //TODO: Localization
 
-        private readonly Dictionary<string, ITAsyncProcessor> _serviceProcessorMap =
-            new Dictionary<string, ITAsyncProcessor>();
+        private readonly Dictionary<string, ITAsyncProcessor> _serviceProcessorMap = new Dictionary<string, ITAsyncProcessor>();
 
         public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot)
         {
diff --git a/lib/netstd/Thrift/Processor/TSingletonProcessorFactory.cs b/lib/netstd/Thrift/Processor/TSingletonProcessorFactory.cs
index 97ecff6..568a50c 100644
--- a/lib/netstd/Thrift/Processor/TSingletonProcessorFactory.cs
+++ b/lib/netstd/Thrift/Processor/TSingletonProcessorFactory.cs
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation(ASF) under one
+// Licensed to the Apache Software Foundation(ASF) under one
 // or more contributor license agreements.See the NOTICE file
 // distributed with this work for additional information
 // regarding copyright ownership.The ASF licenses this file
@@ -18,6 +18,9 @@
 using Thrift.Server;
 using Thrift.Transport;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Processor
 {
     // ReSharper disable once InconsistentNaming
@@ -35,4 +38,4 @@
             return _asyncProcessor;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Entities/TField.cs b/lib/netstd/Thrift/Protocol/Entities/TField.cs
index 4e29bb5..92fd41a 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TField.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TField.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
@@ -34,4 +37,4 @@
         // ReSharper disable once InconsistentNaming - do not rename - it used for generation 
         public short ID { get; set; }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Entities/TList.cs b/lib/netstd/Thrift/Protocol/Entities/TList.cs
index f599225..7e5c545 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TList.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TList.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
@@ -30,4 +33,4 @@
 
         public int Count { get; set; }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Entities/TMap.cs b/lib/netstd/Thrift/Protocol/Entities/TMap.cs
index 1efebe7..fba5780 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TMap.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TMap.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
@@ -33,4 +36,4 @@
 
         public int Count { get; set; }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Entities/TMessage.cs b/lib/netstd/Thrift/Protocol/Entities/TMessage.cs
index 08d741d..2e586ea 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TMessage.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TMessage.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
@@ -34,4 +37,4 @@
         // ReSharper disable once InconsistentNaming - do not rename - it used for generation 
         public int SeqID { get; set; }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Entities/TSet.cs b/lib/netstd/Thrift/Protocol/Entities/TSet.cs
index 692d564..d29cc0d 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TSet.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TSet.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
@@ -35,4 +38,4 @@
 
         public int Count { get; set; }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Entities/TStruct.cs b/lib/netstd/Thrift/Protocol/Entities/TStruct.cs
index d876087..b2fd000 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TStruct.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TStruct.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
diff --git a/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs b/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs
index 7feb698..6389184 100644
--- a/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs
@@ -24,6 +24,8 @@
 using Thrift.Protocol.Utilities;
 using Thrift.Transport;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
 
 namespace Thrift.Protocol
 {
@@ -33,8 +35,8 @@
         protected const uint VersionMask = 0xffff0000;
         protected const uint Version1 = 0x80010000;
 
-        protected bool StrictRead;
-        protected bool StrictWrite;
+        protected readonly bool StrictRead;
+        protected readonly bool StrictWrite;
 
         // minimize memory allocations by means of an preallocated bytes buffer
         // The value of 128 is arbitrarily chosen, the required minimum size must be sizeof(long)
@@ -470,15 +472,10 @@
 
         public class Factory : TProtocolFactory
         {
-            protected bool StrictRead;
-            protected bool StrictWrite;
+            protected readonly bool StrictRead;
+            protected readonly bool StrictWrite;
 
-            public Factory()
-                : this(false, true)
-            {
-            }
-
-            public Factory(bool strictRead, bool strictWrite)
+            public Factory(bool strictRead = false, bool strictWrite = true)
             {
                 StrictRead = strictRead;
                 StrictWrite = strictWrite;
diff --git a/lib/netstd/Thrift/Protocol/TCompactProtocol.cs b/lib/netstd/Thrift/Protocol/TCompactProtocol.cs
index dd38f48..8e5d00d 100644
--- a/lib/netstd/Thrift/Protocol/TCompactProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TCompactProtocol.cs
@@ -27,6 +27,8 @@
 using Thrift.Protocol.Utilities;
 using Thrift.Transport;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0301 // net8 - simplified collection init 
 
 namespace Thrift.Protocol
 {
diff --git a/lib/netstd/Thrift/Protocol/TJSONProtocol.cs b/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
index 9f761ae..64308d6 100644
--- a/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
@@ -27,6 +27,8 @@
 using Thrift.Protocol.Utilities;
 using Thrift.Transport;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
 
 namespace Thrift.Protocol
 {
diff --git a/lib/netstd/Thrift/Protocol/TMultiplexedProtocol.cs b/lib/netstd/Thrift/Protocol/TMultiplexedProtocol.cs
index fbc8c05..510dc28 100644
--- a/lib/netstd/Thrift/Protocol/TMultiplexedProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TMultiplexedProtocol.cs
@@ -19,6 +19,9 @@
 using System.Threading.Tasks;
 using Thrift.Protocol.Entities;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Protocol
 {
     /**
diff --git a/lib/netstd/Thrift/Protocol/ToString.cs b/lib/netstd/Thrift/Protocol/ToString.cs
index ae69d1c..9a94c08 100644
--- a/lib/netstd/Thrift/Protocol/ToString.cs
+++ b/lib/netstd/Thrift/Protocol/ToString.cs
@@ -34,16 +34,16 @@
                 sb.Append(", ");
 
             bool first_child = true;
-            if (self is string) // string is IEnumerable
+            if (self is string str) // string is IEnumerable
             {
                 sb.Append('"');
-                sb.Append(self);
+                sb.Append(str);
                 sb.Append('"');
             }
-            else if (self is IDictionary)
+            else if (self is IDictionary dict)
             {
                 sb.Append("{ ");
-                foreach (DictionaryEntry pair in (self as IDictionary))
+                foreach (DictionaryEntry pair in dict)
                 {
                     if (first_child)
                         first_child = false;
@@ -58,23 +58,23 @@
                 }
                 sb.Append('}');
             }
-            else if (self is IEnumerable)
+            else if (self is IEnumerable enumerable)
             {
                 sb.Append("{ ");
-                foreach (var elm in (self as IEnumerable))
+                foreach (var elm in enumerable)
                 {
                     elm.ToString(sb, first_child);
                     first_child = false;
                 }
                 sb.Append('}');
             }
-            else if (self is TBase)
+            else if (self is TBase tbase)
             {
-                sb.Append((self as TBase).ToString());
+                sb.Append(tbase.ToString());
             }
-            else if (self is double)
+            else if (self is double dbVal)
             {
-                sb.Append(((double)self).ToString(CultureInfo.InvariantCulture));
+                sb.Append(dbVal.ToString(CultureInfo.InvariantCulture));
             }
             else
             {
diff --git a/lib/netstd/Thrift/Protocol/Utilities/TBase64Utils.cs b/lib/netstd/Thrift/Protocol/Utilities/TBase64Utils.cs
index 90b8f88..15ef04f 100644
--- a/lib/netstd/Thrift/Protocol/Utilities/TBase64Utils.cs
+++ b/lib/netstd/Thrift/Protocol/Utilities/TBase64Utils.cs
@@ -17,6 +17,12 @@
 
 using System;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0300 // net8 - simplified collection init 
+#pragma warning disable IDE0028 // net8 - simplified collection init 
+#pragma warning disable CA1510  // net8 - use ThrowIfNull
+#pragma warning disable CA1513  // net8 - use ThrowIfNull
+
 namespace Thrift.Protocol.Utilities
 {
     // ReSharper disable once InconsistentNaming
@@ -98,4 +104,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/Utilities/TGuidExtensions.cs b/lib/netstd/Thrift/Protocol/Utilities/TGuidExtensions.cs
index 190ddbb..ecc0263 100644
--- a/lib/netstd/Thrift/Protocol/Utilities/TGuidExtensions.cs
+++ b/lib/netstd/Thrift/Protocol/Utilities/TGuidExtensions.cs
@@ -42,9 +42,7 @@
 
         private static void SwapBytes(ref byte one, ref byte two)
         {
-            var tmp = one;
-            one = two;
-            two = tmp;
+            (two, one) = (one, two);
         }
 
         #region SelfTest
diff --git a/lib/netstd/Thrift/Protocol/Utilities/TJsonProtocolConstants.cs b/lib/netstd/Thrift/Protocol/Utilities/TJsonProtocolConstants.cs
index f8c261a..6e248db 100644
--- a/lib/netstd/Thrift/Protocol/Utilities/TJsonProtocolConstants.cs
+++ b/lib/netstd/Thrift/Protocol/Utilities/TJsonProtocolConstants.cs
@@ -15,6 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0300 // net8 - simplified collection init 
+
 namespace Thrift.Protocol.Utilities
 {
     // ReSharper disable once InconsistentNaming
diff --git a/lib/netstd/Thrift/Server/TServer.cs b/lib/netstd/Thrift/Server/TServer.cs
index 3d4f3fc..5f5bc49 100644
--- a/lib/netstd/Thrift/Server/TServer.cs
+++ b/lib/netstd/Thrift/Server/TServer.cs
@@ -65,8 +65,7 @@
         // Log delegation? deprecated, use ILogger 
         protected void LogError( string msg)
         {
-            if (Logger != null)
-                Logger.LogError("{Msg}",msg);  // NOTE: Log message template, not string interpolation!
+            Logger?.LogError("{Msg}",msg);  // NOTE: Log message template, not string interpolation!
         }
 
         public abstract void Stop();
diff --git a/lib/netstd/Thrift/Server/TSimpleAsyncServer.cs b/lib/netstd/Thrift/Server/TSimpleAsyncServer.cs
index f1f6277..ffa3b88 100644
--- a/lib/netstd/Thrift/Server/TSimpleAsyncServer.cs
+++ b/lib/netstd/Thrift/Server/TSimpleAsyncServer.cs
@@ -23,6 +23,8 @@
 using System.Threading.Tasks;
 using Microsoft.Extensions.Logging;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
 
 namespace Thrift.Server
 {
diff --git a/lib/netstd/Thrift/Thrift.csproj b/lib/netstd/Thrift/Thrift.csproj
index 2ebfb06..c7b2a82 100644
--- a/lib/netstd/Thrift/Thrift.csproj
+++ b/lib/netstd/Thrift/Thrift.csproj
@@ -19,7 +19,7 @@
   -->
 
   <PropertyGroup>
-    <TargetFrameworks>netstandard2.1;netstandard2.0;net6.0;net7.0</TargetFrameworks>
+    <TargetFrameworks>netstandard2.1;netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
     <AssemblyName>Thrift</AssemblyName>
     <PackageId>ApacheThrift</PackageId>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
diff --git a/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs b/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs
index bda1290..0a51c9a 100644
--- a/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs
@@ -25,6 +25,9 @@
 using System.Threading;
 using System.Threading.Tasks;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0028 // net8 - simplified collection init 
+
 namespace Thrift.Transport.Client
 {
     //TODO: check for correct work
diff --git a/lib/netstd/Thrift/Transport/Layered/TFramedTransport.cs b/lib/netstd/Thrift/Transport/Layered/TFramedTransport.cs
index 694ea0f..5e67f10 100644
--- a/lib/netstd/Thrift/Transport/Layered/TFramedTransport.cs
+++ b/lib/netstd/Thrift/Transport/Layered/TFramedTransport.cs
@@ -21,6 +21,10 @@
 using System.Threading;
 using System.Threading.Tasks;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable CA1510  // net8 - use ThrowIfNull
+#pragma warning disable CA1513  // net8 - use ThrowIfNull
+
 namespace Thrift.Transport
 {
     // ReSharper disable once InconsistentNaming
diff --git a/lib/netstd/Thrift/Transport/Layered/TLayeredTransport.cs b/lib/netstd/Thrift/Transport/Layered/TLayeredTransport.cs
index 98fbd22..3d855a4 100644
--- a/lib/netstd/Thrift/Transport/Layered/TLayeredTransport.cs
+++ b/lib/netstd/Thrift/Transport/Layered/TLayeredTransport.cs
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation(ASF) under one
+// Licensed to the Apache Software Foundation(ASF) under one
 // or more contributor license agreements.See the NOTICE file
 // distributed with this work for additional information
 // regarding copyright ownership.The ASF licenses this file
@@ -16,8 +16,9 @@
 // under the License.
 
 using System;
-using System.Collections.Generic;
-using System.Text;
+
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
 
 namespace Thrift.Transport
 {
diff --git a/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs b/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
index b1ed91e..138c7fd 100644
--- a/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
@@ -28,6 +28,11 @@
 using System.IO;
 using System.Diagnostics;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0028 // net8 - simplified collection init 
+#pragma warning disable IDE0300 // net8 - simplified collection init 
+#pragma warning disable IDE0290 // net8 - primary CTOR
+#pragma warning disable SYSLIB1054 // net8 - use LibraryImport attribute
 #pragma warning disable CS1998  // async no await
 
 namespace Thrift.Transport.Server
@@ -46,7 +51,7 @@
         // to manage incoming connections, we set up a task for each stream to listen on
         private struct TaskStreamPair
         {
-            public NamedPipeServerStream Stream;
+            public readonly NamedPipeServerStream Stream;
             public Task Task;
 
             public TaskStreamPair(NamedPipeServerStream stream, Task task)
@@ -321,8 +326,9 @@
 
                 // there must be an exact mapping between task index and stream index
                 Debug.Assert(_streams.Count == tasks.Count);
+                #pragma warning disable IDE0305  // see https://github.com/dotnet/roslyn/issues/70656 - yet unsolved
                 var index = Task.WaitAny(tasks.ToArray(), cancellationToken);
-
+                #pragma warning restore IDE0305 
                 var trans = new ServerTransport(_streams[index].Stream, Configuration);
                 _streams.RemoveAt(index); // pass stream ownership to ServerTransport
 
diff --git a/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs b/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
index 31ecef3..43663c3 100644
--- a/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
@@ -22,6 +22,9 @@
 using System.Threading.Tasks;
 using Thrift.Transport.Client;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Transport.Server
 {
 
diff --git a/lib/netstd/Thrift/Transport/Server/TServerTransport.cs b/lib/netstd/Thrift/Transport/Server/TServerTransport.cs
index 5366114..70857c5 100644
--- a/lib/netstd/Thrift/Transport/Server/TServerTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TServerTransport.cs
@@ -18,6 +18,9 @@
 using System.Threading;
 using System.Threading.Tasks;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable IDE0290 // net8 - primary CTOR
+
 namespace Thrift.Transport
 {
     // ReSharper disable once InconsistentNaming
@@ -40,14 +43,8 @@
 
         public async ValueTask<TTransport> AcceptAsync(CancellationToken cancellationToken = default)
         {
-            var transport = await AcceptImplementationAsync(cancellationToken);
-
-            if (transport == null)
-            {
-                throw new TTransportException($"{nameof(AcceptImplementationAsync)} should not return null");
-            }
-
-            return transport;
+            return await AcceptImplementationAsync(cancellationToken)
+                ?? throw new TTransportException($"{nameof(AcceptImplementationAsync)} should not return null");
         }
     }
 }
diff --git a/lib/netstd/Thrift/Transport/TTransport.cs b/lib/netstd/Thrift/Transport/TTransport.cs
index 2f87ca0..4420224 100644
--- a/lib/netstd/Thrift/Transport/TTransport.cs
+++ b/lib/netstd/Thrift/Transport/TTransport.cs
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation(ASF) under one
+// Licensed to the Apache Software Foundation(ASF) under one
 // or more contributor license agreements.See the NOTICE file
 // distributed with this work for additional information
 // regarding copyright ownership.The ASF licenses this file
@@ -21,6 +21,10 @@
 using System.Threading;
 using System.Threading.Tasks;
 
+#pragma warning disable IDE0079 // net20 - unneeded suppression
+#pragma warning disable CA1510  // net8 - use ThrowIfNull
+#pragma warning disable CA1513  // net8 - use ThrowIfNull
+
 namespace Thrift.Transport
 {
     //TODO: think about client info