THRIFT-5746 Upgrade to net8
Client: netstd
Patch: Jens Geyer
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