diff --git a/test/netstd/Client/Performance/PerformanceTests.cs b/test/netstd/Client/Performance/PerformanceTests.cs
index 2c79aa6..f9eb9e4 100644
--- a/test/netstd/Client/Performance/PerformanceTests.cs
+++ b/test/netstd/Client/Performance/PerformanceTests.cs
@@ -28,6 +28,8 @@
 using System.Diagnostics;
 using Thrift.Transport;
 
+#pragma warning disable CS1998  // no await in async method
+
 namespace Client.Tests
 {
     public class PerformanceTests
@@ -37,9 +39,9 @@
         private TMemoryBufferTransport MemBuffer;
         private TTransport Transport;
         private LayeredChoice Layered;
-        private readonly TConfiguration Configuration = new TConfiguration();
+        private readonly TConfiguration Configuration = new();
 
-        internal static int Execute()
+        internal static async Task<int> Execute()
         {
             var instance = new PerformanceTests();
             instance.ProtocolPeformanceTestAsync().Wait();
diff --git a/test/netstd/Client/Program.cs b/test/netstd/Client/Program.cs
index bcc02a2..09a9cf2 100644
--- a/test/netstd/Client/Program.cs
+++ b/test/netstd/Client/Program.cs
@@ -19,13 +19,14 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Runtime.InteropServices;
+using System.Threading.Tasks;
 using ThriftTest;
 
 namespace Client
 {
     public class Program
     {
-        public static int Main(string[] args)
+        static async Task<int> Main(string[] args)
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
@@ -46,15 +47,15 @@
                 case "client":  // crosstest wants to pass this, so just emit a hint and ignore
                     Console.WriteLine("Hint: The 'client' argument is no longer required.");
                     argslist.RemoveAt(0);
-                    return TestClient.Execute(argslist);
+                    return await TestClient.Execute(argslist);
                 case "--performance":
                 case "--performance-test":
-                    return Tests.PerformanceTests.Execute();
+                    return await Tests.PerformanceTests.Execute();
                 case "--help":
                     PrintHelp();
                     return 0;
                 default:
-                    return TestClient.Execute(argslist);
+                    return await TestClient.Execute(argslist);
             }
         }
 
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index 2d18cf1..38bccf1 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -17,6 +17,7 @@
 
 #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;
@@ -322,7 +323,7 @@
                 numIterations = param.numIterations;
             }
 
-            public void Execute()
+            public async Task Execute()
             {
                 if (done)
                 {
@@ -335,7 +336,7 @@
                     try
                     {
                         if (!transport.IsOpen)
-                            transport.OpenAsync(MakeTimeoutToken()).GetAwaiter().GetResult();
+                            await transport.OpenAsync(MakeTimeoutToken());
                     }
                     catch (TTransportException ex)
                     {
@@ -356,7 +357,7 @@
 
                     try
                     {
-                        ReturnCode |= ExecuteClientTest(client).GetAwaiter().GetResult(); ;
+                        ReturnCode |= await ExecuteClientTest(client);
                     }
                     catch (Exception ex)
                     {
@@ -393,7 +394,7 @@
             Console.WriteLine();
         }
 
-        public static int Execute(List<string> args)
+        public static async Task<int> Execute(List<string> args)
         {
             try
             {
@@ -414,15 +415,9 @@
                 var tests = Enumerable.Range(0, param.numThreads).Select(_ => new ClientTest(param)).ToArray();
 
                 //issue tests on separate threads simultaneously
-                var threads = tests.Select(test => new Task(test.Execute)).ToArray();
                 var start = DateTime.Now;
-                foreach (var t in threads)
-                {
-                    t.Start();
-                }
-
-                Task.WaitAll(threads);
-
+                var tasks = tests.Select(test => test.Execute()).ToArray();
+                Task.WaitAll(tasks);
                 Console.WriteLine("Total time: " + (DateTime.Now - start));
                 Console.WriteLine();
                 return tests.Select(t => t.ReturnCode).Aggregate((r1, r2) => r1 | r2);
@@ -660,37 +655,13 @@
                 mapout[j] = j - 10;
             }
             Console.Write("testMap({");
-            var first = true;
-            foreach (var key in mapout.Keys)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(key + " => " + mapout[key]);
-            }
+            Console.Write(string.Join(", ", mapout.Select((pair) => { return pair.Key + " => " + pair.Value; })));
             Console.Write("})");
 
             var mapin = await client.testMap(mapout, MakeTimeoutToken());
 
             Console.Write(" = {");
-            first = true;
-            foreach (var key in mapin.Keys)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(key + " => " + mapin[key]);
-            }
+            Console.Write(string.Join(", ", mapin.Select((pair) => { return pair.Key + " => " + pair.Value; })));
             Console.WriteLine("}");
 
             // TODO: Validate received message
@@ -700,37 +671,13 @@
                 listout.Add(j);
             }
             Console.Write("testList({");
-            first = true;
-            foreach (var j in listout)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
+            Console.Write(string.Join(", ", listout));
             Console.Write("})");
 
             var listin = await client.testList(listout, MakeTimeoutToken());
 
             Console.Write(" = {");
-            first = true;
-            foreach (var j in listin)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
+            Console.Write(string.Join(", ", listin));
             Console.WriteLine("}");
 
             //set
@@ -741,37 +688,13 @@
                 setout.Add(j);
             }
             Console.Write("testSet({");
-            first = true;
-            foreach (int j in setout)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
+            Console.Write(string.Join(", ", setout));
             Console.Write("})");
 
             var setin = await client.testSet(setout, MakeTimeoutToken());
 
             Console.Write(" = {");
-            first = true;
-            foreach (int j in setin)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
+            Console.Write(string.Join(", ", setin));
             Console.WriteLine("}");
 
 
diff --git a/test/netstd/Server/Program.cs b/test/netstd/Server/Program.cs
index 8f1f36d..a319b22 100644
--- a/test/netstd/Server/Program.cs
+++ b/test/netstd/Server/Program.cs
@@ -20,12 +20,13 @@
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using ThriftTest;
+using System.Threading.Tasks;
 
 namespace Server
 {
     public class Program
     {
-        public static int Main(string[] args)
+        static async Task<int> Main(string[] args)
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
@@ -46,12 +47,12 @@
                 case "server":  // crosstest wants to pass this, so just emit a hint and ignore
                     Console.WriteLine("Hint: The 'server' argument is no longer required.");
                     argslist.RemoveAt(0);
-                    return TestServer.Execute(argslist);
+                    return await TestServer.Execute(argslist);
                 case "--help":
                     PrintHelp();
                     return 0;
                 default:
-                    return TestServer.Execute(argslist);
+                    return await TestServer.Execute(argslist);
             }
         }
 
diff --git a/test/netstd/Server/TestServer.cs b/test/netstd/Server/TestServer.cs
index 471d6c8..65458d6 100644
--- a/test/netstd/Server/TestServer.cs
+++ b/test/netstd/Server/TestServer.cs
@@ -500,13 +500,11 @@
                 return Task.FromResult(result);
             }
 
-            public Task testOneway(int secondsToSleep, CancellationToken cancellationToken)
+            public async Task testOneway(int secondsToSleep, CancellationToken cancellationToken)
             {
                 logger.Invoke("testOneway({0}), sleeping...", secondsToSleep);
-                Task.Delay(secondsToSleep * 1000, cancellationToken).GetAwaiter().GetResult();
+                await Task.Delay(secondsToSleep * 1000, cancellationToken);
                 logger.Invoke("testOneway finished");
-
-                return Task.CompletedTask;
             }
         }
 
@@ -543,7 +541,7 @@
             return cert;
         }
 
-        public static int Execute(List<string> args)
+        public static async Task<int> Execute(List<string> args)
         {
             using (var loggerFactory = new LoggerFactory()) //.AddConsole().AddDebug();
             {
@@ -648,7 +646,7 @@
                                       (param.protocol == ProtocolChoice.Compact ? " with compact protocol" : "") +
                                       (param.protocol == ProtocolChoice.Json ? " with json protocol" : "") +
                                       "...");
-                    serverEngine.ServeAsync(CancellationToken.None).GetAwaiter().GetResult();
+                    await serverEngine.ServeAsync(CancellationToken.None);
                     Console.ReadLine();
                 }
                 catch (Exception x)
