THRIFT-5479 Add net 6 support
diff --git a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc
index 88f8da4..1f8e169 100644
--- a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc
@@ -304,7 +304,8 @@
 
 void t_netstd_generator::start_netstd_namespace(ostream& out)
 {
-    out << "#pragma warning disable IDE0079  // remove unnecessary pragmas" << endl
+    out << "#nullable disable                // suppress C# 8.0 nullable contexts (we still support earlier versions)" << endl
+        << "#pragma warning disable IDE0079  // remove unnecessary pragmas" << endl
         << "#pragma warning disable IDE1006  // parts of the code use IDL spelling" << endl
         << "#pragma warning disable IDE0083  // pattern matching \"that is not SomeType\" requires net5.0 but we still support earlier versions" << endl
         << endl;
@@ -862,7 +863,7 @@
 
     f_struct.open(f_struct_name.c_str());
 
-  reset_indent();
+    reset_indent();
     f_struct << autogen_comment() << netstd_type_usings() << netstd_thrift_usings() << endl;
 
     generate_netstd_struct_definition(f_struct, tstruct, is_exception);
diff --git a/compiler/cpp/src/thrift/generate/t_netstd_generator.h b/compiler/cpp/src/thrift/generate/t_netstd_generator.h
index 47a7042..31226f2 100644
--- a/compiler/cpp/src/thrift/generate/t_netstd_generator.h
+++ b/compiler/cpp/src/thrift/generate/t_netstd_generator.h
@@ -150,6 +150,18 @@
   string convert_to_pascal_case(const string& str);
   string get_enum_class_name(t_type* type);
 
+protected:
+  std::string autogen_comment() override {
+    return std::string("/**\n") 
+                      + " * <auto-generated>\n"
+                      + " * " + autogen_summary() + "\n" 
+                      + " * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n"
+                      + " * </auto-generated>\n"
+                      " */\n"
+                      ;
+  }
+
+
 private:
   string namespace_name_;
   string namespace_dir_;
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>
diff --git a/test/netstd/Client/Client.csproj b/test/netstd/Client/Client.csproj
index c7d5349..859297f 100644
--- a/test/netstd/Client/Client.csproj
+++ b/test/netstd/Client/Client.csproj
@@ -31,6 +31,7 @@
     <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
     <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
     <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/test/netstd/Client/Performance/PerformanceTests.cs b/test/netstd/Client/Performance/PerformanceTests.cs
index f9eb9e4..c1f00dd 100644
--- a/test/netstd/Client/Performance/PerformanceTests.cs
+++ b/test/netstd/Client/Performance/PerformanceTests.cs
@@ -34,10 +34,10 @@
 {
     public class PerformanceTests
     {
-        private CancellationTokenSource Cancel;
-        private CrazyNesting Testdata;
-        private TMemoryBufferTransport MemBuffer;
-        private TTransport Transport;
+        private CancellationTokenSource Cancel = new();
+        private CrazyNesting? Testdata;
+        private TMemoryBufferTransport? MemBuffer;
+        private TTransport? Transport;
         private LayeredChoice Layered;
         private readonly TConfiguration Configuration = new();
 
@@ -76,52 +76,49 @@
             }
         }
 
-        private Task<TProtocol> GenericProtocolFactory<T>(bool forWrite)
+        private async Task<TProtocol> GenericProtocolFactory<T>(bool forWrite)
             where T : TProtocol
         {
             var oldTrans = Transport;
             try
             {
+                Transport = null;
+
                 // read happens after write here, so let's take over the written bytes
                 if (forWrite)
                     MemBuffer = new TMemoryBufferTransport(Configuration);  
                 else
-                    MemBuffer = new TMemoryBufferTransport(MemBuffer.GetBuffer(), Configuration);
+                    MemBuffer = new TMemoryBufferTransport(MemBuffer?.GetBuffer(), Configuration);
 
                 //  layered transports anyone?
-                switch (Layered)
+                Transport = Layered switch
                 {
-                    case LayeredChoice.None:
-                        Transport = MemBuffer;
-                        break;
-                    case LayeredChoice.Framed:
-                        Transport = new TFramedTransport(MemBuffer);
-                        break;
-                    case LayeredChoice.Buffered:
-                        Transport = new TBufferedTransport(MemBuffer);
-                        break;
-                    default:
-                        Debug.Assert(false);
-                        break;
-                }
+                    LayeredChoice.None => MemBuffer,
+                    LayeredChoice.Framed => new TFramedTransport(MemBuffer),
+                    LayeredChoice.Buffered => new TBufferedTransport(MemBuffer),
+                    _ => throw new Exception("Unhandled case " + Layered.ToString()),
+                };
+                ;
 
                 if (!Transport.IsOpen)
                     Transport.OpenAsync().Wait();
 
-                var instance = (T)Activator.CreateInstance(typeof(T), Transport);
-                return Task.FromResult<TProtocol>(instance);
+                if (Activator.CreateInstance(typeof(T), Transport) is T instance)
+                    return instance;
+
+                throw new Exception("Unexpected.");
             }
             finally
             {
-                if (oldTrans is IDisposable)
-                    (oldTrans as IDisposable).Dispose();
+                oldTrans?.Dispose();
             }
         }
 
         private string GetProtocolTransportName(TProtocol proto)
         {
-            var name = Transport.GetType().Name;
-            if (name.Equals(MemBuffer.GetType().Name))
+            var name = Transport?.GetType().Name;
+            var bufnm = MemBuffer?.GetType().Name;
+            if ((name is null) || name.Equals(bufnm))
                 name = string.Empty;
             else
                 name = " + " + name;
@@ -135,6 +132,9 @@
         {
             var stop = new Stopwatch();
 
+            if ((Testdata is null) || (Transport is null))
+                throw new Exception("unexpected internal state");
+
             var proto = await factory(true);
             stop.Start();
             await Testdata.WriteAsync(proto, Cancel.Token);
diff --git a/test/netstd/Client/Performance/TestDataFactory.cs b/test/netstd/Client/Performance/TestDataFactory.cs
index 9896285..833947c 100644
--- a/test/netstd/Client/Performance/TestDataFactory.cs
+++ b/test/netstd/Client/Performance/TestDataFactory.cs
@@ -26,7 +26,7 @@
     
     static class TestDataFactory
     {
-        public static CrazyNesting CreateCrazyNesting(int count = 10)
+        public static CrazyNesting? CreateCrazyNesting(int count = 10)
         {
             if (count <= 0)
                 return null;
@@ -78,13 +78,15 @@
 
         private static Dictionary<Numberz, long> CreateUserMap(int count)
         {
-            var retval = new Dictionary<Numberz, long>();
-            retval.Add(Numberz.ONE, count);
-            retval.Add(Numberz.TWO, count);
-            retval.Add(Numberz.THREE, count);
-            retval.Add(Numberz.FIVE, count);
-            retval.Add(Numberz.SIX, count);
-            retval.Add(Numberz.EIGHT, count);
+            var retval = new Dictionary<Numberz, long>
+            {
+                { Numberz.ONE, count },
+                { Numberz.TWO, count },
+                { Numberz.THREE, count },
+                { Numberz.FIVE, count },
+                { Numberz.SIX, count },
+                { Numberz.EIGHT, count }
+            };
             return retval;
         }
 
@@ -138,9 +140,10 @@
 
         private static Dictionary<Insanity, string> CreateListFieldDataDictValueListDict(int count)
         {
-            var retval = new Dictionary<Insanity, string>();
-            retval.Add(CreateInsanity(count), string.Format("data level {0}", count));
-            return retval;
+            return new Dictionary<Insanity, string>
+            {
+                { CreateInsanity(count), string.Format("data level {0}", count) }
+            };
         }
 
         private static byte[] CreateBytesArray(int count)
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index 38bccf1..0a7fa00 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -71,12 +71,12 @@
             public string host = "localhost";
             public int port = 9090;
             public int numThreads = 1;
-            public string url;
-            public string pipe;
+            public string url = string.Empty;
+            public string pipe = string.Empty;
             public LayeredChoice layered = LayeredChoice.None;
             public ProtocolChoice protocol = ProtocolChoice.Binary;
             public TransportChoice transport = TransportChoice.Socket;
-            private readonly TConfiguration Configuration = null;  // or new TConfiguration() if needed
+            private readonly TConfiguration Configuration = new();
 
             internal void Parse(List<string> args)
             {
@@ -210,7 +210,7 @@
                     "keys/",
                 };
 
-                string existingPath = null;
+                var existingPath = string.Empty;
                 foreach (var possiblePath in possiblePaths)
                 {
                     var path = Path.GetFullPath(possiblePath + clientCertName);
@@ -234,8 +234,7 @@
             public TTransport CreateTransport()
             {
                 // endpoint transport
-                TTransport trans = null;
-
+                TTransport trans;
                 switch (transport)
                 {
                     case TransportChoice.Http:
diff --git a/test/netstd/Server/Server.csproj b/test/netstd/Server/Server.csproj
index 7d5eb17..cda1dff 100644
--- a/test/netstd/Server/Server.csproj
+++ b/test/netstd/Server/Server.csproj
@@ -31,6 +31,7 @@
     <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
     <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
     <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/test/netstd/Server/TestServer.cs b/test/netstd/Server/TestServer.cs
index 65458d6..515a299 100644
--- a/test/netstd/Server/TestServer.cs
+++ b/test/netstd/Server/TestServer.cs
@@ -36,6 +36,7 @@
 
 #pragma warning disable IDE0063  // using can be simplified, we don't
 #pragma warning disable IDE0057  // substr can be simplified, we don't
+#pragma warning disable CS1998   // await missing
 
 namespace ThriftTest
 {
@@ -74,7 +75,7 @@
         internal TransportChoice transport = TransportChoice.Socket;
         internal ServerChoice server = ServerChoice.Simple;
         internal int port = 9090;
-        internal string pipe = null;
+        internal string pipe = string.Empty;
 
         internal void Parse(List<string> args)
         {
@@ -166,7 +167,7 @@
         public static int _clientID = -1;  // use with Interlocked only!
         #pragma warning restore CA2211
 
-        private static readonly TConfiguration Configuration = null;  // or new TConfiguration() if needed
+        private static readonly TConfiguration Configuration = new(); 
 
         public delegate void TestLogDelegate(string msg, params object[] values);
 
@@ -180,10 +181,10 @@
                 return Task.CompletedTask;
             }
 
-            public Task<object> CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken)
+            public async Task<object?> CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken)
             {
                 callCount++;
-                return Task.FromResult<object>(null);
+                return null;
             }
 
             public Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output, CancellationToken cancellationToken)
@@ -201,7 +202,7 @@
 
         public class TestHandlerAsync : ThriftTest.IAsync
         {
-            public TServer Server { get; set; }
+            //public TServer Server { get; set; }
             private readonly int handlerID;
             private readonly StringBuilder sb = new();
             private readonly TestLogDelegate logger;
@@ -520,7 +521,7 @@
                 "keys/",
             };
                         
-            string existingPath = null;
+            var existingPath = string.Empty;
             foreach (var possiblePath in possiblePaths)
             {
                 var path = Path.GetFullPath(possiblePath + serverCertName);
@@ -595,7 +596,7 @@
                     }
 
                     // Layered transport (mandatory)
-                    TTransportFactory transFactory = null;
+                    TTransportFactory? transFactory;
                     switch (param.buffering)
                     {
                         case BufferChoice.Framed: