THRIFT-5746 Upgrade to net8
Client: netstd
Patch: Jens Geyer
diff --git a/test/netstd/Client/Client.csproj b/test/netstd/Client/Client.csproj
index 1ae67fa..0e1eaa3 100644
--- a/test/netstd/Client/Client.csproj
+++ b/test/netstd/Client/Client.csproj
@@ -19,8 +19,8 @@
   -->
 
   <PropertyGroup>
-    <TargetFramework>net7.0</TargetFramework>
-    <LangVersion>9.0</LangVersion>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latestMajor</LangVersion>
     <AssemblyName>Client</AssemblyName>
     <PackageId>Client</PackageId>
     <OutputType>Exe</OutputType>
@@ -49,8 +49,8 @@
     <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
       <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
     </Exec>
-    <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
-    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
+    <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netstd:wcf,union,serial,net8 -r ./../../ThriftTest.thrift" />
+    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net8 -r ./../../ThriftTest.thrift" />
+    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net8 -r ./../../ThriftTest.thrift" />
   </Target>
 </Project>
diff --git a/test/netstd/Client/Performance/PerformanceTests.cs b/test/netstd/Client/Performance/PerformanceTests.cs
index 6ac3aed..5262379 100644
--- a/test/netstd/Client/Performance/PerformanceTests.cs
+++ b/test/netstd/Client/Performance/PerformanceTests.cs
@@ -28,8 +28,6 @@
 using System.Diagnostics;
 using Thrift.Transport;
 
-#pragma warning disable CS1998  // no await in async method
-
 namespace Client.Tests
 {
     public class PerformanceTests
@@ -44,7 +42,7 @@
         internal static async Task<int> Execute()
         {
             var instance = new PerformanceTests();
-            instance.ProtocolPeformanceTestAsync().Wait();
+            await instance.ProtocolPeformanceTestAsync();
 
             // debug only
             if (Debugger.IsAttached)
@@ -101,7 +99,7 @@
                 ;
 
                 if (!Transport.IsOpen)
-                    Transport.OpenAsync().Wait();
+                    await Transport.OpenAsync();
 
                 if (Activator.CreateInstance(typeof(T), Transport) is T instance)
                     return instance;
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index 3bf2daa..7486712 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -17,7 +17,6 @@
 
 #pragma warning disable IDE0066 // switch expression
 #pragma warning disable IDE0057 // substring
-#pragma warning disable CS1998  // no await in async method
 
 using System;
 using System.Collections.Generic;
@@ -93,19 +92,19 @@
                     }
                     else if (args[i].StartsWith("--pipe="))
                     {
-                        pipe = args[i].Substring(args[i].IndexOf("=") + 1);
+                        pipe = args[i].Substring(args[i].IndexOf('=') + 1);
                         transport = TransportChoice.NamedPipe;
                     }
                     else if (args[i].StartsWith("--host="))
                     {
                         // check there for ipaddress
-                        host = args[i].Substring(args[i].IndexOf("=") + 1);
+                        host = args[i].Substring(args[i].IndexOf('=') + 1);
                         if (transport != TransportChoice.TlsSocket)
                             transport = TransportChoice.Socket;
                     }
                     else if (args[i].StartsWith("--port="))
                     {
-                        port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1));
+                        port = int.Parse(args[i].Substring(args[i].IndexOf('=') + 1));
                         if (transport != TransportChoice.TlsSocket)
                             transport = TransportChoice.Socket;
                     }
@@ -393,7 +392,7 @@
             Console.WriteLine();
         }
 
-        public static async Task<int> Execute(List<string> args)
+        public static Task<int> Execute(List<string> args)
         {
             try
             {
@@ -408,7 +407,7 @@
                     Console.WriteLine("*** FAILED ***");
                     Console.WriteLine("Error while parsing arguments");
                     Console.WriteLine("{0} {1}\nStack:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
-                    return ErrorUnknown;
+                    return Task.FromResult(ErrorUnknown);
                 }
 
                 //issue tests on separate threads simultaneously
@@ -432,14 +431,14 @@
                 Task.WaitAll(tasks);
                 Console.WriteLine("Total time: " + (DateTime.Now - start));
                 Console.WriteLine();
-                return retcode;
+                return Task.FromResult(retcode);
             }
             catch (Exception outerEx)
             {
                 Console.WriteLine("*** FAILED ***");
                 Console.WriteLine("Unexpected error");
                 Console.WriteLine(outerEx.Message + "\n" + outerEx.StackTrace);
-                return ErrorUnknown;
+                return Task.FromResult(ErrorUnknown);
             }
         }
 
@@ -646,8 +645,8 @@
             var two = new CrazyNesting();
             one.String_field = "crazy";
             two.String_field = "crazy";
-            one.Binary_field = new byte[] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF };
-            two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF };
+            one.Binary_field = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF];
+            two.Binary_field = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF];
             if (typeof(CrazyNesting).GetMethod("Equals")?.DeclaringType == typeof(CrazyNesting))
             {
                 if (!one.Equals(two))
@@ -820,10 +819,7 @@
                 I32_thing = 8,
                 I64_thing = 8
             };
-            insane.Xtructs = new List<Xtruct>
-            {
-                truck
-            };
+            insane.Xtructs = [ truck ];
             Console.Write("testInsanity()");
             var whoa = await client.testInsanity(insane, MakeTimeoutToken());
             Console.Write(" = {");