diff --git a/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs b/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs
index cb6b07f..16dcc76 100644
--- a/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs
+++ b/lib/netstd/Benchmarks/Thrift.Benchmarks/CompactProtocolBenchmarks.cs
@@ -29,7 +29,7 @@
     public class CompactProtocolBenchmarks
     {
         private MemoryStream _Stream;
-        private TCompactProtocol _Protocol;
+        private TProtocol _Protocol;
 
         [Params(10000)]
         public int NumberOfOperationsPerIteration { get; set; }
diff --git a/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs b/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
index b8df515..62ab317 100644
--- a/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
+++ b/lib/netstd/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
@@ -57,13 +57,13 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteMessageBeginAsync(expected);
-                    await protocol.WriteMessageEndAsync();
+                    await protocol.WriteMessageBeginAsync(expected, default);
+                    await protocol.WriteMessageEndAsync(default);
 
                     stream.Seek(0, SeekOrigin.Begin);
 
-                    var actualMessage = await protocol.ReadMessageBeginAsync();
-                    await protocol.ReadMessageEndAsync();
+                    var actualMessage = await protocol.ReadMessageBeginAsync(default);
+                    await protocol.ReadMessageEndAsync(default);
 
                     var result = _compareLogic.Compare(expected, actualMessage);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -91,13 +91,13 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteStructBeginAsync(expected);
-                    await protocol.WriteStructEndAsync();
+                    await protocol.WriteStructBeginAsync(expected, default);
+                    await protocol.WriteStructEndAsync(default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadStructBeginAsync();
-                    await protocol.ReadStructEndAsync();
+                    var actual = await protocol.ReadStructBeginAsync(default);
+                    await protocol.ReadStructEndAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -126,13 +126,13 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteFieldBeginAsync(expected);
-                    await protocol.WriteFieldEndAsync();
+                    await protocol.WriteFieldBeginAsync(expected, default);
+                    await protocol.WriteFieldEndAsync(default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadFieldBeginAsync();
-                    await protocol.ReadFieldEndAsync();
+                    var actual = await protocol.ReadFieldBeginAsync(default);
+                    await protocol.ReadFieldEndAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -159,13 +159,13 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteMapBeginAsync(expected);
-                    await protocol.WriteMapEndAsync();
+                    await protocol.WriteMapBeginAsync(expected, default);
+                    await protocol.WriteMapEndAsync(default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadMapBeginAsync();
-                    await protocol.ReadMapEndAsync();
+                    var actual = await protocol.ReadMapBeginAsync(default);
+                    await protocol.ReadMapEndAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -193,13 +193,13 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteListBeginAsync(expected);
-                    await protocol.WriteListEndAsync();
+                    await protocol.WriteListBeginAsync(expected, default);
+                    await protocol.WriteListEndAsync(default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadListBeginAsync();
-                    await protocol.ReadListEndAsync();
+                    var actual = await protocol.ReadListBeginAsync(default);
+                    await protocol.ReadListEndAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -226,13 +226,13 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteSetBeginAsync(expected);
-                    await protocol.WriteSetEndAsync();
+                    await protocol.WriteSetBeginAsync(expected, default);
+                    await protocol.WriteSetEndAsync(default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadSetBeginAsync();
-                    await protocol.ReadSetEndAsync();
+                    var actual = await protocol.ReadSetBeginAsync(default);
+                    await protocol.ReadSetEndAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -259,11 +259,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteBoolAsync(expected);
+                    await protocol.WriteBoolAsync(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadBoolAsync();
+                    var actual = await protocol.ReadBoolAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -290,11 +290,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteByteAsync(expected);
+                    await protocol.WriteByteAsync(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadByteAsync();
+                    var actual = await protocol.ReadByteAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -321,11 +321,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteI16Async(expected);
+                    await protocol.WriteI16Async(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadI16Async();
+                    var actual = await protocol.ReadI16Async(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -352,11 +352,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteI32Async(expected);
+                    await protocol.WriteI32Async(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadI32Async();
+                    var actual = await protocol.ReadI32Async(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -383,11 +383,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteI64Async(expected);
+                    await protocol.WriteI64Async(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadI64Async();
+                    var actual = await protocol.ReadI64Async(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -414,11 +414,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteDoubleAsync(expected);
+                    await protocol.WriteDoubleAsync(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadDoubleAsync();
+                    var actual = await protocol.ReadDoubleAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -445,11 +445,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteStringAsync(expected);
+                    await protocol.WriteStringAsync(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadStringAsync();
+                    var actual = await protocol.ReadStringAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
@@ -476,11 +476,11 @@
                 {
                     var protocol = tuple.Item2;
 
-                    await protocol.WriteBinaryAsync(expected);
+                    await protocol.WriteBinaryAsync(expected, default);
 
                     stream?.Seek(0, SeekOrigin.Begin);
 
-                    var actual = await protocol.ReadBinaryAsync();
+                    var actual = await protocol.ReadBinaryAsync(default);
 
                     var result = _compareLogic.Compare(expected, actual);
                     Assert.IsTrue(result.AreEqual, result.DifferencesString);
diff --git a/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs b/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs
index e5aeaa6..b192210 100644
--- a/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs
+++ b/lib/netstd/Thrift/Processor/TMultiplexedProcessor.cs
@@ -40,10 +40,7 @@
 
         public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<bool>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             try
             {
@@ -129,14 +126,10 @@
                 _msgBegin = messageBegin;
             }
 
-            public override async ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
+            public override ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<TMessage>(cancellationToken);
-                }
-
-                return _msgBegin;
+                cancellationToken.ThrowIfCancellationRequested();
+                return new ValueTask<TMessage>(_msgBegin);
             }
         }
     }
diff --git a/lib/netstd/Thrift/Protocol/Entities/TStruct.cs b/lib/netstd/Thrift/Protocol/Entities/TStruct.cs
index e04167e..d876087 100644
--- a/lib/netstd/Thrift/Protocol/Entities/TStruct.cs
+++ b/lib/netstd/Thrift/Protocol/Entities/TStruct.cs
@@ -18,13 +18,13 @@
 namespace Thrift.Protocol.Entities
 {
     // ReSharper disable once InconsistentNaming
-    public struct TStruct
+    public readonly struct TStruct
     {
         public TStruct(string name)
         {
             Name = name;
         }
 
-        public string Name { get; set; }
+        public string Name { get;  }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs b/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs
index a00c5c1..28b7d29 100644
--- a/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TBinaryProtocol.cs
@@ -38,9 +38,6 @@
         // The value of 128 is arbitrarily chosen, the required minimum size must be sizeof(long)
         private byte[] PreAllocatedBuffer = new byte[128];
 
-        private static readonly TStruct AnonymousStruct = new TStruct(string.Empty);
-        private static readonly TField StopField = new TField() { Type = TType.Stop };
-
         public TBinaryProtocol(TTransport trans)
             : this(trans, false, true)
         {
@@ -55,10 +52,7 @@
 
         public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             if (StrictWrite)
             {
@@ -75,65 +69,47 @@
             }
         }
 
-        public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
+        public override Task WriteMessageEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
-        public override async Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
+        public override Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
-        public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
+        public override Task WriteStructEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
+            cancellationToken.ThrowIfCancellationRequested();
             await WriteByteAsync((sbyte) field.Type, cancellationToken);
             await WriteI16Async(field.ID, cancellationToken);
         }
 
-        public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
+        public override Task WriteFieldEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await WriteByteAsync((sbyte) TType.Stop, cancellationToken);
         }
 
         public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             PreAllocatedBuffer[0] = (byte)map.KeyType;
             PreAllocatedBuffer[1] = (byte)map.ValueType;
@@ -142,69 +118,47 @@
             await WriteI32Async(map.Count, cancellationToken);
         }
 
-        public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
-
+        public override Task WriteMapEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
+            cancellationToken.ThrowIfCancellationRequested();
             await WriteByteAsync((sbyte) list.ElementType, cancellationToken);
             await WriteI32Async(list.Count, cancellationToken);
         }
 
-        public override async Task WriteListEndAsync(CancellationToken cancellationToken)
+        public override Task WriteListEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
+            cancellationToken.ThrowIfCancellationRequested();
             await WriteByteAsync((sbyte) set.ElementType, cancellationToken);
             await WriteI32Async(set.Count, cancellationToken);
         }
 
-        public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
+        public override Task WriteSetEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
+            cancellationToken.ThrowIfCancellationRequested();
             await WriteByteAsync(b ? (sbyte) 1 : (sbyte) 0, cancellationToken);
         }
 
         public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             PreAllocatedBuffer[0] = (byte)b;
 
@@ -212,10 +166,8 @@
         }
         public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+
             BinaryPrimitives.WriteInt16BigEndian(PreAllocatedBuffer, i16);
 
             await Trans.WriteAsync(PreAllocatedBuffer, 0, 2, cancellationToken);
@@ -223,10 +175,7 @@
 
         public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             BinaryPrimitives.WriteInt32BigEndian(PreAllocatedBuffer, i32);
 
@@ -236,10 +185,7 @@
       
         public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             BinaryPrimitives.WriteInt64BigEndian(PreAllocatedBuffer, i64);
 
@@ -248,10 +194,7 @@
 
         public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await WriteI64Async(BitConverter.DoubleToInt64Bits(d), cancellationToken);
         }
@@ -259,10 +202,7 @@
 
         public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await WriteI32Async(bytes.Length, cancellationToken);
             await Trans.WriteAsync(bytes, 0, bytes.Length, cancellationToken);
@@ -270,10 +210,7 @@
 
         public override async ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TMessage>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var message = new TMessage();
             var size = await ReadI32Async(cancellationToken);
@@ -303,39 +240,27 @@
             return message;
         }
 
-        public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
+        public override Task ReadMessageEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
-        public override async ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
+        public override ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            return AnonymousStruct;
+            cancellationToken.ThrowIfCancellationRequested();
+            return new ValueTask<TStruct>(AnonymousStruct);
         }
 
-        public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
+        public override Task ReadStructEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TField>(cancellationToken);
-            }
-
+            cancellationToken.ThrowIfCancellationRequested();
 
             var type = (TType)await ReadByteAsync(cancellationToken);
             if (type == TType.Stop)
@@ -349,21 +274,16 @@
             };
         }
 
-        public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
+        public override Task ReadFieldEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TMap>(cancellationToken);
-            }
-
+            cancellationToken.ThrowIfCancellationRequested();
+ 
             var map = new TMap
             {
                 KeyType = (TType) await ReadByteAsync(cancellationToken),
@@ -374,20 +294,15 @@
             return map;
         }
 
-        public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
+        public override Task ReadMapEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TList> ReadListBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TList>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var list = new TList
             {
@@ -398,20 +313,15 @@
             return list;
         }
 
-        public override async Task ReadListEndAsync(CancellationToken cancellationToken)
+        public override Task ReadListEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TSet>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var set = new TSet
             {
@@ -422,30 +332,22 @@
             return set;
         }
 
-        public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
+        public override Task ReadSetEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<bool> ReadBoolAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<bool>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             return await ReadByteAsync(cancellationToken) == 1;
         }
 
         public override async ValueTask<sbyte> ReadByteAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<sbyte>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await Trans.ReadAllAsync(PreAllocatedBuffer, 0, 1, cancellationToken);
             return (sbyte)PreAllocatedBuffer[0];
@@ -453,10 +355,7 @@
 
         public override async ValueTask<short> ReadI16Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<short>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await Trans.ReadAllAsync(PreAllocatedBuffer, 0, 2, cancellationToken);
             var result = BinaryPrimitives.ReadInt16BigEndian(PreAllocatedBuffer);
@@ -465,10 +364,7 @@
 
         public override async ValueTask<int> ReadI32Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<int>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await Trans.ReadAllAsync(PreAllocatedBuffer, 0, 4, cancellationToken);
 
@@ -479,10 +375,7 @@
 
         public override async ValueTask<long> ReadI64Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<long>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await Trans.ReadAllAsync(PreAllocatedBuffer, 0, 8, cancellationToken);
             return BinaryPrimitives.ReadInt64BigEndian(PreAllocatedBuffer);
@@ -490,10 +383,7 @@
 
         public override async ValueTask<double> ReadDoubleAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<double>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var d = await ReadI64Async(cancellationToken);
             return BitConverter.Int64BitsToDouble(d);
@@ -501,10 +391,7 @@
 
         public override async ValueTask<byte[]> ReadBinaryAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<byte[]>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var size = await ReadI32Async(cancellationToken);
             Transport.CheckReadBytesAvailable(size);
@@ -515,10 +402,7 @@
 
         public override async ValueTask<string> ReadStringAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<string>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var size = await ReadI32Async(cancellationToken);
             return size > 0 ? await ReadStringBodyAsync(size, cancellationToken) : string.Empty;
@@ -526,10 +410,7 @@
 
         private async ValueTask<string> ReadStringBodyAsync(int size, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<string>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             if (size <= PreAllocatedBuffer.Length)
             {
diff --git a/lib/netstd/Thrift/Protocol/TCompactProtocol.cs b/lib/netstd/Thrift/Protocol/TCompactProtocol.cs
index bb531f4..066b327 100644
--- a/lib/netstd/Thrift/Protocol/TCompactProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TCompactProtocol.cs
@@ -39,8 +39,6 @@
         private const byte TypeMask = 0xE0; // 1110 0000
         private const byte TypeBits = 0x07; // 0000 0111
         private const int TypeShiftAmount = 5;
-        private static readonly TStruct AnonymousStruct = new TStruct(string.Empty);
-        private static readonly TField StopField = new TField(string.Empty, TType.Stop, 0);
 
         private const byte NoTypeOverride = 0xFF;
 
@@ -134,12 +132,10 @@
             await WriteStringAsync(message.Name, cancellationToken);
         }
 
-        public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
+        public override Task WriteMessageEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         /// <summary>
@@ -147,25 +143,23 @@
         ///     use it as an opportunity to put special placeholder markers on the field
         ///     stack so we can get the field id deltas correct.
         /// </summary>
-        public override async Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
+        public override Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             _lastField.Push(_lastFieldId);
             _lastFieldId = 0;
+
+            return Task.CompletedTask;
         }
 
-        public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
+        public override Task WriteStructEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             _lastFieldId = _lastField.Pop();
+
+            return Task.CompletedTask;
         }
 
         private async Task WriteFieldBeginInternalAsync(TField field, byte fieldType, CancellationToken cancellationToken)
@@ -208,20 +202,15 @@
             }
         }
 
-        public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
+        public override Task WriteFieldEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             PreAllocatedBuffer[0] = Types.Stop;
             await Trans.WriteAsync(PreAllocatedBuffer, 0, 1, cancellationToken);
@@ -229,10 +218,7 @@
 
         protected async Task WriteCollectionBeginAsync(TType elemType, int size, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Abstract method for writing the start of lists and sets. List and sets on
@@ -259,38 +245,28 @@
             await WriteCollectionBeginAsync(list.ElementType, list.Count, cancellationToken);
         }
 
-        public override async Task WriteListEndAsync(CancellationToken cancellationToken)
+        public override Task WriteListEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await WriteCollectionBeginAsync(set.ElementType, set.Count, cancellationToken);
         }
 
-        public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
+        public override Task WriteSetEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Write a boolean value. Potentially, this could be a boolean field, in
@@ -316,10 +292,7 @@
 
         public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             PreAllocatedBuffer[0] = (byte)b;
             await Trans.WriteAsync(PreAllocatedBuffer, 0, 1, cancellationToken);
@@ -327,10 +300,7 @@
 
         public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             Int32ToVarInt(IntToZigzag(i16), ref PreAllocatedVarInt);
             await Trans.WriteAsync(PreAllocatedVarInt.bytes, 0, PreAllocatedVarInt.count, cancellationToken);
@@ -357,10 +327,7 @@
 
         public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             Int32ToVarInt(IntToZigzag(i32), ref PreAllocatedVarInt);
             await Trans.WriteAsync(PreAllocatedVarInt.bytes, 0, PreAllocatedVarInt.count, cancellationToken);
@@ -386,10 +353,7 @@
 
         public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             Int64ToVarInt(LongToZigzag(i64), ref PreAllocatedVarInt);
             await Trans.WriteAsync(PreAllocatedVarInt.bytes, 0, PreAllocatedVarInt.count, cancellationToken);
@@ -397,20 +361,15 @@
 
         public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+
             BinaryPrimitives.WriteInt64LittleEndian(PreAllocatedBuffer, BitConverter.DoubleToInt64Bits(d));
             await Trans.WriteAsync(PreAllocatedBuffer, 0, 8, cancellationToken);
         }
 
         public override async Task WriteStringAsync(string str, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var buf = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetByteCount(str));
             try
@@ -429,10 +388,7 @@
 
         public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             Int32ToVarInt((uint) bytes.Length, ref PreAllocatedVarInt);
             await Trans.WriteAsync(PreAllocatedVarInt.bytes, 0, PreAllocatedVarInt.count, cancellationToken);
@@ -441,11 +397,8 @@
 
         public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-            
+            cancellationToken.ThrowIfCancellationRequested();
+
             if (map.Count == 0)
             {
                 PreAllocatedBuffer[0] = 0;
@@ -461,20 +414,15 @@
             }
         }
 
-        public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
+        public override Task WriteMapEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TMessage>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             var protocolId = (byte) await ReadByteAsync(cancellationToken);
             if (protocolId != ProtocolId)
@@ -497,35 +445,25 @@
             return new TMessage(messageName, (TMessageType) type, seqid);
         }
 
-        public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
+        public override Task ReadMessageEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
-        public override async ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
+        public override ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TStruct>(cancellationToken);
-            }
-
-            // some magic is here )
+            cancellationToken.ThrowIfCancellationRequested();
 
             _lastField.Push(_lastFieldId);
             _lastFieldId = 0;
 
-            return AnonymousStruct;
+            return new ValueTask<TStruct>(AnonymousStruct);
         }
 
-        public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
+        public override Task ReadStructEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Doesn't actually consume any wire data, just removes the last field for
@@ -534,6 +472,8 @@
 
             // consume the last field we Read off the wire.
             _lastFieldId = _lastField.Pop();
+
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
@@ -576,20 +516,15 @@
             return field;
         }
 
-        public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
+        public override Task ReadFieldEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<TMap>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Read a map header off the wire. If the size is zero, skip Reading the key
@@ -604,12 +539,10 @@
             return map;
         }
 
-        public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
+        public override Task ReadMapEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async ValueTask<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
@@ -658,40 +591,28 @@
 
         public override async ValueTask<short> ReadI16Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<short>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             return (short) ZigzagToInt(await ReadVarInt32Async(cancellationToken));
         }
 
         public override async ValueTask<int> ReadI32Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<int>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             return ZigzagToInt(await ReadVarInt32Async(cancellationToken));
         }
 
         public override async ValueTask<long> ReadI64Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<long>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             return ZigzagToLong(await ReadVarInt64Async(cancellationToken));
         }
 
         public override async ValueTask<double> ReadDoubleAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<double>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await Trans.ReadAllAsync(PreAllocatedBuffer, 0, 8, cancellationToken);
             
@@ -746,10 +667,7 @@
 
         public override async ValueTask<TList> ReadListBeginAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<TList>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Read a list header off the wire. If the list size is 0-14, the size will
@@ -771,20 +689,16 @@
             return list;
         }
 
-        public override async Task ReadListEndAsync(CancellationToken cancellationToken)
+        public override Task ReadListEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
-        public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
+        public override Task ReadSetEndAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         private static byte GetCompactType(TType ttype)
@@ -796,10 +710,7 @@
 
         private async ValueTask<uint> ReadVarInt32Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<uint>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Read an i32 from the wire as a varint. The MSB of each byte is set
@@ -825,10 +736,7 @@
 
         private async ValueTask<ulong> ReadVarInt64Async(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<uint>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             /*
             Read an i64 from the wire as a proper varint. The MSB of each byte is set
diff --git a/lib/netstd/Thrift/Protocol/TJSONProtocol.cs b/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
index 3b2ed06..2f1ccdb 100644
--- a/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
@@ -127,7 +127,7 @@
                     }
                     else
                     {
-                        await Trans.WriteAsync(bytes.ToArray(), i, 1, cancellationToken);
+                        await Trans.WriteAsync(bytes, i, 1, cancellationToken);
                     }
                 }
                 else
@@ -315,12 +315,10 @@
             await WriteJsonObjectEndAsync(cancellationToken);
         }
 
-        public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
+        public override Task WriteFieldStopAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
@@ -679,7 +677,8 @@
         public override async ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
         {
             await ReadJsonObjectStartAsync(cancellationToken);
-            return new TStruct();
+
+            return AnonymousStruct;
         }
 
         public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
@@ -689,18 +688,19 @@
 
         public override async ValueTask<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
         {
-            var field = new TField();
             var ch = await Reader.PeekAsync(cancellationToken);
             if (ch == TJSONProtocolConstants.RightBrace[0])
             {
-                field.Type = TType.Stop;
+                return StopField;
             }
-            else
+
+            var field = new TField()
             {
-                field.ID = (short) await ReadJsonIntegerAsync(cancellationToken);
-                await ReadJsonObjectStartAsync(cancellationToken);
-                field.Type = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
-            }
+                ID = (short)await ReadJsonIntegerAsync(cancellationToken)
+            };
+
+            await ReadJsonObjectStartAsync(cancellationToken);
+            field.Type = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
             return field;
         }
 
@@ -845,20 +845,16 @@
                 Proto = proto;
             }
 
-            public virtual async Task WriteConditionalDelimiterAsync(CancellationToken cancellationToken)
+            public virtual Task WriteConditionalDelimiterAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
+                cancellationToken.ThrowIfCancellationRequested();
+                return Task.CompletedTask;
             }
 
-            public virtual async Task ReadConditionalDelimiterAsync(CancellationToken cancellationToken)
+            public virtual Task ReadConditionalDelimiterAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
+                cancellationToken.ThrowIfCancellationRequested();
+                return Task.CompletedTask;
             }
 
             public virtual bool EscapeNumbers()
@@ -978,10 +974,7 @@
             /// </summary>
             public async ValueTask<byte> ReadAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<byte>(cancellationToken);
-                }
+                cancellationToken.ThrowIfCancellationRequested();
 
                 if (_hasData)
                 {
@@ -1001,10 +994,7 @@
             /// </summary>
             public async ValueTask<byte> PeekAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<byte>(cancellationToken);
-                }
+                cancellationToken.ThrowIfCancellationRequested();
 
                 if (!_hasData)
                 {
diff --git a/lib/netstd/Thrift/Protocol/TProtocol.cs b/lib/netstd/Thrift/Protocol/TProtocol.cs
index 5275c9c..5b1bec1 100644
--- a/lib/netstd/Thrift/Protocol/TProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TProtocol.cs
@@ -32,6 +32,10 @@
 
         protected TTransport Trans;
 
+        protected static readonly TStruct AnonymousStruct = new TStruct(string.Empty);
+        protected static readonly TField StopField = new TField() { Type = TType.Stop };
+
+
         protected TProtocol(TTransport trans)
         {
             Trans = trans;
@@ -98,299 +102,94 @@
         public abstract int GetMinSerializedSize(TType type);
 
 
-        public virtual async Task WriteMessageBeginAsync(TMessage message)
-        {
-            await WriteMessageBeginAsync(message, CancellationToken.None);
-        }
+        public abstract Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken = default);
 
-        public abstract Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken);
+        public abstract Task WriteMessageEndAsync(CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteMessageEndAsync()
-        {
-            await WriteMessageEndAsync(CancellationToken.None);
-        }
+        public abstract Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken = default);
 
-        public abstract Task WriteMessageEndAsync(CancellationToken cancellationToken);
+        public abstract Task WriteStructEndAsync(CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteStructBeginAsync(TStruct @struct)
-        {
-            await WriteStructBeginAsync(@struct, CancellationToken.None);
-        }
+        public abstract Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken = default);
+                
+        public abstract Task WriteFieldEndAsync(CancellationToken cancellationToken = default);
+                
+        public abstract Task WriteFieldStopAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken);
+        public abstract Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteStructEndAsync()
-        {
-            await WriteStructEndAsync(CancellationToken.None);
-        }
+        public abstract Task WriteMapEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task WriteStructEndAsync(CancellationToken cancellationToken);
+        public abstract Task WriteListBeginAsync(TList list, CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteFieldBeginAsync(TField field)
-        {
-            await WriteFieldBeginAsync(field, CancellationToken.None);
-        }
+        public abstract Task WriteListEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken);
+        public abstract Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteFieldEndAsync()
-        {
-            await WriteFieldEndAsync(CancellationToken.None);
-        }
+        public abstract Task WriteSetEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task WriteFieldEndAsync(CancellationToken cancellationToken);
+        public abstract Task WriteBoolAsync(bool b, CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteFieldStopAsync()
-        {
-            await WriteFieldStopAsync(CancellationToken.None);
-        }
+        public abstract Task WriteByteAsync(sbyte b, CancellationToken cancellationToken = default);
 
-        public abstract Task WriteFieldStopAsync(CancellationToken cancellationToken);
+        public abstract Task WriteI16Async(short i16, CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteMapBeginAsync(TMap map)
-        {
-            await WriteMapBeginAsync(map, CancellationToken.None);
-        }
+        public abstract Task WriteI32Async(int i32, CancellationToken cancellationToken = default);
 
-        public abstract Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken);
+        public abstract Task WriteI64Async(long i64, CancellationToken cancellationToken = default);
 
-        public virtual async Task WriteMapEndAsync()
-        {
-            await WriteMapEndAsync(CancellationToken.None);
-        }
+        public abstract Task WriteDoubleAsync(double d, CancellationToken cancellationToken = default);
 
-        public abstract Task WriteMapEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteListBeginAsync(TList list)
-        {
-            await WriteListBeginAsync(list, CancellationToken.None);
-        }
-
-        public abstract Task WriteListBeginAsync(TList list, CancellationToken cancellationToken);
-
-        public virtual async Task WriteListEndAsync()
-        {
-            await WriteListEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task WriteListEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteSetBeginAsync(TSet set)
-        {
-            await WriteSetBeginAsync(set, CancellationToken.None);
-        }
-
-        public abstract Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken);
-
-        public virtual async Task WriteSetEndAsync()
-        {
-            await WriteSetEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task WriteSetEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteBoolAsync(bool b)
-        {
-            await WriteBoolAsync(b, CancellationToken.None);
-        }
-
-        public abstract Task WriteBoolAsync(bool b, CancellationToken cancellationToken);
-
-        public virtual async Task WriteByteAsync(sbyte b)
-        {
-            await WriteByteAsync(b, CancellationToken.None);
-        }
-
-        public abstract Task WriteByteAsync(sbyte b, CancellationToken cancellationToken);
-
-        public virtual async Task WriteI16Async(short i16)
-        {
-            await WriteI16Async(i16, CancellationToken.None);
-        }
-
-        public abstract Task WriteI16Async(short i16, CancellationToken cancellationToken);
-
-        public virtual async Task WriteI32Async(int i32)
-        {
-            await WriteI32Async(i32, CancellationToken.None);
-        }
-
-        public abstract Task WriteI32Async(int i32, CancellationToken cancellationToken);
-
-        public virtual async Task WriteI64Async(long i64)
-        {
-            await WriteI64Async(i64, CancellationToken.None);
-        }
-
-        public abstract Task WriteI64Async(long i64, CancellationToken cancellationToken);
-
-        public virtual async Task WriteDoubleAsync(double d)
-        {
-            await WriteDoubleAsync(d, CancellationToken.None);
-        }
-
-        public abstract Task WriteDoubleAsync(double d, CancellationToken cancellationToken);
-
-        public virtual async Task WriteStringAsync(string s)
-        {
-            await WriteStringAsync(s, CancellationToken.None);
-        }
-
-        public virtual async Task WriteStringAsync(string s, CancellationToken cancellationToken)
+        public virtual async Task WriteStringAsync(string s, CancellationToken cancellationToken = default)
         {
             var bytes = Encoding.UTF8.GetBytes(s);
             await WriteBinaryAsync(bytes, cancellationToken);
         }
 
-        public virtual async Task WriteBinaryAsync(byte[] bytes)
-        {
-            await WriteBinaryAsync(bytes, CancellationToken.None);
-        }
+        public abstract Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken = default);
 
-        public abstract Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken);
+        public abstract ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken = default);
 
-        public virtual async ValueTask<TMessage> ReadMessageBeginAsync()
-        {
-            return await ReadMessageBeginAsync(CancellationToken.None);
-        }
+        public abstract Task ReadMessageEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract ValueTask<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken = default);
 
-        public virtual async Task ReadMessageEndAsync()
-        {
-            await ReadMessageEndAsync(CancellationToken.None);
-        }
+        public abstract Task ReadStructEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task ReadMessageEndAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<TField> ReadFieldBeginAsync(CancellationToken cancellationToken = default);
 
-        public virtual async ValueTask<TStruct> ReadStructBeginAsync()
-        {
-            return await ReadStructBeginAsync(CancellationToken.None);
-        }
+        public abstract Task ReadFieldEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract ValueTask<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<TMap> ReadMapBeginAsync(CancellationToken cancellationToken = default);
 
-        public virtual async Task ReadStructEndAsync()
-        {
-            await ReadStructEndAsync(CancellationToken.None);
-        }
+        public abstract Task ReadMapEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task ReadStructEndAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<TList> ReadListBeginAsync(CancellationToken cancellationToken = default);
 
-        public virtual async ValueTask<TField> ReadFieldBeginAsync()
-        {
-            return await ReadFieldBeginAsync(CancellationToken.None);
-        }
+        public abstract Task ReadListEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract ValueTask<TField> ReadFieldBeginAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<TSet> ReadSetBeginAsync(CancellationToken cancellationToken = default);
 
-        public virtual async Task ReadFieldEndAsync()
-        {
-            await ReadFieldEndAsync(CancellationToken.None);
-        }
+        public abstract Task ReadSetEndAsync(CancellationToken cancellationToken = default);
 
-        public abstract Task ReadFieldEndAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<bool> ReadBoolAsync(CancellationToken cancellationToken = default);
 
-        public virtual async ValueTask<TMap> ReadMapBeginAsync()
-        {
-            return await ReadMapBeginAsync(CancellationToken.None);
-        }
+        public abstract ValueTask<sbyte> ReadByteAsync(CancellationToken cancellationToken = default);
 
-        public abstract ValueTask<TMap> ReadMapBeginAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<short> ReadI16Async(CancellationToken cancellationToken = default);
 
-        public virtual async Task ReadMapEndAsync()
-        {
-            await ReadMapEndAsync(CancellationToken.None);
-        }
+        public abstract ValueTask<int> ReadI32Async(CancellationToken cancellationToken = default);
 
-        public abstract Task ReadMapEndAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<long> ReadI64Async(CancellationToken cancellationToken = default);
 
-        public virtual async ValueTask<TList> ReadListBeginAsync()
-        {
-            return await ReadListBeginAsync(CancellationToken.None);
-        }
+        public abstract ValueTask<double> ReadDoubleAsync(CancellationToken cancellationToken = default);
 
-        public abstract ValueTask<TList> ReadListBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadListEndAsync()
-        {
-            await ReadListEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadListEndAsync(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<TSet> ReadSetBeginAsync()
-        {
-            return await ReadSetBeginAsync(CancellationToken.None);
-        }
-
-        public abstract ValueTask<TSet> ReadSetBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadSetEndAsync()
-        {
-            await ReadSetEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadSetEndAsync(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<bool> ReadBoolAsync()
-        {
-            return await ReadBoolAsync(CancellationToken.None);
-        }
-
-        public abstract ValueTask<bool> ReadBoolAsync(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<sbyte> ReadByteAsync()
-        {
-            return await ReadByteAsync(CancellationToken.None);
-        }
-
-        public abstract ValueTask<sbyte> ReadByteAsync(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<short> ReadI16Async()
-        {
-            return await ReadI16Async(CancellationToken.None);
-        }
-
-        public abstract ValueTask<short> ReadI16Async(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<int> ReadI32Async()
-        {
-            return await ReadI32Async(CancellationToken.None);
-        }
-
-        public abstract ValueTask<int> ReadI32Async(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<long> ReadI64Async()
-        {
-            return await ReadI64Async(CancellationToken.None);
-        }
-
-        public abstract ValueTask<long> ReadI64Async(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<double> ReadDoubleAsync()
-        {
-            return await ReadDoubleAsync(CancellationToken.None);
-        }
-
-        public abstract ValueTask<double> ReadDoubleAsync(CancellationToken cancellationToken);
-
-        public virtual async ValueTask<string> ReadStringAsync()
-        {
-            return await ReadStringAsync(CancellationToken.None);
-        }
-
-        public virtual async ValueTask<string> ReadStringAsync(CancellationToken cancellationToken)
+        public virtual async ValueTask<string> ReadStringAsync(CancellationToken cancellationToken = default)
         {
             var buf = await ReadBinaryAsync(cancellationToken);
             return Encoding.UTF8.GetString(buf, 0, buf.Length);
         }
 
-        public virtual async ValueTask<byte[]> ReadBinaryAsync()
-        {
-            return await ReadBinaryAsync(CancellationToken.None);
-        }
-
-        public abstract ValueTask<byte[]> ReadBinaryAsync(CancellationToken cancellationToken);
+        public abstract ValueTask<byte[]> ReadBinaryAsync(CancellationToken cancellationToken = default);
     }
 }
diff --git a/lib/netstd/Thrift/Protocol/Utilities/TProtocolUtil.cs b/lib/netstd/Thrift/Protocol/Utilities/TProtocolUtil.cs
index 18f92d8..832e46e 100644
--- a/lib/netstd/Thrift/Protocol/Utilities/TProtocolUtil.cs
+++ b/lib/netstd/Thrift/Protocol/Utilities/TProtocolUtil.cs
@@ -26,10 +26,7 @@
     {
         public static async Task SkipAsync(TProtocol protocol, TType type, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             protocol.IncrementRecursionDepth();
             try
diff --git a/lib/netstd/Thrift/Server/TServer.cs b/lib/netstd/Thrift/Server/TServer.cs
index f40f2b7..3fd0bc5 100644
--- a/lib/netstd/Thrift/Server/TServer.cs
+++ b/lib/netstd/Thrift/Server/TServer.cs
@@ -76,12 +76,10 @@
             // do nothing
         }
 
-        public virtual async Task ServeAsync(CancellationToken cancellationToken)
+        public virtual Task ServeAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
     }
 }
diff --git a/lib/netstd/Thrift/TApplicationException.cs b/lib/netstd/Thrift/TApplicationException.cs
index 67ac2f8..514db9a 100644
--- a/lib/netstd/Thrift/TApplicationException.cs
+++ b/lib/netstd/Thrift/TApplicationException.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
@@ -112,10 +112,7 @@
 
         public async Task WriteAsync(TProtocol outputProtocol, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             const string messageTypeFieldName = "message";
             const string exTypeFieldName = "exType";
@@ -147,4 +144,4 @@
             await outputProtocol.WriteStructEndAsync(cancellationToken);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Thrift/Transport/Client/THttpTransport.cs b/lib/netstd/Thrift/Transport/Client/THttpTransport.cs
index 0790cc8..46071cd 100644
--- a/lib/netstd/Thrift/Transport/Client/THttpTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/THttpTransport.cs
@@ -68,12 +68,10 @@
 
         public MediaTypeHeaderValue ContentType { get; set; }
 
-        public override async Task OpenAsync(CancellationToken cancellationToken)
+        public override Task OpenAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override void Close()
@@ -99,8 +97,7 @@
 
         public override async ValueTask<int> ReadAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-                return await Task.FromCanceled<int>(cancellationToken);
+            cancellationToken.ThrowIfCancellationRequested();
 
             if (_inputStream == null)
                 throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No request has been sent");
@@ -130,10 +127,7 @@
 
         public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             await _outputStream.WriteAsync(buffer, offset, length, cancellationToken);
         }
diff --git a/lib/netstd/Thrift/Transport/Client/TMemoryBufferTransport.cs b/lib/netstd/Thrift/Transport/Client/TMemoryBufferTransport.cs
index 290e50c..797de4e 100644
--- a/lib/netstd/Thrift/Transport/Client/TMemoryBufferTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TMemoryBufferTransport.cs
@@ -81,12 +81,10 @@
 
         public override bool IsOpen => true;
 
-        public override async Task OpenAsync(CancellationToken cancellationToken)
+        public override Task OpenAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override void Close()
@@ -143,13 +141,11 @@
             return Task.CompletedTask;
         }
 
-        public override async Task FlushAsync(CancellationToken cancellationToken)
+        public override Task FlushAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
             ResetConsumedMessageSize();
+            return Task.CompletedTask;
         }
 
         public byte[] GetBuffer()
diff --git a/lib/netstd/Thrift/Transport/Client/TNamedPipeTransport.cs b/lib/netstd/Thrift/Transport/Client/TNamedPipeTransport.cs
index 8dab6a0..815983e 100644
--- a/lib/netstd/Thrift/Transport/Client/TNamedPipeTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TNamedPipeTransport.cs
@@ -101,13 +101,12 @@
             }
         }
 
-        public override async Task FlushAsync(CancellationToken cancellationToken)
+        public override Task FlushAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+
             ResetConsumedMessageSize();
+            return Task.CompletedTask;
         }
 
         
diff --git a/lib/netstd/Thrift/Transport/Client/TSocketTransport.cs b/lib/netstd/Thrift/Transport/Client/TSocketTransport.cs
index 612d3da..5e3245b 100644
--- a/lib/netstd/Thrift/Transport/Client/TSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TSocketTransport.cs
@@ -106,10 +106,7 @@
 
         public override async Task OpenAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             if (IsOpen)
             {
diff --git a/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs b/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs
index ccadad0..b397460 100644
--- a/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TStreamTransport.cs
@@ -51,12 +51,10 @@
 
         public override bool IsOpen => true;
 
-        public override async Task OpenAsync(CancellationToken cancellationToken)
+        public override Task OpenAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
+            return Task.CompletedTask;
         }
 
         public override void Close()
diff --git a/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs b/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
index 4b82cbd..aea0f86 100644
--- a/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TNamedPipeServerTransport.cs
@@ -256,12 +256,10 @@
 
             public override bool IsOpen => PipeStream != null && PipeStream.IsConnected;
 
-            public override async Task OpenAsync(CancellationToken cancellationToken)
+            public override Task OpenAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
+                cancellationToken.ThrowIfCancellationRequested();
+                return Task.CompletedTask;
             }
 
             public override void Close()
@@ -306,14 +304,12 @@
                 }
             }
 
-            public override async Task FlushAsync(CancellationToken cancellationToken)
+            public override Task FlushAsync(CancellationToken cancellationToken)
             {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
+                cancellationToken.ThrowIfCancellationRequested();
 
                 ResetConsumedMessageSize();
+                return Task.CompletedTask;
             }
 
             protected override void Dispose(bool disposing)
diff --git a/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs b/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
index 6656b64..281c7ff 100644
--- a/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TServerSocketTransport.cs
@@ -77,10 +77,7 @@
 
         protected override async ValueTask<TTransport> AcceptImplementationAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TTransport>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             if (_server == null)
             {
diff --git a/lib/netstd/Thrift/Transport/Server/TTlsServerSocketTransport.cs b/lib/netstd/Thrift/Transport/Server/TTlsServerSocketTransport.cs
index 9f74562..79d2b11 100644
--- a/lib/netstd/Thrift/Transport/Server/TTlsServerSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/TTlsServerSocketTransport.cs
@@ -104,10 +104,7 @@
 
         protected override async ValueTask<TTransport> AcceptImplementationAsync(CancellationToken cancellationToken)
         {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TTransport>(cancellationToken);
-            }
+            cancellationToken.ThrowIfCancellationRequested();
 
             if (_server == null)
             {
diff --git a/lib/netstd/Thrift/Transport/TTransport.cs b/lib/netstd/Thrift/Transport/TTransport.cs
index dedd51d..3f4245a 100644
--- a/lib/netstd/Thrift/Transport/TTransport.cs
+++ b/lib/netstd/Thrift/Transport/TTransport.cs
@@ -73,12 +73,8 @@
             return true;
         }
 
-        public virtual async Task OpenAsync()
-        {
-            await OpenAsync(CancellationToken.None);
-        }
 
-        public abstract Task OpenAsync(CancellationToken cancellationToken);
+        public abstract Task OpenAsync(CancellationToken cancellationToken = default);
 
         public abstract void Close();
 
@@ -107,25 +103,14 @@
 #endif
         }
 
-        public virtual async ValueTask<int> ReadAsync(byte[] buffer, int offset, int length)
-        {
-            return await ReadAsync(buffer, offset, length, CancellationToken.None);
-        }
 
         public abstract ValueTask<int> ReadAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken);
 
-        public virtual async ValueTask<int> ReadAllAsync(byte[] buffer, int offset, int length)
-        {
-            return await ReadAllAsync(buffer, offset, length, CancellationToken.None);
-        }
-
         public virtual async ValueTask<int> ReadAllAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
         {
+            cancellationToken.ThrowIfCancellationRequested();
+
             ValidateBufferArgs(buffer, offset, length);
-
-            if (cancellationToken.IsCancellationRequested)
-                return await Task.FromCanceled<int>(cancellationToken);
-
             if (length <= 0)
                 return 0;
 
@@ -164,11 +149,6 @@
             }
         }
 
-        public virtual async Task WriteAsync(byte[] buffer)
-        {
-            await WriteAsync(buffer, CancellationToken.None);
-        }
-
         public virtual async Task WriteAsync(byte[] buffer, CancellationToken cancellationToken)
         {
             await WriteAsync(buffer, 0, buffer.Length, CancellationToken.None);
@@ -181,10 +161,6 @@
 
         public abstract Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken);
 
-        public virtual async Task FlushAsync()
-        {
-            await FlushAsync(CancellationToken.None);
-        }
 
         public abstract Task FlushAsync(CancellationToken cancellationToken);
 
