diff --git a/Makefile.am b/Makefile.am
index bacd008..5832077 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,7 +78,7 @@
 space := $(empty) $(empty)
 comma := ,
 
-CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_CL@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_DOTNETCORE@ @MAYBE_NODETS@
+CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_CL@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_NETSTD@ @MAYBE_NODETS@
 CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))
 
 if WITH_PY3
diff --git a/build/veralign.sh b/build/veralign.sh
index 39b67eb..c15e001 100755
--- a/build/veralign.sh
+++ b/build/veralign.sh
@@ -78,8 +78,6 @@
 FILES[lib/js/package-lock.json]=jsonReplace
 FILES[lib/js/src/thrift.js]=simpleReplace
 FILES[lib/lua/Thrift.lua]=simpleReplace
-FILES[lib/netcore/Thrift/Properties/AssemblyInfo.cs]=simpleReplace
-FILES[lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs]=simpleReplace
 FILES[lib/netstd/Thrift/Properties/AssemblyInfo.cs]=simpleReplace
 FILES[lib/netstd/Thrift/Thrift.csproj]=simpleReplace
 FILES[lib/ocaml/_oasis]=simpleReplace
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 2bc08cf..3c292b4 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -91,7 +91,6 @@
 THRIFT_ADD_COMPILER(js      "Enable compiler for JavaScript" ON)
 THRIFT_ADD_COMPILER(json    "Enable compiler for JSON" ON)
 THRIFT_ADD_COMPILER(lua     "Enable compiler for Lua" ON)
-THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
 THRIFT_ADD_COMPILER(netstd  "Enable compiler for .NET Standard" ON)
 THRIFT_ADD_COMPILER(ocaml   "Enable compiler for OCaml" ON)
 THRIFT_ADD_COMPILER(perl    "Enable compiler for Perl" ON)
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 429df64..d0ac874 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -88,8 +88,6 @@
                   src/thrift/generate/t_js_generator.cc \
                   src/thrift/generate/t_json_generator.cc \
                   src/thrift/generate/t_lua_generator.cc \
-                  src/thrift/generate/t_netcore_generator.cc \
-                  src/thrift/generate/t_netcore_generator.h \
                   src/thrift/generate/t_netstd_generator.cc \
                   src/thrift/generate/t_netstd_generator.h \
                   src/thrift/generate/t_ocaml_generator.cc \
diff --git a/compiler/cpp/README.md b/compiler/cpp/README.md
index 5c04cd8..8d6edac 100644
--- a/compiler/cpp/README.md
+++ b/compiler/cpp/README.md
@@ -168,7 +168,7 @@
 
 ## Using Catch C++ test library
 
-Added generic way to cover code by tests for many languages (you just need to make a correct header file for generator for your language - example in **netcore** implementation)
+Added generic way to cover code by tests for many languages (you just need to make a correct header file for generator for your language - example in **netstd** implementation)
 
 - pls check **tests** folder
 
diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj
index 06c4eb4..5d073e7 100644
--- a/compiler/cpp/compiler.vcxproj
+++ b/compiler/cpp/compiler.vcxproj
@@ -73,7 +73,6 @@
     <ClCompile Include="src\thrift\generate\t_js_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_json_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_lua_generator.cc" />
-    <ClCompile Include="src\thrift\generate\t_netcore_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_netstd_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_ocaml_generator.cc" />
     <ClCompile Include="src\thrift\generate\t_perl_generator.cc" />
diff --git a/compiler/cpp/compiler.vcxproj.filters b/compiler/cpp/compiler.vcxproj.filters
index 5a57589..664a9d9 100644
--- a/compiler/cpp/compiler.vcxproj.filters
+++ b/compiler/cpp/compiler.vcxproj.filters
@@ -161,15 +161,9 @@
     <ClCompile Include="src\generate\t_rb_generator.cc">
       <Filter>generate</Filter>
     </ClCompile>
-    <ClCompile Include="src\generate\t_netcore_generator.h">
-      <Filter>generate</Filter>
-    </ClCompile>
     <ClCompile Include="src\generate\t_netstd_generator.h">
       <Filter>generate</Filter>
     </ClCompile>
-    <ClCompile Include="src\generate\t_netcore_generator.cc">
-      <Filter>generate</Filter>
-    </ClCompile>
     <ClCompile Include="src\generate\t_netstd_generator.cc">
       <Filter>generate</Filter>
     </ClCompile>
diff --git a/compiler/cpp/src/thrift/generate/t_netcore_generator.cc b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
deleted file mode 100644
index ed6a365..0000000
--- a/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
+++ /dev/null
@@ -1,3133 +0,0 @@
-/*
- * 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
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- * Contains some contributions under the Thrift Software License.
- * Please see doc/old-thrift-license.txt in the Thrift distribution for
- * details.
- */
-
-#include <cassert>
-
-#include <string>
-#include <fstream>
-#include <iostream>
-#include <vector>
-#include <cctype>
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sstream>
-
-#include "thrift/platform.h"
-#include "thrift/generate/t_oop_generator.h"
-#include "thrift/generate/t_netcore_generator.h"
-
-using std::map;
-using std::ostream;
-using std::ostringstream;
-using std::string;
-using std::stringstream;
-using std::vector;
-
-//TODO: check for indentation
-//TODO: Do we need seqId_ in generation?
-
-t_netcore_generator::t_netcore_generator(t_program* program, const map<string, string>& parsed_options, const string& option_string)
-    : t_oop_generator(program)
-{
-    (void)option_string;
-
-    nullable_ = false;
-    hashcode_ = false;
-    union_ = false;
-    serialize_ = false;
-    wcf_ = false;
-    wcf_namespace_.clear();
-
-    map<string, string>::const_iterator iter;
-
-    for (iter = parsed_options.begin(); iter != parsed_options.end(); ++iter)
-    {
-        if (iter->first.compare("nullable") == 0)
-        {
-            nullable_ = true;
-        }
-        else if (iter->first.compare("hashcode") == 0)
-        {
-            hashcode_ = true;
-        }
-        else if (iter->first.compare("union") == 0)
-        {
-            union_ = true;
-        }
-        else if (iter->first.compare("serial") == 0)
-        {
-            serialize_ = true;
-            wcf_namespace_ = iter->second; // since there can be only one namespace
-        }
-        else if (iter->first.compare("wcf") == 0)
-        {
-            wcf_ = true;
-            wcf_namespace_ = iter->second;
-        }
-        else
-        {
-            throw "unknown option netcore:" + iter->first;
-        }
-    }
-
-    pwarning(1, "The 'netcore' target is deprecated. Consider using 'netstd' instead.\n");
-
-    out_dir_base_ = "gen-netcore";
-}
-
-static string correct_function_name_for_async(string const& function_name)
-{
-    string const async_end = "Async";
-    size_t i = function_name.find(async_end);
-    if (i != string::npos)
-    {
-        return function_name + async_end;
-    }
-
-    return function_name;
-}
-
-/**
-* \brief Search and replace "_args" substring in struct name if exist (for C# class naming)
-* \param struct_name
-* \return Modified struct name ("Struct_args" -> "StructArgs") or original name
-*/
-static string check_and_correct_struct_name(const string& struct_name)
-{
-    string args_end = "_args";
-    size_t i = struct_name.find(args_end);
-    if (i != string::npos)
-    {
-        string new_struct_name = struct_name;
-        new_struct_name.replace(i, args_end.length(), "Args");
-        return new_struct_name;
-    }
-
-    string result_end = "_result";
-    size_t j = struct_name.find(result_end);
-    if (j != string::npos)
-    {
-        string new_struct_name = struct_name;
-        new_struct_name.replace(j, result_end.length(), "Result");
-        return new_struct_name;
-    }
-
-    return struct_name;
-}
-
-static bool field_has_default(t_field* tfield) { return tfield->get_value() != NULL; }
-
-static bool field_is_required(t_field* tfield) { return tfield->get_req() == t_field::T_REQUIRED; }
-
-static bool type_can_be_null(t_type* ttype)
-{
-    while (ttype->is_typedef())
-    {
-        ttype = static_cast<t_typedef*>(ttype)->get_type();
-    }
-
-    return ttype->is_container() || ttype->is_struct() || ttype->is_xception() || ttype->is_string();
-}
-
-bool t_netcore_generator::is_wcf_enabled() const { return wcf_; }
-
-bool t_netcore_generator::is_nullable_enabled() const { return nullable_; }
-
-bool t_netcore_generator::is_hashcode_enabled() const { return hashcode_; }
-
-bool t_netcore_generator::is_serialize_enabled() const { return serialize_; }
-
-bool t_netcore_generator::is_union_enabled() const { return union_; }
-
-map<string, int> t_netcore_generator::get_keywords_list() const
-{
-    return netcore_keywords;
-}
-
-void t_netcore_generator::init_generator()
-{
-    MKDIR(get_out_dir().c_str());
-
-    // for usage of csharp namespaces in thrift files (from files for csharp)
-    namespace_name_ = program_->get_namespace("netcore");
-    if (namespace_name_.empty())
-    {
-        namespace_name_ = program_->get_namespace("netcore");
-    }
-
-    string dir = namespace_name_;
-    string subdir = get_out_dir().c_str();
-    string::size_type loc;
-
-    while ((loc = dir.find(".")) != string::npos)
-    {
-        subdir = subdir + "/" + dir.substr(0, loc);
-        MKDIR(subdir.c_str());
-        dir = dir.substr(loc + 1);
-    }
-    if (dir.size() > 0)
-    {
-        subdir = subdir + "/" + dir;
-        MKDIR(subdir.c_str());
-    }
-
-    namespace_dir_ = subdir;
-    init_keywords();
-
-    while (!member_mapping_scopes.empty())
-    {
-        cleanup_member_name_mapping(member_mapping_scopes.back().scope_member);
-    }
-
-    pverbose(".NET Core options:\n");
-    pverbose("- nullable ... %s\n", (nullable_ ? "ON" : "off"));
-    pverbose("- union ...... %s\n", (union_ ? "ON" : "off"));
-    pverbose("- hashcode ... %s\n", (hashcode_ ? "ON" : "off"));
-    pverbose("- serialize .. %s\n", (serialize_ ? "ON" : "off"));
-    pverbose("- wcf ........ %s\n", (wcf_ ? "ON" : "off"));
-}
-
-string t_netcore_generator::normalize_name(string name)
-{
-    string tmp(name);
-    transform(tmp.begin(), tmp.end(), tmp.begin(), static_cast<int(*)(int)>(tolower));
-
-    // un-conflict keywords by prefixing with "@"
-    if (netcore_keywords.find(tmp) != netcore_keywords.end())
-    {
-        return "@" + name;
-    }
-
-    // no changes necessary
-    return name;
-}
-
-void t_netcore_generator::init_keywords()
-{
-    netcore_keywords.clear();
-
-    // C# keywords
-    netcore_keywords["abstract"] = 1;
-    netcore_keywords["as"] = 1;
-    netcore_keywords["base"] = 1;
-    netcore_keywords["bool"] = 1;
-    netcore_keywords["break"] = 1;
-    netcore_keywords["byte"] = 1;
-    netcore_keywords["case"] = 1;
-    netcore_keywords["catch"] = 1;
-    netcore_keywords["char"] = 1;
-    netcore_keywords["checked"] = 1;
-    netcore_keywords["class"] = 1;
-    netcore_keywords["const"] = 1;
-    netcore_keywords["continue"] = 1;
-    netcore_keywords["decimal"] = 1;
-    netcore_keywords["default"] = 1;
-    netcore_keywords["delegate"] = 1;
-    netcore_keywords["do"] = 1;
-    netcore_keywords["double"] = 1;
-    netcore_keywords["else"] = 1;
-    netcore_keywords["enum"] = 1;
-    netcore_keywords["event"] = 1;
-    netcore_keywords["explicit"] = 1;
-    netcore_keywords["extern"] = 1;
-    netcore_keywords["false"] = 1;
-    netcore_keywords["finally"] = 1;
-    netcore_keywords["fixed"] = 1;
-    netcore_keywords["float"] = 1;
-    netcore_keywords["for"] = 1;
-    netcore_keywords["foreach"] = 1;
-    netcore_keywords["goto"] = 1;
-    netcore_keywords["if"] = 1;
-    netcore_keywords["implicit"] = 1;
-    netcore_keywords["in"] = 1;
-    netcore_keywords["int"] = 1;
-    netcore_keywords["interface"] = 1;
-    netcore_keywords["internal"] = 1;
-    netcore_keywords["is"] = 1;
-    netcore_keywords["lock"] = 1;
-    netcore_keywords["long"] = 1;
-    netcore_keywords["namespace"] = 1;
-    netcore_keywords["new"] = 1;
-    netcore_keywords["null"] = 1;
-    netcore_keywords["object"] = 1;
-    netcore_keywords["operator"] = 1;
-    netcore_keywords["out"] = 1;
-    netcore_keywords["override"] = 1;
-    netcore_keywords["params"] = 1;
-    netcore_keywords["private"] = 1;
-    netcore_keywords["protected"] = 1;
-    netcore_keywords["public"] = 1;
-    netcore_keywords["readonly"] = 1;
-    netcore_keywords["ref"] = 1;
-    netcore_keywords["return"] = 1;
-    netcore_keywords["sbyte"] = 1;
-    netcore_keywords["sealed"] = 1;
-    netcore_keywords["short"] = 1;
-    netcore_keywords["sizeof"] = 1;
-    netcore_keywords["stackalloc"] = 1;
-    netcore_keywords["static"] = 1;
-    netcore_keywords["string"] = 1;
-    netcore_keywords["struct"] = 1;
-    netcore_keywords["switch"] = 1;
-    netcore_keywords["this"] = 1;
-    netcore_keywords["throw"] = 1;
-    netcore_keywords["true"] = 1;
-    netcore_keywords["try"] = 1;
-    netcore_keywords["typeof"] = 1;
-    netcore_keywords["uint"] = 1;
-    netcore_keywords["ulong"] = 1;
-    netcore_keywords["unchecked"] = 1;
-    netcore_keywords["unsafe"] = 1;
-    netcore_keywords["ushort"] = 1;
-    netcore_keywords["using"] = 1;
-    netcore_keywords["virtual"] = 1;
-    netcore_keywords["void"] = 1;
-    netcore_keywords["volatile"] = 1;
-    netcore_keywords["while"] = 1;
-
-    // C# contextual keywords
-    netcore_keywords["add"] = 1;
-    netcore_keywords["alias"] = 1;
-    netcore_keywords["ascending"] = 1;
-    netcore_keywords["async"] = 1;
-    netcore_keywords["await"] = 1;
-    netcore_keywords["descending"] = 1;
-    netcore_keywords["dynamic"] = 1;
-    netcore_keywords["from"] = 1;
-    netcore_keywords["get"] = 1;
-    netcore_keywords["global"] = 1;
-    netcore_keywords["group"] = 1;
-    netcore_keywords["into"] = 1;
-    netcore_keywords["join"] = 1;
-    netcore_keywords["let"] = 1;
-    netcore_keywords["orderby"] = 1;
-    netcore_keywords["partial"] = 1;
-    netcore_keywords["remove"] = 1;
-    netcore_keywords["select"] = 1;
-    netcore_keywords["set"] = 1;
-    netcore_keywords["value"] = 1;
-    netcore_keywords["var"] = 1;
-    netcore_keywords["where"] = 1;
-    netcore_keywords["yield"] = 1;
-
-	netcore_keywords["when"] = 1;
-}
-
-void t_netcore_generator::start_netcore_namespace(ostream& out)
-{
-    if (!namespace_name_.empty())
-    {
-        out << "namespace " << namespace_name_ << endl;
-        scope_up(out);
-    }
-}
-
-void t_netcore_generator::end_netcore_namespace(ostream& out)
-{
-    if (!namespace_name_.empty())
-    {
-        scope_down(out);
-    }
-}
-
-string t_netcore_generator::netcore_type_usings() const
-{
-    string namespaces =
-        "using System;\n"
-        "using System.Collections;\n"
-        "using System.Collections.Generic;\n"
-        "using System.Text;\n"
-        "using System.IO;\n"
-        "using System.Threading;\n"
-        "using System.Threading.Tasks;\n"
-        "using Thrift;\n"
-        "using Thrift.Collections;\n";
-
-    if (wcf_)
-    {
-        namespaces += "using System.ServiceModel;\n";
-        namespaces += "using System.Runtime.Serialization;\n";
-    }
-
-    return namespaces + endl;
-}
-
-string t_netcore_generator::netcore_thrift_usings() const
-{
-    string namespaces =
-        "using Thrift.Protocols;\n"
-        "using Thrift.Protocols.Entities;\n"
-        "using Thrift.Protocols.Utilities;\n"
-        "using Thrift.Transports;\n"
-        "using Thrift.Transports.Client;\n"
-        "using Thrift.Transports.Server;\n";
-
-    return namespaces + endl;
-}
-
-void t_netcore_generator::close_generator()
-{
-}
-
-void t_netcore_generator::generate_typedef(t_typedef* ttypedef)
-{
-    (void)ttypedef;
-}
-
-void t_netcore_generator::generate_enum(t_enum* tenum)
-{
-	int ic = indent_count();
-    string f_enum_name = namespace_dir_ + "/" + tenum->get_name() + ".cs";
-
-    ofstream_with_content_based_conditional_update f_enum;
-    f_enum.open(f_enum_name.c_str());
-
-	generate_enum(f_enum, tenum);
-
-    f_enum.close();
-	indent_validate(ic, "generate_enum");
-}
-
-void t_netcore_generator::generate_enum(ostream& out, t_enum* tenum)
-{
-	out << autogen_comment() << endl;
-
-	start_netcore_namespace(out);
-	generate_netcore_doc(out, tenum);
-
-	out << indent() << "public enum " << tenum->get_name() << endl;
-	scope_up(out);
-
-	vector<t_enum_value*> constants = tenum->get_constants();
-	vector<t_enum_value*>::iterator c_iter;
-
-	for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter)
-	{
-		generate_netcore_doc(out, *c_iter);
-		int value = (*c_iter)->get_value();
-		out << indent() << (*c_iter)->get_name() << " = " << value << "," << endl;
-	}
-
-	scope_down(out);
-	end_netcore_namespace(out);
-}
-
-void t_netcore_generator::generate_consts(vector<t_const*> consts)
-{
-    if (consts.empty())
-    {
-        return;
-    }
-
-    string f_consts_name = namespace_dir_ + '/' + program_name_ + ".Constants.cs";
-    ofstream_with_content_based_conditional_update f_consts;
-    f_consts.open(f_consts_name.c_str());
-
-    generate_consts(f_consts, consts);
-
-    f_consts.close();
-}
-
-void t_netcore_generator::generate_consts(ostream& out, vector<t_const*> consts)
-{
-    if (consts.empty())
-    {
-        return;
-    }
-
-    out << autogen_comment() << netcore_type_usings() << endl;
-
-    start_netcore_namespace(out);
-
-    out << indent() << "public static class " << make_valid_csharp_identifier(program_name_) << "Constants" << endl;
-
-    scope_up(out);
-
-    vector<t_const*>::iterator c_iter;
-    bool need_static_constructor = false;
-    for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter)
-    {
-        generate_netcore_doc(out, *c_iter);
-        if (print_const_value(out, (*c_iter)->get_name(), (*c_iter)->get_type(), (*c_iter)->get_value(), false))
-        {
-            need_static_constructor = true;
-        }
-    }
-
-    if (need_static_constructor)
-    {
-        print_const_constructor(out, consts);
-    }
-
-    scope_down(out);
-    end_netcore_namespace(out);
-}
-
-void t_netcore_generator::print_const_def_value(ostream& out, string name, t_type* type, t_const_value* value)
-{
-    if (type->is_struct() || type->is_xception())
-    {
-        const vector<t_field*>& fields = static_cast<t_struct*>(type)->get_members();
-        const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-        vector<t_field*>::const_iterator f_iter;
-        map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-        prepare_member_name_mapping(static_cast<t_struct*>(type));
-
-        for (v_iter = val.begin(); v_iter != val.end(); ++v_iter)
-        {
-            t_field* field = NULL;
-
-            for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-            {
-                if ((*f_iter)->get_name() == v_iter->first->get_string())
-                {
-                    field = *f_iter;
-                }
-            }
-
-            if (field == NULL)
-            {
-                throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string();
-            }
-
-            t_type* field_type = field->get_type();
-
-            string val = render_const_value(out, name, field_type, v_iter->second);
-            out << indent() << name << "." << prop_name(field) << " = " << val << ";" << endl;
-        }
-
-        cleanup_member_name_mapping(static_cast<t_struct*>(type));
-    }
-    else if (type->is_map())
-    {
-        t_type* ktype = static_cast<t_map*>(type)->get_key_type();
-        t_type* vtype = static_cast<t_map*>(type)->get_val_type();
-        const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
-        map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
-        for (v_iter = val.begin(); v_iter != val.end(); ++v_iter)
-        {
-            string key = render_const_value(out, name, ktype, v_iter->first);
-            string val = render_const_value(out, name, vtype, v_iter->second);
-            out << indent() << name << "[" << key << "]" << " = " << val << ";" << endl;
-        }
-    }
-    else if (type->is_list() || type->is_set())
-    {
-        t_type* etype;
-        if (type->is_list())
-        {
-            etype = static_cast<t_list*>(type)->get_elem_type();
-        }
-        else
-        {
-            etype = static_cast<t_set*>(type)->get_elem_type();
-        }
-
-        const vector<t_const_value*>& val = value->get_list();
-        vector<t_const_value*>::const_iterator v_iter;
-        for (v_iter = val.begin(); v_iter != val.end(); ++v_iter)
-        {
-            string val = render_const_value(out, name, etype, *v_iter);
-            out << indent() << name << ".Add(" << val << ");" << endl;
-        }
-    }
-}
-
-void t_netcore_generator::print_const_constructor(ostream& out, vector<t_const*> consts)
-{
-    out << indent() << "static " << make_valid_csharp_identifier(program_name_).c_str() << "Constants()" << endl;
-    scope_up(out);
-
-    vector<t_const*>::iterator c_iter;
-    for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter)
-    {
-        string name = (*c_iter)->get_name();
-        t_type* type = (*c_iter)->get_type();
-        t_const_value* value = (*c_iter)->get_value();
-
-        print_const_def_value(out, name, type, value);
-    }
-    scope_down(out);
-}
-
-bool t_netcore_generator::print_const_value(ostream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval, bool needtype)
-{
-    out << indent();
-    bool need_static_construction = !in_static;
-    while (type->is_typedef())
-    {
-        type = static_cast<t_typedef*>(type)->get_type();
-    }
-
-    if (!defval || needtype)
-    {
-        out << (in_static ? "" : type->is_base_type() ? "public const " : "public static ") << type_name(type) << " ";
-    }
-
-    if (type->is_base_type())
-    {
-        string v2 = render_const_value(out, name, type, value);
-        out << normalize_name(name) << " = " << v2 << ";" << endl;
-        need_static_construction = false;
-    }
-    else if (type->is_enum())
-    {
-        out << name << " = " << type_name(type, false, true) << "." << value->get_identifier_name() << ";" << endl;
-        need_static_construction = false;
-    }
-    else if (type->is_struct() || type->is_xception())
-    {
-        out << name << " = new " << type_name(type) << "();" << endl;
-    }
-    else if (type->is_map())
-    {
-        out << name << " = new " << type_name(type, true, true) << "();" << endl;
-    }
-    else if (type->is_list() || type->is_set())
-    {
-        out << name << " = new " << type_name(type) << "();" << endl;
-    }
-
-    if (defval && !type->is_base_type() && !type->is_enum())
-    {
-        print_const_def_value(out, name, type, value);
-    }
-
-    return need_static_construction;
-}
-
-string t_netcore_generator::render_const_value(ostream& out, string name, t_type* type, t_const_value* value)
-{
-    (void)name;
-    ostringstream render;
-
-    if (type->is_base_type())
-    {
-        t_base_type::t_base tbase = static_cast<t_base_type*>(type)->get_base();
-        switch (tbase)
-        {
-        case t_base_type::TYPE_STRING:
-            render << '"' << get_escaped_string(value) << '"';
-            break;
-        case t_base_type::TYPE_BOOL:
-            render << ((value->get_integer() > 0) ? "true" : "false");
-            break;
-        case t_base_type::TYPE_I8:
-        case t_base_type::TYPE_I16:
-        case t_base_type::TYPE_I32:
-        case t_base_type::TYPE_I64:
-            render << value->get_integer();
-            break;
-        case t_base_type::TYPE_DOUBLE:
-            if (value->get_type() == t_const_value::CV_INTEGER)
-            {
-                render << value->get_integer();
-            }
-            else
-            {
-                render << value->get_double();
-            }
-            break;
-        default:
-            throw "compiler error: no const of base type " + t_base_type::t_base_name(tbase);
-        }
-    }
-    else if (type->is_enum())
-    {
-        render << type->get_name() << "." << value->get_identifier_name();
-    }
-    else
-    {
-        string t = tmp("tmp");
-        print_const_value(out, t, type, value, true, true, true);
-        render << t;
-    }
-
-    return render.str();
-}
-
-void t_netcore_generator::generate_struct(t_struct* tstruct)
-{
-    if (union_ && tstruct->is_union())
-    {
-        generate_netcore_union(tstruct);
-    }
-    else
-    {
-        generate_netcore_struct(tstruct, false);
-    }
-}
-
-void t_netcore_generator::generate_xception(t_struct* txception)
-{
-    generate_netcore_struct(txception, true);
-}
-
-void t_netcore_generator::generate_netcore_struct(t_struct* tstruct, bool is_exception)
-{
-    int ic = indent_count();
-
-    string f_struct_name = namespace_dir_ + "/" + (tstruct->get_name()) + ".cs";
-    ofstream_with_content_based_conditional_update f_struct;
-
-    f_struct.open(f_struct_name.c_str());
-
-    f_struct << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl;
-
-    generate_netcore_struct_definition(f_struct, tstruct, is_exception);
-
-    f_struct.close();
-
-    indent_validate(ic, "generate_netcore_struct");
-}
-
-void t_netcore_generator::generate_netcore_struct_definition(ostream& out, t_struct* tstruct, bool is_exception, bool in_class, bool is_result)
-{
-    if (!in_class)
-    {
-        start_netcore_namespace(out);
-    }
-
-    out << endl;
-
-    generate_netcore_doc(out, tstruct);
-    prepare_member_name_mapping(tstruct);
-
-    if ((serialize_ || wcf_) && !is_exception)
-    {
-        out << indent() << "[DataContract(Namespace=\"" << wcf_namespace_ << "\")]" << endl;
-    }
-
-    bool is_final = tstruct->annotations_.find("final") != tstruct->annotations_.end();
-
-    string sharp_struct_name = check_and_correct_struct_name(normalize_name(tstruct->get_name()));
-
-    out << indent() << "public " << (is_final ? "sealed " : "") << "partial class " << sharp_struct_name << " : ";
-
-    if (is_exception)
-    {
-        out << "TException, ";
-    }
-
-    out << "TBase" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    const vector<t_field*>& members = tstruct->get_members();
-    vector<t_field*>::const_iterator m_iter;
-
-    // make private members with public Properties
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-    {
-        // if the field is requied, then we use auto-properties
-        if (!field_is_required((*m_iter)) && (!nullable_ || field_has_default((*m_iter))))
-        {
-            out << indent() << "private " << declare_field(*m_iter, false, "_") << endl;
-        }
-    }
-    out << endl;
-
-    bool has_non_required_fields = false;
-    bool has_non_required_default_value_fields = false;
-    bool has_required_fields = false;
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-    {
-        generate_netcore_doc(out, *m_iter);
-        generate_property(out, *m_iter, true, true);
-        bool is_required = field_is_required((*m_iter));
-        bool has_default = field_has_default((*m_iter));
-        if (is_required)
-        {
-            has_required_fields = true;
-        }
-        else
-        {
-            if (has_default)
-            {
-                has_non_required_default_value_fields = true;
-            }
-            has_non_required_fields = true;
-        }
-    }
-
-    bool generate_isset = (nullable_ && has_non_required_default_value_fields) || (!nullable_ && has_non_required_fields);
-    if (generate_isset)
-    {
-        out << endl;
-        if (serialize_ || wcf_)
-        {
-            out << indent() << "[DataMember(Order = 1)]" << endl;
-        }
-        out << indent() << "public Isset __isset;" << endl;
-        if (serialize_ || wcf_)
-        {
-            out << indent() << "[DataContract]" << endl;
-        }
-
-        out << indent() << "public struct Isset" << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-        {
-            bool is_required = field_is_required((*m_iter));
-            bool has_default = field_has_default((*m_iter));
-            // if it is required, don't need Isset for that variable
-            // if it is not required, if it has a default value, we need to generate Isset
-            // if we are not nullable, then we generate Isset
-            if (!is_required && (!nullable_ || has_default))
-            {
-                if (serialize_ || wcf_)
-                {
-                    out << indent() << "[DataMember]" << endl;
-                }
-                out << indent() << "public bool " << normalize_name((*m_iter)->get_name()) << ";" << endl;
-            }
-        }
-
-        indent_down();
-        out << indent() << "}" << endl << endl;
-
-        if (generate_isset && (serialize_ || wcf_))
-        {
-            out << indent() << "#region XmlSerializer support" << endl << endl;
-
-            for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-            {
-                bool is_required = field_is_required(*m_iter);
-                bool has_default = field_has_default(*m_iter);
-                // if it is required, don't need Isset for that variable
-                // if it is not required, if it has a default value, we need to generate Isset
-                // if we are not nullable, then we generate Isset
-                if (!is_required && (!nullable_ || has_default))
-                {
-                    out << indent() << "public bool ShouldSerialize" << prop_name(*m_iter) << "()" << endl
-                        << indent() << "{" << endl;
-                    indent_up();
-                    out << indent() << "return __isset." << normalize_name((*m_iter)->get_name()) << ";" << endl;
-                    indent_down();
-                    out << indent() << "}" << endl << endl;
-                }
-            }
-
-            out << indent() << "#endregion XmlSerializer support" << endl << endl;
-        }
-    }
-
-    // We always want a default, no argument constructor for Reading
-    out << indent() << "public " << sharp_struct_name << "()" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-    {
-        t_type* t = (*m_iter)->get_type();
-        while (t->is_typedef())
-        {
-            t = static_cast<t_typedef*>(t)->get_type();
-        }
-        if ((*m_iter)->get_value() != NULL)
-        {
-            if (field_is_required((*m_iter)))
-            {
-                print_const_value(out, "this." + prop_name(*m_iter), t, (*m_iter)->get_value(), true, true);
-            }
-            else
-            {
-                print_const_value(out, "this._" + (*m_iter)->get_name(), t, (*m_iter)->get_value(), true, true);
-                // Optionals with defaults are marked set
-                out << indent() << "this.__isset." << normalize_name((*m_iter)->get_name()) << " = true;" << endl;
-            }
-        }
-    }
-    indent_down();
-    out << indent() << "}" << endl << endl;
-
-    if (has_required_fields)
-    {
-        out << indent() << "public " << sharp_struct_name << "(";
-        bool first = true;
-        for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-        {
-            if (field_is_required(*m_iter))
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    out << ", ";
-                }
-                out << type_name((*m_iter)->get_type()) << " " << (*m_iter)->get_name();
-            }
-        }
-        out << ") : this()" << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-        {
-            if (field_is_required(*m_iter))
-            {
-                out << indent() << "this." << prop_name(*m_iter) << " = " << (*m_iter)->get_name() << ";" << endl;
-            }
-        }
-
-        indent_down();
-        out << indent() << "}" << endl << endl;
-    }
-
-    generate_netcore_struct_reader(out, tstruct);
-    if (is_result)
-    {
-        generate_netcore_struct_result_writer(out, tstruct);
-    }
-    else
-    {
-        generate_netcore_struct_writer(out, tstruct);
-    }
-    if (hashcode_)
-    {
-        generate_netcore_struct_equals(out, tstruct);
-        generate_netcore_struct_hashcode(out, tstruct);
-    }
-    generate_netcore_struct_tostring(out, tstruct);
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-
-    // generate a corresponding WCF fault to wrap the exception
-    if ((serialize_ || wcf_) && is_exception)
-    {
-        generate_netcore_wcffault(out, tstruct);
-    }
-
-    cleanup_member_name_mapping(tstruct);
-    if (!in_class)
-    {
-        end_netcore_namespace(out);
-    }
-}
-
-void t_netcore_generator::generate_netcore_wcffault(ostream& out, t_struct* tstruct)
-{
-    out << endl;
-    out << indent() << "[DataContract]" << endl;
-
-    bool is_final = tstruct->annotations_.find("final") != tstruct->annotations_.end();
-
-    out << indent() << "public " << (is_final ? "sealed " : "") << "partial class " << tstruct->get_name() << "Fault" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    const vector<t_field*>& members = tstruct->get_members();
-    vector<t_field*>::const_iterator m_iter;
-
-    // make private members with public Properties
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-    {
-        out << indent() << "private " << declare_field(*m_iter, false, "_") << endl;
-    }
-    out << endl;
-
-    for (m_iter = members.begin(); m_iter != members.end(); ++m_iter)
-    {
-        generate_property(out, *m_iter, true, false);
-    }
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_struct_reader(ostream& out, t_struct* tstruct)
-{
-    out << indent() << "public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "iprot.IncrementRecursionDepth();" << endl
-        << indent() << "try" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    const vector<t_field*>& fields = tstruct->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    // Required variables aren't in __isset, so we need tmp vars to check them
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        if (field_is_required(*f_iter))
-        {
-            out << indent() << "bool isset_" << (*f_iter)->get_name() << " = false;" << endl;
-        }
-    }
-
-    out << indent() << "TField field;" << endl
-        << indent() << "await iprot.ReadStructBeginAsync(cancellationToken);" << endl
-        << indent() << "while (true)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "field = await iprot.ReadFieldBeginAsync(cancellationToken);" << endl
-        << indent() << "if (field.Type == TType.Stop)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "break;" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl
-        << indent() << "switch (field.ID)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        bool is_required = field_is_required(*f_iter);
-        out << indent() << "case " << (*f_iter)->get_key() << ":" << endl;
-        indent_up();
-        out << indent() << "if (field.Type == " << type_to_enum((*f_iter)->get_type()) << ")" << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        generate_deserialize_field(out, *f_iter);
-        if (is_required)
-        {
-            out << indent() << "isset_" << (*f_iter)->get_name() << " = true;" << endl;
-        }
-
-        indent_down();
-        out << indent() << "}" << endl
-            << indent() << "else" << endl
-            << indent() << "{" << endl;
-        indent_up();
-        out << indent() << "await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);" << endl;
-        indent_down();
-        out << indent() << "}" << endl
-            << indent() << "break;" << endl;
-        indent_down();
-    }
-
-    out << indent() << "default: " << endl;
-    indent_up();
-    out << indent() << "await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);" << endl
-        << indent() << "break;" << endl;
-    indent_down();
-    indent_down();
-    out << indent() << "}" << endl
-        << endl
-        << indent() << "await iprot.ReadFieldEndAsync(cancellationToken);" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-        << endl
-        << indent() << "await iprot.ReadStructEndAsync(cancellationToken);" << endl;
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        if (field_is_required((*f_iter)))
-        {
-            out << indent() << "if (!isset_" << (*f_iter)->get_name() << ")" << endl
-                << indent() << "{" << endl;
-            indent_up();
-            out << indent() << "throw new TProtocolException(TProtocolException.INVALID_DATA);" << endl;
-            indent_down();
-            out << indent() << "}" << endl;
-        }
-    }
-
-    indent_down();
-    out << indent() << "}" << endl;
-    out << indent() << "finally" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "iprot.DecrementRecursionDepth();" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_struct_writer(ostream& out, t_struct* tstruct)
-{
-    out << indent() << "public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "oprot.IncrementRecursionDepth();" << endl
-        << indent() << "try" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    string name = tstruct->get_name();
-    const vector<t_field*>& fields = tstruct->get_sorted_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    out << indent() << "var struc = new TStruct(\"" << name << "\");" << endl
-        << indent() << "await oprot.WriteStructBeginAsync(struc, cancellationToken);" << endl;
-
-    if (fields.size() > 0)
-    {
-        out << indent() << "var field = new TField();" << endl;
-        for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-        {
-            bool is_required = field_is_required(*f_iter);
-            bool has_default = field_has_default(*f_iter);
-            if (nullable_ && !has_default && !is_required)
-            {
-                out << indent() << "if (" << prop_name(*f_iter) << " != null)" << endl
-                    << indent() << "{" << endl;
-                indent_up();
-            }
-            else if (!is_required)
-            {
-                bool null_allowed = type_can_be_null((*f_iter)->get_type());
-                if (null_allowed)
-                {
-                    out << indent() << "if (" << prop_name(*f_iter) << " != null && __isset." << normalize_name((*f_iter)->get_name()) << ")" << endl
-                        << indent() << "{" << endl;
-                    indent_up();
-                }
-                else
-                {
-                    out << indent() << "if (__isset." << normalize_name((*f_iter)->get_name()) << ")" << endl
-                        << indent() << "{" << endl;
-                    indent_up();
-                }
-            }
-            out << indent() << "field.Name = \"" << (*f_iter)->get_name() << "\";" << endl
-                << indent() << "field.Type = " << type_to_enum((*f_iter)->get_type()) << ";" << endl
-                << indent() << "field.ID = " << (*f_iter)->get_key() << ";" << endl
-                << indent() << "await oprot.WriteFieldBeginAsync(field, cancellationToken);" << endl;
-
-            generate_serialize_field(out, *f_iter);
-
-            out << indent() << "await oprot.WriteFieldEndAsync(cancellationToken);" << endl;
-            if (!is_required)
-            {
-                indent_down();
-                out << indent() << "}" << endl;
-            }
-        }
-    }
-
-    out << indent() << "await oprot.WriteFieldStopAsync(cancellationToken);" << endl
-        << indent() << "await oprot.WriteStructEndAsync(cancellationToken);" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-        << indent() << "finally" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "oprot.DecrementRecursionDepth();" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_struct_result_writer(ostream& out, t_struct* tstruct)
-{
-    out << indent() << "public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "oprot.IncrementRecursionDepth();" << endl
-        << indent() << "try" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    string name = tstruct->get_name();
-    const vector<t_field*>& fields = tstruct->get_sorted_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    out << indent() << "var struc = new TStruct(\"" << name << "\");" << endl
-        << indent() << "await oprot.WriteStructBeginAsync(struc, cancellationToken);" << endl;
-
-    if (fields.size() > 0)
-    {
-        out << indent() << "var field = new TField();" << endl;
-        bool first = true;
-        for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-        {
-            if (first)
-            {
-                first = false;
-                out << endl << indent() << "if";
-            }
-            else
-            {
-                out << indent() << "else if";
-            }
-
-            if (nullable_)
-            {
-                out << "(this." << prop_name((*f_iter)) << " != null)" << endl
-                    << indent() << "{" << endl;
-            }
-            else
-            {
-                out << "(this.__isset." << normalize_name((*f_iter)->get_name()) << ")" << endl
-                    << indent() << "{" << endl;
-            }
-            indent_up();
-
-            bool null_allowed = !nullable_ && type_can_be_null((*f_iter)->get_type());
-            if (null_allowed)
-            {
-                out << indent() << "if (" << prop_name(*f_iter) << " != null)" << endl
-                    << indent() << "{" << endl;
-                indent_up();
-            }
-
-            out << indent() << "field.Name = \"" << prop_name(*f_iter) << "\";" << endl
-                << indent() << "field.Type = " << type_to_enum((*f_iter)->get_type()) << ";" << endl
-                << indent() << "field.ID = " << (*f_iter)->get_key() << ";" << endl
-                << indent() << "await oprot.WriteFieldBeginAsync(field, cancellationToken);" << endl;
-
-            generate_serialize_field(out, *f_iter);
-
-            out << indent() << "await oprot.WriteFieldEndAsync(cancellationToken);" << endl;
-
-            if (null_allowed)
-            {
-                indent_down();
-                out << indent() << "}" << endl;
-            }
-
-            indent_down();
-            out << indent() << "}" << endl;
-        }
-    }
-
-    out << indent() << "await oprot.WriteFieldStopAsync(cancellationToken);" << endl
-        << indent() << "await oprot.WriteStructEndAsync(cancellationToken);" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-        << indent() << "finally" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "oprot.DecrementRecursionDepth();" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_struct_tostring(ostream& out, t_struct* tstruct)
-{
-    out << indent() << "public override string ToString()" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "var sb = new StringBuilder(\"" << tstruct->get_name() << "(\");" << endl;
-
-    const vector<t_field*>& fields = tstruct->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    bool useFirstFlag = false;
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        if (!field_is_required((*f_iter)))
-        {
-            out << indent() << "bool __first = true;" << endl;
-            useFirstFlag = true;
-        }
-        break;
-    }
-
-    bool had_required = false; // set to true after first required field has been processed
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        bool is_required = field_is_required((*f_iter));
-        bool has_default = field_has_default((*f_iter));
-        if (nullable_ && !has_default && !is_required)
-        {
-            out << indent() << "if (" << prop_name((*f_iter)) << " != null)" << endl
-                << indent() << "{" << endl;
-            indent_up();
-        }
-        else if (!is_required)
-        {
-            bool null_allowed = type_can_be_null((*f_iter)->get_type());
-            if (null_allowed)
-            {
-                out << indent() << "if (" << prop_name((*f_iter)) << " != null && __isset." << normalize_name((*f_iter)->get_name()) << ")" << endl
-                    << indent() << "{" << endl;
-                indent_up();
-            }
-            else
-            {
-                out << indent() << "if (__isset." << normalize_name((*f_iter)->get_name()) << ")" << endl
-                    << indent() << "{" << endl;
-                indent_up();
-            }
-        }
-
-        if (useFirstFlag && (!had_required))
-        {
-            out << indent() << "if(!__first) { sb.Append(\", \"); }" << endl;
-            if (!is_required)
-            {
-                out << indent() << "__first = false;" << endl;
-            }
-            out << indent() << "sb.Append(\"" << prop_name(*f_iter) << ": \");" << endl;
-        }
-        else
-        {
-            out << indent() << "sb.Append(\", " << prop_name(*f_iter) << ": \");" << endl;
-        }
-
-        t_type* ttype = (*f_iter)->get_type();
-        if (ttype->is_xception() || ttype->is_struct())
-        {
-            out << indent() << "sb.Append(" << prop_name(*f_iter) << "== null ? \"<null>\" : " << prop_name(*f_iter) << ".ToString());" << endl;
-        }
-        else
-        {
-            out << indent() << "sb.Append(" << prop_name(*f_iter) << ");" << endl;
-        }
-
-        if (!is_required)
-        {
-            indent_down();
-            out << indent() << "}" << endl;
-        }
-        else
-        {
-            had_required = true; // now __first must be false, so we don't need to check it anymore
-        }
-    }
-
-    out << indent() << "sb.Append(\")\");" << endl
-        << indent() << "return sb.ToString();" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-}
-
-void t_netcore_generator::generate_netcore_union(t_struct* tunion)
-{
-    int ic = indent_count();
-
-    string f_union_name = namespace_dir_ + "/" + (tunion->get_name()) + ".cs";
-    ofstream_with_content_based_conditional_update f_union;
-
-    f_union.open(f_union_name.c_str());
-
-    f_union << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl;
-
-    generate_netcore_union_definition(f_union, tunion);
-
-    f_union.close();
-
-    indent_validate(ic, "generate_netcore_union.");
-}
-
-void t_netcore_generator::generate_netcore_union_definition(ostream& out, t_struct* tunion)
-{
-    // Let's define the class first
-    start_netcore_namespace(out);
-
-    out << indent() << "public abstract partial class " << tunion->get_name() << " : TAbstractBase" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "public abstract Task WriteAsync(TProtocol tProtocol, CancellationToken cancellationToken);" << endl
-        << indent() << "public readonly int Isset;" << endl
-        << indent() << "public abstract object Data { get; }" << endl
-        << indent() << "protected " << tunion->get_name() << "(int isset)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "Isset = isset;" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-
-    out << indent() << "public class ___undefined : " << tunion->get_name() << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "public override object Data { get { return null; } }" << endl
-        << indent() << "public ___undefined() : base(0) {}" << endl << endl;
-
-    out << indent() << "public override Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "throw new TProtocolException( TProtocolException.INVALID_DATA, \"Cannot persist an union type which is not set.\");" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-
-    const vector<t_field*>& fields = tunion->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        generate_netcore_union_class(out, tunion, (*f_iter));
-    }
-
-    generate_netcore_union_reader(out, tunion);
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-
-    end_netcore_namespace(out);
-}
-
-void t_netcore_generator::generate_netcore_union_class(ostream& out, t_struct* tunion, t_field* tfield)
-{
-    out << indent() << "public " << type_name(tfield->get_type()) << " As_" << tfield->get_name() << endl;
-    out << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "get" << endl;
-    out << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "return (" << tfield->get_key() << " == Isset) ? (" << type_name(tfield->get_type()) << ")Data : default(" << type_name(tfield->get_type()) << ");" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-		<< endl;
-	
-	
-    out << indent() << "public class " << tfield->get_name() << " : " << tunion->get_name() << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "private " << type_name(tfield->get_type()) << " _data;" << endl
-        << indent() << "public override object Data { get { return _data; } }" << endl
-        << indent() << "public " << tfield->get_name() << "(" << type_name(tfield->get_type()) << " data) : base("<< tfield->get_key() <<")" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "this._data = data;" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-
-    out << indent() << "public override async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) {" << endl;
-    indent_up();
-
-    out << indent() << "oprot.IncrementRecursionDepth();" << endl
-        << indent() << "try" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "var struc = new TStruct(\"" << tunion->get_name() << "\");" << endl
-        << indent() << "await oprot.WriteStructBeginAsync(struc, cancellationToken);" << endl;
-
-    out << indent() << "var field = new TField();" << endl
-        << indent() << "field.Name = \"" << tfield->get_name() << "\";" << endl
-        << indent() << "field.Type = " << type_to_enum(tfield->get_type()) << ";" << endl
-        << indent() << "field.ID = " << tfield->get_key() << ";" << endl
-        << indent() << "await oprot.WriteFieldBeginAsync(field, cancellationToken);" << endl;
-
-    generate_serialize_field(out, tfield, "_data", true, true);
-
-    out << indent() << "await oprot.WriteFieldEndAsync(cancellationToken);" << endl
-        << indent() << "await oprot.WriteFieldStopAsync(cancellationToken);" << endl
-        << indent() << "await oprot.WriteStructEndAsync(cancellationToken);" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-        << indent() << "finally" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "oprot.DecrementRecursionDepth();" << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-    out << indent() << "}" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_struct_equals(ostream& out, t_struct* tstruct)
-{
-    out << indent() << "public override bool Equals(object that)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "var other = that as " << check_and_correct_struct_name(normalize_name(tstruct->get_name())) << ";" << endl
-        << indent() << "if (other == null) return false;" << endl
-        << indent() << "if (ReferenceEquals(this, other)) return true;" << endl;
-
-    const vector<t_field*>& fields = tstruct->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    bool first = true;
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        if (first)
-        {
-            first = false;
-            out << indent() << "return ";
-            indent_up();
-        }
-        else
-        {
-            out << endl;
-            out << indent() << "&& ";
-        }
-        if (!field_is_required((*f_iter)) && !(nullable_ && !field_has_default((*f_iter))))
-        {
-            out << "((__isset." << normalize_name((*f_iter)->get_name()) << " == other.__isset."
-                << normalize_name((*f_iter)->get_name()) << ") && ((!__isset."
-                << normalize_name((*f_iter)->get_name()) << ") || (";
-        }
-        t_type* ttype = (*f_iter)->get_type();
-        if (ttype->is_container() || ttype->is_binary())
-        {
-            out << "TCollections.Equals(";
-        }
-        else
-        {
-            out << "System.Object.Equals(";
-        }
-        out << prop_name((*f_iter)) << ", other." << prop_name((*f_iter)) << ")";
-        if (!field_is_required((*f_iter)) && !(nullable_ && !field_has_default((*f_iter))))
-        {
-            out << ")))";
-        }
-    }
-    if (first)
-    {
-        out << indent() << "return true;" << endl;
-    }
-    else
-    {
-        out << ";" << endl;
-        indent_down();
-    }
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_struct_hashcode(ostream& out, t_struct* tstruct)
-{
-    out << indent() << "public override int GetHashCode() {" << endl;
-    indent_up();
-
-    out << indent() << "int hashcode = 0;" << endl;
-    out << indent() << "unchecked {" << endl;
-    indent_up();
-
-    const vector<t_field*>& fields = tstruct->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        t_type* ttype = (*f_iter)->get_type();
-        out << indent() << "hashcode = (hashcode * 397) ^ ";
-        if (field_is_required((*f_iter)))
-        {
-            out << "(";
-        }
-        else if (nullable_)
-        {
-            out << "(" << prop_name((*f_iter)) << " == null ? 0 : ";
-        }
-        else
-        {
-            out << "(!__isset." << normalize_name((*f_iter)->get_name()) << " ? 0 : ";
-        }
-        if (ttype->is_container())
-        {
-            out << "(TCollections.GetHashCode(" << prop_name((*f_iter)) << "))";
-        }
-        else
-        {
-            out << "(" << prop_name((*f_iter)) << ".GetHashCode())";
-        }
-        out << ");" << endl;
-    }
-
-    indent_down();
-    out << indent() << "}" << endl;
-    out << indent() << "return hashcode;" << endl;
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_service(t_service* tservice)
-{
-    int ic = indent_count();
-
-    string f_service_name = namespace_dir_ + "/" + service_name_ + ".cs";
-    ofstream_with_content_based_conditional_update f_service;
-    f_service.open(f_service_name.c_str());
-
-    f_service << autogen_comment() << netcore_type_usings() << netcore_thrift_usings() << endl;
-
-    start_netcore_namespace(f_service);
-
-    f_service << indent() << "public partial class " << normalize_name(service_name_) << endl
-              << indent() << "{" << endl;
-    indent_up();
-
-    generate_service_interface(f_service, tservice);
-    generate_service_client(f_service, tservice);
-    generate_service_server(f_service, tservice);
-    generate_service_helpers(f_service, tservice);
-
-    indent_down();
-    f_service << indent() << "}" << endl;
-
-    end_netcore_namespace(f_service);
-    f_service.close();
-
-    indent_validate(ic, "generate_service.");
-}
-
-void t_netcore_generator::generate_service_interface(ostream& out, t_service* tservice)
-{
-    string extends = "";
-    string extends_iface = "";
-    if (tservice->get_extends() != NULL)
-    {
-        extends = type_name(tservice->get_extends());
-        extends_iface = " : " + extends + ".IAsync";
-    }
-
-    //out << endl << endl;
-
-    generate_netcore_doc(out, tservice);
-
-    if (wcf_)
-    {
-        out << indent() << "[ServiceContract(Namespace=\"" << wcf_namespace_ << "\")]" << endl;
-    }
-
-    out << indent() << "public interface IAsync" << extends_iface << endl
-        << indent() << "{" << endl;
-
-    indent_up();
-    vector<t_function*> functions = tservice->get_functions();
-    vector<t_function*>::iterator f_iter;
-    for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter)
-    {
-        generate_netcore_doc(out, *f_iter);
-
-        // if we're using WCF, add the corresponding attributes
-        if (wcf_)
-        {
-            out << indent() << "[OperationContract]" << endl;
-
-            const vector<t_field*>& xceptions = (*f_iter)->get_xceptions()->get_members();
-            vector<t_field*>::const_iterator x_iter;
-            for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter)
-            {
-                out << indent() << "[FaultContract(typeof(" + type_name((*x_iter)->get_type(), false, false) + "Fault))]" << endl;
-            }
-        }
-
-        out << indent() << function_signature_async(*f_iter) << ";" << endl << endl;
-    }
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_service_helpers(ostream& out, t_service* tservice)
-{
-    vector<t_function*> functions = tservice->get_functions();
-    vector<t_function*>::iterator f_iter;
-
-    for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter)
-    {
-        t_struct* ts = (*f_iter)->get_arglist();
-        generate_netcore_struct_definition(out, ts, false, true);
-        generate_function_helpers(out, *f_iter);
-    }
-}
-
-void t_netcore_generator::generate_service_client(ostream& out, t_service* tservice)
-{
-    string extends = "";
-    string extends_client = "";
-    if (tservice->get_extends() != NULL)
-    {
-        extends = type_name(tservice->get_extends());
-        extends_client = extends + ".Client, ";
-    }
-    else
-    {
-        extends_client = "TBaseClient, IDisposable, ";
-    }
-
-    out << endl;
-
-    generate_netcore_doc(out, tservice);
-
-    out << indent() << "public class Client : " << extends_client << "IAsync" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "public Client(TProtocol protocol) : this(protocol, protocol)" << endl
-        << indent() << "{" << endl
-        << indent() << "}" << endl
-        << endl
-        << indent() << "public Client(TProtocol inputProtocol, TProtocol outputProtocol) : base(inputProtocol, outputProtocol)"
-        << indent() << "{" << endl
-        << indent() << "}" << endl;
-
-    vector<t_function*> functions = tservice->get_functions();
-    vector<t_function*>::const_iterator functions_iterator;
-
-    for (functions_iterator = functions.begin(); functions_iterator != functions.end(); ++functions_iterator)
-    {
-        string function_name = correct_function_name_for_async((*functions_iterator)->get_name());
-
-        // async
-        out << indent() << "public async " << function_signature_async(*functions_iterator, "") << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        string argsname = (*functions_iterator)->get_name() + "Args";
-
-        out << indent() << "await OutputProtocol.WriteMessageBeginAsync(new TMessage(\"" << function_name
-            << "\", " << ((*functions_iterator)->is_oneway() ? "TMessageType.Oneway" : "TMessageType.Call") << ", SeqId), cancellationToken);" << endl
-            << indent() << endl
-            << indent() << "var args = new " << argsname << "();" << endl;
-
-        t_struct* arg_struct = (*functions_iterator)->get_arglist();
-        prepare_member_name_mapping(arg_struct);
-        const vector<t_field*>& fields = arg_struct->get_members();
-        vector<t_field*>::const_iterator fld_iter;
-
-        for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter)
-        {
-            out << indent() << "args." << prop_name(*fld_iter) << " = " << normalize_name((*fld_iter)->get_name()) << ";" << endl;
-        }
-
-        out << indent() << endl
-            << indent() << "await args.WriteAsync(OutputProtocol, cancellationToken);" << endl
-            << indent() << "await OutputProtocol.WriteMessageEndAsync(cancellationToken);" << endl
-            << indent() << "await OutputProtocol.Transport.FlushAsync(cancellationToken);" << endl;
-
-        if (!(*functions_iterator)->is_oneway())
-        {
-            string resultname = (*functions_iterator)->get_name() + "Result";
-            t_struct noargs(program_);
-            t_struct* xs = (*functions_iterator)->get_xceptions();
-            prepare_member_name_mapping(xs, xs->get_members(), resultname);
-
-            out << indent() << endl
-                << indent() << "var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken);" << endl
-                << indent() << "if (msg.Type == TMessageType.Exception)" << endl
-                << indent() << "{" << endl;
-            indent_up();
-
-            out << indent() << "var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken);" << endl
-                << indent() << "await InputProtocol.ReadMessageEndAsync(cancellationToken);" << endl
-                << indent() << "throw x;" << endl;
-            indent_down();
-
-            out << indent() << "}" << endl
-                << endl
-                << indent() << "var result = new " << resultname << "();" << endl
-                << indent() << "await result.ReadAsync(InputProtocol, cancellationToken);" << endl
-                << indent() << "await InputProtocol.ReadMessageEndAsync(cancellationToken);" << endl;
-
-            if (!(*functions_iterator)->get_returntype()->is_void())
-            {
-                if (nullable_)
-                {
-                    if (type_can_be_null((*functions_iterator)->get_returntype()))
-                    {
-                        out << indent() << "if (result.Success != null)" << endl
-                            << indent() << "{" << endl;
-                        indent_up();
-                        out << indent() << "return result.Success;" << endl;
-                        indent_down();
-                        out << indent() << "}" << endl;
-                    }
-                    else
-                    {
-                        out << indent() << "if (result.Success.HasValue)" << endl
-                            << indent() << "{" << endl;
-                        indent_up();
-                        out << indent() << "return result.Success.Value;" << endl;
-                        indent_down();
-                        out << indent() << "}" << endl;
-                    }
-                }
-                else
-                {
-                    out << indent() << "if (result.__isset.success)" << endl
-                        << indent() << "{" << endl;
-                    indent_up();
-                    out << indent() << "return result.Success;" << endl;
-                    indent_down();
-                    out << indent() << "}" << endl;
-                }
-            }
-
-            const vector<t_field*>& xceptions = xs->get_members();
-            vector<t_field*>::const_iterator x_iter;
-            for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter)
-            {
-                if (nullable_)
-                {
-                    out << indent() << "if (result." << prop_name(*x_iter) << " != null)" << endl
-                        << indent() << "{" << endl;
-                    indent_up();
-                    out << indent() << "throw result." << prop_name(*x_iter) << ";" << endl;
-                    indent_down();
-                    out << indent() << "}" << endl;
-                }
-                else
-                {
-                    out << indent() << "if (result.__isset." << normalize_name((*x_iter)->get_name()) << ")" << endl
-                        << indent() << "{" << endl;
-                    indent_up();
-                    out << indent() << "throw result." << prop_name(*x_iter) << ";" << endl;
-                    indent_down();
-                    out << indent() << "}" << endl;
-                }
-            }
-
-            if ((*functions_iterator)->get_returntype()->is_void())
-            {
-                out << indent() << "return;" << endl;
-            }
-            else
-            {
-                out << indent() << "throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, \""
-                    << function_name << " failed: unknown result\");" << endl;
-            }
-
-            cleanup_member_name_mapping((*functions_iterator)->get_xceptions());
-            indent_down();
-            out << indent() << "}" << endl << endl;
-        }
-        else
-        {
-            indent_down();
-            out << indent() << "}" << endl;
-        }
-    }
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_service_server(ostream& out, t_service* tservice)
-{
-    vector<t_function*> functions = tservice->get_functions();
-    vector<t_function*>::iterator f_iter;
-
-    string extends = "";
-    string extends_processor = "";
-    if (tservice->get_extends() != NULL)
-    {
-        extends = type_name(tservice->get_extends());
-        extends_processor = extends + ".AsyncProcessor, ";
-    }
-
-    out << indent() << "public class AsyncProcessor : " << extends_processor << "ITAsyncProcessor" << endl
-        << indent() << "{" << endl;
-
-    indent_up();
-
-    out << indent() << "private IAsync _iAsync;" << endl
-        << endl
-        << indent() << "public AsyncProcessor(IAsync iAsync)";
-
-    if (!extends.empty())
-    {
-        out << " : base(iAsync)";
-    }
-
-    out << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "if (iAsync == null) throw new ArgumentNullException(nameof(iAsync));" << endl
-        << endl
-        << indent() << "_iAsync = iAsync;" << endl;
-
-    for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter)
-    {
-        string function_name = (*f_iter)->get_name();
-        out << indent() << "processMap_[\"" << correct_function_name_for_async(function_name) << "\"] = " << function_name << "_ProcessAsync;" << endl;
-    }
-
-    indent_down();
-    out << indent() << "}" << endl
-        << endl;
-
-    if (extends.empty())
-    {
-        out << indent() << "protected delegate Task ProcessFunction(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken);" << endl;
-    }
-
-    if (extends.empty())
-    {
-        out << indent() << "protected Dictionary<string, ProcessFunction> processMap_ = new Dictionary<string, ProcessFunction>();" << endl;
-    }
-
-    out << endl;
-
-    if (extends.empty())
-    {
-        out << indent() << "public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot)" << endl
-            << indent() << "{" << endl;
-        indent_up();
-        out << indent() << "return await ProcessAsync(iprot, oprot, CancellationToken.None);" << endl;
-        indent_down();
-        out << indent() << "}" << endl << endl;
-
-        out << indent() << "public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)" << endl;
-    }
-    else
-    {
-        out << indent() << "public new async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot)" << endl
-            << indent() << "{" << endl;
-        indent_up();
-        out << indent() << "return await ProcessAsync(iprot, oprot, CancellationToken.None);" << endl;
-        indent_down();
-        out << indent() << "}" << endl << endl;
-
-        out << indent() << "public new async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)" << endl;
-    }
-
-    out << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "try" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "var msg = await iprot.ReadMessageBeginAsync(cancellationToken);" << endl
-        << endl
-        << indent() << "ProcessFunction fn;" << endl
-        << indent() << "processMap_.TryGetValue(msg.Name, out fn);" << endl
-        << endl
-        << indent() << "if (fn == null)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "await TProtocolUtil.SkipAsync(iprot, TType.Struct, cancellationToken);" << endl
-        << indent() << "await iprot.ReadMessageEndAsync(cancellationToken);" << endl
-        << indent() << "var x = new TApplicationException (TApplicationException.ExceptionType.UnknownMethod, \"Invalid method name: '\" + msg.Name + \"'\");" << endl
-        << indent() << "await oprot.WriteMessageBeginAsync(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID), cancellationToken);" << endl
-        << indent() << "await x.WriteAsync(oprot, cancellationToken);" << endl
-        << indent() << "await oprot.WriteMessageEndAsync(cancellationToken);" << endl
-        << indent() << "await oprot.Transport.FlushAsync(cancellationToken);" << endl
-        << indent() << "return true;" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-        << endl
-        << indent() << "await fn(msg.SeqID, iprot, oprot, cancellationToken);" << endl
-        << endl;
-    indent_down();
-    out << indent() << "}" << endl;
-    out << indent() << "catch (IOException)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-    out << indent() << "return false;" << endl;
-    indent_down();
-    out << indent() << "}" << endl
-        << endl
-        << indent() << "return true;" << endl;
-    indent_down();
-    out << indent() << "}" << endl << endl;
-
-    for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter)
-    {
-        generate_process_function_async(out, tservice, *f_iter);
-    }
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_function_helpers(ostream& out, t_function* tfunction)
-{
-    if (tfunction->is_oneway())
-    {
-        return;
-    }
-
-    t_struct result(program_, tfunction->get_name() + "_result");
-    t_field success(tfunction->get_returntype(), "success", 0);
-    if (!tfunction->get_returntype()->is_void())
-    {
-        result.append(&success);
-    }
-
-    t_struct* xs = tfunction->get_xceptions();
-    const vector<t_field*>& fields = xs->get_members();
-    vector<t_field*>::const_iterator f_iter;
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        result.append(*f_iter);
-    }
-
-    generate_netcore_struct_definition(out, &result, false, true, true);
-}
-
-void t_netcore_generator::generate_process_function_async(ostream& out, t_service* tservice, t_function* tfunction)
-{
-    (void)tservice;
-    out << indent() << "public async Task " << tfunction->get_name()
-        << "_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    string argsname = tfunction->get_name() + "Args";
-    string resultname = tfunction->get_name() + "Result";
-
-    out << indent() << "var args = new " << argsname << "();" << endl
-        << indent() << "await args.ReadAsync(iprot, cancellationToken);" << endl
-        << indent() << "await iprot.ReadMessageEndAsync(cancellationToken);" << endl;
-
-    if (!tfunction->is_oneway())
-    {
-        out << indent() << "var result = new " << resultname << "();" << endl;
-    }
-
-    out << indent() << "try" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    t_struct* xs = tfunction->get_xceptions();
-    const vector<t_field*>& xceptions = xs->get_members();
-
-    if (xceptions.size() > 0)
-    {
-        out << indent() << "try" << endl
-            << indent() << "{" << endl;
-        indent_up();
-    }
-
-    t_struct* arg_struct = tfunction->get_arglist();
-    const vector<t_field*>& fields = arg_struct->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    out << indent();
-    if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void())
-    {
-        out << "result.Success = ";
-    }
-
-    out << "await _iAsync." << normalize_name(tfunction->get_name()) << "Async(";
-
-    bool first = true;
-    prepare_member_name_mapping(arg_struct);
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        if (first)
-        {
-            first = false;
-        }
-        else
-        {
-            out << ", ";
-        }
-
-        out << "args." << prop_name(*f_iter);
-        if (nullable_ && !type_can_be_null((*f_iter)->get_type()))
-        {
-            out << ".Value";
-        }
-    }
-
-    cleanup_member_name_mapping(arg_struct);
-
-    if (!first)
-    {
-        out << ", ";
-    }
-
-    out << "cancellationToken);" << endl;
-
-    vector<t_field*>::const_iterator x_iter;
-
-    prepare_member_name_mapping(xs, xs->get_members(), resultname);
-    if (xceptions.size() > 0)
-    {
-        indent_down();
-        out << indent() << "}" << endl;
-
-        for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter)
-        {
-            out << indent() << "catch (" << type_name((*x_iter)->get_type(), false, false) << " " << (*x_iter)->get_name() << ")" << endl
-                << indent() << "{" << endl;
-
-            if (!tfunction->is_oneway())
-            {
-                indent_up();
-                out << indent() << "result." << prop_name(*x_iter) << " = " << (*x_iter)->get_name() << ";" << endl;
-                indent_down();
-            }
-            out << indent() << "}" << endl;
-        }
-    }
-
-    if (!tfunction->is_oneway())
-    {
-        out << indent() << "await oprot.WriteMessageBeginAsync(new TMessage(\""
-                << correct_function_name_for_async(tfunction->get_name()) << "\", TMessageType.Reply, seqid), cancellationToken); " << endl
-            << indent() << "await result.WriteAsync(oprot, cancellationToken);" << endl;
-    }
-    indent_down();
-
-    cleanup_member_name_mapping(xs);
-
-    out << indent() << "}" << endl
-        << indent() << "catch (TTransportException)" << endl
-        << indent() << "{" << endl
-        << indent() << "  throw;" << endl
-        << indent() << "}" << endl
-        << indent() << "catch (Exception ex)" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    out << indent() << "Console.Error.WriteLine(\"Error occurred in processor:\");" << endl
-        << indent() << "Console.Error.WriteLine(ex.ToString());" << endl;
-
-    if (tfunction->is_oneway())
-    {
-        indent_down();
-        out << indent() << "}" << endl;
-    }
-    else
-    {
-        out << indent() << "var x = new TApplicationException(TApplicationException.ExceptionType.InternalError,\" Internal error.\");" << endl
-            << indent() << "await oprot.WriteMessageBeginAsync(new TMessage(\"" << correct_function_name_for_async(tfunction->get_name())
-            << "\", TMessageType.Exception, seqid), cancellationToken);" << endl
-            << indent() << "await x.WriteAsync(oprot, cancellationToken);" << endl;
-        indent_down();
-
-        out << indent() << "}" << endl
-            << indent() << "await oprot.WriteMessageEndAsync(cancellationToken);" << endl
-            << indent() << "await oprot.Transport.FlushAsync(cancellationToken);" << endl;
-    }
-
-    indent_down();
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_netcore_union_reader(ostream& out, t_struct* tunion)
-{
-    // Thanks to THRIFT-1768, we don't need to check for required fields in the union
-    const vector<t_field*>& fields = tunion->get_members();
-    vector<t_field*>::const_iterator f_iter;
-
-    out << indent() << "public static async Task<" << tunion->get_name() << "> ReadAsync(TProtocol iprot, CancellationToken cancellationToken)" << endl;
-    scope_up(out);
-
-    out << indent() << "iprot.IncrementRecursionDepth();" << endl;
-    out << indent() << "try" << endl;
-    scope_up(out);
-
-    out << indent() << tunion->get_name() << " retval;" << endl;
-    out << indent() << "await iprot.ReadStructBeginAsync(cancellationToken);" << endl;
-    out << indent() << "TField field = await iprot.ReadFieldBeginAsync(cancellationToken);" << endl;
-    // we cannot have the first field be a stop -- we must have a single field defined
-    out << indent() << "if (field.Type == TType.Stop)" << endl;
-    scope_up(out);
-    out << indent() << "await iprot.ReadFieldEndAsync(cancellationToken);" << endl;
-    out << indent() << "retval = new ___undefined();" << endl;
-    scope_down(out);
-    out << indent() << "else" << endl;
-    scope_up(out);
-    out << indent() << "switch (field.ID)" << endl;
-    scope_up(out);
-
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        out << indent() << "case " << (*f_iter)->get_key() << ":" << endl;
-        indent_up();
-        out << indent() << "if (field.Type == " << type_to_enum((*f_iter)->get_type()) << ") {" << endl;
-        indent_up();
-
-        out << indent() << type_name((*f_iter)->get_type()) << " temp;" << endl;
-        generate_deserialize_field(out, (*f_iter), "temp", true);
-        out << indent() << "retval = new " << (*f_iter)->get_name() << "(temp);" << endl;
-
-        indent_down();
-        out << indent() << "} else { " << endl << indent() << " await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);"
-            << endl << indent() << "  retval = new ___undefined();" << endl << indent() << "}" << endl
-            << indent() << "break;" << endl;
-        indent_down();
-    }
-
-    out << indent() << "default: " << endl;
-    indent_up();
-    out << indent() << "await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);" << endl << indent()
-        << "retval = new ___undefined();" << endl;
-    out << indent() << "break;" << endl;
-    indent_down();
-
-    scope_down(out);
-
-    out << indent() << "await iprot.ReadFieldEndAsync(cancellationToken);" << endl;
-
-    out << indent() << "if ((await iprot.ReadFieldBeginAsync(cancellationToken)).Type != TType.Stop)" << endl;
-    scope_up(out);
-    out << indent() << "throw new TProtocolException(TProtocolException.INVALID_DATA);" << endl;
-    scope_down(out);
-
-    // end of else for TStop
-    scope_down(out);
-    out << indent() << "await iprot.ReadStructEndAsync(cancellationToken);" << endl;
-    out << indent() << "return retval;" << endl;
-    indent_down();
-
-    scope_down(out);
-    out << indent() << "finally" << endl;
-    scope_up(out);
-    out << indent() << "iprot.DecrementRecursionDepth();" << endl;
-    scope_down(out);
-
-    out << indent() << "}" << endl << endl;
-}
-
-void t_netcore_generator::generate_deserialize_field(ostream& out, t_field* tfield, string prefix, bool is_propertyless)
-{
-    t_type* type = tfield->get_type();
-    while (type->is_typedef())
-    {
-        type = static_cast<t_typedef*>(type)->get_type();
-    }
-
-    if (type->is_void())
-    {
-        throw "CANNOT GENERATE DESERIALIZE CODE FOR void TYPE: " + prefix + tfield->get_name();
-    }
-
-    string name = prefix + (is_propertyless ? "" : prop_name(tfield));
-
-    if (type->is_struct() || type->is_xception())
-    {
-        generate_deserialize_struct(out, static_cast<t_struct*>(type), name);
-    }
-    else if (type->is_container())
-    {
-        generate_deserialize_container(out, type, name);
-    }
-    else if (type->is_base_type() || type->is_enum())
-    {
-        out << indent() << name << " = ";
-
-        if (type->is_enum())
-        {
-            out << "(" << type_name(type, false, true) << ")";
-        }
-
-        out << "await iprot.";
-
-        if (type->is_base_type())
-        {
-            t_base_type::t_base tbase = static_cast<t_base_type*>(type)->get_base();
-            switch (tbase)
-            {
-            case t_base_type::TYPE_VOID:
-                throw "compiler error: cannot serialize void field in a struct: " + name;
-                break;
-            case t_base_type::TYPE_STRING:
-                if (type->is_binary())
-                {
-                    out << "ReadBinaryAsync(cancellationToken);";
-                }
-                else
-                {
-                    out << "ReadStringAsync(cancellationToken);";
-                }
-                break;
-            case t_base_type::TYPE_BOOL:
-                out << "ReadBoolAsync(cancellationToken);";
-                break;
-            case t_base_type::TYPE_I8:
-                out << "ReadByteAsync(cancellationToken);";
-                break;
-            case t_base_type::TYPE_I16:
-                out << "ReadI16Async(cancellationToken);";
-                break;
-            case t_base_type::TYPE_I32:
-                out << "ReadI32Async(cancellationToken);";
-                break;
-            case t_base_type::TYPE_I64:
-                out << "ReadI64Async(cancellationToken);";
-                break;
-            case t_base_type::TYPE_DOUBLE:
-                out << "ReadDoubleAsync(cancellationToken);";
-                break;
-            default:
-                throw "compiler error: no C# name for base type " + t_base_type::t_base_name(tbase);
-            }
-        }
-        else if (type->is_enum())
-        {
-            out << "ReadI32Async(cancellationToken);";
-        }
-        out << endl;
-    }
-    else
-    {
-        printf("DO NOT KNOW HOW TO DESERIALIZE FIELD '%s' TYPE '%s'\n", tfield->get_name().c_str(), type_name(type).c_str());
-    }
-}
-
-void t_netcore_generator::generate_deserialize_struct(ostream& out, t_struct* tstruct, string prefix)
-{
-    if (union_ && tstruct->is_union())
-    {
-        out << indent() << prefix << " = await " << type_name(tstruct) << ".ReadAsync(iprot, cancellationToken);" << endl;
-    }
-    else
-    {
-        out << indent() << prefix << " = new " << type_name(tstruct) << "();" << endl
-            << indent() << "await " << prefix << ".ReadAsync(iprot, cancellationToken);" << endl;
-    }
-}
-
-void t_netcore_generator::generate_deserialize_container(ostream& out, t_type* ttype, string prefix)
-{
-    out << indent() << "{" << endl;
-    indent_up();
-
-    string obj;
-
-    if (ttype->is_map())
-    {
-        obj = tmp("_map");
-    }
-    else if (ttype->is_set())
-    {
-        obj = tmp("_set");
-    }
-    else if (ttype->is_list())
-    {
-        obj = tmp("_list");
-    }
-
-    out << indent() << prefix << " = new " << type_name(ttype, false, true) << "();" << endl;
-    if (ttype->is_map())
-    {
-        out << indent() << "TMap " << obj << " = await iprot.ReadMapBeginAsync(cancellationToken);" << endl;
-    }
-    else if (ttype->is_set())
-    {
-        out << indent() << "TSet " << obj << " = await iprot.ReadSetBeginAsync(cancellationToken);" << endl;
-    }
-    else if (ttype->is_list())
-    {
-        out << indent() << "TList " << obj << " = await iprot.ReadListBeginAsync(cancellationToken);" << endl;
-    }
-
-    string i = tmp("_i");
-    out << indent() << "for(int " << i << " = 0; " << i << " < " << obj << ".Count; ++" << i << ")" << endl
-        << indent() << "{" << endl;
-    indent_up();
-
-    if (ttype->is_map())
-    {
-        generate_deserialize_map_element(out, static_cast<t_map*>(ttype), prefix);
-    }
-    else if (ttype->is_set())
-    {
-        generate_deserialize_set_element(out, static_cast<t_set*>(ttype), prefix);
-    }
-    else if (ttype->is_list())
-    {
-        generate_deserialize_list_element(out, static_cast<t_list*>(ttype), prefix);
-    }
-
-    indent_down();
-    out << indent() << "}" << endl;
-
-    if (ttype->is_map())
-    {
-        out << indent() << "await iprot.ReadMapEndAsync(cancellationToken);" << endl;
-    }
-    else if (ttype->is_set())
-    {
-        out << indent() << "await iprot.ReadSetEndAsync(cancellationToken);" << endl;
-    }
-    else if (ttype->is_list())
-    {
-        out << indent() << "await iprot.ReadListEndAsync(cancellationToken);" << endl;
-    }
-
-    indent_down();
-    out << indent() << "}" << endl;
-}
-
-void t_netcore_generator::generate_deserialize_map_element(ostream& out, t_map* tmap, string prefix)
-{
-    string key = tmp("_key");
-    string val = tmp("_val");
-
-    t_field fkey(tmap->get_key_type(), key);
-    t_field fval(tmap->get_val_type(), val);
-
-    out << indent() << declare_field(&fkey) << endl;
-    out << indent() << declare_field(&fval) << endl;
-
-    generate_deserialize_field(out, &fkey);
-    generate_deserialize_field(out, &fval);
-
-    out << indent() << prefix << "[" << key << "] = " << val << ";" << endl;
-}
-
-void t_netcore_generator::generate_deserialize_set_element(ostream& out, t_set* tset, string prefix)
-{
-    string elem = tmp("_elem");
-    t_field felem(tset->get_elem_type(), elem);
-
-    out << indent() << declare_field(&felem) << endl;
-
-    generate_deserialize_field(out, &felem);
-
-    out << indent() << prefix << ".Add(" << elem << ");" << endl;
-}
-
-void t_netcore_generator::generate_deserialize_list_element(ostream& out, t_list* tlist, string prefix)
-{
-    string elem = tmp("_elem");
-    t_field felem(tlist->get_elem_type(), elem);
-
-    out << indent() << declare_field(&felem) << endl;
-
-    generate_deserialize_field(out, &felem);
-
-    out << indent() << prefix << ".Add(" << elem << ");" << endl;
-}
-
-void t_netcore_generator::generate_serialize_field(ostream& out, t_field* tfield, string prefix, bool is_element, bool is_propertyless)
-{
-    t_type* type = tfield->get_type();
-    while (type->is_typedef())
-    {
-        type = static_cast<t_typedef*>(type)->get_type();
-    }
-
-    string name = prefix + (is_propertyless ? "" : prop_name(tfield));
-
-    if (type->is_void())
-    {
-        throw "CANNOT GENERATE SERIALIZE CODE FOR void TYPE: " + name;
-    }
-
-    if (type->is_struct() || type->is_xception())
-    {
-        generate_serialize_struct(out, static_cast<t_struct*>(type), name);
-    }
-    else if (type->is_container())
-    {
-        generate_serialize_container(out, type, name);
-    }
-    else if (type->is_base_type() || type->is_enum())
-    {
-        out << indent() << "await oprot.";
-
-        string nullable_name = nullable_ && !is_element && !field_is_required(tfield) ? name + ".Value" : name;
-
-        if (type->is_base_type())
-        {
-            t_base_type::t_base tbase = static_cast<t_base_type*>(type)->get_base();
-            switch (tbase)
-            {
-            case t_base_type::TYPE_VOID:
-                throw "compiler error: cannot serialize void field in a struct: " + name;
-            case t_base_type::TYPE_STRING:
-                if (type->is_binary())
-                {
-                    out << "WriteBinaryAsync(";
-                }
-                else
-                {
-                    out << "WriteStringAsync(";
-                }
-                out << name << ", cancellationToken);";
-                break;
-            case t_base_type::TYPE_BOOL:
-                out << "WriteBoolAsync(" << nullable_name << ", cancellationToken);";
-                break;
-            case t_base_type::TYPE_I8:
-                out << "WriteByteAsync(" << nullable_name << ", cancellationToken);";
-                break;
-            case t_base_type::TYPE_I16:
-                out << "WriteI16Async(" << nullable_name << ", cancellationToken);";
-                break;
-            case t_base_type::TYPE_I32:
-                out << "WriteI32Async(" << nullable_name << ", cancellationToken);";
-                break;
-            case t_base_type::TYPE_I64:
-                out << "WriteI64Async(" << nullable_name << ", cancellationToken);";
-                break;
-            case t_base_type::TYPE_DOUBLE:
-                out << "WriteDoubleAsync(" << nullable_name << ", cancellationToken);";
-                break;
-            default:
-                throw "compiler error: no C# name for base type " + t_base_type::t_base_name(tbase);
-            }
-        }
-        else if (type->is_enum())
-        {
-            out << "WriteI32Async((int)" << nullable_name << ", cancellationToken);";
-        }
-        out << endl;
-    }
-    else
-    {
-        printf("DO NOT KNOW HOW TO SERIALIZE '%s%s' TYPE '%s'\n", prefix.c_str(), tfield->get_name().c_str(), type_name(type).c_str());
-    }
-}
-
-void t_netcore_generator::generate_serialize_struct(ostream& out, t_struct* tstruct, string prefix)
-{
-    (void)tstruct;
-    out << indent() << "await " << prefix << ".WriteAsync(oprot, cancellationToken);" << endl;
-}
-
-void t_netcore_generator::generate_serialize_container(ostream& out, t_type* ttype, string prefix)
-{
-    out << indent() << "{" << endl;
-    indent_up();
-
-    if (ttype->is_map())
-    {
-        out << indent() << "await oprot.WriteMapBeginAsync(new TMap(" << type_to_enum(static_cast<t_map*>(ttype)->get_key_type())
-            << ", " << type_to_enum(static_cast<t_map*>(ttype)->get_val_type()) << ", " << prefix
-            << ".Count), cancellationToken);" << endl;
-    }
-    else if (ttype->is_set())
-    {
-        out << indent() << "await oprot.WriteSetBeginAsync(new TSet(" << type_to_enum(static_cast<t_set*>(ttype)->get_elem_type())
-            << ", " << prefix << ".Count), cancellationToken);" << endl;
-    }
-    else if (ttype->is_list())
-    {
-        out << indent() << "await oprot.WriteListBeginAsync(new TList("
-            << type_to_enum(static_cast<t_list*>(ttype)->get_elem_type()) << ", " << prefix << ".Count), cancellationToken);"
-            << endl;
-    }
-
-    string iter = tmp("_iter");
-    if (ttype->is_map())
-    {
-        out << indent() << "foreach (" << type_name(static_cast<t_map*>(ttype)->get_key_type()) << " " << iter
-            << " in " << prefix << ".Keys)";
-    }
-    else if (ttype->is_set())
-    {
-        out << indent() << "foreach (" << type_name(static_cast<t_set*>(ttype)->get_elem_type()) << " " << iter
-            << " in " << prefix << ")";
-    }
-    else if (ttype->is_list())
-    {
-        out << indent() << "foreach (" << type_name(static_cast<t_list*>(ttype)->get_elem_type()) << " " << iter
-            << " in " << prefix << ")";
-    }
-
-    out << endl;
-    out << indent() << "{" << endl;
-    indent_up();
-
-    if (ttype->is_map())
-    {
-        generate_serialize_map_element(out, static_cast<t_map*>(ttype), iter, prefix);
-    }
-    else if (ttype->is_set())
-    {
-        generate_serialize_set_element(out, static_cast<t_set*>(ttype), iter);
-    }
-    else if (ttype->is_list())
-    {
-        generate_serialize_list_element(out, static_cast<t_list*>(ttype), iter);
-    }
-
-    indent_down();
-    out << indent() << "}" << endl;
-
-    if (ttype->is_map())
-    {
-        out << indent() << "await oprot.WriteMapEndAsync(cancellationToken);" << endl;
-    }
-    else if (ttype->is_set())
-    {
-        out << indent() << "await oprot.WriteSetEndAsync(cancellationToken);" << endl;
-    }
-    else if (ttype->is_list())
-    {
-        out << indent() << "await oprot.WriteListEndAsync(cancellationToken);" << endl;
-    }
-
-    indent_down();
-    out << indent() << "}" << endl;
-}
-
-void t_netcore_generator::generate_serialize_map_element(ostream& out, t_map* tmap, string iter, string map)
-{
-    t_field kfield(tmap->get_key_type(), iter);
-    generate_serialize_field(out, &kfield, "", true);
-    t_field vfield(tmap->get_val_type(), map + "[" + iter + "]");
-    generate_serialize_field(out, &vfield, "", true);
-}
-
-void t_netcore_generator::generate_serialize_set_element(ostream& out, t_set* tset, string iter)
-{
-    t_field efield(tset->get_elem_type(), iter);
-    generate_serialize_field(out, &efield, "", true);
-}
-
-void t_netcore_generator::generate_serialize_list_element(ostream& out, t_list* tlist, string iter)
-{
-    t_field efield(tlist->get_elem_type(), iter);
-    generate_serialize_field(out, &efield, "", true);
-}
-
-void t_netcore_generator::generate_property(ostream& out, t_field* tfield, bool isPublic, bool generateIsset)
-{
-    generate_netcore_property(out, tfield, isPublic, generateIsset, "_");
-}
-
-void t_netcore_generator::generate_netcore_property(ostream& out, t_field* tfield, bool isPublic, bool generateIsset, string fieldPrefix)
-{
-    if ((serialize_ || wcf_) && isPublic)
-    {
-        out << indent() << "[DataMember(Order = 0)]" << endl;
-    }
-    bool has_default = field_has_default(tfield);
-    bool is_required = field_is_required(tfield);
-    if ((nullable_ && !has_default) || is_required)
-    {
-        out << indent() << (isPublic ? "public " : "private ") << type_name(tfield->get_type(), false, false, true, is_required) << " " << prop_name(tfield) << " { get; set; }" << endl;
-    }
-    else
-    {
-        out << indent() << (isPublic ? "public " : "private ")  << type_name(tfield->get_type(), false, false, true) << " " << prop_name(tfield) << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        out << indent() << "get" << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        bool use_nullable = false;
-        if (nullable_)
-        {
-            t_type* ttype = tfield->get_type();
-            while (ttype->is_typedef())
-            {
-                ttype = static_cast<t_typedef*>(ttype)->get_type();
-            }
-            if (ttype->is_base_type())
-            {
-                use_nullable = static_cast<t_base_type*>(ttype)->get_base() != t_base_type::TYPE_STRING;
-            }
-        }
-
-        out << indent() << "return " << fieldPrefix + tfield->get_name() << ";" << endl;
-        indent_down();
-        out << indent() << "}" << endl
-            << indent() << "set" << endl
-            << indent() << "{" << endl;
-        indent_up();
-
-        if (use_nullable)
-        {
-            if (generateIsset)
-            {
-                out << indent() << "__isset." << normalize_name(tfield->get_name()) << " = value.HasValue;" << endl;
-            }
-            out << indent() << "if (value.HasValue) this." << fieldPrefix + tfield->get_name() << " = value.Value;" << endl;
-        }
-        else
-        {
-            if (generateIsset)
-            {
-                out << indent() << "__isset." << normalize_name(tfield->get_name()) << " = true;" << endl;
-            }
-            out << indent() << "this." << fieldPrefix + tfield->get_name() << " = value;" << endl;
-        }
-
-        indent_down();
-        out << indent() << "}" << endl;
-        indent_down();
-        out << indent() << "}" << endl;
-    }
-    out << endl;
-}
-
-string t_netcore_generator::make_valid_csharp_identifier(string const& fromName)
-{
-    string str = fromName;
-    if (str.empty())
-    {
-        return str;
-    }
-
-    // tests rely on this
-    assert(('A' < 'Z') && ('a' < 'z') && ('0' < '9'));
-
-    // if the first letter is a number, we add an additional underscore in front of it
-    char c = str.at(0);
-    if (('0' <= c) && (c <= '9'))
-    {
-        str = "_" + str;
-    }
-
-    // following chars: letter, number or underscore
-    for (size_t i = 0; i < str.size(); ++i)
-    {
-        c = str.at(i);
-        if (('A' > c || c > 'Z') && ('a' > c || c > 'z') && ('0' > c || c > '9') && '_' != c)
-        {
-            str.replace(i, 1, "_");
-        }
-    }
-
-    return str;
-}
-
-void t_netcore_generator::cleanup_member_name_mapping(void* scope)
-{
-    if (member_mapping_scopes.empty())
-    {
-        throw "internal error: cleanup_member_name_mapping() no scope active";
-    }
-
-    member_mapping_scope& active = member_mapping_scopes.back();
-    if (active.scope_member != scope)
-    {
-        throw "internal error: cleanup_member_name_mapping() called for wrong struct";
-    }
-
-    member_mapping_scopes.pop_back();
-}
-
-string t_netcore_generator::get_mapped_member_name(string name)
-{
-    if (!member_mapping_scopes.empty())
-    {
-        member_mapping_scope& active = member_mapping_scopes.back();
-        map<string, string>::iterator iter = active.mapping_table.find(name);
-        if (active.mapping_table.end() != iter)
-        {
-            return iter->second;
-        }
-    }
-
-    pverbose("no mapping for member %s\n", name.c_str());
-    return name;
-}
-
-void t_netcore_generator::prepare_member_name_mapping(t_struct* tstruct)
-{
-    prepare_member_name_mapping(tstruct, tstruct->get_members(), tstruct->get_name());
-}
-
-void t_netcore_generator::prepare_member_name_mapping(void* scope, const vector<t_field*>& members, const string& structname)
-{
-    // begin new scope
-    member_mapping_scopes.emplace_back();
-    member_mapping_scope& active = member_mapping_scopes.back();
-    active.scope_member = scope;
-
-    // current C# generator policy:
-    // - prop names are always rendered with an Uppercase first letter
-    // - struct names are used as given
-    std::set<string> used_member_names;
-    vector<t_field*>::const_iterator iter;
-
-    // prevent name conflicts with struct (CS0542 error)
-    used_member_names.insert(structname);
-
-    // prevent name conflicts with known methods (THRIFT-2942)
-    used_member_names.insert("Read");
-    used_member_names.insert("Write");
-
-    for (iter = members.begin(); iter != members.end(); ++iter)
-    {
-        string oldname = (*iter)->get_name();
-        string newname = prop_name(*iter, true);
-        while (true)
-        {
-            // new name conflicts with another member
-            if (used_member_names.find(newname) != used_member_names.end())
-            {
-                pverbose("struct %s: member %s conflicts with another member\n", structname.c_str(), newname.c_str());
-                newname += '_';
-                continue;
-            }
-
-            // add always, this helps us to detect edge cases like
-            // different spellings ("foo" and "Foo") within the same struct
-            pverbose("struct %s: member mapping %s => %s\n", structname.c_str(), oldname.c_str(), newname.c_str());
-            active.mapping_table[oldname] = newname;
-            used_member_names.insert(newname);
-            break;
-        }
-    }
-}
-
-string t_netcore_generator::prop_name(t_field* tfield, bool suppress_mapping)
-{
-    string name(tfield->get_name());
-    if (suppress_mapping)
-    {
-        name[0] = toupper(name[0]);
-    }
-    else
-    {
-        name = get_mapped_member_name(name);
-    }
-    return name;
-}
-
-string t_netcore_generator::type_name(t_type* ttype, bool in_container, bool in_init, bool in_param, bool is_required)
-{
-    (void)in_init;
-
-    while (ttype->is_typedef())
-    {
-        ttype = static_cast<t_typedef*>(ttype)->get_type();
-    }
-
-    if (ttype->is_base_type())
-    {
-        return base_type_name(static_cast<t_base_type*>(ttype), in_container, in_param, is_required);
-    }
-
-    if (ttype->is_map())
-    {
-        t_map* tmap = static_cast<t_map*>(ttype);
-        return "Dictionary<" + type_name(tmap->get_key_type(), true) + ", " + type_name(tmap->get_val_type(), true) + ">";
-    }
-
-    if (ttype->is_set())
-    {
-        t_set* tset = static_cast<t_set*>(ttype);
-        return "THashSet<" + type_name(tset->get_elem_type(), true) + ">";
-    }
-
-    if (ttype->is_list())
-    {
-        t_list* tlist = static_cast<t_list*>(ttype);
-        return "List<" + type_name(tlist->get_elem_type(), true) + ">";
-    }
-
-    t_program* program = ttype->get_program();
-    string postfix = (!is_required && nullable_ && in_param && ttype->is_enum()) ? "?" : "";
-    if (program != NULL && program != program_)
-    {
-        string ns = program->get_namespace("netcore");
-        if (!ns.empty())
-        {
-            return ns + "." + normalize_name(ttype->get_name()) + postfix;
-        }
-    }
-
-    return normalize_name(ttype->get_name()) + postfix;
-}
-
-string t_netcore_generator::base_type_name(t_base_type* tbase, bool in_container, bool in_param, bool is_required)
-{
-    (void)in_container;
-    string postfix = (!is_required && nullable_ && in_param) ? "?" : "";
-    switch (tbase->get_base())
-    {
-    case t_base_type::TYPE_VOID:
-        return "void";
-    case t_base_type::TYPE_STRING:
-        {
-            if (tbase->is_binary())
-            {
-                return "byte[]";
-            }
-            return "string";
-        }
-    case t_base_type::TYPE_BOOL:
-        return "bool" + postfix;
-    case t_base_type::TYPE_I8:
-        return "sbyte" + postfix;
-    case t_base_type::TYPE_I16:
-        return "short" + postfix;
-    case t_base_type::TYPE_I32:
-        return "int" + postfix;
-    case t_base_type::TYPE_I64:
-        return "long" + postfix;
-    case t_base_type::TYPE_DOUBLE:
-        return "double" + postfix;
-    default:
-        throw "compiler error: no C# name for base type " + t_base_type::t_base_name(tbase->get_base());
-    }
-}
-
-string t_netcore_generator::declare_field(t_field* tfield, bool init, string prefix)
-{
-    string result = type_name(tfield->get_type()) + " " + prefix + tfield->get_name();
-    if (init)
-    {
-        t_type* ttype = tfield->get_type();
-        while (ttype->is_typedef())
-        {
-            ttype = static_cast<t_typedef*>(ttype)->get_type();
-        }
-        if (ttype->is_base_type() && field_has_default(tfield))
-        {
-            std::ofstream dummy;
-            result += " = " + render_const_value(dummy, tfield->get_name(), ttype, tfield->get_value());
-        }
-        else if (ttype->is_base_type())
-        {
-            t_base_type::t_base tbase = static_cast<t_base_type*>(ttype)->get_base();
-            switch (tbase)
-            {
-            case t_base_type::TYPE_VOID:
-                throw "NO T_VOID CONSTRUCT";
-            case t_base_type::TYPE_STRING:
-                result += " = null";
-                break;
-            case t_base_type::TYPE_BOOL:
-                result += " = false";
-                break;
-            case t_base_type::TYPE_I8:
-            case t_base_type::TYPE_I16:
-            case t_base_type::TYPE_I32:
-            case t_base_type::TYPE_I64:
-                result += " = 0";
-                break;
-            case t_base_type::TYPE_DOUBLE:
-                result += " = (double)0";
-                break;
-            }
-        }
-        else if (ttype->is_enum())
-        {
-            result += " = (" + type_name(ttype, false, true) + ")0";
-        }
-        else if (ttype->is_container())
-        {
-            result += " = new " + type_name(ttype, false, true) + "()";
-        }
-        else
-        {
-            result += " = new " + type_name(ttype, false, true) + "()";
-        }
-    }
-    return result + ";";
-}
-
-string t_netcore_generator::function_signature(t_function* tfunction, string prefix)
-{
-    t_type* ttype = tfunction->get_returntype();
-    return type_name(ttype) + " " + normalize_name(prefix + tfunction->get_name()) + "(" + argument_list(tfunction->get_arglist()) + ")";
-}
-
-string t_netcore_generator::function_signature_async(t_function* tfunction, string prefix)
-{
-    t_type* ttype = tfunction->get_returntype();
-    string task = "Task";
-    if (!ttype->is_void())
-    {
-        task += "<" + type_name(ttype) + ">";
-    }
-
-    string result = task + " " + normalize_name(prefix + tfunction->get_name()) + "Async(";
-    string args = argument_list(tfunction->get_arglist());
-    result += args;
-    if (!args.empty())
-    {
-        result += ", ";
-    }
-    result += "CancellationToken cancellationToken)";
-
-    return result;
-}
-
-string t_netcore_generator::argument_list(t_struct* tstruct)
-{
-    string result = "";
-    const vector<t_field*>& fields = tstruct->get_members();
-    vector<t_field*>::const_iterator f_iter;
-    bool first = true;
-    for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter)
-    {
-        if (first)
-        {
-            first = false;
-        }
-        else
-        {
-            result += ", ";
-        }
-        result += type_name((*f_iter)->get_type()) + " " + normalize_name((*f_iter)->get_name());
-    }
-    return result;
-}
-
-string t_netcore_generator::type_to_enum(t_type* type)
-{
-    while (type->is_typedef())
-    {
-        type = static_cast<t_typedef*>(type)->get_type();
-    }
-
-    if (type->is_base_type())
-    {
-        t_base_type::t_base tbase = static_cast<t_base_type*>(type)->get_base();
-        switch (tbase)
-        {
-        case t_base_type::TYPE_VOID:
-            throw "NO T_VOID CONSTRUCT";
-        case t_base_type::TYPE_STRING:
-            return "TType.String";
-        case t_base_type::TYPE_BOOL:
-            return "TType.Bool";
-        case t_base_type::TYPE_I8:
-            return "TType.Byte";
-        case t_base_type::TYPE_I16:
-            return "TType.I16";
-        case t_base_type::TYPE_I32:
-            return "TType.I32";
-        case t_base_type::TYPE_I64:
-            return "TType.I64";
-        case t_base_type::TYPE_DOUBLE:
-            return "TType.Double";
-        }
-    }
-    else if (type->is_enum())
-    {
-        return "TType.I32";
-    }
-    else if (type->is_struct() || type->is_xception())
-    {
-        return "TType.Struct";
-    }
-    else if (type->is_map())
-    {
-        return "TType.Map";
-    }
-    else if (type->is_set())
-    {
-        return "TType.Set";
-    }
-    else if (type->is_list())
-    {
-        return "TType.List";
-    }
-
-    throw "INVALID TYPE IN type_to_enum: " + type->get_name();
-}
-
-void t_netcore_generator::generate_netcore_docstring_comment(ostream& out, string contents)
-{
-    docstring_comment(out, "/// <summary>" + endl, "/// ", contents, "/// </summary>" + endl);
-}
-
-void t_netcore_generator::generate_netcore_doc(ostream& out, t_field* field)
-{
-    if (field->get_type()->is_enum())
-    {
-        string combined_message = field->get_doc() + endl + "<seealso cref=\"" + get_enum_class_name(field->get_type()) + "\"/>";
-        generate_netcore_docstring_comment(out, combined_message);
-    }
-    else
-    {
-        generate_netcore_doc(out, static_cast<t_doc*>(field));
-    }
-}
-
-void t_netcore_generator::generate_netcore_doc(ostream& out, t_doc* tdoc)
-{
-    if (tdoc->has_doc())
-    {
-        generate_netcore_docstring_comment(out, tdoc->get_doc());
-    }
-}
-
-void t_netcore_generator::generate_netcore_doc(ostream& out, t_function* tfunction)
-{
-    if (tfunction->has_doc())
-    {
-        stringstream ps;
-        const vector<t_field*>& fields = tfunction->get_arglist()->get_members();
-        vector<t_field*>::const_iterator p_iter;
-        for (p_iter = fields.begin(); p_iter != fields.end(); ++p_iter)
-        {
-            t_field* p = *p_iter;
-            ps << endl << "<param name=\"" << p->get_name() << "\">";
-            if (p->has_doc())
-            {
-                string str = p->get_doc();
-                str.erase(remove(str.begin(), str.end(), '\n'), str.end());
-                ps << str;
-            }
-            ps << "</param>";
-        }
-
-        docstring_comment(out,
-                                   "",
-                                   "/// ",
-                                   "<summary>" + endl + tfunction->get_doc() + "</summary>" + ps.str(),
-                                   "");
-    }
-}
-
-void t_netcore_generator::docstring_comment(ostream& out, const string& comment_start, const string& line_prefix, const string& contents, const string& comment_end)
-{
-    if (comment_start != "")
-    {
-        out << indent() << comment_start;
-    }
-
-    stringstream docs(contents, std::ios_base::in);
-
-    while (!(docs.eof() || docs.fail()))
-    {
-        char line[1024];
-        docs.getline(line, 1024);
-
-        // Just prnt a newline when the line & prefix are empty.
-        if (strlen(line) == 0 && line_prefix == "" && !docs.eof())
-        {
-            out << endl;
-        }
-        else if (strlen(line) > 0 || !docs.eof())
-        { // skip the empty last line
-            out << indent() << line_prefix << line << endl;
-        }
-    }
-    if (comment_end != "")
-    {
-        out << indent() << comment_end;
-    }
-}
-
-string t_netcore_generator::get_enum_class_name(t_type* type)
-{
-    string package = "";
-    t_program* program = type->get_program();
-    if (program != NULL && program != program_)
-    {
-        package = program->get_namespace("netcore") + ".";
-    }
-    return package + type->get_name();
-}
-
-THRIFT_REGISTER_GENERATOR(
-    netcore,
-    "C#",
-    "    wcf:             Adds bindings for WCF to generated classes.\n"
-    "    serial:          Add serialization support to generated classes.\n"
-    "    nullable:        Use nullable types for properties.\n"
-    "    hashcode:        Generate a hashcode and equals implementation for classes.\n"
-    "    union:           Use new union typing, which includes a static read function for union types.\n"
-)
diff --git a/compiler/cpp/src/thrift/generate/t_netcore_generator.h b/compiler/cpp/src/thrift/generate/t_netcore_generator.h
deleted file mode 100644
index e98980a..0000000
--- a/compiler/cpp/src/thrift/generate/t_netcore_generator.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- * Contains some contributions under the Thrift Software License.
- * Please see doc/old-thrift-license.txt in the Thrift distribution for
- * details.
- */
-
-#include <cassert>
-
-#include <string>
-#include <fstream>
-#include <iostream>
-#include <vector>
-#include <cctype>
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sstream>
-
-#include "thrift/platform.h"
-#include "thrift/generate/t_oop_generator.h"
-
-using std::map;
-using std::ostream;
-using std::ostringstream;
-using std::string;
-using std::stringstream;
-using std::vector;
-
-static const string endl = "\n"; // avoid ostream << std::endl flushes
-
-class t_netcore_generator : public t_oop_generator
-{
-
-    struct member_mapping_scope
-    {
-    public:
-        member_mapping_scope() : scope_member(0) { }
-        void* scope_member;
-        map<string, string> mapping_table;
-    };
-
-public:
-    t_netcore_generator(t_program* program, const map<string, string>& parsed_options, const string& option_string);
-
-    bool is_wcf_enabled() const;
-    bool is_nullable_enabled() const;
-    bool is_hashcode_enabled() const;
-    bool is_serialize_enabled() const;
-    bool is_union_enabled() const;
-    map<string, int> get_keywords_list() const;
-
-    // overrides
-    void init_generator();
-    void close_generator();
-    void generate_consts(vector<t_const*> consts);
-    void generate_consts(ostream& out, vector<t_const*> consts);
-    void generate_typedef(t_typedef* ttypedef);
-    void generate_enum(t_enum* tenum);
-    void generate_enum(ostream& out, t_enum* tenum);
-    void generate_struct(t_struct* tstruct);
-    void generate_xception(t_struct* txception);
-    void generate_service(t_service* tservice);
-
-    void generate_property(ostream& out, t_field* tfield, bool isPublic, bool generateIsset);
-    void generate_netcore_property(ostream& out, t_field* tfield, bool isPublic, bool includeIsset = true, string fieldPrefix = "");
-    bool print_const_value(ostream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval = false, bool needtype = false);
-    string render_const_value(ostream& out, string name, t_type* type, t_const_value* value);
-    void print_const_constructor(ostream& out, vector<t_const*> consts);
-    void print_const_def_value(ostream& out, string name, t_type* type, t_const_value* value);
-    void generate_netcore_struct(t_struct* tstruct, bool is_exception);
-    void generate_netcore_union(t_struct* tunion);
-    void generate_netcore_struct_definition(ostream& out, t_struct* tstruct, bool is_xception = false, bool in_class = false, bool is_result = false);
-    void generate_netcore_union_definition(ostream& out, t_struct* tunion);
-    void generate_netcore_union_class(ostream& out, t_struct* tunion, t_field* tfield);
-    void generate_netcore_wcffault(ostream& out, t_struct* tstruct);
-    void generate_netcore_struct_reader(ostream& out, t_struct* tstruct);
-    void generate_netcore_struct_result_writer(ostream& out, t_struct* tstruct);
-    void generate_netcore_struct_writer(ostream& out, t_struct* tstruct);
-    void generate_netcore_struct_tostring(ostream& out, t_struct* tstruct);
-    void generate_netcore_struct_equals(ostream& out, t_struct* tstruct);
-    void generate_netcore_struct_hashcode(ostream& out, t_struct* tstruct);
-    void generate_netcore_union_reader(ostream& out, t_struct* tunion);
-    void generate_function_helpers(ostream& out, t_function* tfunction);
-    void generate_service_interface(ostream& out, t_service* tservice);
-    void generate_service_helpers(ostream& out, t_service* tservice);
-    void generate_service_client(ostream& out, t_service* tservice);
-    void generate_service_server(ostream& out, t_service* tservice);
-    void generate_process_function_async(ostream& out, t_service* tservice, t_function* function);
-    void generate_deserialize_field(ostream& out, t_field* tfield, string prefix = "", bool is_propertyless = false);
-    void generate_deserialize_struct(ostream& out, t_struct* tstruct, string prefix = "");
-    void generate_deserialize_container(ostream& out, t_type* ttype, string prefix = "");
-    void generate_deserialize_set_element(ostream& out, t_set* tset, string prefix = "");
-    void generate_deserialize_map_element(ostream& out, t_map* tmap, string prefix = "");
-    void generate_deserialize_list_element(ostream& out, t_list* list, string prefix = "");
-    void generate_serialize_field(ostream& out, t_field* tfield, string prefix = "", bool is_element = false, bool is_propertyless = false);
-    void generate_serialize_struct(ostream& out, t_struct* tstruct, string prefix = "");
-    void generate_serialize_container(ostream& out, t_type* ttype, string prefix = "");
-    void generate_serialize_map_element(ostream& out, t_map* tmap, string iter, string map);
-    void generate_serialize_set_element(ostream& out, t_set* tmap, string iter);
-    void generate_serialize_list_element(ostream& out, t_list* tlist, string iter);
-    void generate_netcore_doc(ostream& out, t_field* field);
-    void generate_netcore_doc(ostream& out, t_doc* tdoc);
-    void generate_netcore_doc(ostream& out, t_function* tdoc);
-    void generate_netcore_docstring_comment(ostream& out, string contents);
-    void docstring_comment(ostream& out, const string& comment_start, const string& line_prefix, const string& contents, const string& comment_end);
-    void start_netcore_namespace(ostream& out);
-    void end_netcore_namespace(ostream& out);
-
-    string netcore_type_usings() const;
-    string netcore_thrift_usings() const;
-
-    string type_name(t_type* ttype, bool in_countainer = false, bool in_init = false, bool in_param = false, bool is_required = false);
-    string base_type_name(t_base_type* tbase, bool in_container = false, bool in_param = false, bool is_required = false);
-    string declare_field(t_field* tfield, bool init = false, string prefix = "");
-    string function_signature_async(t_function* tfunction, string prefix = "");
-    string function_signature(t_function* tfunction, string prefix = "");
-    string argument_list(t_struct* tstruct);
-    string type_to_enum(t_type* ttype);
-    string prop_name(t_field* tfield, bool suppress_mapping = false);
-    string get_enum_class_name(t_type* type);
-
-private:
-    string namespace_name_;
-    string namespace_dir_;
-
-    bool nullable_;
-    bool union_;
-    bool hashcode_;
-    bool serialize_;
-    bool wcf_;
-
-    string wcf_namespace_;
-    map<string, int> netcore_keywords;
-    vector<member_mapping_scope> member_mapping_scopes;
-
-    void init_keywords();
-    string normalize_name(string name);
-    string make_valid_csharp_identifier(string const& fromName);
-    void prepare_member_name_mapping(t_struct* tstruct);
-    void prepare_member_name_mapping(void* scope, const vector<t_field*>& members, const string& structname);
-    void cleanup_member_name_mapping(void* scope);
-    string get_mapped_member_name(string oldname);
-};
diff --git a/compiler/cpp/src/thrift/parse/t_program.h b/compiler/cpp/src/thrift/parse/t_program.h
index e0b4b6e..de68a0c 100644
--- a/compiler/cpp/src/thrift/parse/t_program.h
+++ b/compiler/cpp/src/thrift/parse/t_program.h
@@ -291,10 +291,14 @@
         pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
         base_language = "st";
       }
-      else if ((base_language == "csharp") || (base_language == "netcore")) {
+      else if (base_language == "csharp") {
         pwarning(1, "The '%s' target is deprecated. Consider moving to 'netstd' instead.", base_language.c_str());
         // warn only, don't change base_language
       }
+      else if (base_language == "netcore") {
+        pwarning(1, "The '%s' target is no longer available. Use 'netstd' instead.", base_language.c_str());
+        // warn only, don't change base_language
+      }
 
       t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map();
 
diff --git a/compiler/cpp/tests/CMakeLists.txt b/compiler/cpp/tests/CMakeLists.txt
index 91cc35d..7798c15 100644
--- a/compiler/cpp/tests/CMakeLists.txt
+++ b/compiler/cpp/tests/CMakeLists.txt
@@ -116,7 +116,7 @@
 THRIFT_ADD_COMPILER(js      "Enable compiler for JavaScript" OFF)
 THRIFT_ADD_COMPILER(json    "Enable compiler for JSON" OFF)
 THRIFT_ADD_COMPILER(lua     "Enable compiler for Lua" OFF)
-THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
+THRIFT_ADD_COMPILER(netstd  "Enable compiler for .NET Standard" ON)
 THRIFT_ADD_COMPILER(ocaml   "Enable compiler for OCaml" OFF)
 THRIFT_ADD_COMPILER(perl    "Enable compiler for Perl" OFF)
 THRIFT_ADD_COMPILER(php     "Enable compiler for PHP" OFF)
diff --git a/compiler/cpp/tests/README.md b/compiler/cpp/tests/README.md
index 27be491..91c0625 100644
--- a/compiler/cpp/tests/README.md
+++ b/compiler/cpp/tests/README.md
@@ -16,7 +16,7 @@
 
 ## General information 
 
-Added generic way to cover code by tests for many languages (you just need to make a correct header file for generator for your language - example in **netcore** implementation)
+Added generic way to cover code by tests for many languages (you just need to make a correct header file for generator for your language - example in **netstd** implementation)
 
 At current moment these tests use free Catch library (https://github.com/catchorg/Catch2/tree/Catch1.x) for easy test creation and usage.
 Decision to use it was because of simplicity, easy usage, one header file to use, stable community and growing interest  (https://cpp.libhunt.com/project/googletest-google/vs/catch?rel=cmp-cmp)
@@ -29,7 +29,7 @@
 - Set **On** to call of **THRIFT_ADD_COMPILER** for your language
 
 ``` cmake 
-THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
+THRIFT_ADD_COMPILER(netstd "Enable compiler for .NET Standard" ON)
 ```
 
 - Create folder with name specified in list of languages in **CMakeLists.txt**
diff --git a/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests.cc b/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests.cc
index 0b8c837..a2f0a50 100644
--- a/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests.cc
+++ b/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests.cc
@@ -17,18 +17,18 @@
 
 #include "../catch/catch.hpp"
 #include <thrift/parse/t_program.h>
-#include <thrift/generate/t_netcore_generator.h>
-#include "t_netcore_generator_functional_tests_helpers.h"
+#include <thrift/generate/t_netstd_generator.h>
+#include "t_netstd_generator_functional_tests_helpers.h"
 
-TEST_CASE( "t_netcore_generator should generate valid enum", "[functional]" )
+TEST_CASE( "t_netstd_generator should generate valid enum", "[functional]" )
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
 
     std::pair<string, t_enum*> pair = TestDataGenerator::get_test_enum_data(program);
     string expected_result = pair.first;
@@ -53,15 +53,15 @@
     delete program;	
 }
 
-TEST_CASE("t_netcore_generator should generate valid void", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid void", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_void_const_data(gen);
     string expected_result = pair.first;
@@ -86,15 +86,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid string with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid string with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_string_const_data(gen);
@@ -122,15 +122,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid bool with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid bool with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_bool_const_data(gen);
@@ -158,15 +158,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid sbyte (i8) with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid sbyte (i8) with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_i8_const_data(gen);
@@ -194,15 +194,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid short (i16) with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid short (i16) with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_i16_const_data(gen);
@@ -230,15 +230,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid integer (i32) with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid integer (i32) with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_i32_const_data(gen);
@@ -266,15 +266,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid long (i64) with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid long (i64) with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_i64_const_data(gen);
@@ -302,15 +302,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should generate valid double with escaping keyword", "[functional]")
+TEST_CASE("t_netstd_generator should generate valid double with escaping keyword", "[functional]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
 
     std::pair<string, t_const*> pair = TestDataGenerator::get_test_double_const_data(gen);
diff --git a/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.cc b/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.cc
index 92c170b..db4ce78 100644
--- a/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.cc
+++ b/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.cc
@@ -17,8 +17,8 @@
 
 #include <thrift/parse/t_program.h>
 #include "thrift/common.h"
-#include <thrift/generate/t_netcore_generator.h>
-#include "t_netcore_generator_functional_tests_helpers.h"
+#include <thrift/generate/t_netstd_generator.h>
+#include "t_netstd_generator_functional_tests_helpers.h"
 
 const string TestDataGenerator::DEFAULT_FILE_HEADER = "/**" "\n"
             " * Autogenerated by Thrift Compiler ()" "\n"
@@ -52,7 +52,7 @@
     return std::pair<string, t_enum*>(expected_result, enum_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_void_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_void_const_data(t_netstd_generator* gen)
 {
     string expected_result = DEFAULT_FILE_HEADER;
 
@@ -68,11 +68,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_string_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_string_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() + 
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() + 
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
@@ -92,11 +92,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_bool_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_bool_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() +
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() +
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
@@ -116,11 +116,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_i8_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_i8_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() +
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() +
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
@@ -140,11 +140,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_i16_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_i16_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() +
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() +
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
@@ -164,11 +164,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_i32_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_i32_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() +
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() +
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
@@ -188,11 +188,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_i64_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_i64_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() +
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() +
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
@@ -212,11 +212,11 @@
     return std::pair<string, t_const*>(expected_result, const_);
 }
 
-std::pair<string, t_const*> TestDataGenerator::get_test_double_const_data(t_netcore_generator* gen)
+std::pair<string, t_const*> TestDataGenerator::get_test_double_const_data(t_netstd_generator* gen)
 {
-    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netcore_type_usings() +
+    string expected_result = DEFAULT_FILE_HEADER + "\n" +gen->netstd_type_usings() +
         "\n"
-        "public static class netcoreConstants\n"
+        "public static class netstdConstants\n"
         "{\n"
         "  /// <summary>\n"
         "  /// TestDoc\n"
diff --git a/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.h b/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.h
index c6eaac2..9829197 100644
--- a/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.h
+++ b/compiler/cpp/tests/netcore/t_netcore_generator_functional_tests_helpers.h
@@ -23,12 +23,12 @@
     static const string DEFAULT_FILE_HEADER;
 
     static std::pair<string, t_enum*> get_test_enum_data(t_program* program);
-    static std::pair<string, t_const*> get_test_void_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_string_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_bool_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_i8_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_i16_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_i32_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_i64_const_data(t_netcore_generator* gen);
-    static std::pair<string, t_const*> get_test_double_const_data(t_netcore_generator* gen);
+    static std::pair<string, t_const*> get_test_void_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_string_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_bool_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_i8_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_i16_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_i32_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_i64_const_data(t_netstd_generator* gen);
+    static std::pair<string, t_const*> get_test_double_const_data(t_netstd_generator* gen);
 };
diff --git a/compiler/cpp/tests/netcore/t_netcore_generator_helpers_tests.cc b/compiler/cpp/tests/netcore/t_netcore_generator_helpers_tests.cc
index 0bcbeed..6acedc0 100644
--- a/compiler/cpp/tests/netcore/t_netcore_generator_helpers_tests.cc
+++ b/compiler/cpp/tests/netcore/t_netcore_generator_helpers_tests.cc
@@ -17,14 +17,14 @@
 
 #include "../catch/catch.hpp"
 #include <thrift/parse/t_program.h>
-#include <thrift/generate/t_netcore_generator.h>
+#include <thrift/generate/t_netstd_generator.h>
 
 using std::vector;
 
-TEST_CASE("t_netcore_generator::netcore_type_usings() without option wcf should return valid namespaces", "[helpers]")
+TEST_CASE("t_netstd_generator::netstd_type_usings() without option wcf should return valid namespaces", "[helpers]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "union", "union" } };
     string option_string = "";
 
@@ -39,19 +39,19 @@
                                 "using Thrift.Collections;\n" + endl;
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
 
     REQUIRE_FALSE(gen->is_wcf_enabled());
-    REQUIRE(gen->netcore_type_usings() == expected_namespaces);
+    REQUIRE(gen->netstd_type_usings() == expected_namespaces);
 
     delete gen;
     delete program;
 }
 
-TEST_CASE("t_netcore_generator::netcore_type_usings() with option wcf should return valid namespaces", "[helpers]")
+TEST_CASE("t_netstd_generator::netstd_type_usings() with option wcf should return valid namespaces", "[helpers]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
 
@@ -68,19 +68,19 @@
                                     "using System.Runtime.Serialization;\n" + endl;
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
 
     REQUIRE(gen->is_wcf_enabled());
-    REQUIRE(gen->netcore_type_usings() == expected_namespaces_wcf);
+    REQUIRE(gen->netstd_type_usings() == expected_namespaces_wcf);
 
     delete gen;
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should contains latest C# keywords to normalize with @", "[helpers]")
+TEST_CASE("t_netstd_generator should contains latest C# keywords to normalize with @", "[helpers]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" } };
     string option_string = "";
     vector<string> current_keywords = {
@@ -190,7 +190,7 @@
     string missed_keywords = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
     gen->init_generator();
     map<string, int> generators_keywords = gen->get_keywords_list();
 
diff --git a/compiler/cpp/tests/netcore/t_netcore_generator_initialization_tests.cc b/compiler/cpp/tests/netcore/t_netcore_generator_initialization_tests.cc
index ec17733..530e290 100644
--- a/compiler/cpp/tests/netcore/t_netcore_generator_initialization_tests.cc
+++ b/compiler/cpp/tests/netcore/t_netcore_generator_initialization_tests.cc
@@ -17,35 +17,35 @@
 
 #include "../catch/catch.hpp"
 #include <thrift/parse/t_program.h>
-#include <thrift/generate/t_netcore_generator.h>
+#include <thrift/generate/t_netstd_generator.h>
 
-TEST_CASE( "t_netcore_generator should throw error with unknown options", "[initialization]" )
+TEST_CASE( "t_netstd_generator should throw error with unknown options", "[initialization]" )
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "keys", "keys" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = nullptr;
+    t_netstd_generator* gen = nullptr;
 
-    REQUIRE_THROWS(gen = new t_netcore_generator(program, parsed_options, option_string));	
+    REQUIRE_THROWS(gen = new t_netstd_generator(program, parsed_options, option_string));	
 
     delete gen;
     delete program;	
 }
 
-TEST_CASE("t_netcore_generator should create valid instance with valid options", "[initialization]")
+TEST_CASE("t_netstd_generator should create valid instance with valid options", "[initialization]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" }, { "nullable", "nullable"} };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = nullptr;
+    t_netstd_generator* gen = nullptr;
 
-    REQUIRE_NOTHROW(gen = new t_netcore_generator(program, parsed_options, option_string));
+    REQUIRE_NOTHROW(gen = new t_netstd_generator(program, parsed_options, option_string));
     REQUIRE(gen != nullptr);
     REQUIRE(gen->is_wcf_enabled());
     REQUIRE(gen->is_nullable_enabled());
@@ -57,15 +57,15 @@
     delete program;
 }
 
-TEST_CASE("t_netcore_generator should pass init succesfully", "[initialization]")
+TEST_CASE("t_netstd_generator should pass init succesfully", "[initialization]")
 {
     string path = "CassandraTest.thrift";
-    string name = "netcore";
+    string name = "netstd";
     map<string, string> parsed_options = { { "wcf", "wcf" },{ "nullable", "nullable" } };
     string option_string = "";
 
     t_program* program = new t_program(path, name);
-    t_netcore_generator* gen = new t_netcore_generator(program, parsed_options, option_string);
+    t_netstd_generator* gen = new t_netstd_generator(program, parsed_options, option_string);
 
     REQUIRE_NOTHROW(gen->init_generator());
 
diff --git a/configure.ac b/configure.ac
index ad26ef0..d5d7ecb 100755
--- a/configure.ac
+++ b/configure.ac
@@ -127,7 +127,6 @@
   with_ruby="no"
   with_haskell="no"
   with_haxe="no"
-  with_dotnetcore="no"
   with_netstd="no"
   with_perl="no"
   with_php="no"
@@ -502,14 +501,14 @@
 AM_CONDITIONAL(WITH_HAXE, [test "$have_haxe" = "yes"])
 
 
-AX_THRIFT_LIB(dotnetcore, [.NET Core], yes)
-if test "$with_dotnetcore" = "yes";  then
+AX_THRIFT_LIB(netstd, [.NET Core], yes)
+if test "$with_netstd" = "yes";  then
   AC_PATH_PROG([DOTNETCORE], [dotnet])
   if [[ -x "$DOTNETCORE" ]] ; then
-    AX_PROG_DOTNETCORE_VERSION( [2.0.0], have_dotnetcore="yes", have_dotnetcore="no")
+    AX_PROG_DOTNETCORE_VERSION( [2.0.0], have_netstd="yes", have_netstd="no")
   fi
 fi
-AM_CONDITIONAL(WITH_DOTNET, [test "$have_dotnetcore" = "yes"])
+AM_CONDITIONAL(WITH_DOTNET, [test "$have_netstd" = "yes"])
 
 
 AX_THRIFT_LIB(d, [D], yes)
@@ -817,7 +816,6 @@
   lib/js/test/Makefile
   lib/json/Makefile
   lib/json/test/Makefile
-  lib/netcore/Makefile
   lib/netstd/Makefile
   lib/nodejs/Makefile
   lib/nodets/Makefile
@@ -846,7 +844,6 @@
   test/haxe/Makefile
   test/hs/Makefile
   test/lua/Makefile
-  test/netcore/Makefile
   test/netstd/Makefile
   test/php/Makefile
   test/dart/Makefile
@@ -866,7 +863,6 @@
   tutorial/hs/Makefile
   tutorial/java/Makefile
   tutorial/js/Makefile
-  tutorial/netcore/Makefile
   tutorial/netstd/Makefile
   tutorial/nodejs/Makefile
   tutorial/dart/Makefile
@@ -919,8 +915,8 @@
 AC_SUBST([MAYBE_RS])
 if test "$have_swift" = "yes" ; then MAYBE_SWIFT="swift" ; else MAYBE_SWIFT="" ; fi
 AC_SUBST([MAYBE_SWIFT])
-if test "$have_dotnetcore" = "yes" ; then MAYBE_DOTNETCORE="netcore" ; else MAYBE_DOTNETCORE="" ; fi
-AC_SUBST([MAYBE_DOTNETCORE])
+if test "$have_netstd" = "yes" ; then MAYBE_NETSTD="netstd" ; else MAYBE_NETSTD="" ; fi
+AC_SUBST([MAYBE_NETSTD])
 if test "$have_cl" = "yes" ; then MAYBE_CL="cl" ; else MAYBE_CL="" ; fi
 AC_SUBST([MAYBE_CL])
 
@@ -937,8 +933,7 @@
 echo "Building Common Lisp Library.. : $have_cl"
 echo "Building D Library ........... : $have_d"
 echo "Building Dart Library ........ : $have_dart"
-echo "Building dotnetcore Library .. : $have_dotnetcore"
-echo "Building .NET Standard Library : $have_dotnetcore"
+echo "Building .NET Standard Library : $have_netstd"
 echo "Building Erlang Library ...... : $have_erlang"
 echo "Building Go Library .......... : $have_go"
 echo "Building Haskell Library ..... : $have_haskell"
@@ -1001,13 +996,7 @@
   echo "   Using Pub ................. : $DARTPUB"
   echo "   Using Dart version ........ : $($DART --version 2>&1)"
 fi
-if test "$have_dotnetcore" = "yes" ; then
-  echo
-  echo ".NET Core Library:"
-  echo "   Using .NET Core ........... : $DOTNETCORE"
-  echo "   Using .NET Core version ... : $DOTNETCORE_VERSION"
-fi
-if test "$have_dotnetcore" = "yes" ; then
+if test "$have_netstd" = "yes" ; then
   echo
   echo ".NET Standard Library:"
   echo "   Using dotnet .............. : $DOTNETCORE"
diff --git a/contrib/fb303/if/fb303.thrift b/contrib/fb303/if/fb303.thrift
index 89bd6eb..f1ca982 100644
--- a/contrib/fb303/if/fb303.thrift
+++ b/contrib/fb303/if/fb303.thrift
@@ -24,7 +24,7 @@
 namespace java com.facebook.fb303
 namespace cpp facebook.fb303
 namespace perl Facebook.FB303
-namespace netcore Facebook.FB303.Test
+namespace netstd Facebook.FB303.Test
 
 /**
  * Common status reporting mechanism across all services
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 73326a5..51a2af0 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -73,7 +73,6 @@
 endif
 
 if WITH_DOTNET
-SUBDIRS += netcore
 SUBDIRS += netstd
 endif
 
diff --git a/lib/cpp/test/OneWayTest.thrift b/lib/cpp/test/OneWayTest.thrift
index 102cf26..1e9894c 100644
--- a/lib/cpp/test/OneWayTest.thrift
+++ b/lib/cpp/test/OneWayTest.thrift
@@ -36,7 +36,6 @@
 namespace delphi Onewaytest
 namespace lua OneWayTest
 namespace xsd test (uri = 'http://thrift.apache.org/ns/OneWayTest')
-namespace netcore ThriftAsync.OneWayTest
 
 // a minimal Thrift service, for use in OneWayHTTPTtest.cpp
 service OneWayService {
diff --git a/lib/netcore/Makefile.am b/lib/netcore/Makefile.am
deleted file mode 100644
index 4e2d6a5..0000000
--- a/lib/netcore/Makefile.am
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-all-local:
-	$(DOTNETCORE) build
-
-check-local:
-	$(DOTNETCORE) test Tests/Thrift.Tests/Thrift.Tests.csproj
-	$(DOTNETCORE) test Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
-
-clean-local:
-	$(RM) -r Thrift/bin
-	$(RM) -r Thrift/obj
-	$(RM) -r Tests/Thrift.Tests/bin
-	$(RM) -r Tests/Thrift.Tests/obj
-	$(RM) -r Tests/Thrift.IntegrationTests/bin
-	$(RM) -r Tests/Thrift.IntegrationTests/obj
-	$(RM) -r Tests/Thrift.PublicInterfaces.Compile.Tests/bin
-	$(RM) -r Tests/Thrift.PublicInterfaces.Compile.Tests/obj
-
-dist-hook:
-	$(RM) -r $(distdir)/Thrift/bin
-	$(RM) -r $(distdir)/Thrift/obj
-	$(RM) -r $(distdir)/Tests/Thrift.Tests/bin
-	$(RM) -r $(distdir)/Tests/Thrift.Tests/obj
-	$(RM) -r $(distdir)/Tests/Thrift.IntegrationTests/bin
-	$(RM) -r $(distdir)/Tests/Thrift.IntegrationTests/obj
-	$(RM) -r $(distdir)/Tests/Thrift.PublicInterfaces.Compile.Tests/bin
-	$(RM) -r $(distdir)/Tests/Thrift.PublicInterfaces.Compile.Tests/obj
-
-DISTCLEANFILES = \
-	Makefile.in
-
-EXTRA_DIST = \
-	README.md \
-	Tests \
-	Thrift \
-	Thrift.sln \
-	build.cmd \
-	build.sh \
-	runtests.cmd \
-	runtests.sh
diff --git a/lib/netcore/README.md b/lib/netcore/README.md
deleted file mode 100644
index bcd25b9..0000000
--- a/lib/netcore/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Apache Thrift netcore
-
-Thrift client library ported to Microsoft .Net Core 
-
-# Deprecation notice
-
-Per [THRIFT-4723](https://issues.apache.org/jira/browse/THRIFT-4723), both CSharp and Netcore targets are deprecated 
-and will be removed with the next release. Migrate to the [NetStd language target](../netstd/README.md) instead.
-
-# Content
-- Tests/Thrift.PublicInterfaces.Compile.Tests - project for checking public interfaces during adding changes to Thrift library
-- Thrift - Thrift library 
-
-# Reused components 
-- .NET Standard 1.6 (SDK 2.0.0)
-
-# How to build on Windows
-- Get Thrift IDL compiler executable, add to some folder and add path to this folder into PATH variable
-- Open the Thrift.sln project with Visual Studio and build.
-or 
-- Build with scripts
-
-# How to build on Unix
-- Ensure you have .NET Core 2.0.0 SDK installed or use the Ubuntu Xenial docker image
-- Follow common build practice for Thrift: bootstrap, configure, and make
-
-# Known issues
-- In trace logging mode you can see some not important internal exceptions
-
diff --git a/lib/netcore/Tests/Thrift.IntegrationTests/.gitignore b/lib/netcore/Tests/Thrift.IntegrationTests/.gitignore
deleted file mode 100644
index 7254c31..0000000
--- a/lib/netcore/Tests/Thrift.IntegrationTests/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# ignore for autogenerated files
-/Apache
diff --git a/lib/netcore/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs b/lib/netcore/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
deleted file mode 100644
index bc4afa1..0000000
--- a/lib/netcore/Tests/Thrift.IntegrationTests/Protocols/ProtocolsOperationsTests.cs
+++ /dev/null
@@ -1,502 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.IO;
-using System.Text;
-using System.Threading.Tasks;
-using KellermanSoftware.CompareNetObjects;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Thrift.Protocols;
-using Thrift.Protocols.Entities;
-using Thrift.Transports.Client;
-
-namespace Thrift.IntegrationTests.Protocols
-{
-    [TestClass]
-    public class ProtocolsOperationsTests
-    {
-        private readonly CompareLogic _compareLogic = new CompareLogic();
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol), TMessageType.Call)]
-        [DataRow(typeof(TBinaryProtocol), TMessageType.Exception)]
-        [DataRow(typeof(TBinaryProtocol), TMessageType.Oneway)]
-        [DataRow(typeof(TBinaryProtocol), TMessageType.Reply)]
-        [DataRow(typeof(TCompactProtocol), TMessageType.Call)]
-        [DataRow(typeof(TCompactProtocol), TMessageType.Exception)]
-        [DataRow(typeof(TCompactProtocol), TMessageType.Oneway)]
-        [DataRow(typeof(TCompactProtocol), TMessageType.Reply)]
-        [DataRow(typeof(TJsonProtocol), TMessageType.Call)]
-        [DataRow(typeof(TJsonProtocol), TMessageType.Exception)]
-        [DataRow(typeof(TJsonProtocol), TMessageType.Oneway)]
-        [DataRow(typeof(TJsonProtocol), TMessageType.Reply)]
-        public async Task WriteReadMessage_Test(Type protocolType, TMessageType messageType)
-        {
-            var expected = new TMessage(nameof(TMessage), messageType, 1);
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteMessageBeginAsync(expected);
-                    await protocol.WriteMessageEndAsync();
-
-                    stream.Seek(0, SeekOrigin.Begin);
-
-                    var actualMessage = await protocol.ReadMessageBeginAsync();
-                    await protocol.ReadMessageEndAsync();
-
-                    var result = _compareLogic.Compare(expected, actualMessage);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        [ExpectedException(typeof(Exception))]
-        public async Task WriteReadStruct_Test(Type protocolType)
-        {
-            var expected = new TStruct(nameof(TStruct));
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteStructBeginAsync(expected);
-                    await protocol.WriteStructEndAsync();
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadStructBeginAsync();
-                    await protocol.ReadStructEndAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        [ExpectedException(typeof(Exception))]
-        public async Task WriteReadField_Test(Type protocolType)
-        {
-            var expected = new TField(nameof(TField), TType.String, 1);
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteFieldBeginAsync(expected);
-                    await protocol.WriteFieldEndAsync();
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadFieldBeginAsync();
-                    await protocol.ReadFieldEndAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadMap_Test(Type protocolType)
-        {
-            var expected = new TMap(TType.String, TType.String, 1);
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteMapBeginAsync(expected);
-                    await protocol.WriteMapEndAsync();
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadMapBeginAsync();
-                    await protocol.ReadMapEndAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadList_Test(Type protocolType)
-        {
-            var expected = new TList(TType.String, 1);
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteListBeginAsync(expected);
-                    await protocol.WriteListEndAsync();
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadListBeginAsync();
-                    await protocol.ReadListEndAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadSet_Test(Type protocolType)
-        {
-            var expected = new TSet(TType.String, 1);
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteSetBeginAsync(expected);
-                    await protocol.WriteSetEndAsync();
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadSetBeginAsync();
-                    await protocol.ReadSetEndAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadBool_Test(Type protocolType)
-        {
-            var expected = true;
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteBoolAsync(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadBoolAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadByte_Test(Type protocolType)
-        {
-            var expected = sbyte.MaxValue;
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteByteAsync(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadByteAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadI16_Test(Type protocolType)
-        {
-            var expected = short.MaxValue;
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteI16Async(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadI16Async();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadI32_Test(Type protocolType)
-        {
-            var expected = int.MaxValue;
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteI32Async(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadI32Async();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadI64_Test(Type protocolType)
-        {
-            var expected = long.MaxValue;
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteI64Async(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadI64Async();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadDouble_Test(Type protocolType)
-        {
-            var expected = double.MaxValue;
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteDoubleAsync(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadDoubleAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadString_Test(Type protocolType)
-        {
-            var expected = nameof(String);
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteStringAsync(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadStringAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(typeof(TBinaryProtocol))]
-        [DataRow(typeof(TCompactProtocol))]
-        [DataRow(typeof(TJsonProtocol))]
-        public async Task WriteReadBinary_Test(Type protocolType)
-        {
-            var expected = Encoding.UTF8.GetBytes(nameof(String));
-
-            try
-            {
-                var tuple = GetProtocolInstance(protocolType);
-                using (var stream = tuple.Item1)
-                {
-                    var protocol = tuple.Item2;
-
-                    await protocol.WriteBinaryAsync(expected);
-
-                    stream?.Seek(0, SeekOrigin.Begin);
-
-                    var actual = await protocol.ReadBinaryAsync();
-
-                    var result = _compareLogic.Compare(expected, actual);
-                    Assert.IsTrue(result.AreEqual, result.DifferencesString);
-                }
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"Exception during testing of protocol: {protocolType.FullName}", e);
-            }
-        }
-
-        private static Tuple<Stream, TProtocol> GetProtocolInstance(Type protocolType)
-        {
-            var memoryStream = new MemoryStream();
-            var streamClientTransport = new TStreamClientTransport(memoryStream, memoryStream);
-            var protocol = (TProtocol) Activator.CreateInstance(protocolType, streamClientTransport);
-            return new Tuple<Stream, TProtocol>(memoryStream, protocol);
-        }
-    }
-}
diff --git a/lib/netcore/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj b/lib/netcore/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
deleted file mode 100644
index f25dac5..0000000
--- a/lib/netcore/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
+++ /dev/null
@@ -1,29 +0,0 @@
-﻿<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-    <AssemblyName>Thrift.IntegrationTests</AssemblyName>
-    <PackageId>Thrift.IntegrationTests</PackageId>
-    <OutputType>Exe</OutputType>
-    <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
-    <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="CompareNETObjects" Version="4.3.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
-    <PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
-    <PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
-    <PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Thrift\Thrift.csproj" />
-  </ItemGroup>
-  <ItemGroup>
-    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
-  </ItemGroup>
-
-</Project>
\ No newline at end of file
diff --git a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/.gitignore b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/.gitignore
deleted file mode 100644
index ae929a3..0000000
--- a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-# ignore for autogenerated files
-/ThriftTest
-/Apache
-/Facebook
diff --git a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift
deleted file mode 100644
index 4b92720..0000000
--- a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/CassandraTest.thrift
+++ /dev/null
@@ -1,705 +0,0 @@
-#!/usr/local/bin/thrift --java --php --py
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# *** PLEASE REMEMBER TO EDIT THE VERSION CONSTANT WHEN MAKING CHANGES ***
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# Interface definition for Cassandra Service
-#
-
-namespace netcore Apache.Cassandra.Test
-
-# Thrift.rb has a bug where top-level modules that include modules 
-# with the same name are not properly referenced, so we can't do
-# Cassandra::Cassandra::Client.
-namespace rb CassandraThrift
-
-# The API version (NOT the product version), composed as a dot delimited
-# string with major, minor, and patch level components.
-#
-#  - Major: Incremented for backward incompatible changes. An example would
-#           be changes to the number or disposition of method arguments.
-#  - Minor: Incremented for backward compatible changes. An example would
-#           be the addition of a new (optional) method.
-#  - Patch: Incremented for bug fixes. The patch level should be increased
-#           for every edit that doesn't result in a change to major/minor.
-#
-# See the Semantic Versioning Specification (SemVer) http://semver.org.
-const string VERSION = "19.24.0"
-
-
-#
-# data structures
-#
-
-/** Basic unit of data within a ColumnFamily.
- * @param name, the name by which this column is set and retrieved.  Maximum 64KB long.
- * @param value. The data associated with the name.  Maximum 2GB long, but in practice you should limit it to small numbers of MB (since Thrift must read the full value into memory to operate on it).
- * @param timestamp. The timestamp is used for conflict detection/resolution when two columns with same name need to be compared.
- * @param ttl. An optional, positive delay (in seconds) after which the column will be automatically deleted. 
- */
-struct Column {
-   1: required binary name,
-   2: optional binary value,
-   3: optional i64 timestamp,
-   4: optional i32 ttl,
-}
-
-/** A named list of columns.
- * @param name. see Column.name.
- * @param columns. A collection of standard Columns.  The columns within a super column are defined in an adhoc manner.
- *                 Columns within a super column do not have to have matching structures (similarly named child columns).
- */
-struct SuperColumn {
-   1: required binary name,
-   2: required list<Column> columns,
-}
-
-struct CounterColumn {
-    1: required binary name,
-    2: required i64 value
-}
-
-struct CounterSuperColumn {
-    1: required binary name,
-    2: required list<CounterColumn> columns
-}
-
-/**
-    Methods for fetching rows/records from Cassandra will return either a single instance of ColumnOrSuperColumn or a list
-    of ColumnOrSuperColumns (get_slice()). If you're looking up a SuperColumn (or list of SuperColumns) then the resulting
-    instances of ColumnOrSuperColumn will have the requested SuperColumn in the attribute super_column. For queries resulting
-    in Columns, those values will be in the attribute column. This change was made between 0.3 and 0.4 to standardize on
-    single query methods that may return either a SuperColumn or Column.
-
-    If the query was on a counter column family, you will either get a counter_column (instead of a column) or a 
-    counter_super_column (instead of a super_column)
-
-    @param column. The Column returned by get() or get_slice().
-    @param super_column. The SuperColumn returned by get() or get_slice().
-    @param counter_column. The Counterolumn returned by get() or get_slice().
-    @param counter_super_column. The CounterSuperColumn returned by get() or get_slice().
- */
-struct ColumnOrSuperColumn {
-    1: optional Column column,
-    2: optional SuperColumn super_column,
-    3: optional CounterColumn counter_column,
-    4: optional CounterSuperColumn counter_super_column
-}
-
-
-#
-# Exceptions
-# (note that internal server errors will raise a TApplicationException, courtesy of Thrift)
-#
-
-/** A specific column was requested that does not exist. */
-exception NotFoundException {
-}
-
-/** Invalid request could mean keyspace or column family does not exist, required parameters are missing, or a parameter is malformed. 
-    why contains an associated error message.
-*/
-exception InvalidRequestException {
-    1: required string why
-}
-
-/** Not all the replicas required could be created and/or read. */
-exception UnavailableException {
-}
-
-/** RPC timeout was exceeded.  either a node failed mid-operation, or load was too high, or the requested op was too large. */
-exception TimedOutException {
-}
-
-/** invalid authentication request (invalid keyspace, user does not exist, or credentials invalid) */
-exception AuthenticationException {
-    1: required string why
-}
-
-/** invalid authorization request (user does not have access to keyspace) */
-exception AuthorizationException {
-    1: required string why
-}
-
-/** schemas are not in agreement across all nodes */
-exception SchemaDisagreementException {
-}
-
-
-#
-# service api
-#
-/** 
- * The ConsistencyLevel is an enum that controls both read and write
- * behavior based on the ReplicationFactor of the keyspace.  The
- * different consistency levels have different meanings, depending on
- * if you're doing a write or read operation. 
- *
- * If W + R > ReplicationFactor, where W is the number of nodes to
- * block for on write, and R the number to block for on reads, you
- * will have strongly consistent behavior; that is, readers will
- * always see the most recent write. Of these, the most interesting is
- * to do QUORUM reads and writes, which gives you consistency while
- * still allowing availability in the face of node failures up to half
- * of <ReplicationFactor>. Of course if latency is more important than
- * consistency then you can use lower values for either or both.
- * 
- * Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number
- * of replicas rather than a logical concept that adjusts
- * automatically with the replication factor.  Of these, only ONE is
- * commonly used; TWO and (even more rarely) THREE are only useful
- * when you care more about guaranteeing a certain level of
- * durability, than consistency.
- * 
- * Write consistency levels make the following guarantees before reporting success to the client:
- *   ANY          Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node.
- *   ONE          Ensure that the write has been written to at least 1 node's commit log and memory table
- *   TWO          Ensure that the write has been written to at least 2 node's commit log and memory table
- *   THREE        Ensure that the write has been written to at least 3 node's commit log and memory table
- *   QUORUM       Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes
- *   LOCAL_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
- *   EACH_QUORUM  Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
- *   ALL          Ensure that the write is written to <code>&lt;ReplicationFactor&gt;</code> nodes before responding to the client.
- * 
- * Read consistency levels make the following guarantees before returning successful results to the client:
- *   ANY          Not supported. You probably want ONE instead.
- *   ONE          Returns the record obtained from a single replica.
- *   TWO          Returns the record with the most recent timestamp once two replicas have replied.
- *   THREE        Returns the record with the most recent timestamp once three replicas have replied.
- *   QUORUM       Returns the record with the most recent timestamp once a majority of replicas have replied.
- *   LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied.
- *   EACH_QUORUM  Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied.
- *   ALL          Returns the record with the most recent timestamp once all replicas have replied (implies no replica may be down)..
-*/
-enum ConsistencyLevel {
-    ONE = 1,
-    QUORUM = 2,
-    LOCAL_QUORUM = 3,
-    EACH_QUORUM = 4,
-    ALL = 5,
-    ANY = 6,
-    TWO = 7,
-    THREE = 8,
-}
-
-/**
-    ColumnParent is used when selecting groups of columns from the same ColumnFamily. In directory structure terms, imagine
-    ColumnParent as ColumnPath + '/../'.
-
-    See also <a href="cassandra.html#Struct_ColumnPath">ColumnPath</a>
- */
-struct ColumnParent {
-    3: required string column_family,
-    4: optional binary super_column,
-}
-
-/** The ColumnPath is the path to a single column in Cassandra. It might make sense to think of ColumnPath and
- * ColumnParent in terms of a directory structure.
- *
- * ColumnPath is used to looking up a single column.
- *
- * @param column_family. The name of the CF of the column being looked up.
- * @param super_column. The super column name.
- * @param column. The column name.
- */
-struct ColumnPath {
-    3: required string column_family,
-    4: optional binary super_column,
-    5: optional binary column,
-}
-
-/**
-    A slice range is a structure that stores basic range, ordering and limit information for a query that will return
-    multiple columns. It could be thought of as Cassandra's version of LIMIT and ORDER BY
-
-    @param start. The column name to start the slice with. This attribute is not required, though there is no default value,
-                  and can be safely set to '', i.e., an empty byte array, to start with the first column name. Otherwise, it
-                  must a valid value under the rules of the Comparator defined for the given ColumnFamily.
-    @param finish. The column name to stop the slice at. This attribute is not required, though there is no default value,
-                   and can be safely set to an empty byte array to not stop until 'count' results are seen. Otherwise, it
-                   must also be a valid value to the ColumnFamily Comparator.
-    @param reversed. Whether the results should be ordered in reversed order. Similar to ORDER BY blah DESC in SQL.
-    @param count. How many columns to return. Similar to LIMIT in SQL. May be arbitrarily large, but Thrift will
-                  materialize the whole result into memory before returning it to the client, so be aware that you may
-                  be better served by iterating through slices by passing the last value of one call in as the 'start'
-                  of the next instead of increasing 'count' arbitrarily large.
- */
-struct SliceRange {
-    1: required binary start,
-    2: required binary finish,
-    3: required bool reversed=0,
-    4: required i32 count=100,
-}
-
-/**
-    A SlicePredicate is similar to a mathematic predicate (see http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)),
-    which is described as "a property that the elements of a set have in common."
-
-    SlicePredicate's in Cassandra are described with either a list of column_names or a SliceRange.  If column_names is
-    specified, slice_range is ignored.
-
-    @param column_name. A list of column names to retrieve. This can be used similar to Memcached's "multi-get" feature
-                        to fetch N known column names. For instance, if you know you wish to fetch columns 'Joe', 'Jack',
-                        and 'Jim' you can pass those column names as a list to fetch all three at once.
-    @param slice_range. A SliceRange describing how to range, order, and/or limit the slice.
- */
-struct SlicePredicate {
-    1: optional list<binary> column_names,
-    2: optional SliceRange   slice_range,
-}
-
-enum IndexOperator {
-    EQ,
-    GTE,
-    GT,
-    LTE,
-    LT
-}
-
-struct IndexExpression {
-    1: required binary column_name,
-    2: required IndexOperator op,
-    3: required binary value,
-}
-
-struct IndexClause {
-    1: required list<IndexExpression> expressions
-    2: required binary start_key,
-    3: required i32 count=100,
-}
-
-/**
-The semantics of start keys and tokens are slightly different.
-Keys are start-inclusive; tokens are start-exclusive.  Token
-ranges may also wrap -- that is, the end token may be less
-than the start one.  Thus, a range from keyX to keyX is a
-one-element range, but a range from tokenY to tokenY is the
-full ring.
-*/
-struct KeyRange {
-    1: optional binary start_key,
-    2: optional binary end_key,
-    3: optional string start_token,
-    4: optional string end_token,
-    5: required i32 count=100
-}
-
-/**
-    A KeySlice is key followed by the data it maps to. A collection of KeySlice is returned by the get_range_slice operation.
-
-    @param key. a row key
-    @param columns. List of data represented by the key. Typically, the list is pared down to only the columns specified by
-                    a SlicePredicate.
- */
-struct KeySlice {
-    1: required binary key,
-    2: required list<ColumnOrSuperColumn> columns,
-}
-
-struct KeyCount {
-    1: required binary key,
-    2: required i32 count
-}
-
-/**
- * Note that the timestamp is only optional in case of counter deletion.
- */
-struct Deletion {
-    1: optional i64 timestamp,
-    2: optional binary super_column,
-    3: optional SlicePredicate predicate,
-}
-
-/**
-    A Mutation is either an insert (represented by filling column_or_supercolumn) or a deletion (represented by filling the deletion attribute).
-    @param column_or_supercolumn. An insert to a column or supercolumn (possibly counter column or supercolumn)
-    @param deletion. A deletion of a column or supercolumn
-*/
-struct Mutation {
-    1: optional ColumnOrSuperColumn column_or_supercolumn,
-    2: optional Deletion deletion,
-}
-
-struct EndpointDetails {
-    1: string host,
-    2: string datacenter,
-    3: optional string rack
-}
-
-/**
-    A TokenRange describes part of the Cassandra ring, it is a mapping from a range to
-    endpoints responsible for that range.
-    @param start_token The first token in the range
-    @param end_token The last token in the range
-    @param endpoints The endpoints responsible for the range (listed by their configured listen_address)
-    @param rpc_endpoints The endpoints responsible for the range (listed by their configured rpc_address)
-*/
-struct TokenRange {
-    1: required string start_token,
-    2: required string end_token,
-    3: required list<string> endpoints,
-    4: optional list<string> rpc_endpoints
-    5: optional list<EndpointDetails> endpoint_details,
-}
-
-/**
-    Authentication requests can contain any data, dependent on the IAuthenticator used
-*/
-struct AuthenticationRequest {
-    1: required map<string, string> credentials
-}
-
-enum IndexType {
-    KEYS,
-    CUSTOM
-}
-
-/* describes a column in a column family. */
-struct ColumnDef {
-    1: required binary name,
-    2: required string validation_class,
-    3: optional IndexType index_type,
-    4: optional string index_name,
-    5: optional map<string,string> index_options
-}
-
-
-/* describes a column family. */
-struct CfDef {
-    1: required string keyspace,
-    2: required string name,
-    3: optional string column_type="Standard",
-    5: optional string comparator_type="BytesType",
-    6: optional string subcomparator_type,
-    8: optional string comment,
-    12: optional double read_repair_chance=1.0,
-    13: optional list<ColumnDef> column_metadata,
-    14: optional i32 gc_grace_seconds,
-    15: optional string default_validation_class,
-    16: optional i32 id,
-    17: optional i32 min_compaction_threshold,
-    18: optional i32 max_compaction_threshold,
-    24: optional bool replicate_on_write,
-    25: optional double merge_shards_chance,
-    26: optional string key_validation_class,
-    28: optional binary key_alias,
-    29: optional string compaction_strategy,
-    30: optional map<string,string> compaction_strategy_options,
-    32: optional map<string,string> compression_options,
-    33: optional double bloom_filter_fp_chance,
-}
-
-/* describes a keyspace. */
-struct KsDef {
-    1: required string name,
-    2: required string strategy_class,
-    3: optional map<string,string> strategy_options,
-
-    /** @deprecated */
-    4: optional i32 replication_factor, 
-
-    5: required list<CfDef> cf_defs,
-    6: optional bool durable_writes=1,
-}
-
-/** CQL query compression */
-enum Compression {
-    GZIP = 1,
-    NONE = 2
-}
-
-enum CqlResultType {
-    ROWS = 1,
-    VOID = 2,
-    INT = 3
-}
-
-/** Row returned from a CQL query */
-struct CqlRow {
-    1: required binary key,
-    2: required list<Column> columns
-}
-
-struct CqlMetadata {
-    1: required map<binary,string> name_types,
-    2: required map<binary,string> value_types,
-    3: required string default_name_type,
-    4: required string default_value_type
-}
-
-struct CqlResult {
-    1: required CqlResultType type,
-    2: optional list<CqlRow> rows,
-    3: optional i32 num,
-    4: optional CqlMetadata schema
-}
-
-struct CqlPreparedResult {
-    1: required i32 itemId,
-    2: required i32 count
-}
-
-
-service Cassandra {
-  # auth methods
-  void login(1: required AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 2:AuthorizationException authzx),
- 
-  # set keyspace
-  void set_keyspace(1: required string keyspace) throws (1:InvalidRequestException ire),
-  
-  # retrieval methods
-
-  /**
-    Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This is
-    the only method that can throw an exception under non-failure conditions.)
-   */
-  ColumnOrSuperColumn get(1:required binary key,
-                          2:required ColumnPath column_path,
-                          3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-                      throws (1:InvalidRequestException ire, 2:NotFoundException nfe, 3:UnavailableException ue, 4:TimedOutException te),
-
-  /**
-    Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name
-    pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned.
-   */
-  list<ColumnOrSuperColumn> get_slice(1:required binary key, 
-                                      2:required ColumnParent column_parent, 
-                                      3:required SlicePredicate predicate, 
-                                      4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-                            throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-    returns the number of columns matching <code>predicate</code> for a particular <code>key</code>, 
-    <code>ColumnFamily</code> and optionally <code>SuperColumn</code>.
-  */
-  i32 get_count(1:required binary key, 
-                2:required ColumnParent column_parent, 
-                3:required SlicePredicate predicate,
-                4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-      throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-    Performs a get_slice for column_parent and predicate for the given keys in parallel.
-  */
-  map<binary,list<ColumnOrSuperColumn>> multiget_slice(1:required list<binary> keys, 
-                                                       2:required ColumnParent column_parent, 
-                                                       3:required SlicePredicate predicate, 
-                                                       4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-                                        throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-    Perform a get_count in parallel on the given list<binary> keys. The return value maps keys to the count found.
-  */
-  map<binary, i32> multiget_count(1:required list<binary> keys,
-                2:required ColumnParent column_parent,
-                3:required SlicePredicate predicate,
-                4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-      throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-   returns a subset of columns for a contiguous range of keys.
-  */
-  list<KeySlice> get_range_slices(1:required ColumnParent column_parent, 
-                                  2:required SlicePredicate predicate,
-                                  3:required KeyRange range,
-                                  4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-                 throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /** Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause */
-  list<KeySlice> get_indexed_slices(1:required ColumnParent column_parent,
-                                    2:required IndexClause index_clause,
-                                    3:required SlicePredicate column_predicate,
-                                    4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-                 throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  # modification methods
-
-  /**
-   * Insert a Column at the given column_parent.column_family and optional column_parent.super_column.
-   */
-  void insert(1:required binary key, 
-              2:required ColumnParent column_parent,
-              3:required Column column,
-              4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-   * Increment or decrement a counter.
-   */
-  void add(1:required binary key,
-           2:required ColumnParent column_parent,
-           3:required CounterColumn column,
-           4:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-    Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
-    that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
-    row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those levels too.
-   */
-  void remove(1:required binary key,
-              2:required ColumnPath column_path,
-              3:required i64 timestamp,
-              4:ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-  /**
-   * Remove a counter at the specified location.
-   * Note that counters have limited support for deletes: if you remove a counter, you must wait to issue any following update
-   * until the delete has reached all the nodes and all of them have been fully compacted.
-   */
-  void remove_counter(1:required binary key,
-                      2:required ColumnPath path,
-                      3:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-      throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-
-
-  /**
-    Mutate many columns or super columns for many row keys. See also: Mutation.
-
-    mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
-  **/
-  void batch_mutate(1:required map<binary, map<string, list<Mutation>>> mutation_map,
-                    2:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
-       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
-       
-  /**
-   Truncate will mark and entire column family as deleted.
-   From the user's perspective a successful call to truncate will result complete data deletion from cfname.
-   Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one
-   only marks the data as deleted.
-   The operation succeeds only if all hosts in the cluster at available and will throw an UnavailableException if 
-   some hosts are down.
-  */
-  void truncate(1:required string cfname)
-       throws (1: InvalidRequestException ire, 2: UnavailableException ue, 3: TimedOutException te),
-
-
-    
-  // Meta-APIs -- APIs to get information about the node or cluster,
-  // rather than user data.  The nodeprobe program provides usage examples.
-  
-  /** 
-   * for each schema version present in the cluster, returns a list of nodes at that version.
-   * hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. 
-   * the cluster is all on the same version if the size of the map is 1. 
-   */
-  map<string, list<string>> describe_schema_versions()
-       throws (1: InvalidRequestException ire),
-
-  /** list the defined keyspaces in this cluster */
-  list<KsDef> describe_keyspaces()
-    throws (1:InvalidRequestException ire),
-
-  /** get the cluster name */
-  string describe_cluster_name(),
-
-  /** get the thrift api version */
-  string describe_version(),
-
-  /** get the token ring: a map of ranges to host addresses,
-      represented as a set of TokenRange instead of a map from range
-      to list of endpoints, because you can't use Thrift structs as
-      map keys:
-      https://issues.apache.org/jira/browse/THRIFT-162 
-
-      for the same reason, we can't return a set here, even though
-      order is neither important nor predictable. */
-  list<TokenRange> describe_ring(1:required string keyspace)
-                   throws (1:InvalidRequestException ire),
-
-  /** returns the partitioner used by this cluster */
-  string describe_partitioner(),
-
-  /** returns the snitch used by this cluster */
-  string describe_snitch(),
-
-  /** describe specified keyspace */
-  KsDef describe_keyspace(1:required string keyspace)
-    throws (1:NotFoundException nfe, 2:InvalidRequestException ire),
-
-  /** experimental API for hadoop/parallel query support.  
-      may change violently and without warning. 
-
-      returns list of token strings such that first subrange is (list[0], list[1]],
-      next is (list[1], list[2]], etc. */
-  list<string> describe_splits(1:required string cfName,
-                               2:required string start_token, 
-                               3:required string end_token,
-                               4:required i32 keys_per_split)
-    throws (1:InvalidRequestException ire),
-
-  /** adds a column family. returns the new schema id. */
-  string system_add_column_family(1:required CfDef cf_def)
-    throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
-    
-  /** drops a column family. returns the new schema id. */
-  string system_drop_column_family(1:required string column_family)
-    throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde), 
-  
-  /** adds a keyspace and any column families that are part of it. returns the new schema id. */
-  string system_add_keyspace(1:required KsDef ks_def)
-    throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
-  
-  /** drops a keyspace and any column families that are part of it. returns the new schema id. */
-  string system_drop_keyspace(1:required string keyspace)
-    throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
-  
-  /** updates properties of a keyspace. returns the new schema id. */
-  string system_update_keyspace(1:required KsDef ks_def)
-    throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
-        
-  /** updates properties of a column family. returns the new schema id. */
-  string system_update_column_family(1:required CfDef cf_def)
-    throws (1:InvalidRequestException ire, 2:SchemaDisagreementException sde),
-  
-  /**
-   * Executes a CQL (Cassandra Query Language) statement and returns a
-   * CqlResult containing the results.
-   */
-  CqlResult execute_cql_query(1:required binary query, 2:required Compression compression)
-    throws (1:InvalidRequestException ire,
-            2:UnavailableException ue,
-            3:TimedOutException te,
-            4:SchemaDisagreementException sde)
-            
-            
-  /**
-   * Prepare a CQL (Cassandra Query Language) statement by compiling and returning
-   * - the type of CQL statement
-   * - an id token of the compiled CQL stored on the server side.
-   * - a count of the discovered bound markers in the statement 
-   */
-  CqlPreparedResult prepare_cql_query(1:required binary query, 2:required Compression compression)
-    throws (1:InvalidRequestException ire)
-
-             
-  /**
-   * Executes a prepared CQL (Cassandra Query Language) statement by passing an id token and  a list of variables
-   * to bind and returns a CqlResult containing the results.
-   */
-  CqlResult execute_prepared_cql_query(1:required i32 itemId, 2:required list<string> values)
-    throws (1:InvalidRequestException ire,
-            2:UnavailableException ue,
-            3:TimedOutException te,
-            4:SchemaDisagreementException sde)
-           
-
-}
diff --git a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 0bb460f..0000000
--- a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("d0d3706b-fed5-4cf5-b984-04f448de9d7b")]
\ No newline at end of file
diff --git a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj b/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
deleted file mode 100644
index c4a84a3..0000000
--- a/lib/netcore/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-    <AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
-    <PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="../../Thrift/Thrift.csproj" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <PackageReference Include="System.ServiceModel.Primitives" Version="[4.1.0,)" />
-  </ItemGroup>
-
-  <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
-    <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
-      <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
-    </Exec>
-    <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./CassandraTest.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./CassandraTest.thrift" />
-    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./CassandraTest.thrift" />
-    <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../../../test/ThriftTest.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../../../test/ThriftTest.thrift" />
-    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../../../test/ThriftTest.thrift" />
-    <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../../../contrib/fb303/if/fb303.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../../../contrib/fb303/if/fb303.thrift" />
-    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../../../contrib/fb303/if/fb303.thrift" />
-  </Target>
-
-</Project>
diff --git a/lib/netcore/Tests/Thrift.Tests/Collections/TCollectionsTests.cs b/lib/netcore/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
deleted file mode 100644
index 1be99b4..0000000
--- a/lib/netcore/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Thrift.Collections;
-
-namespace Thrift.Tests.Collections
-{
-    // ReSharper disable once InconsistentNaming
-    [TestClass]
-    public class TCollectionsTests
-    {
-        //TODO: Add tests for IEnumerable with objects and primitive values inside
-
-        [TestMethod]
-        public void TCollection_Equals_Primitive_Test()
-        {
-            var collection1 = new List<int> {1,2,3};
-            var collection2 = new List<int> {1,2,3};
-
-            var result = TCollections.Equals(collection1, collection2);
-
-            Assert.IsTrue(result);
-        }
-
-        [TestMethod]
-        public void TCollection_Equals_Primitive_Different_Test()
-        {
-            var collection1 = new List<int> { 1, 2, 3 };
-            var collection2 = new List<int> { 1, 2 };
-
-            var result = TCollections.Equals(collection1, collection2);
-
-            Assert.IsFalse(result);
-        }
-
-        [TestMethod]
-        public void TCollection_Equals_Objects_Test()
-        {
-            var collection1 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
-            var collection2 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
-
-            var result = TCollections.Equals(collection1, collection2);
-
-            // references to different collections
-            Assert.IsFalse(result);
-        }
-
-        [TestMethod]
-        public void TCollection_Equals_OneAndTheSameObject_Test()
-        {
-            var collection1 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
-            var collection2 = collection1;
-
-            var result = TCollections.Equals(collection1, collection2);
-
-            // references to one and the same collection
-            Assert.IsTrue(result);
-        }
-
-        private class ExampleClass
-        {
-            public int X { get; set; }
-        }
-    }
-}
diff --git a/lib/netcore/Tests/Thrift.Tests/Collections/THashSetTests.cs b/lib/netcore/Tests/Thrift.Tests/Collections/THashSetTests.cs
deleted file mode 100644
index 8de573e..0000000
--- a/lib/netcore/Tests/Thrift.Tests/Collections/THashSetTests.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Thrift.Collections;
-
-namespace Thrift.Tests.Collections
-{
-    // ReSharper disable once InconsistentNaming
-    [TestClass]
-    public class THashSetTests
-    {
-        [TestMethod]
-        public void THashSet_Equals_Primitive_Test()
-        {
-            const int value = 1;
-
-            var hashSet = new THashSet<int> {value};
-            
-            Assert.IsTrue(hashSet.Contains(value));
-
-            hashSet.Remove(value);
-
-            Assert.IsTrue(hashSet.Count == 0);
-
-            hashSet.Add(value);
-
-            Assert.IsTrue(hashSet.Contains(value));
-
-            hashSet.Clear();
-
-            Assert.IsTrue(hashSet.Count == 0);
-
-            var newArr = new int[1];
-            hashSet.Add(value);
-            hashSet.CopyTo(newArr, 0);
-
-            Assert.IsTrue(newArr.Contains(value));
-
-            var en = hashSet.GetEnumerator();
-            en.MoveNext();
-
-            Assert.IsTrue((int)en.Current == value);
-            
-            using (var ien = ((IEnumerable<int>)hashSet).GetEnumerator())
-            {
-                ien.MoveNext();
-
-                Assert.IsTrue(ien.Current == value);
-            }
-        }
-    }
-}
diff --git a/lib/netcore/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs b/lib/netcore/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
deleted file mode 100644
index cdc8317..0000000
--- a/lib/netcore/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Thrift.Protocols;
-using Thrift.Protocols.Entities;
-using Thrift.Protocols.Utilities;
-
-namespace Thrift.Tests.Protocols
-{
-    [TestClass]
-    public class TJSONProtocolHelperTests
-    {
-        [TestMethod]
-        public void GetTypeNameForTypeId_Test()
-        {
-            // input/output
-            var sets = new List<Tuple<TType, byte[]>>
-            {
-                new Tuple<TType, byte[]>(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
-                new Tuple<TType, byte[]>(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
-                new Tuple<TType, byte[]>(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
-                new Tuple<TType, byte[]>(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
-                new Tuple<TType, byte[]>(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
-                new Tuple<TType, byte[]>(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
-                new Tuple<TType, byte[]>(TType.String, TJSONProtocolConstants.TypeNames.NameString),
-                new Tuple<TType, byte[]>(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
-                new Tuple<TType, byte[]>(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
-                new Tuple<TType, byte[]>(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
-                new Tuple<TType, byte[]>(TType.List, TJSONProtocolConstants.TypeNames.NameList),
-            };
-
-            foreach (var t in sets)
-            {
-                Assert.IsTrue(TJSONProtocolHelper.GetTypeNameForTypeId(t.Item1) == t.Item2, $"Wrong mapping of TypeName {t.Item2} to TType: {t.Item1}");
-            }
-        }
-
-        [TestMethod]
-        [ExpectedException(typeof(TProtocolException))]
-        public void GetTypeNameForTypeId_TStop_Test()
-        {
-            TJSONProtocolHelper.GetTypeNameForTypeId(TType.Stop);
-        }
-
-        [TestMethod]
-        [ExpectedException(typeof(TProtocolException))]
-        public void GetTypeNameForTypeId_NonExistingTType_Test()
-        {
-            TJSONProtocolHelper.GetTypeNameForTypeId((TType)100);
-        }
-
-        [TestMethod]
-        public void GetTypeIdForTypeName_Test()
-        {
-            // input/output
-            var sets = new List<Tuple<TType, byte[]>>
-            {
-                new Tuple<TType, byte[]>(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
-                new Tuple<TType, byte[]>(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
-                new Tuple<TType, byte[]>(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
-                new Tuple<TType, byte[]>(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
-                new Tuple<TType, byte[]>(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
-                new Tuple<TType, byte[]>(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
-                new Tuple<TType, byte[]>(TType.String, TJSONProtocolConstants.TypeNames.NameString),
-                new Tuple<TType, byte[]>(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
-                new Tuple<TType, byte[]>(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
-                new Tuple<TType, byte[]>(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
-                new Tuple<TType, byte[]>(TType.List, TJSONProtocolConstants.TypeNames.NameList),
-            };
-
-            foreach (var t in sets)
-            {
-                Assert.IsTrue(TJSONProtocolHelper.GetTypeIdForTypeName(t.Item2) == t.Item1, $"Wrong mapping of TypeName {t.Item2} to TType: {t.Item1}");
-            }
-        }
-
-        [TestMethod]
-        [ExpectedException(typeof(TProtocolException))]
-        public void GetTypeIdForTypeName_TStopTypeName_Test()
-        {
-            TJSONProtocolHelper.GetTypeIdForTypeName(new []{(byte)TType.Stop, (byte)TType.Stop});
-        }
-
-        [TestMethod]
-        [ExpectedException(typeof(TProtocolException))]
-        public void GetTypeIdForTypeName_NonExistingTypeName_Test()
-        {
-            TJSONProtocolHelper.GetTypeIdForTypeName(new byte[]{100});
-        }
-
-        [TestMethod]
-        [ExpectedException(typeof(TProtocolException))]
-        public void GetTypeIdForTypeName_EmptyName_Test()
-        {
-            TJSONProtocolHelper.GetTypeIdForTypeName(new byte[] {});
-        }
-
-        [TestMethod]
-        public void IsJsonNumeric_Test()
-        {
-            // input/output
-            var correctJsonNumeric = "+-.0123456789Ee";
-            var incorrectJsonNumeric = "AaBcDd/*\\";
-
-            var sets = correctJsonNumeric.Select(ch => new Tuple<byte, bool>((byte) ch, true)).ToList();
-            sets.AddRange(incorrectJsonNumeric.Select(ch => new Tuple<byte, bool>((byte) ch, false)));
-
-            foreach (var t in sets)
-            {
-                Assert.IsTrue(TJSONProtocolHelper.IsJsonNumeric(t.Item1) == t.Item2, $"Wrong mapping of Char {t.Item1} to bool: {t.Item2}");
-            }
-        }
-
-        [TestMethod]
-        public void ToHexVal_Test()
-        {
-            // input/output
-            var chars = "0123456789abcdef";
-            var expectedHexValues = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
-
-            var sets = chars.Select((ch, i) => new Tuple<char, byte>(ch, expectedHexValues[i])).ToList();
-
-            foreach (var t in sets)
-            {
-                var actualResult = TJSONProtocolHelper.ToHexVal((byte)t.Item1);
-                Assert.IsTrue(actualResult == t.Item2, $"Wrong mapping of char byte {t.Item1} to it expected hex value: {t.Item2}. Actual hex value: {actualResult}");
-            }
-        }
-
-        [TestMethod]
-        [ExpectedException(typeof(TProtocolException))]
-        public void ToHexVal_WrongInputChar_Test()
-        {
-            TJSONProtocolHelper.ToHexVal((byte)'s');
-        }
-
-        [TestMethod]
-        public void ToHexChar_Test()
-        {
-            // input/output
-            var hexValues = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-            var expectedChars = "0123456789abcdef";
-            
-
-            var sets = hexValues.Select((hv, i) => new Tuple<byte, char>(hv, expectedChars[i])).ToList();
-
-            foreach (var t in sets)
-            {
-                var actualResult = TJSONProtocolHelper.ToHexChar(t.Item1);
-                Assert.IsTrue(actualResult == t.Item2, $"Wrong mapping of hex value {t.Item1} to it expected char: {t.Item2}. Actual hex value: {actualResult}");
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs b/lib/netcore/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
deleted file mode 100644
index 5237360..0000000
--- a/lib/netcore/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using NSubstitute;
-using Thrift.Protocols;
-using Thrift.Protocols.Entities;
-using Thrift.Transports;
-using Thrift.Transports.Client;
-
-namespace Thrift.Tests.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    [TestClass]
-    public class TJSONProtocolTests
-    {
-        [TestMethod]
-        public void TJSONProtocol_Can_Create_Instance_Test()
-        {
-            var httpClientTransport = Substitute.For<THttpClientTransport>(new Uri("http://localhost"), null);
-
-            var result = new TJSONProtocolWrapper(httpClientTransport);
-
-            Assert.IsNotNull(result);
-            Assert.IsNotNull(result.WrappedContext);
-            Assert.IsNotNull(result.WrappedReader);
-            Assert.IsNotNull(result.Transport);
-            Assert.IsTrue(result.WrappedRecursionDepth == 0);
-            Assert.IsTrue(result.WrappedRecursionLimit == TProtocol.DefaultRecursionDepth);
-
-            Assert.IsTrue(result.Transport.Equals(httpClientTransport));
-            Assert.IsTrue(result.WrappedContext.GetType().Name.Equals("JSONBaseContext", StringComparison.OrdinalIgnoreCase));
-            Assert.IsTrue(result.WrappedReader.GetType().Name.Equals("LookaheadReader", StringComparison.OrdinalIgnoreCase));
-        }
-
-        private class TJSONProtocolWrapper : TJsonProtocol
-        {
-            public TJSONProtocolWrapper(TClientTransport trans) : base(trans)
-            {
-            }
-
-            public object WrappedContext => Context;
-            public object WrappedReader => Reader;
-            public int WrappedRecursionDepth => RecursionDepth;
-            public int WrappedRecursionLimit => RecursionLimit;
-        }
-    }
-}
diff --git a/lib/netcore/Tests/Thrift.Tests/Thrift.Tests.csproj b/lib/netcore/Tests/Thrift.Tests/Thrift.Tests.csproj
deleted file mode 100644
index e46f165..0000000
--- a/lib/netcore/Tests/Thrift.Tests/Thrift.Tests.csproj
+++ /dev/null
@@ -1,18 +0,0 @@
-﻿<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-  </PropertyGroup>
-  <ItemGroup>
-    <PackageReference Include="CompareNETObjects" Version="4.3.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
-    <PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
-    <PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
-    <PackageReference Include="NSubstitute" Version="3.1.0" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\Thrift\Thrift.csproj" />
-  </ItemGroup>
-  <ItemGroup>
-    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/lib/netcore/Thrift.sln b/lib/netcore/Thrift.sln
deleted file mode 100644
index fe30aa5..0000000
--- a/lib/netcore/Thrift.sln
+++ /dev/null
@@ -1,85 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.12
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift", "Thrift\Thrift.csproj", "{D85F572F-7D80-40A4-9A9B-2731ED187C24}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift.IntegrationTests", "Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj", "{9F9A11BF-3C95-4E80-AFBF-768541996844}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift.Tests", "Tests\Thrift.Tests\Thrift.Tests.csproj", "{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift.PublicInterfaces.Compile.Tests", "Tests\Thrift.PublicInterfaces.Compile.Tests\Thrift.PublicInterfaces.Compile.Tests.csproj", "{A429F05B-F511-45EF-AE7B-04E1AE9C9367}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Debug|x64 = Debug|x64
-		Debug|x86 = Debug|x86
-		Release|Any CPU = Release|Any CPU
-		Release|x64 = Release|x64
-		Release|x86 = Release|x86
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x64.Build.0 = Debug|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Debug|x86.Build.0 = Debug|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|Any CPU.Build.0 = Release|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x64.ActiveCfg = Release|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x64.Build.0 = Release|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x86.ActiveCfg = Release|Any CPU
-		{D85F572F-7D80-40A4-9A9B-2731ED187C24}.Release|x86.Build.0 = Release|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Debug|x64.Build.0 = Debug|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Debug|x86.Build.0 = Debug|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Release|x64.ActiveCfg = Release|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Release|x64.Build.0 = Release|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Release|x86.ActiveCfg = Release|Any CPU
-		{9F9A11BF-3C95-4E80-AFBF-768541996844}.Release|x86.Build.0 = Release|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Debug|x64.Build.0 = Debug|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Debug|x86.Build.0 = Debug|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Release|Any CPU.Build.0 = Release|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Release|x64.ActiveCfg = Release|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Release|x64.Build.0 = Release|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Release|x86.ActiveCfg = Release|Any CPU
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1}.Release|x86.Build.0 = Release|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Debug|x64.Build.0 = Debug|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Debug|x86.Build.0 = Debug|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Release|Any CPU.Build.0 = Release|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Release|x64.ActiveCfg = Release|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Release|x64.Build.0 = Release|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Release|x86.ActiveCfg = Release|Any CPU
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367}.Release|x86.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(NestedProjects) = preSolution
-		{9F9A11BF-3C95-4E80-AFBF-768541996844} = {F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}
-		{75C2F9DC-3546-4D0A-A2DF-31C93516B6C1} = {F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}
-		{A429F05B-F511-45EF-AE7B-04E1AE9C9367} = {F51FC4DA-CAC0-48B1-A069-B1712BCAA5BE}
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {FD20BC4A-0109-41D8-8C0C-893E784D7EF9}
-	EndGlobalSection
-EndGlobal
diff --git a/lib/netcore/Thrift/Collections/TCollections.cs b/lib/netcore/Thrift/Collections/TCollections.cs
deleted file mode 100644
index 147bfc7..0000000
--- a/lib/netcore/Thrift/Collections/TCollections.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Collections;
-
-namespace Thrift.Collections
-{
-    // ReSharper disable once InconsistentNaming
-    public class TCollections
-    {
-        /// <summary>
-        ///     This will return true if the two collections are value-wise the same.
-        ///     If the collection contains a collection, the collections will be compared using this method.
-        /// </summary>
-        public static bool Equals(IEnumerable first, IEnumerable second)
-        {
-            if (first == null && second == null)
-            {
-                return true;
-            }
-
-            if (first == null || second == null)
-            {
-                return false;
-            }
-
-            var fiter = first.GetEnumerator();
-            var siter = second.GetEnumerator();
-
-            var fnext = fiter.MoveNext();
-            var snext = siter.MoveNext();
-
-            while (fnext && snext)
-            {
-                var fenum = fiter.Current as IEnumerable;
-                var senum = siter.Current as IEnumerable;
-
-                if (fenum != null && senum != null)
-                {
-                    if (!Equals(fenum, senum))
-                    {
-                        return false;
-                    }
-                }
-                else if (fenum == null ^ senum == null)
-                {
-                    return false;
-                }
-                else if (!Equals(fiter.Current, siter.Current))
-                {
-                    return false;
-                }
-
-                fnext = fiter.MoveNext();
-                snext = siter.MoveNext();
-            }
-
-            return fnext == snext;
-        }
-
-        /// <summary>
-        ///     This returns a hashcode based on the value of the enumerable.
-        /// </summary>
-        public static int GetHashCode(IEnumerable enumerable)
-        {
-            if (enumerable == null)
-            {
-                return 0;
-            }
-
-            var hashcode = 0;
-
-            foreach (var obj in enumerable)
-            {
-                var enum2 = obj as IEnumerable;
-                var objHash = enum2 == null ? obj.GetHashCode() : GetHashCode(enum2);
-
-                unchecked
-                {
-                    hashcode = (hashcode*397) ^ (objHash);
-                }
-            }
-
-            return hashcode;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Collections/THashSet.cs b/lib/netcore/Thrift/Collections/THashSet.cs
deleted file mode 100644
index 011f0a0..0000000
--- a/lib/netcore/Thrift/Collections/THashSet.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Thrift.Collections
-{
-    // ReSharper disable once InconsistentNaming
-    public class THashSet<T> : ICollection<T>
-    {
-        private readonly HashSet<T> _set = new HashSet<T>();
-
-        public int Count => _set.Count;
-
-        public bool IsReadOnly => false;
-
-        public void Add(T item)
-        {
-            _set.Add(item);
-        }
-
-        public void Clear()
-        {
-            _set.Clear();
-        }
-
-        public bool Contains(T item)
-        {
-            return _set.Contains(item);
-        }
-
-        public void CopyTo(T[] array, int arrayIndex)
-        {
-            _set.CopyTo(array, arrayIndex);
-        }
-
-        public IEnumerator GetEnumerator()
-        {
-            return _set.GetEnumerator();
-        }
-
-        IEnumerator<T> IEnumerable<T>.GetEnumerator()
-        {
-            return ((IEnumerable<T>) _set).GetEnumerator();
-        }
-
-        public bool Remove(T item)
-        {
-            return _set.Remove(item);
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/ITAsyncProcessor.cs b/lib/netcore/Thrift/ITAsyncProcessor.cs
deleted file mode 100644
index db8e40a..0000000
--- a/lib/netcore/Thrift/ITAsyncProcessor.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols;
-
-namespace Thrift
-{
-    public interface ITAsyncProcessor
-    {
-        Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot);
-        Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/ITProcessorFactory.cs b/lib/netcore/Thrift/ITProcessorFactory.cs
deleted file mode 100644
index 5133e5c..0000000
--- a/lib/netcore/Thrift/ITProcessorFactory.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using Thrift.Server;
-using Thrift.Transports;
-
-namespace Thrift
-{
-    // ReSharper disable once InconsistentNaming
-    public interface ITProcessorFactory
-    {
-        ITAsyncProcessor GetAsyncProcessor(TClientTransport trans, TBaseServer baseServer = null);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Properties/AssemblyInfo.cs b/lib/netcore/Thrift/Properties/AssemblyInfo.cs
deleted file mode 100644
index 58aa844..0000000
--- a/lib/netcore/Thrift/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Thrift")]
-[assembly: AssemblyDescription("C# .NET Core bindings for the Apache Thrift RPC system")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-//@TODO where to put License information?
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a exType in this assembly from
-// COM, set the ComVisible attribute to true on that exType.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("df3f8ef0-e0a3-4c86-a65b-8ec84e016b1d")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("0.14.0.0")]
-[assembly: AssemblyFileVersion("0.14.0.0")]
diff --git a/lib/netcore/Thrift/Protocols/Entities/TField.cs b/lib/netcore/Thrift/Protocols/Entities/TField.cs
deleted file mode 100644
index d311535..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TField.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public struct TField
-    {
-        public TField(string name, TType type, short id)
-        {
-            Name = name;
-            Type = type;
-            ID = id;
-        }
-
-        public string Name { get; set; }
-
-        public TType Type { get; set; }
-
-        // ReSharper disable once InconsistentNaming - do not rename - it used for generation 
-        public short ID { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TList.cs b/lib/netcore/Thrift/Protocols/Entities/TList.cs
deleted file mode 100644
index ce23220..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TList.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public struct TList
-    {
-        public TList(TType elementType, int count)
-        {
-            ElementType = elementType;
-            Count = count;
-        }
-
-        public TType ElementType { get; set; }
-
-        public int Count { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TMap.cs b/lib/netcore/Thrift/Protocols/Entities/TMap.cs
deleted file mode 100644
index 9195593..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TMap.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public struct TMap
-    {
-        public TMap(TType keyType, TType valueType, int count)
-        {
-            KeyType = keyType;
-            ValueType = valueType;
-            Count = count;
-        }
-
-        public TType KeyType { get; set; }
-
-        public TType ValueType { get; set; }
-
-        public int Count { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TMessage.cs b/lib/netcore/Thrift/Protocols/Entities/TMessage.cs
deleted file mode 100644
index 17f4929..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TMessage.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public struct TMessage
-    {
-        public TMessage(string name, TMessageType type, int seqid)
-        {
-            Name = name;
-            Type = type;
-            SeqID = seqid;
-        }
-
-        public string Name { get; set; }
-
-        public TMessageType Type { get; set; }
-
-        // ReSharper disable once InconsistentNaming - do not rename - it used for generation 
-        public int SeqID { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TMessageType.cs b/lib/netcore/Thrift/Protocols/Entities/TMessageType.cs
deleted file mode 100644
index d7b9a22..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TMessageType.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public enum TMessageType
-    {
-        Call = 1,
-        Reply = 2,
-        Exception = 3,
-        Oneway = 4
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TSet.cs b/lib/netcore/Thrift/Protocols/Entities/TSet.cs
deleted file mode 100644
index a583b54..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TSet.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public struct TSet
-    {
-        public TSet(TType elementType, int count)
-        {
-            ElementType = elementType;
-            Count = count;
-        }
-
-        public TSet(TList list)
-            : this(list.ElementType, list.Count)
-        {
-        }
-
-        public TType ElementType { get; set; }
-
-        public int Count { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TStruct.cs b/lib/netcore/Thrift/Protocols/Entities/TStruct.cs
deleted file mode 100644
index a28dcc3..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TStruct.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public struct TStruct
-    {
-        public TStruct(string name)
-        {
-            Name = name;
-        }
-
-        public string Name { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Entities/TType.cs b/lib/netcore/Thrift/Protocols/Entities/TType.cs
deleted file mode 100644
index ebe781c..0000000
--- a/lib/netcore/Thrift/Protocols/Entities/TType.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Entities
-{
-    // ReSharper disable once InconsistentNaming
-    public enum TType : byte
-    {
-        Stop = 0,
-        Void = 1,
-        Bool = 2,
-        Byte = 3,
-        Double = 4,
-        I16 = 6,
-        I32 = 8,
-        I64 = 10,
-        String = 11,
-        Struct = 12,
-        Map = 13,
-        Set = 14,
-        List = 15
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/ITProtocolFactory.cs b/lib/netcore/Thrift/Protocols/ITProtocolFactory.cs
deleted file mode 100644
index ecc5cc4..0000000
--- a/lib/netcore/Thrift/Protocols/ITProtocolFactory.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using Thrift.Transports;
-
-namespace Thrift.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    public interface ITProtocolFactory
-    {
-        TProtocol GetProtocol(TClientTransport trans);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TAbstractBase.cs b/lib/netcore/Thrift/Protocols/TAbstractBase.cs
deleted file mode 100644
index 4e18681..0000000
--- a/lib/netcore/Thrift/Protocols/TAbstractBase.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    public interface TAbstractBase
-    {
-        Task WriteAsync(TProtocol tProtocol, CancellationToken cancellationToken);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TBase.cs b/lib/netcore/Thrift/Protocols/TBase.cs
deleted file mode 100644
index 014e1ae..0000000
--- a/lib/netcore/Thrift/Protocols/TBase.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    public interface TBase : TAbstractBase
-    {
-        Task ReadAsync(TProtocol tProtocol, CancellationToken cancellationToken);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TBinaryProtocol.cs b/lib/netcore/Thrift/Protocols/TBinaryProtocol.cs
deleted file mode 100644
index deec85c..0000000
--- a/lib/netcore/Thrift/Protocols/TBinaryProtocol.cs
+++ /dev/null
@@ -1,613 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-using Thrift.Transports;
-
-namespace Thrift.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    public class TBinaryProtocol : TProtocol
-    {
-        //TODO: Unit tests
-        //TODO: Localization
-        //TODO: pragma
-
-        protected const uint VersionMask = 0xffff0000;
-        protected const uint Version1 = 0x80010000;
-
-        protected bool StrictRead;
-        protected bool StrictWrite;
-
-        public TBinaryProtocol(TClientTransport trans)
-            : this(trans, false, true)
-        {
-        }
-
-        public TBinaryProtocol(TClientTransport trans, bool strictRead, bool strictWrite)
-            : base(trans)
-        {
-            StrictRead = strictRead;
-            StrictWrite = strictWrite;
-        }
-
-        public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            if (StrictWrite)
-            {
-                var version = Version1 | (uint) message.Type;
-                await WriteI32Async((int) version, cancellationToken);
-                await WriteStringAsync(message.Name, cancellationToken);
-                await WriteI32Async(message.SeqID, cancellationToken);
-            }
-            else
-            {
-                await WriteStringAsync(message.Name, cancellationToken);
-                await WriteByteAsync((sbyte) message.Type, cancellationToken);
-                await WriteI32Async(message.SeqID, cancellationToken);
-            }
-        }
-
-        public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteByteAsync((sbyte) field.Type, cancellationToken);
-            await WriteI16Async(field.ID, cancellationToken);
-        }
-
-        public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteByteAsync((sbyte) TType.Stop, cancellationToken);
-        }
-
-        public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteByteAsync((sbyte) map.KeyType, cancellationToken);
-            await WriteByteAsync((sbyte) map.ValueType, cancellationToken);
-            await WriteI32Async(map.Count, cancellationToken);
-        }
-
-        public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteByteAsync((sbyte) list.ElementType, cancellationToken);
-            await WriteI32Async(list.Count, cancellationToken);
-        }
-
-        public override async Task WriteListEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteByteAsync((sbyte) set.ElementType, cancellationToken);
-            await WriteI32Async(set.Count, cancellationToken);
-        }
-
-        public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteByteAsync(b ? (sbyte) 1 : (sbyte) 0, cancellationToken);
-        }
-
-        protected internal static byte[] CreateWriteByte(sbyte b)
-        {
-            var bout = new byte[1];
-
-            bout[0] = (byte) b;
-
-            return bout;
-        }
-
-        public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var bout = CreateWriteByte(b);
-            await Trans.WriteAsync(bout, 0, 1, cancellationToken);
-        }
-
-        protected internal static byte[] CreateWriteI16(short s)
-        {
-            var i16Out = new byte[2];
-
-            i16Out[0] = (byte) (0xff & (s >> 8));
-            i16Out[1] = (byte) (0xff & s);
-
-            return i16Out;
-        }
-
-        public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var i16Out = CreateWriteI16(i16);
-            await Trans.WriteAsync(i16Out, 0, 2, cancellationToken);
-        }
-
-        protected internal static byte[] CreateWriteI32(int i32)
-        {
-            var i32Out = new byte[4];
-
-            i32Out[0] = (byte) (0xff & (i32 >> 24));
-            i32Out[1] = (byte) (0xff & (i32 >> 16));
-            i32Out[2] = (byte) (0xff & (i32 >> 8));
-            i32Out[3] = (byte) (0xff & i32);
-
-            return i32Out;
-        }
-
-        public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var i32Out = CreateWriteI32(i32);
-            await Trans.WriteAsync(i32Out, 0, 4, cancellationToken);
-        }
-
-        protected internal static byte[] CreateWriteI64(long i64)
-        {
-            var i64Out = new byte[8];
-
-            i64Out[0] = (byte) (0xff & (i64 >> 56));
-            i64Out[1] = (byte) (0xff & (i64 >> 48));
-            i64Out[2] = (byte) (0xff & (i64 >> 40));
-            i64Out[3] = (byte) (0xff & (i64 >> 32));
-            i64Out[4] = (byte) (0xff & (i64 >> 24));
-            i64Out[5] = (byte) (0xff & (i64 >> 16));
-            i64Out[6] = (byte) (0xff & (i64 >> 8));
-            i64Out[7] = (byte) (0xff & i64);
-
-            return i64Out;
-        }
-
-        public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var i64Out = CreateWriteI64(i64);
-            await Trans.WriteAsync(i64Out, 0, 8, cancellationToken);
-        }
-
-        public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteI64Async(BitConverter.DoubleToInt64Bits(d), cancellationToken);
-        }
-
-        public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteI32Async(bytes.Length, cancellationToken);
-            await Trans.WriteAsync(bytes, 0, bytes.Length, cancellationToken);
-        }
-
-        public override async Task<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TMessage>(cancellationToken);
-            }
-
-            var message = new TMessage();
-            var size = await ReadI32Async(cancellationToken);
-            if (size < 0)
-            {
-                var version = (uint) size & VersionMask;
-                if (version != Version1)
-                {
-                    throw new TProtocolException(TProtocolException.BAD_VERSION,
-                        $"Bad version in ReadMessageBegin: {version}");
-                }
-                message.Type = (TMessageType) (size & 0x000000ff);
-                message.Name = await ReadStringAsync(cancellationToken);
-                message.SeqID = await ReadI32Async(cancellationToken);
-            }
-            else
-            {
-                if (StrictRead)
-                {
-                    throw new TProtocolException(TProtocolException.BAD_VERSION,
-                        "Missing version in ReadMessageBegin, old client?");
-                }
-                message.Name = await ReadStringBodyAsync(size, cancellationToken);
-                message.Type = (TMessageType) await ReadByteAsync(cancellationToken);
-                message.SeqID = await ReadI32Async(cancellationToken);
-            }
-            return message;
-        }
-
-        public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            //TODO: no read from internal transport?
-            return new TStruct();
-        }
-
-        public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TField>(cancellationToken);
-            }
-
-            var field = new TField
-            {
-                Type = (TType) await ReadByteAsync(cancellationToken)
-            };
-
-            if (field.Type != TType.Stop)
-            {
-                field.ID = await ReadI16Async(cancellationToken);
-            }
-
-            return field;
-        }
-
-        public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TMap>(cancellationToken);
-            }
-
-            var map = new TMap
-            {
-                KeyType = (TType) await ReadByteAsync(cancellationToken),
-                ValueType = (TType) await ReadByteAsync(cancellationToken),
-                Count = await ReadI32Async(cancellationToken)
-            };
-
-            return map;
-        }
-
-        public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TList> ReadListBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TList>(cancellationToken);
-            }
-
-            var list = new TList
-            {
-                ElementType = (TType) await ReadByteAsync(cancellationToken),
-                Count = await ReadI32Async(cancellationToken)
-            };
-
-            return list;
-        }
-
-        public override async Task ReadListEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TSet>(cancellationToken);
-            }
-
-            var set = new TSet
-            {
-                ElementType = (TType) await ReadByteAsync(cancellationToken),
-                Count = await ReadI32Async(cancellationToken)
-            };
-
-            return set;
-        }
-
-        public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<bool> ReadBoolAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<bool>(cancellationToken);
-            }
-
-            return await ReadByteAsync(cancellationToken) == 1;
-        }
-
-        public override async Task<sbyte> ReadByteAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<sbyte>(cancellationToken);
-            }
-
-            var bin = new byte[1];
-            await Trans.ReadAllAsync(bin, 0, 1, cancellationToken); //TODO: why readall ?
-            return (sbyte) bin[0];
-        }
-
-        public override async Task<short> ReadI16Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<short>(cancellationToken);
-            }
-
-            var i16In = new byte[2];
-            await Trans.ReadAllAsync(i16In, 0, 2, cancellationToken);
-            var result = (short) (((i16In[0] & 0xff) << 8) | i16In[1] & 0xff);
-            return result;
-        }
-
-        public override async Task<int> ReadI32Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<int>(cancellationToken);
-            }
-
-            var i32In = new byte[4];
-            await Trans.ReadAllAsync(i32In, 0, 4, cancellationToken);
-
-            var result = 
-                ((i32In[0] & 0xff) << 24) | 
-                ((i32In[1] & 0xff) << 16) | 
-                ((i32In[2] & 0xff) << 8) |
-                i32In[3] & 0xff;
-
-            return result;
-        }
-
-#pragma warning disable 675
-
-        protected internal long CreateReadI64(byte[] buf)
-        {
-            var result =
-                ((long) (buf[0] & 0xff) << 56) |
-                ((long) (buf[1] & 0xff) << 48) |
-                ((long) (buf[2] & 0xff) << 40) |
-                ((long) (buf[3] & 0xff) << 32) |
-                ((long) (buf[4] & 0xff) << 24) |
-                ((long) (buf[5] & 0xff) << 16) |
-                ((long) (buf[6] & 0xff) << 8) |
-                buf[7] & 0xff;
-
-            return result;
-        }
-
-#pragma warning restore 675
-
-        public override async Task<long> ReadI64Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<long>(cancellationToken);
-            }
-
-            var i64In = new byte[8];
-            await Trans.ReadAllAsync(i64In, 0, 8, cancellationToken);
-            return CreateReadI64(i64In);
-        }
-
-        public override async Task<double> ReadDoubleAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<double>(cancellationToken);
-            }
-
-            var d = await ReadI64Async(cancellationToken);
-            return BitConverter.Int64BitsToDouble(d);
-        }
-
-        public override async Task<byte[]> ReadBinaryAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<byte[]>(cancellationToken);
-            }
-
-            var size = await ReadI32Async(cancellationToken);
-            var buf = new byte[size];
-            await Trans.ReadAllAsync(buf, 0, size, cancellationToken);
-            return buf;
-        }
-
-        private async Task<string> ReadStringBodyAsync(int size, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<string>(cancellationToken);
-            }
-
-            var buf = new byte[size];
-            await Trans.ReadAllAsync(buf, 0, size, cancellationToken);
-            return Encoding.UTF8.GetString(buf, 0, buf.Length);
-        }
-
-        public class Factory : ITProtocolFactory
-        {
-            protected bool StrictRead;
-            protected bool StrictWrite;
-
-            public Factory()
-                : this(false, true)
-            {
-            }
-
-            public Factory(bool strictRead, bool strictWrite)
-            {
-                StrictRead = strictRead;
-                StrictWrite = strictWrite;
-            }
-
-            public TProtocol GetProtocol(TClientTransport trans)
-            {
-                return new TBinaryProtocol(trans, StrictRead, StrictWrite);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TCompactProtocol.cs b/lib/netcore/Thrift/Protocols/TCompactProtocol.cs
deleted file mode 100644
index cecdf03..0000000
--- a/lib/netcore/Thrift/Protocols/TCompactProtocol.cs
+++ /dev/null
@@ -1,922 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-using Thrift.Transports;
-
-namespace Thrift.Protocols
-{
-    //TODO: implementation of TProtocol
-
-    // ReSharper disable once InconsistentNaming
-    public class TCompactProtocol : TProtocol
-    {
-        private const byte ProtocolId = 0x82;
-        private const byte Version = 1;
-        private const byte VersionMask = 0x1f; // 0001 1111
-        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 Tstop = new TField(string.Empty, TType.Stop, 0);
-
-        // ReSharper disable once InconsistentNaming
-        private static readonly byte[] TTypeToCompactType = new byte[16];
-
-        /// <summary>
-        ///     Used to keep track of the last field for the current and previous structs, so we can do the delta stuff.
-        /// </summary>
-        private readonly Stack<short> _lastField = new Stack<short>(15);
-
-        /// <summary>
-        ///     If we encounter a boolean field begin, save the TField here so it can have the value incorporated.
-        /// </summary>
-        private TField? _booleanField;
-
-        /// <summary>
-        ///     If we Read a field header, and it's a boolean field, save the boolean value here so that ReadBool can use it.
-        /// </summary>
-        private bool? _boolValue;
-
-        private short _lastFieldId;
-
-        public TCompactProtocol(TClientTransport trans)
-            : base(trans)
-        {
-            TTypeToCompactType[(int) TType.Stop] = Types.Stop;
-            TTypeToCompactType[(int) TType.Bool] = Types.BooleanTrue;
-            TTypeToCompactType[(int) TType.Byte] = Types.Byte;
-            TTypeToCompactType[(int) TType.I16] = Types.I16;
-            TTypeToCompactType[(int) TType.I32] = Types.I32;
-            TTypeToCompactType[(int) TType.I64] = Types.I64;
-            TTypeToCompactType[(int) TType.Double] = Types.Double;
-            TTypeToCompactType[(int) TType.String] = Types.Binary;
-            TTypeToCompactType[(int) TType.List] = Types.List;
-            TTypeToCompactType[(int) TType.Set] = Types.Set;
-            TTypeToCompactType[(int) TType.Map] = Types.Map;
-            TTypeToCompactType[(int) TType.Struct] = Types.Struct;
-        }
-
-        public void Reset()
-        {
-            _lastField.Clear();
-            _lastFieldId = 0;
-        }
-
-        public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await Trans.WriteAsync(new[] {ProtocolId}, cancellationToken);
-            await
-                Trans.WriteAsync(
-                    new[] {(byte) ((Version & VersionMask) | (((uint) message.Type << TypeShiftAmount) & TypeMask))},
-                    cancellationToken);
-
-            var bufferTuple = CreateWriteVarInt32((uint) message.SeqID);
-            await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-
-            await WriteStringAsync(message.Name, cancellationToken);
-        }
-
-        public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        /// <summary>
-        ///     Write a struct begin. This doesn't actually put anything on the wire. We
-        ///     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)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            _lastField.Push(_lastFieldId);
-            _lastFieldId = 0;
-        }
-
-        public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            _lastFieldId = _lastField.Pop();
-        }
-
-        private async Task WriteFieldBeginInternalAsync(TField field, byte typeOverride,
-            CancellationToken cancellationToken)
-        {
-            // if there's a exType override, use that.
-            var typeToWrite = typeOverride == 0xFF ? GetCompactType(field.Type) : typeOverride;
-
-            // check if we can use delta encoding for the field id
-            if ((field.ID > _lastFieldId) && (field.ID - _lastFieldId <= 15))
-            {
-                var b = (byte) (((field.ID - _lastFieldId) << 4) | typeToWrite);
-                // Write them together
-                await Trans.WriteAsync(new[] {b}, cancellationToken);
-            }
-            else
-            {
-                // Write them separate
-                await Trans.WriteAsync(new[] {typeToWrite}, cancellationToken);
-                await WriteI16Async(field.ID, cancellationToken);
-            }
-
-            _lastFieldId = field.ID;
-        }
-
-        public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken)
-        {
-            if (field.Type == TType.Bool)
-            {
-                _booleanField = field;
-            }
-            else
-            {
-                await WriteFieldBeginInternalAsync(field, 0xFF, cancellationToken);
-            }
-        }
-
-        public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await Trans.WriteAsync(new[] {Types.Stop}, cancellationToken);
-        }
-
-        protected async Task WriteCollectionBeginAsync(TType elemType, int size, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            /*
-            Abstract method for writing the start of lists and sets. List and sets on
-             the wire differ only by the exType indicator.
-            */
-
-            if (size <= 14)
-            {
-                await Trans.WriteAsync(new[] {(byte) ((size << 4) | GetCompactType(elemType))}, cancellationToken);
-            }
-            else
-            {
-                await Trans.WriteAsync(new[] {(byte) (0xf0 | GetCompactType(elemType))}, cancellationToken);
-
-                var bufferTuple = CreateWriteVarInt32((uint) size);
-                await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-            }
-        }
-
-        public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken)
-        {
-            await WriteCollectionBeginAsync(list.ElementType, list.Count, cancellationToken);
-        }
-
-        public override async Task WriteListEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await WriteCollectionBeginAsync(set.ElementType, set.Count, cancellationToken);
-        }
-
-        public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            /*
-            Write a boolean value. Potentially, this could be a boolean field, in
-            which case the field header info isn't written yet. If so, decide what the
-            right exType header is for the value and then Write the field header.
-            Otherwise, Write a single byte.
-            */
-
-            if (_booleanField != null)
-            {
-                // we haven't written the field header yet
-                await
-                    WriteFieldBeginInternalAsync(_booleanField.Value, b ? Types.BooleanTrue : Types.BooleanFalse,
-                        cancellationToken);
-                _booleanField = null;
-            }
-            else
-            {
-                // we're not part of a field, so just Write the value.
-                await Trans.WriteAsync(new[] {b ? Types.BooleanTrue : Types.BooleanFalse}, cancellationToken);
-            }
-        }
-
-        public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            await Trans.WriteAsync(new[] {(byte) b}, cancellationToken);
-        }
-
-        public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var bufferTuple = CreateWriteVarInt32(IntToZigzag(i16));
-            await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-        }
-
-        protected internal Tuple<byte[], int> CreateWriteVarInt32(uint n)
-        {
-            // Write an i32 as a varint.Results in 1 - 5 bytes on the wire.
-            var i32Buf = new byte[5];
-            var idx = 0;
-
-            while (true)
-            {
-                if ((n & ~0x7F) == 0)
-                {
-                    i32Buf[idx++] = (byte) n;
-                    break;
-                }
-
-                i32Buf[idx++] = (byte) ((n & 0x7F) | 0x80);
-                n >>= 7;
-            }
-
-            return new Tuple<byte[], int>(i32Buf, idx);
-        }
-
-        public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var bufferTuple = CreateWriteVarInt32(IntToZigzag(i32));
-            await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-        }
-
-        protected internal Tuple<byte[], int> CreateWriteVarInt64(ulong n)
-        {
-            // Write an i64 as a varint. Results in 1-10 bytes on the wire.
-            var buf = new byte[10];
-            var idx = 0;
-
-            while (true)
-            {
-                if ((n & ~(ulong) 0x7FL) == 0)
-                {
-                    buf[idx++] = (byte) n;
-                    break;
-                }
-                buf[idx++] = (byte) ((n & 0x7F) | 0x80);
-                n >>= 7;
-            }
-
-            return new Tuple<byte[], int>(buf, idx);
-        }
-
-        public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var bufferTuple = CreateWriteVarInt64(LongToZigzag(i64));
-            await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-        }
-
-        public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var data = new byte[8];
-            FixedLongToBytes(BitConverter.DoubleToInt64Bits(d), data, 0);
-            await Trans.WriteAsync(data, cancellationToken);
-        }
-
-        public override async Task WriteStringAsync(string str, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var bytes = Encoding.UTF8.GetBytes(str);
-
-            var bufferTuple = CreateWriteVarInt32((uint) bytes.Length);
-            await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-            await Trans.WriteAsync(bytes, 0, bytes.Length, cancellationToken);
-        }
-
-        public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            var bufferTuple = CreateWriteVarInt32((uint) bytes.Length);
-            await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-            await Trans.WriteAsync(bytes, 0, bytes.Length, cancellationToken);
-        }
-
-        public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return;
-            }
-
-            if (map.Count == 0)
-            {
-                await Trans.WriteAsync(new[] {(byte) 0}, cancellationToken);
-            }
-            else
-            {
-                var bufferTuple = CreateWriteVarInt32((uint) map.Count);
-                await Trans.WriteAsync(bufferTuple.Item1, 0, bufferTuple.Item2, cancellationToken);
-                await
-                    Trans.WriteAsync(
-                        new[] {(byte) ((GetCompactType(map.KeyType) << 4) | GetCompactType(map.ValueType))},
-                        cancellationToken);
-            }
-        }
-
-        public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TMessage>(cancellationToken);
-            }
-
-            var protocolId = (byte) await ReadByteAsync(cancellationToken);
-            if (protocolId != ProtocolId)
-            {
-                throw new TProtocolException($"Expected protocol id {ProtocolId:X} but got {protocolId:X}");
-            }
-
-            var versionAndType = (byte) await ReadByteAsync(cancellationToken);
-            var version = (byte) (versionAndType & VersionMask);
-
-            if (version != Version)
-            {
-                throw new TProtocolException($"Expected version {Version} but got {version}");
-            }
-
-            var type = (byte) ((versionAndType >> TypeShiftAmount) & TypeBits);
-            var seqid = (int) await ReadVarInt32Async(cancellationToken);
-            var messageName = await ReadStringAsync(cancellationToken);
-
-            return new TMessage(messageName, (TMessageType) type, seqid);
-        }
-
-        public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TStruct>(cancellationToken);
-            }
-
-            // some magic is here )
-
-            _lastField.Push(_lastFieldId);
-            _lastFieldId = 0;
-
-            return AnonymousStruct;
-        }
-
-        public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            /*
-            Doesn't actually consume any wire data, just removes the last field for
-            this struct from the field stack.
-            */
-
-            // consume the last field we Read off the wire.
-            _lastFieldId = _lastField.Pop();
-        }
-
-        public override async Task<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
-        {
-            // Read a field header off the wire.
-            var type = (byte) await ReadByteAsync(cancellationToken);
-            // if it's a stop, then we can return immediately, as the struct is over.
-            if (type == Types.Stop)
-            {
-                return Tstop;
-            }
-
-            short fieldId;
-            // mask off the 4 MSB of the exType header. it could contain a field id delta.
-            var modifier = (short) ((type & 0xf0) >> 4);
-            if (modifier == 0)
-            {
-                fieldId = await ReadI16Async(cancellationToken);
-            }
-            else
-            {
-                fieldId = (short) (_lastFieldId + modifier);
-            }
-
-            var field = new TField(string.Empty, GetTType((byte) (type & 0x0f)), fieldId);
-            // if this happens to be a boolean field, the value is encoded in the exType
-            if (IsBoolType(type))
-            {
-                _boolValue = (byte) (type & 0x0f) == Types.BooleanTrue;
-            }
-
-            // push the new field onto the field stack so we can keep the deltas going.
-            _lastFieldId = field.ID;
-            return field;
-        }
-
-        public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<TMap>(cancellationToken);
-            }
-
-            /*
-            Read a map header off the wire. If the size is zero, skip Reading the key
-            and value exType. This means that 0-length maps will yield TMaps without the
-            "correct" types.
-            */
-
-            var size = (int) await ReadVarInt32Async(cancellationToken);
-            var keyAndValueType = size == 0 ? (byte) 0 : (byte) await ReadByteAsync(cancellationToken);
-            return new TMap(GetTType((byte) (keyAndValueType >> 4)), GetTType((byte) (keyAndValueType & 0xf)), size);
-        }
-
-        public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
-        {
-            /*
-            Read a set header off the wire. If the set size is 0-14, the size will
-            be packed into the element exType header. If it's a longer set, the 4 MSB
-            of the element exType header will be 0xF, and a varint will follow with the
-            true size.
-            */
-
-            return new TSet(await ReadListBeginAsync(cancellationToken));
-        }
-
-        public override async Task<bool> ReadBoolAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<bool>(cancellationToken);
-            }
-
-            /*
-            Read a boolean off the wire. If this is a boolean field, the value should
-            already have been Read during ReadFieldBegin, so we'll just consume the
-            pre-stored value. Otherwise, Read a byte.
-            */
-
-            if (_boolValue != null)
-            {
-                var result = _boolValue.Value;
-                _boolValue = null;
-                return result;
-            }
-
-            return await ReadByteAsync(cancellationToken) == Types.BooleanTrue;
-        }
-
-        public override async Task<sbyte> ReadByteAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<sbyte>(cancellationToken);
-            }
-
-            // Read a single byte off the wire. Nothing interesting here.
-            var buf = new byte[1];
-            await Trans.ReadAllAsync(buf, 0, 1, cancellationToken);
-            return (sbyte) buf[0];
-        }
-
-        public override async Task<short> ReadI16Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<short>(cancellationToken);
-            }
-
-            return (short) ZigzagToInt(await ReadVarInt32Async(cancellationToken));
-        }
-
-        public override async Task<int> ReadI32Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<int>(cancellationToken);
-            }
-
-            return ZigzagToInt(await ReadVarInt32Async(cancellationToken));
-        }
-
-        public override async Task<long> ReadI64Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<long>(cancellationToken);
-            }
-
-            return ZigzagToLong(await ReadVarInt64Async(cancellationToken));
-        }
-
-        public override async Task<double> ReadDoubleAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<double>(cancellationToken);
-            }
-
-            var longBits = new byte[8];
-            await Trans.ReadAllAsync(longBits, 0, 8, cancellationToken);
-
-            return BitConverter.Int64BitsToDouble(BytesToLong(longBits));
-        }
-
-        public override async Task<string> ReadStringAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<string>(cancellationToken);
-            }
-
-            // Reads a byte[] (via ReadBinary), and then UTF-8 decodes it.
-            var length = (int) await ReadVarInt32Async(cancellationToken);
-
-            if (length == 0)
-            {
-                return string.Empty;
-            }
-
-            var buf = new byte[length];
-            await Trans.ReadAllAsync(buf, 0, length, cancellationToken);
-
-            return Encoding.UTF8.GetString(buf);
-        }
-
-        public override async Task<byte[]> ReadBinaryAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<byte[]>(cancellationToken);
-            }
-
-            // Read a byte[] from the wire.
-            var length = (int) await ReadVarInt32Async(cancellationToken);
-            if (length == 0)
-            {
-                return new byte[0];
-            }
-
-            var buf = new byte[length];
-            await Trans.ReadAllAsync(buf, 0, length, cancellationToken);
-            return buf;
-        }
-
-        public override async Task<TList> ReadListBeginAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled<TList>(cancellationToken);
-            }
-
-            /*
-            Read a list header off the wire. If the list size is 0-14, the size will
-            be packed into the element exType header. If it's a longer list, the 4 MSB
-            of the element exType header will be 0xF, and a varint will follow with the
-            true size.
-            */
-
-            var sizeAndType = (byte) await ReadByteAsync(cancellationToken);
-            var size = (sizeAndType >> 4) & 0x0f;
-            if (size == 15)
-            {
-                size = (int) await ReadVarInt32Async(cancellationToken);
-            }
-
-            var type = GetTType(sizeAndType);
-            return new TList(type, size);
-        }
-
-        public override async Task ReadListEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        private static byte GetCompactType(TType ttype)
-        {
-            // Given a TType value, find the appropriate TCompactProtocol.Types constant.
-            return TTypeToCompactType[(int) ttype];
-        }
-
-
-        private async Task<uint> ReadVarInt32Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<uint>(cancellationToken);
-            }
-
-            /*
-            Read an i32 from the wire as a varint. The MSB of each byte is set
-            if there is another byte to follow. This can Read up to 5 bytes.
-            */
-
-            uint result = 0;
-            var shift = 0;
-
-            while (true)
-            {
-                var b = (byte) await ReadByteAsync(cancellationToken);
-                result |= (uint) (b & 0x7f) << shift;
-                if ((b & 0x80) != 0x80)
-                {
-                    break;
-                }
-                shift += 7;
-            }
-
-            return result;
-        }
-
-        private async Task<ulong> ReadVarInt64Async(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<uint>(cancellationToken);
-            }
-
-            /*
-            Read an i64 from the wire as a proper varint. The MSB of each byte is set
-            if there is another byte to follow. This can Read up to 10 bytes.
-            */
-
-            var shift = 0;
-            ulong result = 0;
-            while (true)
-            {
-                var b = (byte) await ReadByteAsync(cancellationToken);
-                result |= (ulong) (b & 0x7f) << shift;
-                if ((b & 0x80) != 0x80)
-                {
-                    break;
-                }
-                shift += 7;
-            }
-
-            return result;
-        }
-
-        private static int ZigzagToInt(uint n)
-        {
-            return (int) (n >> 1) ^ -(int) (n & 1);
-        }
-
-        private static long ZigzagToLong(ulong n)
-        {
-            return (long) (n >> 1) ^ -(long) (n & 1);
-        }
-
-        private static long BytesToLong(byte[] bytes)
-        {
-            /*
-            Note that it's important that the mask bytes are long literals,
-            otherwise they'll default to ints, and when you shift an int left 56 bits,
-            you just get a messed up int.
-            */
-
-            return
-                ((bytes[7] & 0xffL) << 56) |
-                ((bytes[6] & 0xffL) << 48) |
-                ((bytes[5] & 0xffL) << 40) |
-                ((bytes[4] & 0xffL) << 32) |
-                ((bytes[3] & 0xffL) << 24) |
-                ((bytes[2] & 0xffL) << 16) |
-                ((bytes[1] & 0xffL) << 8) |
-                (bytes[0] & 0xffL);
-        }
-
-        private static bool IsBoolType(byte b)
-        {
-            var lowerNibble = b & 0x0f;
-            return (lowerNibble == Types.BooleanTrue) || (lowerNibble == Types.BooleanFalse);
-        }
-
-        private static TType GetTType(byte type)
-        {
-            // Given a TCompactProtocol.Types constant, convert it to its corresponding TType value.
-            switch ((byte) (type & 0x0f))
-            {
-                case Types.Stop:
-                    return TType.Stop;
-                case Types.BooleanFalse:
-                case Types.BooleanTrue:
-                    return TType.Bool;
-                case Types.Byte:
-                    return TType.Byte;
-                case Types.I16:
-                    return TType.I16;
-                case Types.I32:
-                    return TType.I32;
-                case Types.I64:
-                    return TType.I64;
-                case Types.Double:
-                    return TType.Double;
-                case Types.Binary:
-                    return TType.String;
-                case Types.List:
-                    return TType.List;
-                case Types.Set:
-                    return TType.Set;
-                case Types.Map:
-                    return TType.Map;
-                case Types.Struct:
-                    return TType.Struct;
-                default:
-                    throw new TProtocolException($"Don't know what exType: {(byte) (type & 0x0f)}");
-            }
-        }
-
-        private static ulong LongToZigzag(long n)
-        {
-            // Convert l into a zigzag long. This allows negative numbers to be represented compactly as a varint
-            return (ulong) (n << 1) ^ (ulong) (n >> 63);
-        }
-
-        private static uint IntToZigzag(int n)
-        {
-            // Convert n into a zigzag int. This allows negative numbers to be represented compactly as a varint
-            return (uint) (n << 1) ^ (uint) (n >> 31);
-        }
-
-        private static void FixedLongToBytes(long n, byte[] buf, int off)
-        {
-            // Convert a long into little-endian bytes in buf starting at off and going until off+7.
-            buf[off + 0] = (byte) (n & 0xff);
-            buf[off + 1] = (byte) ((n >> 8) & 0xff);
-            buf[off + 2] = (byte) ((n >> 16) & 0xff);
-            buf[off + 3] = (byte) ((n >> 24) & 0xff);
-            buf[off + 4] = (byte) ((n >> 32) & 0xff);
-            buf[off + 5] = (byte) ((n >> 40) & 0xff);
-            buf[off + 6] = (byte) ((n >> 48) & 0xff);
-            buf[off + 7] = (byte) ((n >> 56) & 0xff);
-        }
-
-        public class Factory : ITProtocolFactory
-        {
-            public TProtocol GetProtocol(TClientTransport trans)
-            {
-                return new TCompactProtocol(trans);
-            }
-        }
-
-        /// <summary>
-        ///     All of the on-wire exType codes.
-        /// </summary>
-        private static class Types
-        {
-            public const byte Stop = 0x00;
-            public const byte BooleanTrue = 0x01;
-            public const byte BooleanFalse = 0x02;
-            public const byte Byte = 0x03;
-            public const byte I16 = 0x04;
-            public const byte I32 = 0x05;
-            public const byte I64 = 0x06;
-            public const byte Double = 0x07;
-            public const byte Binary = 0x08;
-            public const byte List = 0x09;
-            public const byte Set = 0x0A;
-            public const byte Map = 0x0B;
-            public const byte Struct = 0x0C;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TJSONProtocol.cs b/lib/netcore/Thrift/Protocols/TJSONProtocol.cs
deleted file mode 100644
index 6d33f02..0000000
--- a/lib/netcore/Thrift/Protocols/TJSONProtocol.cs
+++ /dev/null
@@ -1,981 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-using Thrift.Protocols.Utilities;
-using Thrift.Transports;
-
-namespace Thrift.Protocols
-{
-    /// <summary>
-    ///     JSON protocol implementation for thrift.
-    ///     This is a full-featured protocol supporting Write and Read.
-    ///     Please see the C++ class header for a detailed description of the
-    ///     protocol's wire format.
-    ///     Adapted from the Java version.
-    /// </summary>
-    // ReSharper disable once InconsistentNaming
-    public class TJsonProtocol : TProtocol
-    {
-        private const long Version = 1;
-
-        // Temporary buffer used by several methods
-        private readonly byte[] _tempBuffer = new byte[4];
-
-        // Current context that we are in
-        protected JSONBaseContext Context;
-
-        // Stack of nested contexts that we may be in
-        protected Stack<JSONBaseContext> ContextStack = new Stack<JSONBaseContext>();
-
-        // Reader that manages a 1-byte buffer
-        protected LookaheadReader Reader;
-
-        // Default encoding
-        protected Encoding Utf8Encoding = Encoding.UTF8;
-
-        /// <summary>
-        ///     TJsonProtocol Constructor
-        /// </summary>
-        public TJsonProtocol(TClientTransport trans)
-            : base(trans)
-        {
-            Context = new JSONBaseContext(this);
-            Reader = new LookaheadReader(this);
-        }
-
-        /// <summary>
-        ///     Push a new JSON context onto the stack.
-        /// </summary>
-        protected void PushContext(JSONBaseContext c)
-        {
-            ContextStack.Push(Context);
-            Context = c;
-        }
-
-        /// <summary>
-        ///     Pop the last JSON context off the stack
-        /// </summary>
-        protected void PopContext()
-        {
-            Context = ContextStack.Pop();
-        }
-
-        /// <summary>
-        ///     Read a byte that must match b[0]; otherwise an exception is thrown.
-        ///     Marked protected to avoid synthetic accessor in JSONListContext.Read
-        ///     and JSONPairContext.Read
-        /// </summary>
-        protected async Task ReadJsonSyntaxCharAsync(byte[] bytes, CancellationToken cancellationToken)
-        {
-            var ch = await Reader.ReadAsync(cancellationToken);
-            if (ch != bytes[0])
-            {
-                throw new TProtocolException(TProtocolException.INVALID_DATA, $"Unexpected character: {(char) ch}");
-            }
-        }
-
-        /// <summary>
-        ///     Write the bytes in array buf as a JSON characters, escaping as needed
-        /// </summary>
-        private async Task WriteJsonStringAsync(byte[] bytes, CancellationToken cancellationToken)
-        {
-            await Context.WriteAsync(cancellationToken);
-            await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-
-            var len = bytes.Length;
-            for (var i = 0; i < len; i++)
-            {
-                if ((bytes[i] & 0x00FF) >= 0x30)
-                {
-                    if (bytes[i] == TJSONProtocolConstants.Backslash[0])
-                    {
-                        await Trans.WriteAsync(TJSONProtocolConstants.Backslash, cancellationToken);
-                        await Trans.WriteAsync(TJSONProtocolConstants.Backslash, cancellationToken);
-                    }
-                    else
-                    {
-                        await Trans.WriteAsync(bytes.ToArray(), i, 1, cancellationToken);
-                    }
-                }
-                else
-                {
-                    _tempBuffer[0] = TJSONProtocolConstants.JsonCharTable[bytes[i]];
-                    if (_tempBuffer[0] == 1)
-                    {
-                        await Trans.WriteAsync(bytes, i, 1, cancellationToken);
-                    }
-                    else if (_tempBuffer[0] > 1)
-                    {
-                        await Trans.WriteAsync(TJSONProtocolConstants.Backslash, cancellationToken);
-                        await Trans.WriteAsync(_tempBuffer, 0, 1, cancellationToken);
-                    }
-                    else
-                    {
-                        await Trans.WriteAsync(TJSONProtocolConstants.EscSequences, cancellationToken);
-                        _tempBuffer[0] = TJSONProtocolHelper.ToHexChar((byte) (bytes[i] >> 4));
-                        _tempBuffer[1] = TJSONProtocolHelper.ToHexChar(bytes[i]);
-                        await Trans.WriteAsync(_tempBuffer, 0, 2, cancellationToken);
-                    }
-                }
-            }
-            await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-        }
-
-        /// <summary>
-        ///     Write out number as a JSON value. If the context dictates so, it will be
-        ///     wrapped in quotes to output as a JSON string.
-        /// </summary>
-        private async Task WriteJsonIntegerAsync(long num, CancellationToken cancellationToken)
-        {
-            await Context.WriteAsync(cancellationToken);
-            var str = num.ToString();
-
-            var escapeNum = Context.EscapeNumbers();
-            if (escapeNum)
-            {
-                await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-
-            var bytes = Utf8Encoding.GetBytes(str);
-            await Trans.WriteAsync(bytes, cancellationToken);
-
-            if (escapeNum)
-            {
-                await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-        }
-
-        /// <summary>
-        ///     Write out a double as a JSON value. If it is NaN or infinity or if the
-        ///     context dictates escaping, Write out as JSON string.
-        /// </summary>
-        private async Task WriteJsonDoubleAsync(double num, CancellationToken cancellationToken)
-        {
-            await Context.WriteAsync(cancellationToken);
-            var str = num.ToString("G17", CultureInfo.InvariantCulture);
-            var special = false;
-
-            switch (str[0])
-            {
-                case 'N': // NaN
-                case 'I': // Infinity
-                    special = true;
-                    break;
-                case '-':
-                    if (str[1] == 'I')
-                    {
-                        // -Infinity
-                        special = true;
-                    }
-                    break;
-            }
-
-            var escapeNum = special || Context.EscapeNumbers();
-
-            if (escapeNum)
-            {
-                await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-
-            await Trans.WriteAsync(Utf8Encoding.GetBytes(str), cancellationToken);
-
-            if (escapeNum)
-            {
-                await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-        }
-
-        /// <summary>
-        ///     Write out contents of byte array b as a JSON string with base-64 encoded
-        ///     data
-        /// </summary>
-        private async Task WriteJsonBase64Async(byte[] bytes, CancellationToken cancellationToken)
-        {
-            await Context.WriteAsync(cancellationToken);
-            await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-
-            var len = bytes.Length;
-            var off = 0;
-
-            while (len >= 3)
-            {
-                // Encode 3 bytes at a time
-                TBase64Helper.Encode(bytes, off, 3, _tempBuffer, 0);
-                await Trans.WriteAsync(_tempBuffer, 0, 4, cancellationToken);
-                off += 3;
-                len -= 3;
-            }
-
-            if (len > 0)
-            {
-                // Encode remainder
-                TBase64Helper.Encode(bytes, off, len, _tempBuffer, 0);
-                await Trans.WriteAsync(_tempBuffer, 0, len + 1, cancellationToken);
-            }
-
-            await Trans.WriteAsync(TJSONProtocolConstants.Quote, cancellationToken);
-        }
-
-        private async Task WriteJsonObjectStartAsync(CancellationToken cancellationToken)
-        {
-            await Context.WriteAsync(cancellationToken);
-            await Trans.WriteAsync(TJSONProtocolConstants.LeftBrace, cancellationToken);
-            PushContext(new JSONPairContext(this));
-        }
-
-        private async Task WriteJsonObjectEndAsync(CancellationToken cancellationToken)
-        {
-            PopContext();
-            await Trans.WriteAsync(TJSONProtocolConstants.RightBrace, cancellationToken);
-        }
-
-        private async Task WriteJsonArrayStartAsync(CancellationToken cancellationToken)
-        {
-            await Context.WriteAsync(cancellationToken);
-            await Trans.WriteAsync(TJSONProtocolConstants.LeftBracket, cancellationToken);
-            PushContext(new JSONListContext(this));
-        }
-
-        private async Task WriteJsonArrayEndAsync(CancellationToken cancellationToken)
-        {
-            PopContext();
-            await Trans.WriteAsync(TJSONProtocolConstants.RightBracket, cancellationToken);
-        }
-
-        public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayStartAsync(cancellationToken);
-            await WriteJsonIntegerAsync(Version, cancellationToken);
-
-            var b = Utf8Encoding.GetBytes(message.Name);
-            await WriteJsonStringAsync(b, cancellationToken);
-
-            await WriteJsonIntegerAsync((long) message.Type, cancellationToken);
-            await WriteJsonIntegerAsync(message.SeqID, cancellationToken);
-        }
-
-        public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
-        {
-            await WriteJsonObjectStartAsync(cancellationToken);
-        }
-
-        public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
-        {
-            await WriteJsonObjectEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken)
-        {
-            await WriteJsonIntegerAsync(field.ID, cancellationToken);
-            await WriteJsonObjectStartAsync(cancellationToken);
-            await WriteJsonStringAsync(TJSONProtocolHelper.GetTypeNameForTypeId(field.Type), cancellationToken);
-        }
-
-        public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
-        {
-            await WriteJsonObjectEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayStartAsync(cancellationToken);
-            await WriteJsonStringAsync(TJSONProtocolHelper.GetTypeNameForTypeId(map.KeyType), cancellationToken);
-            await WriteJsonStringAsync(TJSONProtocolHelper.GetTypeNameForTypeId(map.ValueType), cancellationToken);
-            await WriteJsonIntegerAsync(map.Count, cancellationToken);
-            await WriteJsonObjectStartAsync(cancellationToken);
-        }
-
-        public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
-        {
-            await WriteJsonObjectEndAsync(cancellationToken);
-            await WriteJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayStartAsync(cancellationToken);
-            await WriteJsonStringAsync(TJSONProtocolHelper.GetTypeNameForTypeId(list.ElementType), cancellationToken);
-            await WriteJsonIntegerAsync(list.Count, cancellationToken);
-        }
-
-        public override async Task WriteListEndAsync(CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayStartAsync(cancellationToken);
-            await WriteJsonStringAsync(TJSONProtocolHelper.GetTypeNameForTypeId(set.ElementType), cancellationToken);
-            await WriteJsonIntegerAsync(set.Count, cancellationToken);
-        }
-
-        public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
-        {
-            await WriteJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
-        {
-            await WriteJsonIntegerAsync(b ? 1 : 0, cancellationToken);
-        }
-
-        public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
-        {
-            await WriteJsonIntegerAsync(b, cancellationToken);
-        }
-
-        public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
-        {
-            await WriteJsonIntegerAsync(i16, cancellationToken);
-        }
-
-        public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
-        {
-            await WriteJsonIntegerAsync(i32, cancellationToken);
-        }
-
-        public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
-        {
-            await WriteJsonIntegerAsync(i64, cancellationToken);
-        }
-
-        public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
-        {
-            await WriteJsonDoubleAsync(d, cancellationToken);
-        }
-
-        public override async Task WriteStringAsync(string s, CancellationToken cancellationToken)
-        {
-            var b = Utf8Encoding.GetBytes(s);
-            await WriteJsonStringAsync(b, cancellationToken);
-        }
-
-        public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
-        {
-            await WriteJsonBase64Async(bytes, cancellationToken);
-        }
-
-        /// <summary>
-        ///     Read in a JSON string, unescaping as appropriate.. Skip Reading from the
-        ///     context if skipContext is true.
-        /// </summary>
-        private async Task<byte[]> ReadJsonStringAsync(bool skipContext, CancellationToken cancellationToken)
-        {
-            using (var buffer = new MemoryStream())
-            {
-                var codeunits = new List<char>();
-
-
-                if (!skipContext)
-                {
-                    await Context.ReadAsync(cancellationToken);
-                }
-
-                await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.Quote, cancellationToken);
-
-                while (true)
-                {
-                    var ch = await Reader.ReadAsync(cancellationToken);
-                    if (ch == TJSONProtocolConstants.Quote[0])
-                    {
-                        break;
-                    }
-
-                    // escaped?
-                    if (ch != TJSONProtocolConstants.EscSequences[0])
-                    {
-                        await buffer.WriteAsync(new[] {ch}, 0, 1, cancellationToken);
-                        continue;
-                    }
-
-                    // distinguish between \uXXXX and \?
-                    ch = await Reader.ReadAsync(cancellationToken);
-                    if (ch != TJSONProtocolConstants.EscSequences[1]) // control chars like \n
-                    {
-                        var off = Array.IndexOf(TJSONProtocolConstants.EscapeChars, (char) ch);
-                        if (off == -1)
-                        {
-                            throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected control char");
-                        }
-                        ch = TJSONProtocolConstants.EscapeCharValues[off];
-                        await buffer.WriteAsync(new[] {ch}, 0, 1, cancellationToken);
-                        continue;
-                    }
-
-                    // it's \uXXXX
-                    await Trans.ReadAllAsync(_tempBuffer, 0, 4, cancellationToken);
-
-                    var wch = (short) ((TJSONProtocolHelper.ToHexVal(_tempBuffer[0]) << 12) +
-                                       (TJSONProtocolHelper.ToHexVal(_tempBuffer[1]) << 8) +
-                                       (TJSONProtocolHelper.ToHexVal(_tempBuffer[2]) << 4) +
-                                       TJSONProtocolHelper.ToHexVal(_tempBuffer[3]));
-
-                    if (char.IsHighSurrogate((char) wch))
-                    {
-                        if (codeunits.Count > 0)
-                        {
-                            throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected low surrogate char");
-                        }
-                        codeunits.Add((char) wch);
-                    }
-                    else if (char.IsLowSurrogate((char) wch))
-                    {
-                        if (codeunits.Count == 0)
-                        {
-                            throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected high surrogate char");
-                        }
-
-                        codeunits.Add((char) wch);
-                        var tmp = Utf8Encoding.GetBytes(codeunits.ToArray());
-                        await buffer.WriteAsync(tmp, 0, tmp.Length, cancellationToken);
-                        codeunits.Clear();
-                    }
-                    else
-                    {
-                        var tmp = Utf8Encoding.GetBytes(new[] {(char) wch});
-                        await buffer.WriteAsync(tmp, 0, tmp.Length, cancellationToken);
-                    }
-                }
-
-                if (codeunits.Count > 0)
-                {
-                    throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected low surrogate char");
-                }
-
-                return buffer.ToArray();
-            }
-        }
-
-        /// <summary>
-        ///     Read in a sequence of characters that are all valid in JSON numbers. Does
-        ///     not do a complete regex check to validate that this is actually a number.
-        /// </summary>
-        private async Task<string> ReadJsonNumericCharsAsync(CancellationToken cancellationToken)
-        {
-            var strbld = new StringBuilder();
-            while (true)
-            {
-                //TODO: workaround for primitive types with TJsonProtocol, think - how to rewrite into more easy form without exceptions
-                try
-                {
-                    var ch = await Reader.PeekAsync(cancellationToken);
-                    if (!TJSONProtocolHelper.IsJsonNumeric(ch))
-                    {
-                        break;
-                    }
-                    var c = (char)await Reader.ReadAsync(cancellationToken);
-                    strbld.Append(c);
-                }
-                catch (TTransportException)
-                {
-                    break;
-                }
-            }
-            return strbld.ToString();
-        }
-
-        /// <summary>
-        ///     Read in a JSON number. If the context dictates, Read in enclosing quotes.
-        /// </summary>
-        private async Task<long> ReadJsonIntegerAsync(CancellationToken cancellationToken)
-        {
-            await Context.ReadAsync(cancellationToken);
-            if (Context.EscapeNumbers())
-            {
-                await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-
-            var str = await ReadJsonNumericCharsAsync(cancellationToken);
-            if (Context.EscapeNumbers())
-            {
-                await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-
-            try
-            {
-                return long.Parse(str);
-            }
-            catch (FormatException)
-            {
-                throw new TProtocolException(TProtocolException.INVALID_DATA, "Bad data encounted in numeric data");
-            }
-        }
-
-        /// <summary>
-        ///     Read in a JSON double value. Throw if the value is not wrapped in quotes
-        ///     when expected or if wrapped in quotes when not expected.
-        /// </summary>
-        private async Task<double> ReadJsonDoubleAsync(CancellationToken cancellationToken)
-        {
-            await Context.ReadAsync(cancellationToken);
-            if (await Reader.PeekAsync(cancellationToken) == TJSONProtocolConstants.Quote[0])
-            {
-                var arr = await ReadJsonStringAsync(true, cancellationToken);
-                var dub = double.Parse(Utf8Encoding.GetString(arr, 0, arr.Length), CultureInfo.InvariantCulture);
-
-                if (!Context.EscapeNumbers() && !double.IsNaN(dub) && !double.IsInfinity(dub))
-                {
-                    // Throw exception -- we should not be in a string in this case
-                    throw new TProtocolException(TProtocolException.INVALID_DATA, "Numeric data unexpectedly quoted");
-                }
-
-                return dub;
-            }
-
-            if (Context.EscapeNumbers())
-            {
-                // This will throw - we should have had a quote if escapeNum == true
-                await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.Quote, cancellationToken);
-            }
-
-            try
-            {
-                return double.Parse(await ReadJsonNumericCharsAsync(cancellationToken), CultureInfo.InvariantCulture);
-            }
-            catch (FormatException)
-            {
-                throw new TProtocolException(TProtocolException.INVALID_DATA, "Bad data encounted in numeric data");
-            }
-        }
-
-        /// <summary>
-        ///     Read in a JSON string containing base-64 encoded data and decode it.
-        /// </summary>
-        private async Task<byte[]> ReadJsonBase64Async(CancellationToken cancellationToken)
-        {
-            var b = await ReadJsonStringAsync(false, cancellationToken);
-            var len = b.Length;
-            var off = 0;
-            var size = 0;
-
-            // reduce len to ignore fill bytes
-            while ((len > 0) && (b[len - 1] == '='))
-            {
-                --len;
-            }
-
-            // read & decode full byte triplets = 4 source bytes
-            while (len > 4)
-            {
-                // Decode 4 bytes at a time
-                TBase64Helper.Decode(b, off, 4, b, size); // NB: decoded in place
-                off += 4;
-                len -= 4;
-                size += 3;
-            }
-
-            // Don't decode if we hit the end or got a single leftover byte (invalid
-            // base64 but legal for skip of regular string exType)
-            if (len > 1)
-            {
-                // Decode remainder
-                TBase64Helper.Decode(b, off, len, b, size); // NB: decoded in place
-                size += len - 1;
-            }
-
-            // Sadly we must copy the byte[] (any way around this?)
-            var result = new byte[size];
-            Array.Copy(b, 0, result, 0, size);
-            return result;
-        }
-
-        private async Task ReadJsonObjectStartAsync(CancellationToken cancellationToken)
-        {
-            await Context.ReadAsync(cancellationToken);
-            await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.LeftBrace, cancellationToken);
-            PushContext(new JSONPairContext(this));
-        }
-
-        private async Task ReadJsonObjectEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.RightBrace, cancellationToken);
-            PopContext();
-        }
-
-        private async Task ReadJsonArrayStartAsync(CancellationToken cancellationToken)
-        {
-            await Context.ReadAsync(cancellationToken);
-            await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.LeftBracket, cancellationToken);
-            PushContext(new JSONListContext(this));
-        }
-
-        private async Task ReadJsonArrayEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.RightBracket, cancellationToken);
-            PopContext();
-        }
-
-        public override async Task<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
-        {
-            var message = new TMessage();
-            await ReadJsonArrayStartAsync(cancellationToken);
-            if (await ReadJsonIntegerAsync(cancellationToken) != Version)
-            {
-                throw new TProtocolException(TProtocolException.BAD_VERSION, "Message contained bad version.");
-            }
-
-            var buf = await ReadJsonStringAsync(false, cancellationToken);
-            message.Name = Utf8Encoding.GetString(buf, 0, buf.Length);
-            message.Type = (TMessageType) await ReadJsonIntegerAsync(cancellationToken);
-            message.SeqID = (int) await ReadJsonIntegerAsync(cancellationToken);
-            return message;
-        }
-
-        public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonObjectStartAsync(cancellationToken);
-            return new TStruct();
-        }
-
-        public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonObjectEndAsync(cancellationToken);
-        }
-
-        public override async Task<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
-        {
-            var field = new TField();
-            var ch = await Reader.PeekAsync(cancellationToken);
-            if (ch == TJSONProtocolConstants.RightBrace[0])
-            {
-                field.Type = TType.Stop;
-            }
-            else
-            {
-                field.ID = (short) await ReadJsonIntegerAsync(cancellationToken);
-                await ReadJsonObjectStartAsync(cancellationToken);
-                field.Type = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
-            }
-            return field;
-        }
-
-        public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonObjectEndAsync(cancellationToken);
-        }
-
-        public override async Task<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
-        {
-            var map = new TMap();
-            await ReadJsonArrayStartAsync(cancellationToken);
-            map.KeyType = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
-            map.ValueType = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
-            map.Count = (int) await ReadJsonIntegerAsync(cancellationToken);
-            await ReadJsonObjectStartAsync(cancellationToken);
-            return map;
-        }
-
-        public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonObjectEndAsync(cancellationToken);
-            await ReadJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task<TList> ReadListBeginAsync(CancellationToken cancellationToken)
-        {
-            var list = new TList();
-            await ReadJsonArrayStartAsync(cancellationToken);
-            list.ElementType = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
-            list.Count = (int) await ReadJsonIntegerAsync(cancellationToken);
-            return list;
-        }
-
-        public override async Task ReadListEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
-        {
-            var set = new TSet();
-            await ReadJsonArrayStartAsync(cancellationToken);
-            set.ElementType = TJSONProtocolHelper.GetTypeIdForTypeName(await ReadJsonStringAsync(false, cancellationToken));
-            set.Count = (int) await ReadJsonIntegerAsync(cancellationToken);
-            return set;
-        }
-
-        public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
-        {
-            await ReadJsonArrayEndAsync(cancellationToken);
-        }
-
-        public override async Task<bool> ReadBoolAsync(CancellationToken cancellationToken)
-        {
-            return await ReadJsonIntegerAsync(cancellationToken) != 0;
-        }
-
-        public override async Task<sbyte> ReadByteAsync(CancellationToken cancellationToken)
-        {
-            return (sbyte) await ReadJsonIntegerAsync(cancellationToken);
-        }
-
-        public override async Task<short> ReadI16Async(CancellationToken cancellationToken)
-        {
-            return (short) await ReadJsonIntegerAsync(cancellationToken);
-        }
-
-        public override async Task<int> ReadI32Async(CancellationToken cancellationToken)
-        {
-            return (int) await ReadJsonIntegerAsync(cancellationToken);
-        }
-
-        public override async Task<long> ReadI64Async(CancellationToken cancellationToken)
-        {
-            return await ReadJsonIntegerAsync(cancellationToken);
-        }
-
-        public override async Task<double> ReadDoubleAsync(CancellationToken cancellationToken)
-        {
-            return await ReadJsonDoubleAsync(cancellationToken);
-        }
-
-        public override async Task<string> ReadStringAsync(CancellationToken cancellationToken)
-        {
-            var buf = await ReadJsonStringAsync(false, cancellationToken);
-            return Utf8Encoding.GetString(buf, 0, buf.Length);
-        }
-
-        public override async Task<byte[]> ReadBinaryAsync(CancellationToken cancellationToken)
-        {
-            return await ReadJsonBase64Async(cancellationToken);
-        }
-
-        /// <summary>
-        ///     Factory for JSON protocol objects
-        /// </summary>
-        public class Factory : ITProtocolFactory
-        {
-            public TProtocol GetProtocol(TClientTransport trans)
-            {
-                return new TJsonProtocol(trans);
-            }
-        }
-
-        /// <summary>
-        ///     Base class for tracking JSON contexts that may require
-        ///     inserting/Reading additional JSON syntax characters
-        ///     This base context does nothing.
-        /// </summary>
-        protected class JSONBaseContext
-        {
-            protected TJsonProtocol Proto;
-
-            public JSONBaseContext(TJsonProtocol proto)
-            {
-                Proto = proto;
-            }
-
-            public virtual async Task WriteAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
-            }
-
-            public virtual async Task ReadAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
-            }
-
-            public virtual bool EscapeNumbers()
-            {
-                return false;
-            }
-        }
-
-        /// <summary>
-        ///     Context for JSON lists. Will insert/Read commas before each item except
-        ///     for the first one
-        /// </summary>
-        protected class JSONListContext : JSONBaseContext
-        {
-            private bool _first = true;
-
-            public JSONListContext(TJsonProtocol protocol)
-                : base(protocol)
-            {
-            }
-
-            public override async Task WriteAsync(CancellationToken cancellationToken)
-            {
-                if (_first)
-                {
-                    _first = false;
-                }
-                else
-                {
-                    await Proto.Trans.WriteAsync(TJSONProtocolConstants.Comma, cancellationToken);
-                }
-            }
-
-            public override async Task ReadAsync(CancellationToken cancellationToken)
-            {
-                if (_first)
-                {
-                    _first = false;
-                }
-                else
-                {
-                    await Proto.ReadJsonSyntaxCharAsync(TJSONProtocolConstants.Comma, cancellationToken);
-                }
-            }
-        }
-
-        /// <summary>
-        ///     Context for JSON records. Will insert/Read colons before the value portion
-        ///     of each record pair, and commas before each key except the first. In
-        ///     addition, will indicate that numbers in the key position need to be
-        ///     escaped in quotes (since JSON keys must be strings).
-        /// </summary>
-        // ReSharper disable once InconsistentNaming
-        protected class JSONPairContext : JSONBaseContext
-        {
-            private bool _colon = true;
-
-            private bool _first = true;
-
-            public JSONPairContext(TJsonProtocol proto)
-                : base(proto)
-            {
-            }
-
-            public override async Task WriteAsync(CancellationToken cancellationToken)
-            {
-                if (_first)
-                {
-                    _first = false;
-                    _colon = true;
-                }
-                else
-                {
-                    await Proto.Trans.WriteAsync(_colon ? TJSONProtocolConstants.Colon : TJSONProtocolConstants.Comma, cancellationToken);
-                    _colon = !_colon;
-                }
-            }
-
-            public override async Task ReadAsync(CancellationToken cancellationToken)
-            {
-                if (_first)
-                {
-                    _first = false;
-                    _colon = true;
-                }
-                else
-                {
-                    await Proto.ReadJsonSyntaxCharAsync(_colon ? TJSONProtocolConstants.Colon : TJSONProtocolConstants.Comma, cancellationToken);
-                    _colon = !_colon;
-                }
-            }
-
-            public override bool EscapeNumbers()
-            {
-                return _colon;
-            }
-        }
-
-        /// <summary>
-        ///     Holds up to one byte from the transport
-        /// </summary>
-        protected class LookaheadReader
-        {
-            private readonly byte[] _data = new byte[1];
-
-            private bool _hasData;
-            protected TJsonProtocol Proto;
-
-            public LookaheadReader(TJsonProtocol proto)
-            {
-                Proto = proto;
-            }
-
-            /// <summary>
-            ///     Return and consume the next byte to be Read, either taking it from the
-            ///     data buffer if present or getting it from the transport otherwise.
-            /// </summary>
-            public async Task<byte> ReadAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<byte>(cancellationToken);
-                }
-
-                if (_hasData)
-                {
-                    _hasData = false;
-                }
-                else
-                {
-                    // find more easy way to avoid exception on reading primitive types
-                    await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken);
-                }
-                return _data[0];
-            }
-
-            /// <summary>
-            ///     Return the next byte to be Read without consuming, filling the data
-            ///     buffer if it has not been filled alReady.
-            /// </summary>
-            public async Task<byte> PeekAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<byte>(cancellationToken);
-                }
-
-                if (!_hasData)
-                {
-                    // find more easy way to avoid exception on reading primitive types
-                    await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken);
-                }
-                _hasData = true;
-                return _data[0];
-            }
-        }
-    }
-}
diff --git a/lib/netcore/Thrift/Protocols/TMultiplexedProtocol.cs b/lib/netcore/Thrift/Protocols/TMultiplexedProtocol.cs
deleted file mode 100644
index 367e4e6..0000000
--- a/lib/netcore/Thrift/Protocols/TMultiplexedProtocol.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-
-namespace Thrift.Protocols
-{
-    /**
-    * TMultiplexedProtocol is a protocol-independent concrete decorator that allows a Thrift
-    * client to communicate with a multiplexing Thrift server, by prepending the service name
-    * to the function name during function calls.
-    *
-    * NOTE: THIS IS NOT TO BE USED BY SERVERS.
-    * On the server, use TMultiplexedProcessor to handle requests from a multiplexing client.
-    *
-    * This example uses a single socket transport to invoke two services:
-    *
-    *     TSocketClientTransport transport = new TSocketClientTransport("localhost", 9090);
-    *     transport.open();
-    *
-    *     TBinaryProtocol protocol = new TBinaryProtocol(transport);
-    *
-    *     TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "Calculator");
-    *     Calculator.Client service = new Calculator.Client(mp);
-    *
-    *     TMultiplexedProtocol mp2 = new TMultiplexedProtocol(protocol, "WeatherReport");
-    *     WeatherReport.Client service2 = new WeatherReport.Client(mp2);
-    *
-    *     System.out.println(service.add(2,2));
-    *     System.out.println(service2.getTemperature());
-    *
-    */
-
-    //TODO: implementation of TProtocol
-
-    // ReSharper disable once InconsistentNaming
-    public class TMultiplexedProtocol : TProtocolDecorator
-    {
-        /** Used to delimit the service name from the function name */
-        public const string Separator = ":";
-
-        private readonly string _serviceName;
-
-        /**
-         * Wrap the specified protocol, allowing it to be used to communicate with a
-         * multiplexing server.  The <code>serviceName</code> is required as it is
-         * prepended to the message header so that the multiplexing server can broker
-         * the function call to the proper service.
-         *
-         * Args:
-         *  protocol        Your communication protocol of choice, e.g. TBinaryProtocol
-         *  serviceName     The service name of the service communicating via this protocol.
-         */
-
-        public TMultiplexedProtocol(TProtocol protocol, string serviceName)
-            : base(protocol)
-        {
-            _serviceName = serviceName;
-        }
-
-        public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
-        {
-            switch (message.Type)
-            {
-                case TMessageType.Call:
-                case TMessageType.Oneway:
-                    await base.WriteMessageBeginAsync(new TMessage($"{_serviceName}{Separator}{message.Name}", message.Type, message.SeqID), cancellationToken);
-                    break;
-                default:
-                    await base.WriteMessageBeginAsync(message, cancellationToken);
-                    break;
-            }
-        }
-    }
-}
diff --git a/lib/netcore/Thrift/Protocols/TProtocol.cs b/lib/netcore/Thrift/Protocols/TProtocol.cs
deleted file mode 100644
index 91e009d..0000000
--- a/lib/netcore/Thrift/Protocols/TProtocol.cs
+++ /dev/null
@@ -1,376 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-using Thrift.Transports;
-
-namespace Thrift.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    public abstract class TProtocol : IDisposable
-    {
-        public const int DefaultRecursionDepth = 64;
-        private bool _isDisposed;
-        protected int RecursionDepth;
-
-        protected TClientTransport Trans;
-
-        protected TProtocol(TClientTransport trans)
-        {
-            Trans = trans;
-            RecursionLimit = DefaultRecursionDepth;
-            RecursionDepth = 0;
-        }
-
-        public TClientTransport Transport => Trans;
-
-        protected int RecursionLimit { get; set; }
-
-        public void Dispose()
-        {
-            Dispose(true);
-        }
-
-        public void IncrementRecursionDepth()
-        {
-            if (RecursionDepth < RecursionLimit)
-            {
-                ++RecursionDepth;
-            }
-            else
-            {
-                throw new TProtocolException(TProtocolException.DEPTH_LIMIT, "Depth limit exceeded");
-            }
-        }
-
-        public void DecrementRecursionDepth()
-        {
-            --RecursionDepth;
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    (Trans as IDisposable)?.Dispose();
-                }
-            }
-            _isDisposed = true;
-        }
-
-        public virtual async Task WriteMessageBeginAsync(TMessage message)
-        {
-            await WriteMessageBeginAsync(message, CancellationToken.None);
-        }
-
-        public abstract Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken);
-
-        public virtual async Task WriteMessageEndAsync()
-        {
-            await WriteMessageEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task WriteMessageEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteStructBeginAsync(TStruct @struct)
-        {
-            await WriteStructBeginAsync(@struct, CancellationToken.None);
-        }
-
-        public abstract Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken);
-
-        public virtual async Task WriteStructEndAsync()
-        {
-            await WriteStructEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task WriteStructEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteFieldBeginAsync(TField field)
-        {
-            await WriteFieldBeginAsync(field, CancellationToken.None);
-        }
-
-        public abstract Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken);
-
-        public virtual async Task WriteFieldEndAsync()
-        {
-            await WriteFieldEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task WriteFieldEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteFieldStopAsync()
-        {
-            await WriteFieldStopAsync(CancellationToken.None);
-        }
-
-        public abstract Task WriteFieldStopAsync(CancellationToken cancellationToken);
-
-        public virtual async Task WriteMapBeginAsync(TMap map)
-        {
-            await WriteMapBeginAsync(map, CancellationToken.None);
-        }
-
-        public abstract Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken);
-
-        public virtual async Task WriteMapEndAsync()
-        {
-            await WriteMapEndAsync(CancellationToken.None);
-        }
-
-        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)
-        {
-            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);
-
-        public virtual async Task<TMessage> ReadMessageBeginAsync()
-        {
-            return await ReadMessageBeginAsync(CancellationToken.None);
-        }
-
-        public abstract Task<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadMessageEndAsync()
-        {
-            await ReadMessageEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadMessageEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<TStruct> ReadStructBeginAsync()
-        {
-            return await ReadStructBeginAsync(CancellationToken.None);
-        }
-
-        public abstract Task<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadStructEndAsync()
-        {
-            await ReadStructEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadStructEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<TField> ReadFieldBeginAsync()
-        {
-            return await ReadFieldBeginAsync(CancellationToken.None);
-        }
-
-        public abstract Task<TField> ReadFieldBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadFieldEndAsync()
-        {
-            await ReadFieldEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadFieldEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<TMap> ReadMapBeginAsync()
-        {
-            return await ReadMapBeginAsync(CancellationToken.None);
-        }
-
-        public abstract Task<TMap> ReadMapBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadMapEndAsync()
-        {
-            await ReadMapEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadMapEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<TList> ReadListBeginAsync()
-        {
-            return await ReadListBeginAsync(CancellationToken.None);
-        }
-
-        public abstract Task<TList> ReadListBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadListEndAsync()
-        {
-            await ReadListEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadListEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<TSet> ReadSetBeginAsync()
-        {
-            return await ReadSetBeginAsync(CancellationToken.None);
-        }
-
-        public abstract Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken);
-
-        public virtual async Task ReadSetEndAsync()
-        {
-            await ReadSetEndAsync(CancellationToken.None);
-        }
-
-        public abstract Task ReadSetEndAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<bool> ReadBoolAsync()
-        {
-            return await ReadBoolAsync(CancellationToken.None);
-        }
-
-        public abstract Task<bool> ReadBoolAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<sbyte> ReadByteAsync()
-        {
-            return await ReadByteAsync(CancellationToken.None);
-        }
-
-        public abstract Task<sbyte> ReadByteAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<short> ReadI16Async()
-        {
-            return await ReadI16Async(CancellationToken.None);
-        }
-
-        public abstract Task<short> ReadI16Async(CancellationToken cancellationToken);
-
-        public virtual async Task<int> ReadI32Async()
-        {
-            return await ReadI32Async(CancellationToken.None);
-        }
-
-        public abstract Task<int> ReadI32Async(CancellationToken cancellationToken);
-
-        public virtual async Task<long> ReadI64Async()
-        {
-            return await ReadI64Async(CancellationToken.None);
-        }
-
-        public abstract Task<long> ReadI64Async(CancellationToken cancellationToken);
-
-        public virtual async Task<double> ReadDoubleAsync()
-        {
-            return await ReadDoubleAsync(CancellationToken.None);
-        }
-
-        public abstract Task<double> ReadDoubleAsync(CancellationToken cancellationToken);
-
-        public virtual async Task<string> ReadStringAsync()
-        {
-            return await ReadStringAsync(CancellationToken.None);
-        }
-
-        public virtual async Task<string> ReadStringAsync(CancellationToken cancellationToken)
-        {
-            var buf = await ReadBinaryAsync(cancellationToken);
-            return Encoding.UTF8.GetString(buf, 0, buf.Length);
-        }
-
-        public virtual async Task<byte[]> ReadBinaryAsync()
-        {
-            return await ReadBinaryAsync(CancellationToken.None);
-        }
-
-        public abstract Task<byte[]> ReadBinaryAsync(CancellationToken cancellationToken);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TProtocolDecorator.cs b/lib/netcore/Thrift/Protocols/TProtocolDecorator.cs
deleted file mode 100644
index 3222754..0000000
--- a/lib/netcore/Thrift/Protocols/TProtocolDecorator.cs
+++ /dev/null
@@ -1,247 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-
-namespace Thrift.Protocols
-{
-    // ReSharper disable once InconsistentNaming
-    /// <summary>
-    ///     TProtocolDecorator forwards all requests to an enclosed TProtocol instance,
-    ///     providing a way to author concise concrete decorator subclasses.While it has
-    ///     no abstract methods, it is marked abstract as a reminder that by itself,
-    ///     it does not modify the behaviour of the enclosed TProtocol.
-    /// </summary>
-    public abstract class TProtocolDecorator : TProtocol
-    {
-        private readonly TProtocol _wrappedProtocol;
-
-        protected TProtocolDecorator(TProtocol protocol)
-            : base(protocol.Transport)
-        {
-            _wrappedProtocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
-        }
-
-        public override async Task WriteMessageBeginAsync(TMessage message, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteMessageBeginAsync(message, cancellationToken);
-        }
-
-        public override async Task WriteMessageEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteMessageEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteStructBeginAsync(TStruct @struct, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteStructBeginAsync(@struct, cancellationToken);
-        }
-
-        public override async Task WriteStructEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteStructEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteFieldBeginAsync(TField field, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteFieldBeginAsync(field, cancellationToken);
-        }
-
-        public override async Task WriteFieldEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteFieldEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteFieldStopAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteFieldStopAsync(cancellationToken);
-        }
-
-        public override async Task WriteMapBeginAsync(TMap map, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteMapBeginAsync(map, cancellationToken);
-        }
-
-        public override async Task WriteMapEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteMapEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteListBeginAsync(TList list, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteListBeginAsync(list, cancellationToken);
-        }
-
-        public override async Task WriteListEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteListEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteSetBeginAsync(TSet set, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteSetBeginAsync(set, cancellationToken);
-        }
-
-        public override async Task WriteSetEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteSetEndAsync(cancellationToken);
-        }
-
-        public override async Task WriteBoolAsync(bool b, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteBoolAsync(b, cancellationToken);
-        }
-
-        public override async Task WriteByteAsync(sbyte b, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteByteAsync(b, cancellationToken);
-        }
-
-        public override async Task WriteI16Async(short i16, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteI16Async(i16, cancellationToken);
-        }
-
-        public override async Task WriteI32Async(int i32, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteI32Async(i32, cancellationToken);
-        }
-
-        public override async Task WriteI64Async(long i64, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteI64Async(i64, cancellationToken);
-        }
-
-        public override async Task WriteDoubleAsync(double d, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteDoubleAsync(d, cancellationToken);
-        }
-
-        public override async Task WriteStringAsync(string s, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteStringAsync(s, cancellationToken);
-        }
-
-        public override async Task WriteBinaryAsync(byte[] bytes, CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.WriteBinaryAsync(bytes, cancellationToken);
-        }
-
-        public override async Task<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadMessageBeginAsync(cancellationToken);
-        }
-
-        public override async Task ReadMessageEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.ReadMessageEndAsync(cancellationToken);
-        }
-
-        public override async Task<TStruct> ReadStructBeginAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadStructBeginAsync(cancellationToken);
-        }
-
-        public override async Task ReadStructEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.ReadStructEndAsync(cancellationToken);
-        }
-
-        public override async Task<TField> ReadFieldBeginAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadFieldBeginAsync(cancellationToken);
-        }
-
-        public override async Task ReadFieldEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.ReadFieldEndAsync(cancellationToken);
-        }
-
-        public override async Task<TMap> ReadMapBeginAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadMapBeginAsync(cancellationToken);
-        }
-
-        public override async Task ReadMapEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.ReadMapEndAsync(cancellationToken);
-        }
-
-        public override async Task<TList> ReadListBeginAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadListBeginAsync(cancellationToken);
-        }
-
-        public override async Task ReadListEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.ReadListEndAsync(cancellationToken);
-        }
-
-        public override async Task<TSet> ReadSetBeginAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadSetBeginAsync(cancellationToken);
-        }
-
-        public override async Task ReadSetEndAsync(CancellationToken cancellationToken)
-        {
-            await _wrappedProtocol.ReadSetEndAsync(cancellationToken);
-        }
-
-        public override async Task<bool> ReadBoolAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadBoolAsync(cancellationToken);
-        }
-
-        public override async Task<sbyte> ReadByteAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadByteAsync(cancellationToken);
-        }
-
-        public override async Task<short> ReadI16Async(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadI16Async(cancellationToken);
-        }
-
-        public override async Task<int> ReadI32Async(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadI32Async(cancellationToken);
-        }
-
-        public override async Task<long> ReadI64Async(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadI64Async(cancellationToken);
-        }
-
-        public override async Task<double> ReadDoubleAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadDoubleAsync(cancellationToken);
-        }
-
-        public override async Task<string> ReadStringAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadStringAsync(cancellationToken);
-        }
-
-        public override async Task<byte[]> ReadBinaryAsync(CancellationToken cancellationToken)
-        {
-            return await _wrappedProtocol.ReadBinaryAsync(cancellationToken);
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/TProtocolException.cs b/lib/netcore/Thrift/Protocols/TProtocolException.cs
deleted file mode 100644
index 8c67c3b..0000000
--- a/lib/netcore/Thrift/Protocols/TProtocolException.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-// ReSharper disable InconsistentNaming
-namespace Thrift.Protocols
-{
-    public class TProtocolException : TException
-    {
-        // do not rename public constants - they used in generated files
-        public const int UNKNOWN = 0;
-        public const int INVALID_DATA = 1;
-        public const int NEGATIVE_SIZE = 2;
-        public const int SIZE_LIMIT = 3;
-        public const int BAD_VERSION = 4;
-        public const int NOT_IMPLEMENTED = 5;
-        public const int DEPTH_LIMIT = 6;
-
-        protected int Type = UNKNOWN;
-
-        public TProtocolException()
-        {
-        }
-
-        public TProtocolException(int type)
-        {
-            Type = type;
-        }
-
-        public TProtocolException(int type, string message)
-            : base(message)
-        {
-            Type = type;
-        }
-
-        public TProtocolException(string message)
-            : base(message)
-        {
-        }
-
-        public int GetExceptionType()
-        {
-            return Type;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Utilities/TBase64Helper.cs b/lib/netcore/Thrift/Protocols/Utilities/TBase64Helper.cs
deleted file mode 100644
index 7eff5e1..0000000
--- a/lib/netcore/Thrift/Protocols/Utilities/TBase64Helper.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-
-namespace Thrift.Protocols.Utilities
-{
-    // ReSharper disable once InconsistentNaming
-    internal static class TBase64Helper
-    {
-        //TODO: Constants
-        //TODO: Check for args
-        //TODO: Unitests
-
-        internal const string EncodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-        private static readonly int[] DecodeTable =
-        {
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
-            52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-            -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
-            15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-            -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-            41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-        };
-
-        internal static void Encode(byte[] src, int srcOff, int len, byte[] dst, int dstOff)
-        {
-            if (src == null)
-            {
-                throw new ArgumentNullException(nameof(src));
-            }
-
-            dst[dstOff] = (byte) EncodeTable[(src[srcOff] >> 2) & 0x3F];
-
-            if (len == 3)
-            {
-                dst[dstOff + 1] = (byte) EncodeTable[((src[srcOff] << 4) & 0x30) | ((src[srcOff + 1] >> 4) & 0x0F)];
-                dst[dstOff + 2] = (byte) EncodeTable[((src[srcOff + 1] << 2) & 0x3C) | ((src[srcOff + 2] >> 6) & 0x03)];
-                dst[dstOff + 3] = (byte) EncodeTable[src[srcOff + 2] & 0x3F];
-            }
-            else if (len == 2)
-            {
-                dst[dstOff + 1] = (byte) EncodeTable[((src[srcOff] << 4) & 0x30) | ((src[srcOff + 1] >> 4) & 0x0F)];
-                dst[dstOff + 2] = (byte) EncodeTable[(src[srcOff + 1] << 2) & 0x3C];
-            }
-            else
-            {
-                // len == 1
-                dst[dstOff + 1] = (byte) EncodeTable[(src[srcOff] << 4) & 0x30];
-            }
-        }
-
-        internal static void Decode(byte[] src, int srcOff, int len, byte[] dst, int dstOff)
-        {
-            if (src == null)
-            {
-                throw new ArgumentNullException(nameof(src));
-            }
-
-            dst[dstOff] = (byte) ((DecodeTable[src[srcOff] & 0x0FF] << 2) | (DecodeTable[src[srcOff + 1] & 0x0FF] >> 4));
-
-            if (len > 2)
-            {
-                dst[dstOff + 1] =
-                    (byte)
-                    (((DecodeTable[src[srcOff + 1] & 0x0FF] << 4) & 0xF0) | (DecodeTable[src[srcOff + 2] & 0x0FF] >> 2));
-                if (len > 3)
-                {
-                    dst[dstOff + 2] =
-                        (byte)
-                        (((DecodeTable[src[srcOff + 2] & 0x0FF] << 6) & 0xC0) | DecodeTable[src[srcOff + 3] & 0x0FF]);
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Utilities/TBase64Utils.cs b/lib/netcore/Thrift/Protocols/Utilities/TBase64Utils.cs
deleted file mode 100644
index 15fd45c..0000000
--- a/lib/netcore/Thrift/Protocols/Utilities/TBase64Utils.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-
-namespace Thrift.Protocols.Utilities
-{
-    // ReSharper disable once InconsistentNaming
-    internal static class TBase64Utils
-    {
-        //TODO: Constants
-        //TODO: Check for args
-        //TODO: Unitests
-
-        internal const string EncodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-        private static readonly int[] DecodeTable =
-        {
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
-            52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-            -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
-            15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-            -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-            41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-        };
-
-        internal static void Encode(byte[] src, int srcOff, int len, byte[] dst, int dstOff)
-        {
-            if (src == null)
-            {
-                throw new ArgumentNullException(nameof(src));
-            }
-
-            dst[dstOff] = (byte) EncodeTable[(src[srcOff] >> 2) & 0x3F];
-
-            if (len == 3)
-            {
-                dst[dstOff + 1] = (byte) EncodeTable[((src[srcOff] << 4) & 0x30) | ((src[srcOff + 1] >> 4) & 0x0F)];
-                dst[dstOff + 2] = (byte) EncodeTable[((src[srcOff + 1] << 2) & 0x3C) | ((src[srcOff + 2] >> 6) & 0x03)];
-                dst[dstOff + 3] = (byte) EncodeTable[src[srcOff + 2] & 0x3F];
-            }
-            else if (len == 2)
-            {
-                dst[dstOff + 1] = (byte) EncodeTable[((src[srcOff] << 4) & 0x30) | ((src[srcOff + 1] >> 4) & 0x0F)];
-                dst[dstOff + 2] = (byte) EncodeTable[(src[srcOff + 1] << 2) & 0x3C];
-            }
-            else
-            {
-                // len == 1
-                dst[dstOff + 1] = (byte) EncodeTable[(src[srcOff] << 4) & 0x30];
-            }
-        }
-
-        internal static void Decode(byte[] src, int srcOff, int len, byte[] dst, int dstOff)
-        {
-            if (src == null)
-            {
-                throw new ArgumentNullException(nameof(src));
-            }
-
-            dst[dstOff] = (byte) ((DecodeTable[src[srcOff] & 0x0FF] << 2) | (DecodeTable[src[srcOff + 1] & 0x0FF] >> 4));
-
-            if (len > 2)
-            {
-                dst[dstOff + 1] =
-                    (byte)
-                    (((DecodeTable[src[srcOff + 1] & 0x0FF] << 4) & 0xF0) | (DecodeTable[src[srcOff + 2] & 0x0FF] >> 2));
-                if (len > 3)
-                {
-                    dst[dstOff + 2] =
-                        (byte)
-                        (((DecodeTable[src[srcOff + 2] & 0x0FF] << 6) & 0xC0) | DecodeTable[src[srcOff + 3] & 0x0FF]);
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Utilities/TJsonProtocolConstants.cs b/lib/netcore/Thrift/Protocols/Utilities/TJsonProtocolConstants.cs
deleted file mode 100644
index 93eff78..0000000
--- a/lib/netcore/Thrift/Protocols/Utilities/TJsonProtocolConstants.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Protocols.Utilities
-{
-    // ReSharper disable once InconsistentNaming
-    public static class TJSONProtocolConstants
-    {
-        //TODO Check for performance for reusing ImmutableArray from System.Collections.Immutable (https://blogs.msdn.microsoft.com/dotnet/2013/06/24/please-welcome-immutablearrayt/)
-        // can be possible to get better performance and also better GC
-
-        public static readonly byte[] Comma = {(byte) ','};
-        public static readonly byte[] Colon = {(byte) ':'};
-        public static readonly byte[] LeftBrace = {(byte) '{'};
-        public static readonly byte[] RightBrace = {(byte) '}'};
-        public static readonly byte[] LeftBracket = {(byte) '['};
-        public static readonly byte[] RightBracket = {(byte) ']'};
-        public static readonly byte[] Quote = {(byte) '"'};
-        public static readonly byte[] Backslash = {(byte) '\\'};
-
-        public static readonly byte[] JsonCharTable =
-        {
-            0, 0, 0, 0, 0, 0, 0, 0, (byte) 'b', (byte) 't', (byte) 'n', 0, (byte) 'f', (byte) 'r', 0, 0,
-            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-            1, 1, (byte) '"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
-        };
-
-        public static readonly char[] EscapeChars = "\"\\/bfnrt".ToCharArray();
-        public static readonly byte[] EscapeCharValues = {(byte) '"', (byte) '\\', (byte) '/', (byte) '\b', (byte) '\f', (byte) '\n', (byte) '\r', (byte) '\t'};
-        public static readonly byte[] EscSequences = {(byte) '\\', (byte) 'u', (byte) '0', (byte) '0'};
-
-        public static class TypeNames
-        {
-            public static readonly byte[] NameBool = { (byte)'t', (byte)'f' };
-            public static readonly byte[] NameByte = { (byte)'i', (byte)'8' };
-            public static readonly byte[] NameI16 = { (byte)'i', (byte)'1', (byte)'6' };
-            public static readonly byte[] NameI32 = { (byte)'i', (byte)'3', (byte)'2' };
-            public static readonly byte[] NameI64 = { (byte)'i', (byte)'6', (byte)'4' };
-            public static readonly byte[] NameDouble = { (byte)'d', (byte)'b', (byte)'l' };
-            public static readonly byte[] NameStruct = { (byte)'r', (byte)'e', (byte)'c' };
-            public static readonly byte[] NameString = { (byte)'s', (byte)'t', (byte)'r' };
-            public static readonly byte[] NameMap = { (byte)'m', (byte)'a', (byte)'p' };
-            public static readonly byte[] NameList = { (byte)'l', (byte)'s', (byte)'t' };
-            public static readonly byte[] NameSet = { (byte)'s', (byte)'e', (byte)'t' };
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Utilities/TJsonProtocolHelper.cs b/lib/netcore/Thrift/Protocols/Utilities/TJsonProtocolHelper.cs
deleted file mode 100644
index adc26a9..0000000
--- a/lib/netcore/Thrift/Protocols/Utilities/TJsonProtocolHelper.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using Thrift.Protocols.Entities;
-
-namespace Thrift.Protocols.Utilities
-{
-    // ReSharper disable once InconsistentNaming
-    public static class TJSONProtocolHelper
-    {
-        public static byte[] GetTypeNameForTypeId(TType typeId)
-        {
-            switch (typeId)
-            {
-                case TType.Bool:
-                    return TJSONProtocolConstants.TypeNames.NameBool;
-                case TType.Byte:
-                    return TJSONProtocolConstants.TypeNames.NameByte;
-                case TType.I16:
-                    return TJSONProtocolConstants.TypeNames.NameI16;
-                case TType.I32:
-                    return TJSONProtocolConstants.TypeNames.NameI32;
-                case TType.I64:
-                    return TJSONProtocolConstants.TypeNames.NameI64;
-                case TType.Double:
-                    return TJSONProtocolConstants.TypeNames.NameDouble;
-                case TType.String:
-                    return TJSONProtocolConstants.TypeNames.NameString;
-                case TType.Struct:
-                    return TJSONProtocolConstants.TypeNames.NameStruct;
-                case TType.Map:
-                    return TJSONProtocolConstants.TypeNames.NameMap;
-                case TType.Set:
-                    return TJSONProtocolConstants.TypeNames.NameSet;
-                case TType.List:
-                    return TJSONProtocolConstants.TypeNames.NameList;
-                default:
-                    throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized exType");
-            }
-        }
-
-        public static TType GetTypeIdForTypeName(byte[] name)
-        {
-            var result = TType.Stop;
-            if (name.Length > 1)
-            {
-                switch (name[0])
-                {
-                    case (byte) 'd':
-                        result = TType.Double;
-                        break;
-                    case (byte) 'i':
-                        switch (name[1])
-                        {
-                            case (byte) '8':
-                                result = TType.Byte;
-                                break;
-                            case (byte) '1':
-                                result = TType.I16;
-                                break;
-                            case (byte) '3':
-                                result = TType.I32;
-                                break;
-                            case (byte) '6':
-                                result = TType.I64;
-                                break;
-                        }
-                        break;
-                    case (byte) 'l':
-                        result = TType.List;
-                        break;
-                    case (byte) 'm':
-                        result = TType.Map;
-                        break;
-                    case (byte) 'r':
-                        result = TType.Struct;
-                        break;
-                    case (byte) 's':
-                        if (name[1] == (byte) 't')
-                        {
-                            result = TType.String;
-                        }
-                        else if (name[1] == (byte) 'e')
-                        {
-                            result = TType.Set;
-                        }
-                        break;
-                    case (byte) 't':
-                        result = TType.Bool;
-                        break;
-                }
-            }
-            if (result == TType.Stop)
-            {
-                throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized exType");
-            }
-            return result;
-        }
-
-        /// <summary>
-        ///     Return true if the given byte could be a valid part of a JSON number.
-        /// </summary>
-        public static bool IsJsonNumeric(byte b)
-        {
-            switch (b)
-            {
-                case (byte)'+':
-                case (byte)'-':
-                case (byte)'.':
-                case (byte)'0':
-                case (byte)'1':
-                case (byte)'2':
-                case (byte)'3':
-                case (byte)'4':
-                case (byte)'5':
-                case (byte)'6':
-                case (byte)'7':
-                case (byte)'8':
-                case (byte)'9':
-                case (byte)'E':
-                case (byte)'e':
-                    return true;
-                default:
-                    return false;
-            }
-        }
-
-        /// <summary>
-        ///     Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its
-        ///     corresponding hex value
-        /// </summary>
-        public static byte ToHexVal(byte ch)
-        {
-            if (ch >= '0' && ch <= '9')
-            {
-                return (byte)((char)ch - '0');
-            }
-
-            if (ch >= 'a' && ch <= 'f')
-            {
-                ch += 10;
-                return (byte)((char)ch - 'a');
-            }
-
-            throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected hex character");
-        }
-
-        /// <summary>
-        ///     Convert a byte containing a hex value to its corresponding hex character
-        /// </summary>
-        public static byte ToHexChar(byte val)
-        {
-            val &= 0x0F;
-            if (val < 10)
-            {
-                return (byte)((char)val + '0');
-            }
-            val -= 10;
-            return (byte)((char)val + 'a');
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Protocols/Utilities/TProtocolUtil.cs b/lib/netcore/Thrift/Protocols/Utilities/TProtocolUtil.cs
deleted file mode 100644
index 50b0385..0000000
--- a/lib/netcore/Thrift/Protocols/Utilities/TProtocolUtil.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols.Entities;
-
-namespace Thrift.Protocols.Utilities
-{
-    // ReSharper disable once InconsistentNaming
-    public static class TProtocolUtil
-    {
-        public static async Task SkipAsync(TProtocol protocol, TType type, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            protocol.IncrementRecursionDepth();
-            try
-            {
-                switch (type)
-                {
-                    case TType.Bool:
-                        await protocol.ReadBoolAsync(cancellationToken);
-                        break;
-                    case TType.Byte:
-                        await protocol.ReadByteAsync(cancellationToken);
-                        break;
-                    case TType.I16:
-                        await protocol.ReadI16Async(cancellationToken);
-                        break;
-                    case TType.I32:
-                        await protocol.ReadI32Async(cancellationToken);
-                        break;
-                    case TType.I64:
-                        await protocol.ReadI64Async(cancellationToken);
-                        break;
-                    case TType.Double:
-                        await protocol.ReadDoubleAsync(cancellationToken);
-                        break;
-                    case TType.String:
-                        // Don't try to decode the string, just skip it.
-                        await protocol.ReadBinaryAsync(cancellationToken);
-                        break;
-                    case TType.Struct:
-                        await protocol.ReadStructBeginAsync(cancellationToken);
-                        while (true)
-                        {
-                            var field = await protocol.ReadFieldBeginAsync(cancellationToken);
-                            if (field.Type == TType.Stop)
-                            {
-                                break;
-                            }
-                            await SkipAsync(protocol, field.Type, cancellationToken);
-                            await protocol.ReadFieldEndAsync(cancellationToken);
-                        }
-                        await protocol.ReadStructEndAsync(cancellationToken);
-                        break;
-                    case TType.Map:
-                        var map = await protocol.ReadMapBeginAsync(cancellationToken);
-                        for (var i = 0; i < map.Count; i++)
-                        {
-                            await SkipAsync(protocol, map.KeyType, cancellationToken);
-                            await SkipAsync(protocol, map.ValueType, cancellationToken);
-                        }
-                        await protocol.ReadMapEndAsync(cancellationToken);
-                        break;
-                    case TType.Set:
-                        var set = await protocol.ReadSetBeginAsync(cancellationToken);
-                        for (var i = 0; i < set.Count; i++)
-                        {
-                            await SkipAsync(protocol, set.ElementType, cancellationToken);
-                        }
-                        await protocol.ReadSetEndAsync(cancellationToken);
-                        break;
-                    case TType.List:
-                        var list = await protocol.ReadListBeginAsync(cancellationToken);
-                        for (var i = 0; i < list.Count; i++)
-                        {
-                            await SkipAsync(protocol, list.ElementType, cancellationToken);
-                        }
-                        await protocol.ReadListEndAsync(cancellationToken);
-                        break;
-                    default:
-                        throw new TProtocolException(TProtocolException.INVALID_DATA, "Unknown data type " + type.ToString("d"));
-                }
-            }
-            finally
-            {
-                protocol.DecrementRecursionDepth();
-            }
-        }
-    }
-}
diff --git a/lib/netcore/Thrift/Server/AsyncBaseServer.cs b/lib/netcore/Thrift/Server/AsyncBaseServer.cs
deleted file mode 100644
index 325c39c..0000000
--- a/lib/netcore/Thrift/Server/AsyncBaseServer.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
-using Thrift.Protocols;
-using Thrift.Transports;
-
-namespace Thrift.Server
-{
-    //TODO: unhandled exceptions, etc.
-
-    // ReSharper disable once InconsistentNaming
-    public class AsyncBaseServer : TBaseServer
-    {
-        private readonly int _clientWaitingDelay;
-        private volatile Task _serverTask;
-
-        public AsyncBaseServer(ITAsyncProcessor processor, TServerTransport serverTransport,
-            ITProtocolFactory inputProtocolFactory, ITProtocolFactory outputProtocolFactory,
-            ILoggerFactory loggerFactory, int clientWaitingDelay = 10)
-            : this(new SingletonTProcessorFactory(processor), serverTransport,
-                new TTransportFactory(), new TTransportFactory(),
-                inputProtocolFactory, outputProtocolFactory,
-                loggerFactory.CreateLogger(nameof(AsyncBaseServer)), clientWaitingDelay)
-        {
-        }
-
-        public AsyncBaseServer(ITProcessorFactory itProcessorFactory, TServerTransport serverTransport,
-            TTransportFactory inputTransportFactory, TTransportFactory outputTransportFactory,
-            ITProtocolFactory inputProtocolFactory, ITProtocolFactory outputProtocolFactory,
-            ILogger logger, int clientWaitingDelay = 10)
-            : base(itProcessorFactory, serverTransport, inputTransportFactory, outputTransportFactory,
-                inputProtocolFactory, outputProtocolFactory, logger)
-        {
-            _clientWaitingDelay = clientWaitingDelay;
-        }
-
-        public override async Task ServeAsync(CancellationToken cancellationToken)
-        {
-            try
-            {
-                // cancelation token
-                _serverTask = Task.Factory.StartNew(() => StartListening(cancellationToken), TaskCreationOptions.LongRunning);
-                await _serverTask;
-            }
-            catch (Exception ex)
-            {
-                Logger.LogError(ex.ToString());
-            }
-        }
-
-        private async Task StartListening(CancellationToken cancellationToken)
-        {
-            ServerTransport.Listen();
-
-            Logger.LogTrace("Started listening at server");
-
-            if (ServerEventHandler != null)
-            {
-                await ServerEventHandler.PreServeAsync(cancellationToken);
-            }
-
-            while (!cancellationToken.IsCancellationRequested)
-            {
-                if (ServerTransport.IsClientPending())
-                {
-                    Logger.LogTrace("Waiting for client connection");
-
-                    try
-                    {
-                        var client = await ServerTransport.AcceptAsync(cancellationToken);
-                        await Task.Factory.StartNew(() => Execute(client, cancellationToken), cancellationToken);
-                    }
-                    catch (TTransportException ttx)
-                    {
-                        Logger.LogTrace($"Transport exception: {ttx}");
-
-                        if (ttx.Type != TTransportException.ExceptionType.Interrupted)
-                        {
-                            Logger.LogError(ttx.ToString());
-                        }
-                    }
-                }
-                else
-                {
-                    try
-                    {
-                        await Task.Delay(TimeSpan.FromMilliseconds(_clientWaitingDelay), cancellationToken);
-                    }
-                    catch(TaskCanceledException) { }
-                }
-            }
-
-            ServerTransport.Close();
-
-            Logger.LogTrace("Completed listening at server");
-        }
-
-        public override void Stop()
-        {
-        }
-
-        private async Task Execute(TClientTransport client, CancellationToken cancellationToken)
-        {
-            Logger.LogTrace("Started client request processing");
-
-            var processor = ItProcessorFactory.GetAsyncProcessor(client, this);
-
-            TClientTransport inputTransport = null;
-            TClientTransport outputTransport = null;
-            TProtocol inputProtocol = null;
-            TProtocol outputProtocol = null;
-            object connectionContext = null;
-
-            try
-            {
-                inputTransport = InputTransportFactory.GetTransport(client);
-                outputTransport = OutputTransportFactory.GetTransport(client);
-
-                inputProtocol = InputProtocolFactory.GetProtocol(inputTransport);
-                outputProtocol = OutputProtocolFactory.GetProtocol(outputTransport);
-
-                if (ServerEventHandler != null)
-                {
-                    connectionContext = await ServerEventHandler.CreateContextAsync(inputProtocol, outputProtocol, cancellationToken);
-                }
-
-                while (!cancellationToken.IsCancellationRequested)
-                {
-                    if (!await inputTransport.PeekAsync(cancellationToken))
-                    {
-                        break;
-                    }
-
-                    if (ServerEventHandler != null)
-                    {
-                        await ServerEventHandler.ProcessContextAsync(connectionContext, inputTransport, cancellationToken);
-                    }
-
-                    if (!await processor.ProcessAsync(inputProtocol, outputProtocol, cancellationToken))
-                    {
-                        break;
-                    }
-                }
-            }
-            catch (TTransportException ttx)
-            {
-                Logger.LogTrace($"Transport exception: {ttx}");
-            }
-            catch (Exception x)
-            {
-                Logger.LogError($"Error: {x}");
-            }
-
-            if (ServerEventHandler != null)
-            {
-                await ServerEventHandler.DeleteContextAsync(connectionContext, inputProtocol, outputProtocol, cancellationToken);
-            }
-
-            inputTransport?.Close();
-            outputTransport?.Close();
-
-            Logger.LogTrace("Completed client request processing");
-        }
-    }
-}
diff --git a/lib/netcore/Thrift/Server/TBaseServer.cs b/lib/netcore/Thrift/Server/TBaseServer.cs
deleted file mode 100644
index 741dd5c..0000000
--- a/lib/netcore/Thrift/Server/TBaseServer.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
-using Thrift.Protocols;
-using Thrift.Transports;
-
-namespace Thrift.Server
-{
-    // ReSharper disable once InconsistentNaming
-    public abstract class TBaseServer
-    {
-        protected readonly ILogger Logger;
-        protected ITProtocolFactory InputProtocolFactory;
-        protected TTransportFactory InputTransportFactory;
-        protected ITProcessorFactory ItProcessorFactory;
-        protected ITProtocolFactory OutputProtocolFactory;
-        protected TTransportFactory OutputTransportFactory;
-
-        protected TServerEventHandler ServerEventHandler;
-        protected TServerTransport ServerTransport;
-
-        protected TBaseServer(ITProcessorFactory itProcessorFactory, TServerTransport serverTransport,
-            TTransportFactory inputTransportFactory, TTransportFactory outputTransportFactory,
-            ITProtocolFactory inputProtocolFactory, ITProtocolFactory outputProtocolFactory,
-            ILogger logger)
-        {
-            ItProcessorFactory = itProcessorFactory ?? throw new ArgumentNullException(nameof(itProcessorFactory));
-            ServerTransport = serverTransport;
-            InputTransportFactory = inputTransportFactory ?? throw new ArgumentNullException(nameof(inputTransportFactory));
-            OutputTransportFactory = outputTransportFactory ?? throw new ArgumentNullException(nameof(outputTransportFactory));
-            InputProtocolFactory = inputProtocolFactory ?? throw new ArgumentNullException(nameof(inputProtocolFactory));
-            OutputProtocolFactory = outputProtocolFactory ?? throw new ArgumentNullException(nameof(outputProtocolFactory));
-            Logger = logger ?? throw new ArgumentNullException(nameof(logger));
-        }
-
-        public void SetEventHandler(TServerEventHandler seh)
-        {
-            ServerEventHandler = seh;
-        }
-
-        public TServerEventHandler GetEventHandler()
-        {
-            return ServerEventHandler;
-        }
-
-        public abstract void Stop();
-
-        public virtual void Start()
-        {
-            // do nothing
-        }
-
-        public virtual async Task ServeAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Server/TServerEventHandler.cs b/lib/netcore/Thrift/Server/TServerEventHandler.cs
deleted file mode 100644
index 733bb4b..0000000
--- a/lib/netcore/Thrift/Server/TServerEventHandler.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols;
-using Thrift.Transports;
-
-namespace Thrift.Server
-{
-    //TODO: replacement by event?
-
-    /// <summary>
-    ///     Interface implemented by server users to handle events from the server
-    /// </summary>
-    // ReSharper disable once InconsistentNaming
-    public interface TServerEventHandler
-    {
-        /// <summary>
-        ///     Called before the server begins */
-        /// </summary>
-        Task PreServeAsync(CancellationToken cancellationToken);
-
-        /// <summary>
-        ///     Called when a new client has connected and is about to being processing */
-        /// </summary>
-        Task<object> CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken);
-
-        /// <summary>
-        ///     Called when a client has finished request-handling to delete server context */
-        /// </summary>
-        Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output,
-            CancellationToken cancellationToken);
-
-        /// <summary>
-        ///     Called when a client is about to call the processor */
-        /// </summary>
-        Task ProcessContextAsync(object serverContext, TClientTransport transport, CancellationToken cancellationToken);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/SingletonTProcessorFactory.cs b/lib/netcore/Thrift/SingletonTProcessorFactory.cs
deleted file mode 100644
index c351233..0000000
--- a/lib/netcore/Thrift/SingletonTProcessorFactory.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using Thrift.Server;
-using Thrift.Transports;
-
-namespace Thrift
-{
-    // ReSharper disable once InconsistentNaming
-    public class SingletonTProcessorFactory : ITProcessorFactory
-    {
-        private readonly ITAsyncProcessor _tAsyncProcessor;
-
-        public SingletonTProcessorFactory(ITAsyncProcessor tAsyncProcessor)
-        {
-            _tAsyncProcessor = tAsyncProcessor;
-        }
-
-        public ITAsyncProcessor GetAsyncProcessor(TClientTransport trans, TBaseServer baseServer = null)
-        {
-            return _tAsyncProcessor;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/TApplicationException.cs b/lib/netcore/Thrift/TApplicationException.cs
deleted file mode 100644
index 9ec145a..0000000
--- a/lib/netcore/Thrift/TApplicationException.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols;
-using Thrift.Protocols.Entities;
-using Thrift.Protocols.Utilities;
-
-namespace Thrift
-{
-    // ReSharper disable once InconsistentNaming
-    public class TApplicationException : TException
-    {
-        public enum ExceptionType
-        {
-            Unknown,
-            UnknownMethod,
-            InvalidMessageType,
-            WrongMethodName,
-            BadSequenceId,
-            MissingResult,
-            InternalError,
-            ProtocolError,
-            InvalidTransform,
-            InvalidProtocol,
-            UnsupportedClientType
-        }
-
-        private const int MessageTypeFieldId = 1;
-        private const int ExTypeFieldId = 2;
-
-        protected ExceptionType Type;
-
-        public TApplicationException()
-        {
-        }
-
-        public TApplicationException(ExceptionType type)
-        {
-            Type = type;
-        }
-
-        public TApplicationException(ExceptionType type, string message)
-            : base(message)
-        {
-            Type = type;
-        }
-
-        public static async Task<TApplicationException> ReadAsync(TProtocol inputProtocol, CancellationToken cancellationToken)
-        {
-            string message = null;
-            var type = ExceptionType.Unknown;
-
-            await inputProtocol.ReadStructBeginAsync(cancellationToken);
-            while (true)
-            {
-                var field = await inputProtocol.ReadFieldBeginAsync(cancellationToken);
-                if (field.Type == TType.Stop)
-                {
-                    break;
-                }
-
-                switch (field.ID)
-                {
-                    case MessageTypeFieldId:
-                        if (field.Type == TType.String)
-                        {
-                            message = await inputProtocol.ReadStringAsync(cancellationToken);
-                        }
-                        else
-                        {
-                            await TProtocolUtil.SkipAsync(inputProtocol, field.Type, cancellationToken);
-                        }
-                        break;
-                    case ExTypeFieldId:
-                        if (field.Type == TType.I32)
-                        {
-                            type = (ExceptionType) await inputProtocol.ReadI32Async(cancellationToken);
-                        }
-                        else
-                        {
-                            await TProtocolUtil.SkipAsync(inputProtocol, field.Type, cancellationToken);
-                        }
-                        break;
-                    default:
-                        await TProtocolUtil.SkipAsync(inputProtocol, field.Type, cancellationToken);
-                        break;
-                }
-
-                await inputProtocol.ReadFieldEndAsync(cancellationToken);
-            }
-
-            await inputProtocol.ReadStructEndAsync(cancellationToken);
-
-            return new TApplicationException(type, message);
-        }
-
-        public async Task WriteAsync(TProtocol outputProtocol, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            const string messageTypeFieldName = "message";
-            const string exTypeFieldName = "exType";
-            const string structApplicationExceptionName = "TApplicationException";
-
-            var struc = new TStruct(structApplicationExceptionName);
-            var field = new TField();
-
-            await outputProtocol.WriteStructBeginAsync(struc, cancellationToken);
-
-            if (!string.IsNullOrEmpty(Message))
-            {
-                field.Name = messageTypeFieldName;
-                field.Type = TType.String;
-                field.ID = MessageTypeFieldId;
-                await outputProtocol.WriteFieldBeginAsync(field, cancellationToken);
-                await outputProtocol.WriteStringAsync(Message, cancellationToken);
-                await outputProtocol.WriteFieldEndAsync(cancellationToken);
-            }
-
-            field.Name = exTypeFieldName;
-            field.Type = TType.I32;
-            field.ID = ExTypeFieldId;
-
-            await outputProtocol.WriteFieldBeginAsync(field, cancellationToken);
-            await outputProtocol.WriteI32Async((int) Type, cancellationToken);
-            await outputProtocol.WriteFieldEndAsync(cancellationToken);
-            await outputProtocol.WriteFieldStopAsync(cancellationToken);
-            await outputProtocol.WriteStructEndAsync(cancellationToken);
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/TBaseClient.cs b/lib/netcore/Thrift/TBaseClient.cs
deleted file mode 100644
index e019251..0000000
--- a/lib/netcore/Thrift/TBaseClient.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols;
-
-namespace Thrift
-{
-    // ReSharper disable once InconsistentNaming
-    /// <summary>
-    ///     TBaseClient.
-    ///     Base client for generated clients.
-    ///     Do not change this class without checking generated code (namings, etc.)
-    /// </summary>
-    public abstract class TBaseClient
-    {
-        private readonly TProtocol _inputProtocol;
-        private readonly TProtocol _outputProtocol;
-        private bool _isDisposed;
-        private int _seqId;
-        public readonly Guid ClientId = Guid.NewGuid();
-
-        protected TBaseClient(TProtocol inputProtocol, TProtocol outputProtocol)
-        {
-            _inputProtocol = inputProtocol ?? throw new ArgumentNullException(nameof(inputProtocol));
-            _outputProtocol = outputProtocol ?? throw new ArgumentNullException(nameof(outputProtocol));
-        }
-
-        public TProtocol InputProtocol => _inputProtocol;
-
-        public TProtocol OutputProtocol => _outputProtocol;
-
-        public int SeqId
-        {
-            get { return ++_seqId; }
-        }
-
-        public virtual async Task OpenTransportAsync()
-        {
-            await OpenTransportAsync(CancellationToken.None);
-        }
-
-        public virtual async Task OpenTransportAsync(CancellationToken cancellationToken)
-        {
-            if (!_inputProtocol.Transport.IsOpen)
-            {
-                await _inputProtocol.Transport.OpenAsync(cancellationToken);
-            }
-
-            if (!_inputProtocol.Transport.IsOpen)
-            {
-                await _outputProtocol.Transport.OpenAsync(cancellationToken);
-            }
-        }
-
-        public void Dispose()
-        {
-            Dispose(true);
-        }
-
-        protected virtual void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    _inputProtocol?.Dispose();
-                    _outputProtocol?.Dispose();
-                }
-            }
-
-            _isDisposed = true;
-        }
-    }
-}
diff --git a/lib/netcore/Thrift/TException.cs b/lib/netcore/Thrift/TException.cs
deleted file mode 100644
index 6aa588d..0000000
--- a/lib/netcore/Thrift/TException.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-
-namespace Thrift
-{
-    // ReSharper disable once InconsistentNaming
-    public class TException : Exception
-    {
-        public TException()
-        {
-        }
-
-        public TException(string message)
-            : base(message)
-        {
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/TMultiplexedProcessor.cs b/lib/netcore/Thrift/TMultiplexedProcessor.cs
deleted file mode 100644
index ad0e749..0000000
--- a/lib/netcore/Thrift/TMultiplexedProcessor.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Protocols;
-using Thrift.Protocols.Entities;
-
-namespace Thrift
-{
-    // ReSharper disable once InconsistentNaming
-    public class TMultiplexedProcessor : ITAsyncProcessor
-    {
-        //TODO: Localization
-
-        private readonly Dictionary<string, ITAsyncProcessor> _serviceProcessorMap =
-            new Dictionary<string, ITAsyncProcessor>();
-
-        public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot)
-        {
-            return await ProcessAsync(iprot, oprot, CancellationToken.None);
-        }
-
-        public async Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<bool>(cancellationToken);
-            }
-
-            try
-            {
-                var message = await iprot.ReadMessageBeginAsync(cancellationToken);
-
-                if ((message.Type != TMessageType.Call) && (message.Type != TMessageType.Oneway))
-                {
-                    await FailAsync(oprot, message, TApplicationException.ExceptionType.InvalidMessageType,
-                        "Message exType CALL or ONEWAY expected", cancellationToken);
-                    return false;
-                }
-
-                // Extract the service name
-                var index = message.Name.IndexOf(TMultiplexedProtocol.Separator, StringComparison.Ordinal);
-                if (index < 0)
-                {
-                    await FailAsync(oprot, message, TApplicationException.ExceptionType.InvalidProtocol,
-                        $"Service name not found in message name: {message.Name}. Did you forget to use a TMultiplexProtocol in your client?",
-                        cancellationToken);
-                    return false;
-                }
-
-                // Create a new TMessage, something that can be consumed by any TProtocol
-                var serviceName = message.Name.Substring(0, index);
-                ITAsyncProcessor actualProcessor;
-                if (!_serviceProcessorMap.TryGetValue(serviceName, out actualProcessor))
-                {
-                    await FailAsync(oprot, message, TApplicationException.ExceptionType.InternalError,
-                        $"Service name not found: {serviceName}. Did you forget to call RegisterProcessor()?",
-                        cancellationToken);
-                    return false;
-                }
-
-                // Create a new TMessage, removing the service name
-                var newMessage = new TMessage(
-                    message.Name.Substring(serviceName.Length + TMultiplexedProtocol.Separator.Length),
-                    message.Type,
-                    message.SeqID);
-
-                // Dispatch processing to the stored processor
-                return
-                    await
-                        actualProcessor.ProcessAsync(new StoredMessageProtocol(iprot, newMessage), oprot,
-                            cancellationToken);
-            }
-            catch (IOException)
-            {
-                return false; // similar to all other processors
-            }
-        }
-
-        public void RegisterProcessor(string serviceName, ITAsyncProcessor processor)
-        {
-            if (_serviceProcessorMap.ContainsKey(serviceName))
-            {
-                throw new InvalidOperationException(
-                    $"Processor map already contains processor with name: '{serviceName}'");
-            }
-
-            _serviceProcessorMap.Add(serviceName, processor);
-        }
-
-        private async Task FailAsync(TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype,
-            string etxt, CancellationToken cancellationToken)
-        {
-            var appex = new TApplicationException(extype, etxt);
-
-            var newMessage = new TMessage(message.Name, TMessageType.Exception, message.SeqID);
-
-            await oprot.WriteMessageBeginAsync(newMessage, cancellationToken);
-            await appex.WriteAsync(oprot, cancellationToken);
-            await oprot.WriteMessageEndAsync(cancellationToken);
-            await oprot.Transport.FlushAsync(cancellationToken);
-        }
-
-        private class StoredMessageProtocol : TProtocolDecorator
-        {
-            readonly TMessage _msgBegin;
-
-            public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin)
-                : base(protocol)
-            {
-                _msgBegin = messageBegin;
-            }
-
-            public override async Task<TMessage> ReadMessageBeginAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<TMessage>(cancellationToken);
-                }
-
-                return _msgBegin;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Thrift.csproj b/lib/netcore/Thrift/Thrift.csproj
deleted file mode 100644
index 6a2ccc3..0000000
--- a/lib/netcore/Thrift/Thrift.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <AssemblyName>Thrift</AssemblyName>
-    <PackageId>Thrift</PackageId>
-    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
-    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
-    <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
-    <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-    <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
-    <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>thrift.snk</AssemblyOriginatorKeyFile>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore" Version="[2.0,)" />
-    <PackageReference Include="Microsoft.Extensions.Logging" Version="[2.0,)" />
-    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="[2.0,)" />
-    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="[2.0,)" />
-    <PackageReference Include="System.IO.Pipes" Version="[4.3,)" />
-    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="4.4.0" />
-    <PackageReference Include="System.Net.NameResolution" Version="[4.3,)" />
-    <PackageReference Include="System.Net.Requests" Version="[4.3,)" />
-    <PackageReference Include="System.Net.Security" Version="[4.3,)" />
-  </ItemGroup>
-
-</Project>
diff --git a/lib/netcore/Thrift/Transports/Client/TBufferedClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TBufferedClientTransport.cs
deleted file mode 100644
index 761f1ac..0000000
--- a/lib/netcore/Thrift/Transports/Client/TBufferedClientTransport.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    // ReSharper disable once InconsistentNaming
-    public class TBufferedClientTransport : TClientTransport
-    {
-        private readonly int _bufSize;
-        private readonly MemoryStream _inputBuffer = new MemoryStream(0);
-        private readonly MemoryStream _outputBuffer = new MemoryStream(0);
-        private readonly TClientTransport _transport;
-        private bool _isDisposed;
-
-        //TODO: should support only specified input transport?
-        public TBufferedClientTransport(TClientTransport transport, int bufSize = 1024)
-        {
-            if (bufSize <= 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(bufSize), "Buffer size must be a positive number.");
-            }
-
-            _transport = transport ?? throw new ArgumentNullException(nameof(transport));
-            _bufSize = bufSize;
-        }
-
-        public TClientTransport UnderlyingTransport
-        {
-            get
-            {
-                CheckNotDisposed();
-
-                return _transport;
-            }
-        }
-
-        public override bool IsOpen => !_isDisposed && _transport.IsOpen;
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            await _transport.OpenAsync(cancellationToken);
-        }
-
-        public override void Close()
-        {
-            CheckNotDisposed();
-
-            _transport.Close();
-        }
-
-        public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            //TODO: investigate how it should work correctly
-            CheckNotDisposed();
-
-            ValidateBufferArgs(buffer, offset, length);
-
-            if (!IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            if (_inputBuffer.Capacity < _bufSize)
-            {
-                _inputBuffer.Capacity = _bufSize;
-            }
-
-            var got = await _inputBuffer.ReadAsync(buffer, offset, length, cancellationToken);
-            if (got > 0)
-            {
-                return got;
-            }
-
-            _inputBuffer.Seek(0, SeekOrigin.Begin);
-            _inputBuffer.SetLength(_inputBuffer.Capacity);
-
-            ArraySegment<byte> bufSegment;
-            _inputBuffer.TryGetBuffer(out bufSegment);
-
-            // investigate
-            var filled = await _transport.ReadAsync(bufSegment.Array, 0, (int) _inputBuffer.Length, cancellationToken);
-            _inputBuffer.SetLength(filled);
-
-            if (filled == 0)
-            {
-                return 0;
-            }
-
-            return await ReadAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            ValidateBufferArgs(buffer, offset, length);
-
-            if (!IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            // Relative offset from "off" argument
-            var writtenCount = 0;
-            if (_outputBuffer.Length > 0)
-            {
-                var capa = (int) (_outputBuffer.Capacity - _outputBuffer.Length);
-                var writeSize = capa <= length ? capa : length;
-                await _outputBuffer.WriteAsync(buffer, offset, writeSize, cancellationToken);
-
-                writtenCount += writeSize;
-                if (writeSize == capa)
-                {
-                    //ArraySegment<byte> bufSegment;
-                    //_outputBuffer.TryGetBuffer(out bufSegment);
-                    var data = _outputBuffer.ToArray();
-                    //await _transport.WriteAsync(bufSegment.Array, cancellationToken);
-                    await _transport.WriteAsync(data, cancellationToken);
-                    _outputBuffer.SetLength(0);
-                }
-            }
-
-            while (length - writtenCount >= _bufSize)
-            {
-                await _transport.WriteAsync(buffer, offset + writtenCount, _bufSize, cancellationToken);
-                writtenCount += _bufSize;
-            }
-
-            var remain = length - writtenCount;
-            if (remain > 0)
-            {
-                if (_outputBuffer.Capacity < _bufSize)
-                {
-                    _outputBuffer.Capacity = _bufSize;
-                }
-                await _outputBuffer.WriteAsync(buffer, offset + writtenCount, remain, cancellationToken);
-            }
-        }
-
-        public override async Task FlushAsync(CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            if (!IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            if (_outputBuffer.Length > 0)
-            {
-                //ArraySegment<byte> bufSegment;
-                var data = _outputBuffer.ToArray(); // TryGetBuffer(out bufSegment);
-
-                await _transport.WriteAsync(data /*bufSegment.Array*/, cancellationToken);
-                _outputBuffer.SetLength(0);
-            }
-
-            await _transport.FlushAsync(cancellationToken);
-        }
-
-        private void CheckNotDisposed()
-        {
-            if (_isDisposed)
-            {
-                throw new ObjectDisposedException(nameof(_transport));
-            }
-        }
-
-        // IDisposable
-        protected override void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    _inputBuffer?.Dispose();
-                    _outputBuffer?.Dispose();
-                    _transport?.Dispose();
-                }
-            }
-            _isDisposed = true;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Client/TFramedClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TFramedClientTransport.cs
deleted file mode 100644
index d11bb95..0000000
--- a/lib/netcore/Thrift/Transports/Client/TFramedClientTransport.cs
+++ /dev/null
@@ -1,201 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    //TODO: check for correct implementation 
-
-    // ReSharper disable once InconsistentNaming
-    public class TFramedClientTransport : TClientTransport
-    {
-        private const int HeaderSize = 4;
-        private readonly byte[] _headerBuf = new byte[HeaderSize];
-        private readonly MemoryStream _readBuffer = new MemoryStream(1024);
-        private readonly TClientTransport _transport;
-        private readonly MemoryStream _writeBuffer = new MemoryStream(1024);
-
-        private bool _isDisposed;
-
-        public TFramedClientTransport(TClientTransport transport)
-        {
-            _transport = transport ?? throw new ArgumentNullException(nameof(transport));
-
-            InitWriteBuffer();
-        }
-
-        public override bool IsOpen => !_isDisposed && _transport.IsOpen;
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            await _transport.OpenAsync(cancellationToken);
-        }
-
-        public override void Close()
-        {
-            CheckNotDisposed();
-
-            _transport.Close();
-        }
-
-        public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            ValidateBufferArgs(buffer, offset, length);
-
-            if (!IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            var got = await _readBuffer.ReadAsync(buffer, offset, length, cancellationToken);
-            if (got > 0)
-            {
-                return got;
-            }
-
-            // Read another frame of data
-            await ReadFrameAsync(cancellationToken);
-
-            return await _readBuffer.ReadAsync(buffer, offset, length, cancellationToken);
-        }
-
-        private async Task ReadFrameAsync(CancellationToken cancellationToken)
-        {
-            await _transport.ReadAllAsync(_headerBuf, 0, HeaderSize, cancellationToken);
-
-            var size = DecodeFrameSize(_headerBuf);
-
-            _readBuffer.SetLength(size);
-            _readBuffer.Seek(0, SeekOrigin.Begin);
-
-            ArraySegment<byte> bufSegment;
-            _readBuffer.TryGetBuffer(out bufSegment);
-
-            var buff = bufSegment.Array;
-
-            await _transport.ReadAllAsync(buff, 0, size, cancellationToken);
-        }
-
-        public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            ValidateBufferArgs(buffer, offset, length);
-
-            if (!IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            if (_writeBuffer.Length + length > int.MaxValue)
-            {
-                await FlushAsync(cancellationToken);
-            }
-
-            await _writeBuffer.WriteAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task FlushAsync(CancellationToken cancellationToken)
-        {
-            CheckNotDisposed();
-
-            if (!IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            //ArraySegment<byte> bufSegment;
-            //_writeBuffer.TryGetBuffer(out bufSegment);
-            //var buf = bufSegment.Array;
-            var buf = _writeBuffer.ToArray();
-
-            //var len = (int)_writeBuffer.Length;
-            var dataLen = (int) _writeBuffer.Length - HeaderSize;
-            if (dataLen < 0)
-            {
-                throw new InvalidOperationException(); // logic error actually
-            }
-
-            // Inject message header into the reserved buffer space
-            EncodeFrameSize(dataLen, buf);
-
-            // Send the entire message at once
-            await _transport.WriteAsync(buf, cancellationToken);
-
-            InitWriteBuffer();
-
-            await _transport.FlushAsync(cancellationToken);
-        }
-
-        private void InitWriteBuffer()
-        {
-            // Reserve space for message header to be put right before sending it out
-            _writeBuffer.SetLength(HeaderSize);
-            _writeBuffer.Seek(0, SeekOrigin.End);
-        }
-
-        private static void EncodeFrameSize(int frameSize, byte[] buf)
-        {
-            buf[0] = (byte) (0xff & (frameSize >> 24));
-            buf[1] = (byte) (0xff & (frameSize >> 16));
-            buf[2] = (byte) (0xff & (frameSize >> 8));
-            buf[3] = (byte) (0xff & (frameSize));
-        }
-
-        private static int DecodeFrameSize(byte[] buf)
-        {
-            return
-                ((buf[0] & 0xff) << 24) |
-                ((buf[1] & 0xff) << 16) |
-                ((buf[2] & 0xff) << 8) |
-                (buf[3] & 0xff);
-        }
-
-
-        private void CheckNotDisposed()
-        {
-            if (_isDisposed)
-            {
-                throw new ObjectDisposedException("TFramedClientTransport");
-            }
-        }
-
-        // IDisposable
-        protected override void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    _readBuffer?.Dispose();
-                    _writeBuffer?.Dispose();
-                    _transport?.Dispose();
-                }
-            }
-            _isDisposed = true;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs b/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs
deleted file mode 100644
index b2ff804..0000000
--- a/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    // ReSharper disable once InconsistentNaming
-    public class THttpClientTransport : TClientTransport
-    {
-        private readonly X509Certificate[] _certificates;
-        private readonly Uri _uri;
-
-        // Timeouts in milliseconds
-        private int _connectTimeout = 30000;
-        private HttpClient _httpClient;
-        private Stream _inputStream;
-
-        private bool _isDisposed;
-        private MemoryStream _outputStream = new MemoryStream();
-
-        public THttpClientTransport(Uri u, IDictionary<string, string> customHeaders)
-            : this(u, Enumerable.Empty<X509Certificate>(), customHeaders)
-        {
-        }
-
-        public THttpClientTransport(Uri u, IEnumerable<X509Certificate> certificates,
-            IDictionary<string, string> customHeaders)
-        {
-            _uri = u;
-            _certificates = (certificates ?? Enumerable.Empty<X509Certificate>()).ToArray();
-            CustomHeaders = customHeaders;
-
-            // due to current bug with performance of Dispose in netcore https://github.com/dotnet/corefx/issues/8809
-            // this can be switched to default way (create client->use->dispose per flush) later
-            _httpClient = CreateClient();
-        }
-
-        public IDictionary<string, string> CustomHeaders { get; }
-
-        public int ConnectTimeout
-        {
-            set { _connectTimeout = value; }
-            get { return _connectTimeout; }
-        }
-
-        public override bool IsOpen => true;
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override void Close()
-        {
-            if (_inputStream != null)
-            {
-                _inputStream.Dispose();
-                _inputStream = null;
-            }
-
-            if (_outputStream != null)
-            {
-                _outputStream.Dispose();
-                _outputStream = null;
-            }
-
-            if (_httpClient != null)
-            {
-                _httpClient.Dispose();
-                _httpClient = null;
-            }
-        }
-
-        public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<int>(cancellationToken);
-            }
-
-            if (_inputStream == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No request has been sent");
-            }
-
-            try
-            {
-                var ret = await _inputStream.ReadAsync(buffer, offset, length, cancellationToken);
-
-                if (ret == -1)
-                {
-                    throw new TTransportException(TTransportException.ExceptionType.EndOfFile, "No more data available");
-                }
-
-                return ret;
-            }
-            catch (IOException iox)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.Unknown, iox.ToString());
-            }
-        }
-
-        public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            await _outputStream.WriteAsync(buffer, offset, length, cancellationToken);
-        }
-
-        private HttpClient CreateClient()
-        {
-            var handler = new HttpClientHandler();
-            handler.ClientCertificates.AddRange(_certificates);
-
-            var httpClient = new HttpClient(handler);
-
-            if (_connectTimeout > 0)
-            {
-                httpClient.Timeout = TimeSpan.FromMilliseconds(_connectTimeout);
-            }
-
-            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-thrift"));
-            httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("THttpClientTransport", "0.14.0"));
-
-            if (CustomHeaders != null)
-            {
-                foreach (var item in CustomHeaders)
-                {
-                    httpClient.DefaultRequestHeaders.Add(item.Key, item.Value);
-                }
-            }
-
-            return httpClient;
-        }
-
-        public override async Task FlushAsync(CancellationToken cancellationToken)
-        {
-            try
-            {
-                try
-                {
-                    if (_outputStream.CanSeek)
-                    {
-                        _outputStream.Seek(0, SeekOrigin.Begin);
-                    }
-
-                    using (var outStream = new StreamContent(_outputStream))
-                    {
-                        var msg = await _httpClient.PostAsync(_uri, outStream, cancellationToken);
-
-                        msg.EnsureSuccessStatusCode();
-
-                        if (_inputStream != null)
-                        {
-                            _inputStream.Dispose();
-                            _inputStream = null;
-                        }
-
-                        _inputStream = await msg.Content.ReadAsStreamAsync();
-                        if (_inputStream.CanSeek)
-                        {
-                            _inputStream.Seek(0, SeekOrigin.Begin);
-                        }
-                    }
-                }
-                catch (IOException iox)
-                {
-                    throw new TTransportException(TTransportException.ExceptionType.Unknown, iox.ToString());
-                }
-                catch (HttpRequestException wx)
-                {
-                    throw new TTransportException(TTransportException.ExceptionType.Unknown,
-                        "Couldn't connect to server: " + wx);
-                }
-            }
-            finally
-            {
-                _outputStream = new MemoryStream();
-            }
-        }
-
-        // IDisposable
-        protected override void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    _inputStream?.Dispose();
-                    _outputStream?.Dispose();
-                    _httpClient?.Dispose();
-                }
-            }
-            _isDisposed = true;
-        }
-    }
-}
diff --git a/lib/netcore/Thrift/Transports/Client/TMemoryBufferClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TMemoryBufferClientTransport.cs
deleted file mode 100644
index 46a55a6..0000000
--- a/lib/netcore/Thrift/Transports/Client/TMemoryBufferClientTransport.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    // ReSharper disable once InconsistentNaming
-    public class TMemoryBufferClientTransport : TClientTransport
-    {
-        private readonly MemoryStream _byteStream;
-        private bool _isDisposed;
-
-        public TMemoryBufferClientTransport()
-        {
-            _byteStream = new MemoryStream();
-        }
-
-        public TMemoryBufferClientTransport(byte[] buf)
-        {
-            _byteStream = new MemoryStream(buf);
-        }
-
-        public override bool IsOpen => true;
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override void Close()
-        {
-            /** do nothing **/
-        }
-
-        public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            return await _byteStream.ReadAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task WriteAsync(byte[] buffer, CancellationToken cancellationToken)
-        {
-            await _byteStream.WriteAsync(buffer, 0, buffer.Length, cancellationToken);
-        }
-
-        public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
-        {
-            await _byteStream.WriteAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task FlushAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public byte[] GetBuffer()
-        {
-            return _byteStream.ToArray();
-        }
-
-        // IDisposable
-        protected override void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    _byteStream?.Dispose();
-                }
-            }
-            _isDisposed = true;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Client/TNamedPipeClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TNamedPipeClientTransport.cs
deleted file mode 100644
index f5e4baf..0000000
--- a/lib/netcore/Thrift/Transports/Client/TNamedPipeClientTransport.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.IO.Pipes;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    // ReSharper disable once InconsistentNaming
-    public class TNamedPipeClientTransport : TClientTransport
-    {
-        private NamedPipeClientStream _client;
-
-        public TNamedPipeClientTransport(string pipe) : this(".", pipe)
-        {
-        }
-
-        public TNamedPipeClientTransport(string server, string pipe)
-        {
-            var serverName = string.IsNullOrWhiteSpace(server) ? server : ".";
-
-            _client = new NamedPipeClientStream(serverName, pipe, PipeDirection.InOut, PipeOptions.None);
-        }
-
-        public override bool IsOpen => _client != null && _client.IsConnected;
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            if (IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen);
-            }
-
-            await _client.ConnectAsync(cancellationToken);
-        }
-
-        public override void Close()
-        {
-            if (_client != null)
-            {
-                _client.Dispose();
-                _client = null;
-            }
-        }
-
-        public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            if (_client == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            return await _client.ReadAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
-        {
-            if (_client == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-            }
-
-            await _client.WriteAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task FlushAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        protected override void Dispose(bool disposing)
-        {
-            _client.Dispose();
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Client/TSocketClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TSocketClientTransport.cs
deleted file mode 100644
index e769d14..0000000
--- a/lib/netcore/Thrift/Transports/Client/TSocketClientTransport.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    // ReSharper disable once InconsistentNaming
-    public class TSocketClientTransport : TStreamClientTransport
-    {
-        private bool _isDisposed;
-
-        public TSocketClientTransport(TcpClient client)
-        {
-            TcpClient = client ?? throw new ArgumentNullException(nameof(client));
-
-            if (IsOpen)
-            {
-                InputStream = client.GetStream();
-                OutputStream = client.GetStream();
-            }
-        }
-
-        public TSocketClientTransport(IPAddress host, int port)
-            : this(host, port, 0)
-        {
-        }
-
-        public TSocketClientTransport(IPAddress host, int port, int timeout)
-        {
-            Host = host;
-            Port = port;
-
-            TcpClient = new TcpClient();
-            TcpClient.ReceiveTimeout = TcpClient.SendTimeout = timeout;
-            TcpClient.Client.NoDelay = true;
-        }
-
-        public TcpClient TcpClient { get; private set; }
-        public IPAddress Host { get; }
-        public int Port { get; }
-
-        public int Timeout
-        {
-            set
-            {
-                if (TcpClient != null)
-                {
-                    TcpClient.ReceiveTimeout = TcpClient.SendTimeout = value;
-                }
-            }
-        }
-
-        public override bool IsOpen
-        {
-            get
-            {
-                if (TcpClient == null)
-                {
-                    return false;
-                }
-
-                return TcpClient.Connected;
-            }
-        }
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-
-            if (IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected");
-            }
-
-            if (Port <= 0)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port");
-            }
-
-            if (TcpClient == null)
-            {
-                throw new InvalidOperationException("Invalid or not initialized tcp client");
-            }
-
-            await TcpClient.ConnectAsync(Host, Port);
-
-            InputStream = TcpClient.GetStream();
-            OutputStream = TcpClient.GetStream();
-        }
-
-        public override void Close()
-        {
-            base.Close();
-
-            if (TcpClient != null)
-            {
-                TcpClient.Dispose();
-                TcpClient = null;
-            }
-        }
-
-        // IDisposable
-        protected override void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    TcpClient?.Dispose();
-
-                    base.Dispose(disposing);
-                }
-            }
-            _isDisposed = true;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Client/TStreamClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TStreamClientTransport.cs
deleted file mode 100644
index be2011e..0000000
--- a/lib/netcore/Thrift/Transports/Client/TStreamClientTransport.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    // ReSharper disable once InconsistentNaming
-    public class TStreamClientTransport : TClientTransport
-    {
-        private bool _isDisposed;
-
-        protected TStreamClientTransport()
-        {
-        }
-
-        public TStreamClientTransport(Stream inputStream, Stream outputStream)
-        {
-            InputStream = inputStream;
-            OutputStream = outputStream;
-        }
-
-        protected Stream OutputStream { get; set; }
-
-        protected Stream InputStream { get; set; }
-
-        public override bool IsOpen => true;
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                await Task.FromCanceled(cancellationToken);
-            }
-        }
-
-        public override void Close()
-        {
-            if (InputStream != null)
-            {
-                InputStream.Dispose();
-                InputStream = null;
-            }
-
-            if (OutputStream != null)
-            {
-                OutputStream.Dispose();
-                OutputStream = null;
-            }
-        }
-
-        public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            if (InputStream == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen,
-                    "Cannot read from null inputstream");
-            }
-
-            return await InputStream.ReadAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task WriteAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken)
-        {
-            if (OutputStream == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen,
-                    "Cannot write to null outputstream");
-            }
-
-            await OutputStream.WriteAsync(buffer, offset, length, cancellationToken);
-        }
-
-        public override async Task FlushAsync(CancellationToken cancellationToken)
-        {
-            await OutputStream.FlushAsync(cancellationToken);
-        }
-
-        // IDisposable
-        protected override void Dispose(bool disposing)
-        {
-            if (!_isDisposed)
-            {
-                if (disposing)
-                {
-                    InputStream?.Dispose();
-                    OutputStream?.Dispose();
-                }
-            }
-            _isDisposed = true;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Client/TTlsSocketClientTransport.cs b/lib/netcore/Thrift/Transports/Client/TTlsSocketClientTransport.cs
deleted file mode 100644
index c8be4ed..0000000
--- a/lib/netcore/Thrift/Transports/Client/TTlsSocketClientTransport.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Net;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Client
-{
-    //TODO: check for correct work
-
-    // ReSharper disable once InconsistentNaming
-    public class TTlsSocketClientTransport : TStreamClientTransport
-    {
-        private readonly X509Certificate2 _certificate;
-        private readonly RemoteCertificateValidationCallback _certValidator;
-        private readonly IPAddress _host;
-        private readonly bool _isServer;
-        private readonly LocalCertificateSelectionCallback _localCertificateSelectionCallback;
-        private readonly int _port;
-        private readonly SslProtocols _sslProtocols;
-        private TcpClient _client;
-        private SslStream _secureStream;
-        private int _timeout;
-
-        public TTlsSocketClientTransport(TcpClient client, X509Certificate2 certificate, bool isServer = false,
-            RemoteCertificateValidationCallback certValidator = null,
-            LocalCertificateSelectionCallback localCertificateSelectionCallback = null,
-            SslProtocols sslProtocols = SslProtocols.Tls12)
-        {
-            _client = client;
-            _certificate = certificate;
-            _certValidator = certValidator;
-            _localCertificateSelectionCallback = localCertificateSelectionCallback;
-            _sslProtocols = sslProtocols;
-            _isServer = isServer;
-
-            if (isServer && certificate == null)
-            {
-                throw new ArgumentException("TTlsSocketClientTransport needs certificate to be used for server",
-                    nameof(certificate));
-            }
-
-            if (IsOpen)
-            {
-                InputStream = client.GetStream();
-                OutputStream = client.GetStream();
-            }
-        }
-
-        public TTlsSocketClientTransport(IPAddress host, int port, string certificatePath,
-            RemoteCertificateValidationCallback certValidator = null,
-            LocalCertificateSelectionCallback localCertificateSelectionCallback = null,
-            SslProtocols sslProtocols = SslProtocols.Tls12)
-            : this(host, port, 0,
-                new X509Certificate2(certificatePath),
-                certValidator,
-                localCertificateSelectionCallback,
-                sslProtocols)
-        {
-        }
-
-        public TTlsSocketClientTransport(IPAddress host, int port,
-            X509Certificate2 certificate = null,
-            RemoteCertificateValidationCallback certValidator = null,
-            LocalCertificateSelectionCallback localCertificateSelectionCallback = null,
-            SslProtocols sslProtocols = SslProtocols.Tls12)
-            : this(host, port, 0,
-                certificate,
-                certValidator,
-                localCertificateSelectionCallback,
-                sslProtocols)
-        {
-        }
-
-        public TTlsSocketClientTransport(IPAddress host, int port, int timeout,
-            X509Certificate2 certificate,
-            RemoteCertificateValidationCallback certValidator = null,
-            LocalCertificateSelectionCallback localCertificateSelectionCallback = null,
-            SslProtocols sslProtocols = SslProtocols.Tls12)
-        {
-            _host = host;
-            _port = port;
-            _timeout = timeout;
-            _certificate = certificate;
-            _certValidator = certValidator;
-            _localCertificateSelectionCallback = localCertificateSelectionCallback;
-            _sslProtocols = sslProtocols;
-
-            InitSocket();
-        }
-
-        public int Timeout
-        {
-            set { _client.ReceiveTimeout = _client.SendTimeout = _timeout = value; }
-        }
-
-        public TcpClient TcpClient => _client;
-
-        public IPAddress Host => _host;
-
-        public int Port => _port;
-
-        public override bool IsOpen
-        {
-            get
-            {
-                if (_client == null)
-                {
-                    return false;
-                }
-
-                return _client.Connected;
-            }
-        }
-
-        private void InitSocket()
-        {
-            _client = new TcpClient();
-            _client.ReceiveTimeout = _client.SendTimeout = _timeout;
-            _client.Client.NoDelay = true;
-        }
-
-        private bool DefaultCertificateValidator(object sender, X509Certificate certificate, X509Chain chain,
-            SslPolicyErrors sslValidationErrors)
-        {
-            return sslValidationErrors == SslPolicyErrors.None;
-        }
-
-        public override async Task OpenAsync(CancellationToken cancellationToken)
-        {
-            if (IsOpen)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected");
-            }
-
-            if (_host == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host");
-            }
-
-            if (_port <= 0)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port");
-            }
-
-            if (_client == null)
-            {
-                InitSocket();
-            }
-
-            if (_client != null)
-            {
-                await _client.ConnectAsync(_host, _port);
-                await SetupTlsAsync();
-            }
-        }
-
-        public async Task SetupTlsAsync()
-        {
-            var validator = _certValidator ?? DefaultCertificateValidator;
-
-            if (_localCertificateSelectionCallback != null)
-            {
-                _secureStream = new SslStream(_client.GetStream(), false, validator, _localCertificateSelectionCallback);
-            }
-            else
-            {
-                _secureStream = new SslStream(_client.GetStream(), false, validator);
-            }
-
-            try
-            {
-                if (_isServer)
-                {
-                    // Server authentication
-                    await
-                        _secureStream.AuthenticateAsServerAsync(_certificate, _certValidator != null, _sslProtocols,
-                            true);
-                }
-                else
-                {
-                    // Client authentication
-                    var certs = _certificate != null
-                        ? new X509CertificateCollection {_certificate}
-                        : new X509CertificateCollection();
-
-                    var targetHost = _host.ToString();
-                    await _secureStream.AuthenticateAsClientAsync(targetHost, certs, _sslProtocols, true);
-                }
-            }
-            catch (Exception)
-            {
-                Close();
-                throw;
-            }
-
-            InputStream = _secureStream;
-            OutputStream = _secureStream;
-        }
-
-        public override void Close()
-        {
-            base.Close();
-            if (_client != null)
-            {
-                _client.Dispose();
-                _client = null;
-            }
-
-            if (_secureStream != null)
-            {
-                _secureStream.Dispose();
-                _secureStream = null;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Server/THttpServerTransport.cs b/lib/netcore/Thrift/Transports/Server/THttpServerTransport.cs
deleted file mode 100644
index 032063a..0000000
--- a/lib/netcore/Thrift/Transports/Server/THttpServerTransport.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Thrift.Protocols;
-using Thrift.Transports.Client;
-
-namespace Thrift.Transports.Server
-{
-    // ReSharper disable once InconsistentNaming
-    public class THttpServerTransport
-    {
-        protected const string ContentType = "application/x-thrift";
-        private readonly ILogger _logger;
-        private readonly RequestDelegate _next;
-        protected Encoding Encoding = Encoding.UTF8;
-
-        protected ITProtocolFactory InputProtocolFactory;
-        protected ITProtocolFactory OutputProtocolFactory;
-
-        protected ITAsyncProcessor Processor;
-
-        public THttpServerTransport(ITAsyncProcessor processor, RequestDelegate next, ILoggerFactory loggerFactory)
-            : this(processor, new TBinaryProtocol.Factory(), next, loggerFactory)
-        {
-        }
-
-        public THttpServerTransport(ITAsyncProcessor processor, ITProtocolFactory protocolFactory, RequestDelegate next,
-            ILoggerFactory loggerFactory)
-            : this(processor, protocolFactory, protocolFactory, next, loggerFactory)
-        {
-        }
-
-        public THttpServerTransport(ITAsyncProcessor processor, ITProtocolFactory inputProtocolFactory,
-            ITProtocolFactory outputProtocolFactory, RequestDelegate next, ILoggerFactory loggerFactory)
-        {
-            if (loggerFactory == null)
-            {
-                throw new ArgumentNullException(nameof(loggerFactory));
-            }
-
-            Processor = processor ?? throw new ArgumentNullException(nameof(processor));
-            InputProtocolFactory = inputProtocolFactory ?? throw new ArgumentNullException(nameof(inputProtocolFactory));
-            OutputProtocolFactory = outputProtocolFactory ?? throw new ArgumentNullException(nameof(outputProtocolFactory));
-
-            _next = next;
-            _logger = loggerFactory.CreateLogger<THttpServerTransport>();
-        }
-
-        public async Task Invoke(HttpContext context)
-        {
-            context.Response.ContentType = ContentType;
-            await ProcessRequestAsync(context, context.RequestAborted); //TODO: check for correct logic
-        }
-
-        public async Task ProcessRequestAsync(HttpContext context, CancellationToken cancellationToken)
-        {
-            var transport = new TStreamClientTransport(context.Request.Body, context.Response.Body);
-
-            try
-            {
-                var input = InputProtocolFactory.GetProtocol(transport);
-                var output = OutputProtocolFactory.GetProtocol(transport);
-
-                while (await Processor.ProcessAsync(input, output, cancellationToken))
-                {
-                }
-            }
-            catch (TTransportException)
-            {
-                // Client died, just move on
-            }
-            finally
-            {
-                transport.Close();
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Server/TNamedPipeServerTransport.cs b/lib/netcore/Thrift/Transports/Server/TNamedPipeServerTransport.cs
deleted file mode 100644
index 186786e..0000000
--- a/lib/netcore/Thrift/Transports/Server/TNamedPipeServerTransport.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.IO.Pipes;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports.Server
-{
-    // ReSharper disable once InconsistentNaming
-    public class TNamedPipeServerTransport : TServerTransport
-    {
-        /// <summary>
-        ///     This is the address of the Pipe on the localhost.
-        /// </summary>
-        private readonly string _pipeAddress;
-
-        private bool _asyncMode = true;
-        private volatile bool _isPending = true;
-
-        private NamedPipeServerStream _stream = null;
-
-        public TNamedPipeServerTransport(string pipeAddress)
-        {
-            _pipeAddress = pipeAddress;
-        }
-
-        public override void Listen()
-        {
-            // nothing to do here
-        }
-
-        public override void Close()
-        {
-            if (_stream != null)
-            {
-                try
-                {
-                    //TODO: check for disconection 
-                    _stream.Disconnect();
-                    _stream.Dispose();
-                }
-                finally
-                {
-                    _stream = null;
-                    _isPending = false;
-                }
-            }
-        }
-
-        public override bool IsClientPending()
-        {
-            return _isPending;
-        }
-
-        private void EnsurePipeInstance()
-        {
-            if (_stream == null)
-            {
-                var direction = PipeDirection.InOut;
-                var maxconn = 254;
-                var mode = PipeTransmissionMode.Byte;
-                var options = _asyncMode ? PipeOptions.Asynchronous : PipeOptions.None;
-                var inbuf = 4096;
-                var outbuf = 4096;
-                // TODO: security
-
-                try
-                {
-                    _stream = new NamedPipeServerStream(_pipeAddress, direction, maxconn, mode, options, inbuf, outbuf);
-                }
-                catch (NotImplementedException) // Mono still does not support async, fallback to sync
-                {
-                    if (_asyncMode)
-                    {
-                        options &= (~PipeOptions.Asynchronous);
-                        _stream = new NamedPipeServerStream(_pipeAddress, direction, maxconn, mode, options, inbuf,
-                            outbuf);
-                        _asyncMode = false;
-                    }
-                    else
-                    {
-                        throw;
-                    }
-                }
-            }
-        }
-
-        protected override async Task<TClientTransport> AcceptImplementationAsync(CancellationToken cancellationToken)
-        {
-            try
-            {
-                EnsurePipeInstance();
-
-                await _stream.WaitForConnectionAsync(cancellationToken);
-
-                var trans = new ServerTransport(_stream);
-                _stream = null; // pass ownership to ServerTransport
-
-                //_isPending = false;
-
-                return trans;
-            }
-            catch (TTransportException)
-            {
-                Close();
-                throw;
-            }
-            catch (Exception e)
-            {
-                Close();
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, e.Message);
-            }
-        }
-
-        private class ServerTransport : TClientTransport
-        {
-            private readonly NamedPipeServerStream _stream;
-
-            public ServerTransport(NamedPipeServerStream stream)
-            {
-                _stream = stream;
-            }
-
-            public override bool IsOpen => _stream != null && _stream.IsConnected;
-
-            public override async Task OpenAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
-            }
-
-            public override void Close()
-            {
-                _stream?.Dispose();
-            }
-
-            public override async Task<int> ReadAsync(byte[] buffer, int offset, int length,
-                CancellationToken cancellationToken)
-            {
-                if (_stream == null)
-                {
-                    throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-                }
-
-                return await _stream.ReadAsync(buffer, offset, length, cancellationToken);
-            }
-
-            public override async Task WriteAsync(byte[] buffer, int offset, int length,
-                CancellationToken cancellationToken)
-            {
-                if (_stream == null)
-                {
-                    throw new TTransportException(TTransportException.ExceptionType.NotOpen);
-                }
-
-                await _stream.WriteAsync(buffer, offset, length, cancellationToken);
-            }
-
-            public override async Task FlushAsync(CancellationToken cancellationToken)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    await Task.FromCanceled(cancellationToken);
-                }
-            }
-
-            protected override void Dispose(bool disposing)
-            {
-                _stream?.Dispose();
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Server/TServerFramedTransport.cs b/lib/netcore/Thrift/Transports/Server/TServerFramedTransport.cs
deleted file mode 100644
index 0b86e9e..0000000
--- a/lib/netcore/Thrift/Transports/Server/TServerFramedTransport.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Transports.Client;
-
-namespace Thrift.Transports.Server
-{
-    // ReSharper disable once InconsistentNaming
-    public class TServerFramedTransport : TServerTransport
-    {
-        private readonly int _clientTimeout;
-        private readonly int _port;
-        private TcpListener _server;
-
-        public TServerFramedTransport(TcpListener listener)
-            : this(listener, 0)
-        {
-        }
-
-        public TServerFramedTransport(TcpListener listener, int clientTimeout)
-        {
-            _server = listener;
-            _clientTimeout = clientTimeout;
-        }
-
-        public TServerFramedTransport(int port)
-            : this(port, 0)
-        {
-        }
-
-        public TServerFramedTransport(int port, int clientTimeout)
-        {
-            _port = port;
-            _clientTimeout = clientTimeout;
-            try
-            {
-                // Make server socket
-                _server = new TcpListener(IPAddress.Any, _port);
-                _server.Server.NoDelay = true;
-            }
-            catch (Exception)
-            {
-                _server = null;
-                throw new TTransportException("Could not create ServerSocket on port " + port + ".");
-            }
-        }
-
-        public override void Listen()
-        {
-            // Make sure not to block on accept
-            if (_server != null)
-            {
-                try
-                {
-                    _server.Start();
-                }
-                catch (SocketException sx)
-                {
-                    throw new TTransportException("Could not accept on listening socket: " + sx.Message);
-                }
-            }
-        }
-
-        public override bool IsClientPending()
-        {
-            return _server.Pending();
-        }
-
-        protected override async Task<TClientTransport> AcceptImplementationAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TClientTransport>(cancellationToken);
-            }
-
-            if (_server == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
-            }
-
-            try
-            {
-                TFramedClientTransport tSocketTransport = null;
-                var tcpClient = await _server.AcceptTcpClientAsync();
-
-                try
-                {
-                    tSocketTransport = new TFramedClientTransport(new TSocketClientTransport(tcpClient)
-                    {
-                        Timeout = _clientTimeout
-                    });
-
-                    return tSocketTransport;
-                }
-                catch (Exception)
-                {
-                    if (tSocketTransport != null)
-                    {
-                        tSocketTransport.Dispose();
-                    }
-                    else //  Otherwise, clean it up ourselves.
-                    {
-                        ((IDisposable) tcpClient).Dispose();
-                    }
-
-                    throw;
-                }
-            }
-            catch (Exception ex)
-            {
-                throw new TTransportException(ex.ToString());
-            }
-        }
-
-        public override void Close()
-        {
-            if (_server != null)
-            {
-                try
-                {
-                    _server.Stop();
-                }
-                catch (Exception ex)
-                {
-                    throw new TTransportException("WARNING: Could not close server socket: " + ex);
-                }
-                _server = null;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Server/TServerSocketTransport.cs b/lib/netcore/Thrift/Transports/Server/TServerSocketTransport.cs
deleted file mode 100644
index 3a9d8a1..0000000
--- a/lib/netcore/Thrift/Transports/Server/TServerSocketTransport.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Transports.Client;
-
-namespace Thrift.Transports.Server
-{
-    // ReSharper disable once InconsistentNaming
-    public class TServerSocketTransport : TServerTransport
-    {
-        private readonly int _clientTimeout;
-        private readonly int _port;
-        private readonly bool _useBufferedSockets;
-        private readonly bool _useFramedTransport;
-        private TcpListener _server;
-
-        public TServerSocketTransport(TcpListener listener)
-            : this(listener, 0)
-        {
-        }
-
-        public TServerSocketTransport(TcpListener listener, int clientTimeout)
-        {
-            _server = listener;
-            _clientTimeout = clientTimeout;
-        }
-
-        public TServerSocketTransport(int port)
-            : this(port, 0)
-        {
-        }
-
-        public TServerSocketTransport(int port, int clientTimeout)
-            : this(port, clientTimeout, false)
-        {
-        }
-
-        public TServerSocketTransport(int port, int clientTimeout, bool useBufferedSockets):
-            this(port, clientTimeout, useBufferedSockets, false)
-        {
-        }
-        
-        public TServerSocketTransport(int port, int clientTimeout, bool useBufferedSockets, bool useFramedTransport)
-        {
-            _port = port;
-            _clientTimeout = clientTimeout;
-            _useBufferedSockets = useBufferedSockets;
-            _useFramedTransport = useFramedTransport;
-            try
-            {
-                // Make server socket
-                _server = new TcpListener(IPAddress.Any, _port);
-                _server.Server.NoDelay = true;
-            }
-            catch (Exception)
-            {
-                _server = null;
-                throw new TTransportException("Could not create ServerSocket on port " + port + ".");
-            }
-        }
-
-        public override void Listen()
-        {
-            // Make sure not to block on accept
-            if (_server != null)
-            {
-                try
-                {
-                    _server.Start();
-                }
-                catch (SocketException sx)
-                {
-                    throw new TTransportException("Could not accept on listening socket: " + sx.Message);
-                }
-            }
-        }
-
-        public override bool IsClientPending()
-        {
-            return _server.Pending();
-        }
-
-        protected override async Task<TClientTransport> AcceptImplementationAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TClientTransport>(cancellationToken);
-            }
-
-            if (_server == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
-            }
-
-            try
-            {
-                TClientTransport tSocketTransport = null;
-                var tcpClient = await _server.AcceptTcpClientAsync();
-
-                try
-                {
-                    tSocketTransport = new TSocketClientTransport(tcpClient)
-                    {
-                        Timeout = _clientTimeout
-                    };
-
-                    if (_useBufferedSockets)
-                    {
-                        tSocketTransport = new TBufferedClientTransport(tSocketTransport);
-                    }
-
-                    if (_useFramedTransport)
-                    {
-                        tSocketTransport = new TFramedClientTransport(tSocketTransport);
-                    }
-
-                    return tSocketTransport;
-                }
-                catch (Exception)
-                {
-                    if (tSocketTransport != null)
-                    {
-                        tSocketTransport.Dispose();
-                    }
-                    else //  Otherwise, clean it up ourselves.
-                    {
-                        ((IDisposable) tcpClient).Dispose();
-                    }
-
-                    throw;
-                }
-            }
-            catch (Exception ex)
-            {
-                throw new TTransportException(ex.ToString());
-            }
-        }
-
-        public override void Close()
-        {
-            if (_server != null)
-            {
-                try
-                {
-                    _server.Stop();
-                }
-                catch (Exception ex)
-                {
-                    throw new TTransportException("WARNING: Could not close server socket: " + ex);
-                }
-                _server = null;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/Server/TTlsServerSocketTransport.cs b/lib/netcore/Thrift/Transports/Server/TTlsServerSocketTransport.cs
deleted file mode 100644
index 759feed..0000000
--- a/lib/netcore/Thrift/Transports/Server/TTlsServerSocketTransport.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Net;
-using System.Net.Security;
-using System.Net.Sockets;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Transports.Client;
-
-namespace Thrift.Transports.Server
-{
-    // ReSharper disable once InconsistentNaming
-    public class TTlsServerSocketTransport : TServerTransport
-    {
-        private readonly RemoteCertificateValidationCallback _clientCertValidator;
-        private readonly int _clientTimeout = 0;
-        private readonly LocalCertificateSelectionCallback _localCertificateSelectionCallback;
-        private readonly int _port;
-        private readonly X509Certificate2 _serverCertificate;
-        private readonly SslProtocols _sslProtocols;
-        private readonly bool _useBufferedSockets;
-        private readonly bool _useFramedTransport;
-        private TcpListener _server;
-
-        public TTlsServerSocketTransport(int port, X509Certificate2 certificate)
-            : this(port, false, certificate)
-        {
-        }
-
-        public TTlsServerSocketTransport(
-            int port,
-            bool useBufferedSockets,
-            X509Certificate2 certificate,
-            RemoteCertificateValidationCallback clientCertValidator = null,
-            LocalCertificateSelectionCallback localCertificateSelectionCallback = null,
-            SslProtocols sslProtocols = SslProtocols.Tls12) 
-            : this(port, useBufferedSockets, false, certificate,
-                clientCertValidator, localCertificateSelectionCallback, sslProtocols)
-        {
-        }
-        
-        public TTlsServerSocketTransport(
-            int port,
-            bool useBufferedSockets,
-            bool useFramedTransport,
-            X509Certificate2 certificate,
-            RemoteCertificateValidationCallback clientCertValidator = null,
-            LocalCertificateSelectionCallback localCertificateSelectionCallback = null,
-            SslProtocols sslProtocols = SslProtocols.Tls12)
-        {
-            if (!certificate.HasPrivateKey)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.Unknown,
-                    "Your server-certificate needs to have a private key");
-            }
-
-            _port = port;
-            _serverCertificate = certificate;
-            _useBufferedSockets = useBufferedSockets;
-            _useFramedTransport = useFramedTransport;
-            _clientCertValidator = clientCertValidator;
-            _localCertificateSelectionCallback = localCertificateSelectionCallback;
-            _sslProtocols = sslProtocols;
-
-            try
-            {
-                // Create server socket
-                _server = new TcpListener(IPAddress.Any, _port);
-                _server.Server.NoDelay = true;
-            }
-            catch (Exception)
-            {
-                _server = null;
-                throw new TTransportException($"Could not create ServerSocket on port {port}.");
-            }
-        }
-
-        public override void Listen()
-        {
-            // Make sure accept is not blocking
-            if (_server != null)
-            {
-                try
-                {
-                    _server.Start();
-                }
-                catch (SocketException sx)
-                {
-                    throw new TTransportException($"Could not accept on listening socket: {sx.Message}");
-                }
-            }
-        }
-
-        public override bool IsClientPending()
-        {
-            return _server.Pending();
-        }
-
-        protected override async Task<TClientTransport> AcceptImplementationAsync(CancellationToken cancellationToken)
-        {
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<TClientTransport>(cancellationToken);
-            }
-
-            if (_server == null)
-            {
-                throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
-            }
-
-            try
-            {
-                var client = await _server.AcceptTcpClientAsync();
-                client.SendTimeout = client.ReceiveTimeout = _clientTimeout;
-
-                //wrap the client in an SSL Socket passing in the SSL cert
-                var tTlsSocket = new TTlsSocketClientTransport(client, _serverCertificate, true, _clientCertValidator,
-                    _localCertificateSelectionCallback, _sslProtocols);
-
-                await tTlsSocket.SetupTlsAsync();
-
-                TClientTransport trans = tTlsSocket;
-                
-                if (_useBufferedSockets)
-                {
-                    trans = new TBufferedClientTransport(trans);
-                }
-
-                if (_useFramedTransport)
-                {
-                    trans = new TFramedClientTransport(trans);
-                }
-                
-                return trans;
-            }
-            catch (Exception ex)
-            {
-                throw new TTransportException(ex.ToString());
-            }
-        }
-
-        public override void Close()
-        {
-            if (_server != null)
-            {
-                try
-                {
-                    _server.Stop();
-                }
-                catch (Exception ex)
-                {
-                    throw new TTransportException($"WARNING: Could not close server socket: {ex}");
-                }
-
-                _server = null;
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/TClientTransport.cs b/lib/netcore/Thrift/Transports/TClientTransport.cs
deleted file mode 100644
index 0dd96cb..0000000
--- a/lib/netcore/Thrift/Transports/TClientTransport.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports
-{
-    //TODO: think about client info 
-    // ReSharper disable once InconsistentNaming
-    public abstract class TClientTransport : IDisposable
-    {
-        //TODO: think how to avoid peek byte
-        private readonly byte[] _peekBuffer = new byte[1];
-        private bool _hasPeekByte;
-        public abstract bool IsOpen { get; }
-
-        public void Dispose()
-        {
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        public async Task<bool> PeekAsync(CancellationToken cancellationToken)
-        {
-            //If we already have a byte read but not consumed, do nothing.
-            if (_hasPeekByte)
-            {
-                return true;
-            }
-
-            //If transport closed we can't peek.
-            if (!IsOpen)
-            {
-                return false;
-            }
-
-            //Try to read one byte. If succeeds we will need to store it for the next read.
-            try
-            {
-                var bytes = await ReadAsync(_peekBuffer, 0, 1, cancellationToken);
-                if (bytes == 0)
-                {
-                    return false;
-                }
-            }
-            catch (IOException)
-            {
-                return false;
-            }
-
-            _hasPeekByte = true;
-            return true;
-        }
-
-        public virtual async Task OpenAsync()
-        {
-            await OpenAsync(CancellationToken.None);
-        }
-
-        public abstract Task OpenAsync(CancellationToken cancellationToken);
-
-        public abstract void Close();
-
-        protected static void ValidateBufferArgs(byte[] buffer, int offset, int length)
-        {
-            if (buffer == null)
-            {
-                throw new ArgumentNullException(nameof(buffer));
-            }
-
-            if (offset < 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(offset), "Buffer offset is smaller than zero.");
-            }
-
-            if (length < 0)
-            {
-                throw new ArgumentOutOfRangeException(nameof(length), "Buffer length is smaller than zero.");
-            }
-
-            if (offset + length > buffer.Length)
-            {
-                throw new ArgumentOutOfRangeException(nameof(buffer), "Not enough data.");
-            }
-        }
-
-        public virtual async Task<int> ReadAsync(byte[] buffer, int offset, int length)
-        {
-            return await ReadAsync(buffer, offset, length, CancellationToken.None);
-        }
-
-        public abstract Task<int> ReadAsync(byte[] buffer, int offset, int length, CancellationToken cancellationToken);
-
-        public virtual async Task<int> ReadAllAsync(byte[] buffer, int offset, int length)
-        {
-            return await ReadAllAsync(buffer, offset, length, CancellationToken.None);
-        }
-
-        public virtual async Task<int> ReadAllAsync(byte[] buffer, int offset, int length,
-            CancellationToken cancellationToken)
-        {
-            ValidateBufferArgs(buffer, offset, length);
-
-            if (cancellationToken.IsCancellationRequested)
-            {
-                return await Task.FromCanceled<int>(cancellationToken);
-            }
-
-            var retrieved = 0;
-
-            //If we previously peeked a byte, we need to use that first.
-            if (_hasPeekByte)
-            {
-                buffer[offset + retrieved++] = _peekBuffer[0];
-                _hasPeekByte = false;
-            }
-
-            while (retrieved < length)
-            {
-                if (cancellationToken.IsCancellationRequested)
-                {
-                    return await Task.FromCanceled<int>(cancellationToken);
-                }
-
-                var returnedCount = await ReadAsync(buffer, offset + retrieved, length - retrieved, cancellationToken);
-                if (returnedCount <= 0)
-                {
-                    throw new TTransportException(TTransportException.ExceptionType.EndOfFile,
-                        "Cannot read, Remote side has closed");
-                }
-                retrieved += returnedCount;
-            }
-            return retrieved;
-        }
-
-        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);
-        }
-
-        public virtual async Task WriteAsync(byte[] buffer, int offset, int length)
-        {
-            await WriteAsync(buffer, offset, length, CancellationToken.None);
-        }
-
-        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);
-
-        protected abstract void Dispose(bool disposing);
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/TServerTransport.cs b/lib/netcore/Thrift/Transports/TServerTransport.cs
deleted file mode 100644
index 0d45a55..0000000
--- a/lib/netcore/Thrift/Transports/TServerTransport.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Thrift.Transports
-{
-    // ReSharper disable once InconsistentNaming
-    public abstract class TServerTransport
-    {
-        public abstract void Listen();
-        public abstract void Close();
-        public abstract bool IsClientPending();
-
-        protected virtual async Task<TClientTransport> AcceptImplementationAsync()
-        {
-            return await AcceptImplementationAsync(CancellationToken.None);
-        }
-
-        protected abstract Task<TClientTransport> AcceptImplementationAsync(CancellationToken cancellationToken);
-
-        public async Task<TClientTransport> AcceptAsync()
-        {
-            return await AcceptAsync(CancellationToken.None);
-        }
-
-        public async Task<TClientTransport> AcceptAsync(CancellationToken cancellationToken)
-        {
-            var transport = await AcceptImplementationAsync(cancellationToken);
-
-            if (transport == null)
-            {
-                throw new TTransportException($"{nameof(AcceptImplementationAsync)} should not return null");
-            }
-
-            return transport;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/TTransportException.cs b/lib/netcore/Thrift/Transports/TTransportException.cs
deleted file mode 100644
index b7c42e3..0000000
--- a/lib/netcore/Thrift/Transports/TTransportException.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Transports
-{
-    // ReSharper disable once InconsistentNaming
-    public class TTransportException : TException
-    {
-        public enum ExceptionType
-        {
-            Unknown,
-            NotOpen,
-            AlreadyOpen,
-            TimedOut,
-            EndOfFile,
-            Interrupted
-        }
-
-        protected ExceptionType ExType;
-
-        public TTransportException()
-        {
-        }
-
-        public TTransportException(ExceptionType exType)
-            : this()
-        {
-            ExType = exType;
-        }
-
-        public TTransportException(ExceptionType exType, string message)
-            : base(message)
-        {
-            ExType = exType;
-        }
-
-        public TTransportException(string message)
-            : base(message)
-        {
-        }
-
-        public ExceptionType Type => ExType;
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/Transports/TTransportFactory.cs b/lib/netcore/Thrift/Transports/TTransportFactory.cs
deleted file mode 100644
index 26c3cc4..0000000
--- a/lib/netcore/Thrift/Transports/TTransportFactory.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-namespace Thrift.Transports
-{
-    /// <summary>
-    ///     From Mark Slee & Aditya Agarwal of Facebook:
-    ///     Factory class used to create wrapped instance of Transports.
-    ///     This is used primarily in servers, which get Transports from
-    ///     a ServerTransport and then may want to mutate them (i.e. create
-    ///     a BufferedTransport from the underlying base transport)
-    /// </summary>
-    // ReSharper disable once InconsistentNaming
-    public class TTransportFactory
-    {
-        public virtual TClientTransport GetTransport(TClientTransport trans)
-        {
-            return trans;
-        }
-    }
-}
\ No newline at end of file
diff --git a/lib/netcore/Thrift/thrift.snk b/lib/netcore/Thrift/thrift.snk
deleted file mode 100644
index 97bc581..0000000
--- a/lib/netcore/Thrift/thrift.snk
+++ /dev/null
Binary files differ
diff --git a/lib/netcore/build.cmd b/lib/netcore/build.cmd
deleted file mode 100644
index 863c4b4..0000000
--- a/lib/netcore/build.cmd
+++ /dev/null
@@ -1,27 +0,0 @@
-@echo off
-rem /*
-rem  * Licensed to the Apache Software Foundation (ASF) under one
-rem  * or more contributor license agreements. See the NOTICE file
-rem  * distributed with this work for additional information
-rem  * regarding copyright ownership. The ASF licenses this file
-rem  * to you under the Apache License, Version 2.0 (the
-rem  * "License"); you may not use this file except in compliance
-rem  * with the License. You may obtain a copy of the License at
-rem  *
-rem  *   http://www.apache.org/licenses/LICENSE-2.0
-rem  *
-rem  * Unless required by applicable law or agreed to in writing,
-rem  * software distributed under the License is distributed on an
-rem  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem  * KIND, either express or implied. See the License for the
-rem  * specific language governing permissions and limitations
-rem  * under the License.
-rem  */
-
-setlocal
-
-thrift -version
-dotnet --info
-dotnet build 
-
-:eof
diff --git a/lib/netcore/build.sh b/lib/netcore/build.sh
deleted file mode 100644
index ae18bce..0000000
--- a/lib/netcore/build.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#exit if any command fails
-#set -e
-
-thrift --version
-dotnet --info
-dotnet build 
-
-#revision=${TRAVIS_JOB_ID:=1}  
-#revision=$(printf "%04d" $revision) 
-
-#dotnet pack ./src/PROJECT_NAME -c Release -o ./artifacts --version-suffix=$revision  
diff --git a/lib/netcore/runtests.cmd b/lib/netcore/runtests.cmd
deleted file mode 100644
index 5114bc5..0000000
--- a/lib/netcore/runtests.cmd
+++ /dev/null
@@ -1,28 +0,0 @@
-@echo off
-rem /*
-rem  * Licensed to the Apache Software Foundation (ASF) under one
-rem  * or more contributor license agreements. See the NOTICE file
-rem  * distributed with this work for additional information
-rem  * regarding copyright ownership. The ASF licenses this file
-rem  * to you under the Apache License, Version 2.0 (the
-rem  * "License"); you may not use this file except in compliance
-rem  * with the License. You may obtain a copy of the License at
-rem  *
-rem  *   http://www.apache.org/licenses/LICENSE-2.0
-rem  *
-rem  * Unless required by applicable law or agreed to in writing,
-rem  * software distributed under the License is distributed on an
-rem  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem  * KIND, either express or implied. See the License for the
-rem  * specific language governing permissions and limitations
-rem  * under the License.
-rem  */
-setlocal
-
-thrift -version
-dotnet --info
-
-dotnet test Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj
-dotnet test Tests\Thrift.Tests\Thrift.Tests.csproj
-
-:eof
diff --git a/lib/netcore/runtests.sh b/lib/netcore/runtests.sh
deleted file mode 100644
index a26cc36..0000000
--- a/lib/netcore/runtests.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-thrift -version
-dotnet --info
-
-dotnet test Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj
-dotnet test Tests\Thrift.Tests\Thrift.Tests.csproj
\ No newline at end of file
diff --git a/lib/netstd/Makefile.am b/lib/netstd/Makefile.am
index f6faaca..bb2aac5 100644
--- a/lib/netstd/Makefile.am
+++ b/lib/netstd/Makefile.am
@@ -24,7 +24,7 @@
 
 check-local:
 	$(DOTNETCORE) test Tests/Thrift.Tests/Thrift.Tests.csproj
-	${DOTNETCORE} test Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
+	$(DOTNETCORE) test Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
 
 clean-local:
 	$(RM) -r Thrift/bin
diff --git a/test/Makefile.am b/test/Makefile.am
index c2fbbd4..fdb2645 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -78,7 +78,6 @@
 endif
 
 if WITH_DOTNET
-SUBDIRS += netcore
 SUBDIRS += netstd
 endif
 
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index cf28b2a..bdc6d87 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -29,7 +29,6 @@
 namespace java thrift.test
 namespace js ThriftTest
 namespace lua ThriftTest
-namespace netcore ThriftTest
 namespace netstd ThriftTest
 namespace perl ThriftTest
 namespace php ThriftTest
diff --git a/test/netcore/Client/.gitignore b/test/netcore/Client/.gitignore
deleted file mode 100644
index 67d5510..0000000
--- a/test/netcore/Client/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# ignore for autogenerated files
-/ThriftTest
diff --git a/test/netcore/Client/Client.csproj b/test/netcore/Client/Client.csproj
deleted file mode 100644
index f16af39..0000000
--- a/test/netcore/Client/Client.csproj
+++ /dev/null
@@ -1,31 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-    <AssemblyName>Client</AssemblyName>
-    <PackageId>Client</PackageId>
-    <OutputType>Exe</OutputType>
-    <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
-    <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-  <ItemGroup>
-    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="[4.4,)" />
-    <PackageReference Include="System.Runtime.Serialization.Primitives" Version="[4.3,)" />
-    <PackageReference Include="System.ServiceModel.Primitives" Version="[4.4,)" />
-    <PackageReference Include="System.Threading" Version="[4.3,)" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\lib\netcore\Thrift\Thrift.csproj" />
-  </ItemGroup>
-  <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
-    <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
-      <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
-    </Exec>
-    <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../ThriftTest.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../ThriftTest.thrift" />
-    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../ThriftTest.thrift" />
-  </Target>
-</Project>
diff --git a/test/netcore/Client/Program.cs b/test/netcore/Client/Program.cs
deleted file mode 100644
index 72139d9..0000000
--- a/test/netcore/Client/Program.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using ThriftTest;
-
-namespace Client
-{
-    public class Program
-    {
-        public static int Main(string[] args)
-        {
-            try
-            {
-                Console.SetBufferSize(Console.BufferWidth, 4096);
-            }
-            catch (Exception)
-            {
-                Console.WriteLine("Failed to grow scroll-back buffer");
-            }
-
-            // split mode and options
-            var subArgs = new List<string>(args);
-            var firstArg = string.Empty;
-            if (subArgs.Count > 0)
-            { 
-                firstArg = subArgs[0];
-                subArgs.RemoveAt(0);
-            }
-
-            // run whatever mode is choosen
-            switch(firstArg)
-            {
-                case "client":
-                    return TestClient.Execute(subArgs);
-                case "--help":
-                    PrintHelp();
-                    return 0;
-                default:
-                    PrintHelp();
-                    return -1;
-            }
-        }
-
-        private static void PrintHelp()
-        {
-            Console.WriteLine("Usage:");
-            Console.WriteLine("  Client  client  [options]'");
-            Console.WriteLine("  Client  --help");
-            Console.WriteLine("");
-
-            TestClient.PrintOptionsHelp();
-        }
-    }
-}
-
-
diff --git a/test/netcore/Client/Properties/AssemblyInfo.cs b/test/netcore/Client/Properties/AssemblyInfo.cs
deleted file mode 100644
index 157152b..0000000
--- a/test/netcore/Client/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Client")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("B0C13DA0-3117-4844-8AE8-B1775E46223D")]
-
diff --git a/test/netcore/Client/TestClient.cs b/test/netcore/Client/TestClient.cs
deleted file mode 100644
index 8be198c..0000000
--- a/test/netcore/Client/TestClient.cs
+++ /dev/null
@@ -1,943 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Reflection;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using System.ServiceModel;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Thrift.Collections;
-using Thrift.Protocols;
-using Thrift.Transports;
-using Thrift.Transports.Client;
-
-namespace ThriftTest
-{
-    public class TestClient
-    {
-        private class TestParams
-        {
-            public int numIterations = 1;
-            public IPAddress host = IPAddress.Any;
-            public int port = 9090;
-            public int numThreads = 1;
-            public string url;
-            public string pipe;
-            public bool buffered;
-            public bool framed;
-            public string protocol;
-            public bool encrypted = false;
-
-            internal void Parse( List<string> args)
-            {
-                for (var i = 0; i < args.Count; ++i)
-                {
-                    if (args[i] == "-u")
-                    {
-                        url = args[++i];
-                    }
-                    else if (args[i] == "-n")
-                    {
-                        numIterations = Convert.ToInt32(args[++i]);
-                    }
-                    else if (args[i].StartsWith("--pipe="))
-                    {
-                        pipe = args[i].Substring(args[i].IndexOf("=") + 1);
-                        Console.WriteLine("Using named pipes transport");
-                    }
-                    else if (args[i].StartsWith("--host="))
-                    {
-                        // check there for ipaddress
-                        host = new IPAddress(Encoding.Unicode.GetBytes(args[i].Substring(args[i].IndexOf("=") + 1)));
-                    }
-                    else if (args[i].StartsWith("--port="))
-                    {
-                        port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1));
-                    }
-                    else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered")
-                    {
-                        buffered = true;
-                        Console.WriteLine("Using buffered sockets");
-                    }
-                    else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed")
-                    {
-                        framed = true;
-                        Console.WriteLine("Using framed transport");
-                    }
-                    else if (args[i] == "-t")
-                    {
-                        numThreads = Convert.ToInt32(args[++i]);
-                    }
-                    else if (args[i] == "--binary" || args[i] == "--protocol=binary")
-                    {
-                        protocol = "binary";
-                        Console.WriteLine("Using binary protocol");
-                    }
-                    else if (args[i] == "--compact" || args[i] == "--protocol=compact")
-                    {
-                        protocol = "compact";
-                        Console.WriteLine("Using compact protocol");
-                    }
-                    else if (args[i] == "--json" || args[i] == "--protocol=json")
-                    {
-                        protocol = "json";
-                        Console.WriteLine("Using JSON protocol");
-                    }
-                    else if (args[i] == "--ssl")
-                    {
-                        encrypted = true;
-                        Console.WriteLine("Using encrypted transport");
-                    }
-                    else
-                    {
-                        //throw new ArgumentException(args[i]);
-                    }
-                }
-            }
-
-            private static X509Certificate2 GetClientCert()
-            {
-                var clientCertName = "client.p12";
-                var possiblePaths = new List<string>
-                {
-                    "../../../keys/",
-                    "../../keys/",
-                    "../keys/",
-                    "keys/",
-                };
-
-                string existingPath = null;
-                foreach (var possiblePath in possiblePaths)
-                {
-                    var path = Path.GetFullPath(possiblePath + clientCertName);
-                    if (File.Exists(path))
-                    {
-                        existingPath = path;
-                        break;
-                    }
-                }
-
-                if (string.IsNullOrEmpty(existingPath))
-                {
-                    throw new FileNotFoundException($"Cannot find file: {clientCertName}");
-                }
-            
-                var cert = new X509Certificate2(existingPath, "thrift");
-
-                return cert;
-            }
-            
-            public TClientTransport CreateTransport()
-            {
-                if (url == null)
-                {
-                    // endpoint transport
-                    TClientTransport trans = null;
-
-                    if (pipe != null)
-                    {
-                        trans = new TNamedPipeClientTransport(pipe);
-                    }
-                    else
-                    {
-                        if (encrypted)
-                        {
-                           var cert = GetClientCert();
-                        
-                            if (cert == null || !cert.HasPrivateKey)
-                            {
-                                throw new InvalidOperationException("Certificate doesn't contain private key");
-                            }
-                            
-                            trans = new TTlsSocketClientTransport(host, port, 0, cert, 
-                                (sender, certificate, chain, errors) => true,
-                                null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12);
-                        }
-                        else
-                        {
-                            trans = new TSocketClientTransport(host, port);
-                        }
-                    }
-
-                    // layered transport
-                    if (buffered)
-                    {
-                        trans = new TBufferedClientTransport(trans);
-                    }
-
-                    if (framed)
-                    {
-                        trans = new TFramedClientTransport(trans);
-                    }
-
-                    return trans;
-                }
-
-                return new THttpClientTransport(new Uri(url), null);
-            }
-
-            public TProtocol CreateProtocol(TClientTransport transport)
-            {
-                if (protocol == "compact")
-                {
-                    return new TCompactProtocol(transport);
-                }
-
-                if (protocol == "json")
-                {
-                    return new TJsonProtocol(transport);
-                }
-
-                return new TBinaryProtocol(transport);
-            }
-        }
-
-
-        private const int ErrorBaseTypes = 1;
-        private const int ErrorStructs = 2;
-        private const int ErrorContainers = 4;
-        private const int ErrorExceptions = 8;
-        private const int ErrorUnknown = 64;
-
-        private class ClientTest
-        {
-            private readonly TClientTransport transport;
-            private readonly ThriftTest.Client client;
-            private readonly int numIterations;
-            private bool done;
-
-            public int ReturnCode { get; set; }
-
-            public ClientTest(TestParams param)
-            {
-                transport = param.CreateTransport();
-                client = new ThriftTest.Client(param.CreateProtocol(transport));
-                numIterations = param.numIterations;
-            }
-
-            public void Execute()
-            {
-                var token = CancellationToken.None;
-
-                if (done)
-                {
-                    Console.WriteLine("Execute called more than once");
-                    throw new InvalidOperationException();
-                }
-
-                for (var i = 0; i < numIterations; i++)
-                {
-                    try
-                    {
-                        if (!transport.IsOpen)
-                        {
-                            transport.OpenAsync(token).GetAwaiter().GetResult();
-                        }
-                    }
-                    catch (TTransportException ex)
-                    {
-                        Console.WriteLine("*** FAILED ***");
-                        Console.WriteLine("Connect failed: " + ex.Message);
-                        ReturnCode |= ErrorUnknown;
-                        Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-                        continue;
-                    }
-                    catch (Exception ex)
-                    {
-                        Console.WriteLine("*** FAILED ***");
-                        Console.WriteLine("Connect failed: " + ex.Message);
-                        ReturnCode |= ErrorUnknown;
-                        Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-                        continue;
-                    }
-
-                    try
-                    {
-                        ReturnCode |= ExecuteClientTestAsync(client).GetAwaiter().GetResult(); ;
-                    }
-                    catch (Exception ex)
-                    {
-                        Console.WriteLine("*** FAILED ***");
-                        Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-                        ReturnCode |= ErrorUnknown;
-                    }
-                }
-                try
-                {
-                    transport.Close();
-                }
-                catch (Exception ex)
-                {
-                    Console.WriteLine("Error while closing transport");
-                    Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-                }
-                done = true;
-            }
-        }
-
-        internal static void PrintOptionsHelp()
-        {
-            Console.WriteLine("Client options:");
-            Console.WriteLine("  -u <URL>");
-            Console.WriteLine("  -t <# of threads to run>        default = 1");
-            Console.WriteLine("  -n <# of iterations>            per thread");
-            Console.WriteLine("  --pipe=<pipe name>");
-            Console.WriteLine("  --host=<IP address>");
-            Console.WriteLine("  --port=<port number>");
-            Console.WriteLine("  --transport=<transport name>    one of buffered,framed  (defaults to none)");
-            Console.WriteLine("  --protocol=<protocol name>      one of compact,json  (defaults to binary)");
-            Console.WriteLine("  --ssl");
-            Console.WriteLine();
-        }
-
-        public static int Execute(List<string> args)
-        {
-            try
-            {
-                var param = new TestParams();
-
-                try
-                {
-                    param.Parse(args);
-                }
-                catch (Exception ex)
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    Console.WriteLine("Error while  parsing arguments");
-                    Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-                    return ErrorUnknown;
-                }
-
-                var tests = Enumerable.Range(0, param.numThreads).Select(_ => new ClientTest(param)).ToArray();
-
-                //issue tests on separate threads simultaneously
-                var threads = tests.Select(test => new Task(test.Execute)).ToArray();
-                var start = DateTime.Now;
-                foreach (var t in threads)
-                {
-                    t.Start();
-                }
-
-                Task.WaitAll(threads);
-
-                Console.WriteLine("Total time: " + (DateTime.Now - start));
-                Console.WriteLine();
-                return tests.Select(t => t.ReturnCode).Aggregate((r1, r2) => r1 | r2);
-            }
-            catch (Exception outerEx)
-            {
-                Console.WriteLine("*** FAILED ***");
-                Console.WriteLine("Unexpected error");
-                Console.WriteLine(outerEx.Message + " ST: " + outerEx.StackTrace);
-                return ErrorUnknown;
-            }
-        }
-
-        public static string BytesToHex(byte[] data)
-        {
-            return BitConverter.ToString(data).Replace("-", string.Empty);
-        }
-
-        public static byte[] PrepareTestData(bool randomDist)
-        {
-            var retval = new byte[0x100];
-            var initLen = Math.Min(0x100, retval.Length);
-
-            // linear distribution, unless random is requested
-            if (!randomDist)
-            {
-                for (var i = 0; i < initLen; ++i)
-                {
-                    retval[i] = (byte)i;
-                }
-                return retval;
-            }
-
-            // random distribution
-            for (var i = 0; i < initLen; ++i)
-            {
-                retval[i] = (byte)0;
-            }
-            var rnd = new Random();
-            for (var i = 1; i < initLen; ++i)
-            {
-                while (true)
-                {
-                    var nextPos = rnd.Next() % initLen;
-                    if (retval[nextPos] == 0)
-                    {
-                        retval[nextPos] = (byte)i;
-                        break;
-                    }
-                }
-            }
-            return retval;
-        }
-
-        public static async Task<int> ExecuteClientTestAsync(ThriftTest.Client client)
-        {
-            var token = CancellationToken.None;
-            var returnCode = 0;
-
-            Console.Write("testVoid()");
-            await client.testVoidAsync(token);
-            Console.WriteLine(" = void");
-
-            Console.Write("testString(\"Test\")");
-            var s = await client.testStringAsync("Test", token);
-            Console.WriteLine(" = \"" + s + "\"");
-            if ("Test" != s)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            Console.Write("testBool(true)");
-            var t = await client.testBoolAsync((bool)true, token);
-            Console.WriteLine(" = " + t);
-            if (!t)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-            Console.Write("testBool(false)");
-            var f = await client.testBoolAsync((bool)false, token);
-            Console.WriteLine(" = " + f);
-            if (f)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            Console.Write("testByte(1)");
-            var i8 = await client.testByteAsync((sbyte)1, token);
-            Console.WriteLine(" = " + i8);
-            if (1 != i8)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            Console.Write("testI32(-1)");
-            var i32 = await client.testI32Async(-1, token);
-            Console.WriteLine(" = " + i32);
-            if (-1 != i32)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            Console.Write("testI64(-34359738368)");
-            var i64 = await client.testI64Async(-34359738368, token);
-            Console.WriteLine(" = " + i64);
-            if (-34359738368 != i64)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            // TODO: Validate received message
-            Console.Write("testDouble(5.325098235)");
-            var dub = await client.testDoubleAsync(5.325098235, token);
-            Console.WriteLine(" = " + dub);
-            if (5.325098235 != dub)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-            Console.Write("testDouble(-0.000341012439638598279)");
-            dub = await client.testDoubleAsync(-0.000341012439638598279, token);
-            Console.WriteLine(" = " + dub);
-            if (-0.000341012439638598279 != dub)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            var binOut = PrepareTestData(true);
-            Console.Write("testBinary(" + BytesToHex(binOut) + ")");
-            try
-            {
-                var binIn = await client.testBinaryAsync(binOut, token);
-                Console.WriteLine(" = " + BytesToHex(binIn));
-                if (binIn.Length != binOut.Length)
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    returnCode |= ErrorBaseTypes;
-                }
-                for (var ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs)
-                    if (binIn[ofs] != binOut[ofs])
-                    {
-                        Console.WriteLine("*** FAILED ***");
-                        returnCode |= ErrorBaseTypes;
-                    }
-            }
-            catch (Thrift.TApplicationException ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-
-            // binary equals? only with hashcode option enabled ...
-            Console.WriteLine("Test CrazyNesting");
-            var one = new CrazyNesting();
-            var two = new CrazyNesting();
-            one.String_field = "crazy";
-            two.String_field = "crazy";
-            one.Binary_field = new byte[] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF };
-            two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF };
-            if (typeof(CrazyNesting).GetMethod("Equals")?.DeclaringType == typeof(CrazyNesting))
-            {
-                if (!one.Equals(two))
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    returnCode |= ErrorContainers;
-                    throw new Exception("CrazyNesting.Equals failed");
-                }
-            }
-
-            // TODO: Validate received message
-            Console.Write("testStruct({\"Zero\", 1, -3, -5})");
-            var o = new Xtruct();
-            o.String_thing = "Zero";
-            o.Byte_thing = (sbyte)1;
-            o.I32_thing = -3;
-            o.I64_thing = -5;
-            var i = await client.testStructAsync(o, token);
-            Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}");
-
-            // TODO: Validate received message
-            Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})");
-            var o2 = new Xtruct2();
-            o2.Byte_thing = (sbyte)1;
-            o2.Struct_thing = o;
-            o2.I32_thing = 5;
-            var i2 = await client.testNestAsync(o2, token);
-            i = i2.Struct_thing;
-            Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
-
-            var mapout = new Dictionary<int, int>();
-            for (var j = 0; j < 5; j++)
-            {
-                mapout[j] = j - 10;
-            }
-            Console.Write("testMap({");
-            var first = true;
-            foreach (var key in mapout.Keys)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(key + " => " + mapout[key]);
-            }
-            Console.Write("})");
-
-            var mapin = await client.testMapAsync(mapout, token);
-
-            Console.Write(" = {");
-            first = true;
-            foreach (var key in mapin.Keys)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(key + " => " + mapin[key]);
-            }
-            Console.WriteLine("}");
-
-            // TODO: Validate received message
-            var listout = new List<int>();
-            for (var j = -2; j < 3; j++)
-            {
-                listout.Add(j);
-            }
-            Console.Write("testList({");
-            first = true;
-            foreach (var j in listout)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
-            Console.Write("})");
-
-            var listin = await client.testListAsync(listout, token);
-
-            Console.Write(" = {");
-            first = true;
-            foreach (var j in listin)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
-            Console.WriteLine("}");
-
-            //set
-            // TODO: Validate received message
-            var setout = new THashSet<int>();
-            for (var j = -2; j < 3; j++)
-            {
-                setout.Add(j);
-            }
-            Console.Write("testSet({");
-            first = true;
-            foreach (int j in setout)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
-            Console.Write("})");
-
-            var setin = await client.testSetAsync(setout, token);
-
-            Console.Write(" = {");
-            first = true;
-            foreach (int j in setin)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    Console.Write(", ");
-                }
-                Console.Write(j);
-            }
-            Console.WriteLine("}");
-
-
-            Console.Write("testEnum(ONE)");
-            var ret = await client.testEnumAsync(Numberz.ONE, token);
-            Console.WriteLine(" = " + ret);
-            if (Numberz.ONE != ret)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorStructs;
-            }
-
-            Console.Write("testEnum(TWO)");
-            ret = await client.testEnumAsync(Numberz.TWO, token);
-            Console.WriteLine(" = " + ret);
-            if (Numberz.TWO != ret)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorStructs;
-            }
-
-            Console.Write("testEnum(THREE)");
-            ret = await client.testEnumAsync(Numberz.THREE, token);
-            Console.WriteLine(" = " + ret);
-            if (Numberz.THREE != ret)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorStructs;
-            }
-
-            Console.Write("testEnum(FIVE)");
-            ret = await client.testEnumAsync(Numberz.FIVE, token);
-            Console.WriteLine(" = " + ret);
-            if (Numberz.FIVE != ret)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorStructs;
-            }
-
-            Console.Write("testEnum(EIGHT)");
-            ret = await client.testEnumAsync(Numberz.EIGHT, token);
-            Console.WriteLine(" = " + ret);
-            if (Numberz.EIGHT != ret)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorStructs;
-            }
-
-            Console.Write("testTypedef(309858235082523)");
-            var uid = await client.testTypedefAsync(309858235082523L, token);
-            Console.WriteLine(" = " + uid);
-            if (309858235082523L != uid)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorStructs;
-            }
-
-            // TODO: Validate received message
-            Console.Write("testMapMap(1)");
-            var mm = await client.testMapMapAsync(1, token);
-            Console.Write(" = {");
-            foreach (var key in mm.Keys)
-            {
-                Console.Write(key + " => {");
-                var m2 = mm[key];
-                foreach (var k2 in m2.Keys)
-                {
-                    Console.Write(k2 + " => " + m2[k2] + ", ");
-                }
-                Console.Write("}, ");
-            }
-            Console.WriteLine("}");
-
-            // TODO: Validate received message
-            var insane = new Insanity();
-            insane.UserMap = new Dictionary<Numberz, long>();
-            insane.UserMap[Numberz.FIVE] = 5000L;
-            var truck = new Xtruct();
-            truck.String_thing = "Truck";
-            truck.Byte_thing = (sbyte)8;
-            truck.I32_thing = 8;
-            truck.I64_thing = 8;
-            insane.Xtructs = new List<Xtruct>();
-            insane.Xtructs.Add(truck);
-            Console.Write("testInsanity()");
-            var whoa = await client.testInsanityAsync(insane, token);
-            Console.Write(" = {");
-            foreach (var key in whoa.Keys)
-            {
-                var val = whoa[key];
-                Console.Write(key + " => {");
-
-                foreach (var k2 in val.Keys)
-                {
-                    var v2 = val[k2];
-
-                    Console.Write(k2 + " => {");
-                    var userMap = v2.UserMap;
-
-                    Console.Write("{");
-                    if (userMap != null)
-                    {
-                        foreach (var k3 in userMap.Keys)
-                        {
-                            Console.Write(k3 + " => " + userMap[k3] + ", ");
-                        }
-                    }
-                    else
-                    {
-                        Console.Write("null");
-                    }
-                    Console.Write("}, ");
-
-                    var xtructs = v2.Xtructs;
-
-                    Console.Write("{");
-                    if (xtructs != null)
-                    {
-                        foreach (var x in xtructs)
-                        {
-                            Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, ");
-                        }
-                    }
-                    else
-                    {
-                        Console.Write("null");
-                    }
-                    Console.Write("}");
-
-                    Console.Write("}, ");
-                }
-                Console.Write("}, ");
-            }
-            Console.WriteLine("}");
-
-            sbyte arg0 = 1;
-            var arg1 = 2;
-            var arg2 = long.MaxValue;
-            var multiDict = new Dictionary<short, string>();
-            multiDict[1] = "one";
-
-            var tmpMultiDict = new List<string>();
-            foreach (var pair in multiDict)
-                tmpMultiDict.Add(pair.Key +" => "+ pair.Value);
-
-            var arg4 = Numberz.FIVE;
-            long arg5 = 5000000;
-            Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + ",{" + string.Join(",", tmpMultiDict) + "}," + arg4 + "," + arg5 + ")");
-            var multiResponse = await client.testMultiAsync(arg0, arg1, arg2, multiDict, arg4, arg5, token);
-            Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing
-                          + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n");
-
-            try
-            {
-                Console.WriteLine("testException(\"Xception\")");
-                await client.testExceptionAsync("Xception", token);
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-            }
-            catch (Xception ex)
-            {
-                if (ex.ErrorCode != 1001 || ex.Message != "Xception")
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    returnCode |= ErrorExceptions;
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-            try
-            {
-                Console.WriteLine("testException(\"TException\")");
-                await client.testExceptionAsync("TException", token);
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-            }
-            catch (Thrift.TException)
-            {
-                // OK
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-            try
-            {
-                Console.WriteLine("testException(\"ok\")");
-                await client.testExceptionAsync("ok", token);
-                // OK
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-
-            try
-            {
-                Console.WriteLine("testMultiException(\"Xception\", ...)");
-                await client.testMultiExceptionAsync("Xception", "ignore", token);
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-            }
-            catch (Xception ex)
-            {
-                if (ex.ErrorCode != 1001 || ex.Message != "This is an Xception")
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    returnCode |= ErrorExceptions;
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-            try
-            {
-                Console.WriteLine("testMultiException(\"Xception2\", ...)");
-                await client.testMultiExceptionAsync("Xception2", "ignore", token);
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-            }
-            catch (Xception2 ex)
-            {
-                if (ex.ErrorCode != 2002 || ex.Struct_thing.String_thing != "This is an Xception2")
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    returnCode |= ErrorExceptions;
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-            try
-            {
-                Console.WriteLine("testMultiException(\"success\", \"OK\")");
-                if ("OK" != (await client.testMultiExceptionAsync("success", "OK", token)).String_thing)
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    returnCode |= ErrorExceptions;
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorExceptions;
-                Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-            }
-
-            var sw = new Stopwatch();
-            sw.Start();
-            Console.WriteLine("Test Oneway(1)");
-            await client.testOnewayAsync(1, token);
-            sw.Stop();
-            if (sw.ElapsedMilliseconds > 1000)
-            {
-                Console.WriteLine("*** FAILED ***");
-                returnCode |= ErrorBaseTypes;
-            }
-
-            Console.Write("Test Calltime()");
-            var times = 50;
-            sw.Reset();
-            sw.Start();
-            for (var k = 0; k < times; ++k)
-                await client.testVoidAsync(token);
-            sw.Stop();
-            Console.WriteLine(" = {0} ms a testVoid() call", sw.ElapsedMilliseconds / times);
-            return returnCode;
-        }
-    }
-}
diff --git a/test/netcore/Makefile.am b/test/netcore/Makefile.am
deleted file mode 100644
index 2fff4ba..0000000
--- a/test/netcore/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-SUBDIRS = . 
-
-all-local:
-	$(DOTNETCORE) build
-
-precross:
-	$(DOTNETCORE) build
-
-clean-local:
-	$(RM) -r Client/bin
-	$(RM) -r Client/obj
-	$(RM) -r Client/ThriftTest
-	$(RM) -r Server/bin
-	$(RM) -r Server/obj
-	$(RM) -r Server/ThriftTest
-
-dist-hook:
-	$(RM) -r $(distdir)/Client/bin
-	$(RM) -r $(distdir)/Client/obj
-	$(RM) -r $(distdir)/Client/ThriftTest
-	$(RM) -r $(distdir)/Server/bin
-	$(RM) -r $(distdir)/Server/obj
-	$(RM) -r $(distdir)/Server/ThriftTest
-
-EXTRA_DIST = \
-	Client \
-	README.md \
-	Server \
-	ThriftTest.sln \
-	build.cmd \
-	build.sh
diff --git a/test/netcore/README.md b/test/netcore/README.md
deleted file mode 100644
index ed728d1..0000000
--- a/test/netcore/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Apache Thrift net-core-lib tests
-
-Tests for Thrift client library ported to Microsoft .Net Core 
-
-# Content
-- ThriftTest - tests for Thrift library 
-
-# Reused components 
-- NET Core Standard 1.6 (SDK 2.0.0)
-
-# How to build on Windows
-- Get Thrift IDL compiler executable, add to some folder and add path to this folder into PATH variable
-- Open ThriftTest.sln in Visual Studio and build
-or 
-- Build with scripts
-
-# How to build on Unix
-- Ensure you have .NET Core 2.0.0 SDK installed or use the Ubuntu Xenial docker image
-- Follow common build practice for Thrift: bootstrap, configure, and make precross
-
diff --git a/test/netcore/Server/.gitignore b/test/netcore/Server/.gitignore
deleted file mode 100644
index 67d5510..0000000
--- a/test/netcore/Server/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# ignore for autogenerated files
-/ThriftTest
diff --git a/test/netcore/Server/Program.cs b/test/netcore/Server/Program.cs
deleted file mode 100644
index e647e5b..0000000
--- a/test/netcore/Server/Program.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using ThriftTest;
-
-namespace Server
-{
-    public class Program
-    {
-        public static int Main(string[] args)
-        {
-            try
-            {
-                Console.SetBufferSize(Console.BufferWidth, 4096);
-            }
-            catch (Exception)
-            {
-                Console.WriteLine("Failed to grow scroll-back buffer");
-            }
-
-            // split mode and options
-            var subArgs = new List<string>(args);
-            var firstArg = string.Empty;
-            if (subArgs.Count > 0)
-            { 
-                firstArg = subArgs[0];
-                subArgs.RemoveAt(0);
-            }
-
-            // run whatever mode is choosen
-            switch(firstArg)
-            {
-                case "server":
-                    return TestServer.Execute(subArgs);
-                case "--help":
-                    PrintHelp();
-                    return 0;
-                default:
-                    PrintHelp();
-                    return -1;
-            }
-        }
-
-        private static void PrintHelp()
-        {
-            Console.WriteLine("Usage:");
-            Console.WriteLine("  Server  server  [options]'");
-            Console.WriteLine("  Server  --help");
-            Console.WriteLine("");
-
-            TestServer.PrintOptionsHelp();
-        }
-    }
-}
-
-
diff --git a/test/netcore/Server/Properties/AssemblyInfo.cs b/test/netcore/Server/Properties/AssemblyInfo.cs
deleted file mode 100644
index 265495c..0000000
--- a/test/netcore/Server/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Server")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("B0C13DA0-3117-4844-8AE8-B1775E46223D")]
-
diff --git a/test/netcore/Server/Server.csproj b/test/netcore/Server/Server.csproj
deleted file mode 100644
index 2f9b4b1..0000000
--- a/test/netcore/Server/Server.csproj
+++ /dev/null
@@ -1,31 +0,0 @@
-﻿<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-    <AssemblyName>Server</AssemblyName>
-    <PackageId>Server</PackageId>
-    <OutputType>Exe</OutputType>
-    <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
-    <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-  <ItemGroup>
-    <PackageReference Include="System.Net.Http.WinHttpHandler" Version="[4.4,)" />
-    <PackageReference Include="System.Runtime.Serialization.Primitives" Version="[4.3,)" />
-    <PackageReference Include="System.ServiceModel.Primitives" Version="[4.4,)" />
-    <PackageReference Include="System.Threading" Version="[4.3,)" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\lib\netcore\Thrift\Thrift.csproj" />
-  </ItemGroup>
-  <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
-    <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
-      <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
-    </Exec>
-    <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../ThriftTest.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../ThriftTest.thrift" />
-    <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../ThriftTest.thrift" />
-  </Target>
-</Project>
\ No newline at end of file
diff --git a/test/netcore/Server/TestServer.cs b/test/netcore/Server/TestServer.cs
deleted file mode 100644
index bfd3335..0000000
--- a/test/netcore/Server/TestServer.cs
+++ /dev/null
@@ -1,594 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Security.Authentication;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
-using Thrift;
-using Thrift.Collections;
-using Thrift.Protocols;
-using Thrift.Server;
-using Thrift.Transports;
-using Thrift.Transports.Server;
-
-namespace ThriftTest
-{
-    internal class ServerParam
-    {
-        internal bool useBufferedSockets = false;
-        internal bool useFramed = false;
-        internal bool useEncryption = false;
-        internal bool compact = false;
-        internal bool json = false;
-        internal int port = 9090;
-        internal string pipe = null;
-
-        internal void Parse(List<string> args)
-        {
-            for (var i = 0; i < args.Count; i++)
-            {
-                if (args[i].StartsWith("--pipe="))
-                {
-                    pipe = args[i].Substring(args[i].IndexOf("=") + 1);
-                }
-                else if (args[i].StartsWith("--port="))
-                {
-                    port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1));
-                }
-                else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered")
-                {
-                    useBufferedSockets = true;
-                }
-                else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed")
-                {
-                    useFramed = true;
-                }
-                else if (args[i] == "--binary" || args[i] == "--protocol=binary")
-                {
-                    // nothing needed
-                }
-                else if (args[i] == "--compact" || args[i] == "--protocol=compact")
-                {
-                    compact = true;
-                }
-                else if (args[i] == "--json" || args[i] == "--protocol=json")
-                {
-                    json = true;
-                }
-                else if (args[i] == "--threaded" || args[i] == "--server-type=threaded")
-                {
-                    throw new NotImplementedException(args[i]);
-                }
-                else if (args[i] == "--threadpool" || args[i] == "--server-type=threadpool")
-                {
-                    throw new NotImplementedException(args[i]);
-                }
-                else if (args[i] == "--prototype" || args[i] == "--processor=prototype")
-                {
-                    throw new NotImplementedException(args[i]);
-                }
-                else if (args[i] == "--ssl")
-                {
-                    useEncryption = true;
-                }
-                else
-                {
-                    //throw new ArgumentException(args[i]);
-                }
-            }
-
-        }
-    }
-
-    public class TestServer
-    {
-        public static int _clientID = -1;
-        public delegate void TestLogDelegate(string msg, params object[] values);
-
-        public class MyServerEventHandler : TServerEventHandler
-        {
-            public int callCount = 0;
-
-            public Task PreServeAsync(CancellationToken cancellationToken)
-            {
-                callCount++;
-                return Task.CompletedTask;
-            }
-
-            public Task<object> CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken)
-            {
-                callCount++;
-                return Task.FromResult<object>(null);
-            }
-
-            public Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output, CancellationToken cancellationToken)
-            {
-                callCount++;
-                return Task.CompletedTask;
-            }
-
-            public Task ProcessContextAsync(object serverContext, TClientTransport transport, CancellationToken cancellationToken)
-            {
-                callCount++;
-                return Task.CompletedTask;
-            }
-        }
-
-        public class TestHandlerAsync : ThriftTest.IAsync
-        {
-            public TBaseServer server { get; set; }
-            private int handlerID;
-            private StringBuilder sb = new StringBuilder();
-            private TestLogDelegate logger;
-
-            public TestHandlerAsync()
-            {
-                handlerID = Interlocked.Increment(ref _clientID);
-                logger += testConsoleLogger;
-                logger.Invoke("New TestHandler instance created");
-            }
-
-            public void testConsoleLogger(string msg, params object[] values)
-            {
-                sb.Clear();
-                sb.AppendFormat("handler{0:D3}:", handlerID);
-                sb.AppendFormat(msg, values);
-                sb.AppendLine();
-                Console.Write(sb.ToString());
-            }
-
-            public Task testVoidAsync(CancellationToken cancellationToken)
-            {
-                logger.Invoke("testVoid()");
-                return Task.CompletedTask;
-            }
-
-            public Task<string> testStringAsync(string thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testString({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<bool> testBoolAsync(bool thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testBool({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<sbyte> testByteAsync(sbyte thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testByte({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<int> testI32Async(int thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testI32({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<long> testI64Async(long thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testI64({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<double> testDoubleAsync(double thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testDouble({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<byte[]> testBinaryAsync(byte[] thing, CancellationToken cancellationToken)
-            {
-                var hex = BitConverter.ToString(thing).Replace("-", string.Empty);
-                logger.Invoke("testBinary({0:X})", hex);
-                return Task.FromResult(thing);
-            }
-
-            public Task<Xtruct> testStructAsync(Xtruct thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testStruct({{\"{0}\", {1}, {2}, {3}}})", thing.String_thing, thing.Byte_thing, thing.I32_thing, thing.I64_thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<Xtruct2> testNestAsync(Xtruct2 nest, CancellationToken cancellationToken)
-            {
-                var thing = nest.Struct_thing;
-                logger.Invoke("testNest({{{0}, {{\"{1}\", {2}, {3}, {4}, {5}}}}})",
-                    nest.Byte_thing,
-                    thing.String_thing,
-                    thing.Byte_thing,
-                    thing.I32_thing,
-                    thing.I64_thing,
-                    nest.I32_thing);
-                return Task.FromResult(nest);
-            }
-
-            public Task<Dictionary<int, int>> testMapAsync(Dictionary<int, int> thing, CancellationToken cancellationToken)
-            {
-                sb.Clear();
-                sb.Append("testMap({{");
-                var first = true;
-                foreach (var key in thing.Keys)
-                {
-                    if (first)
-                    {
-                        first = false;
-                    }
-                    else
-                    {
-                        sb.Append(", ");
-                    }
-                    sb.AppendFormat("{0} => {1}", key, thing[key]);
-                }
-                sb.Append("}})");
-                logger.Invoke(sb.ToString());
-                return Task.FromResult(thing);
-            }
-
-            public Task<Dictionary<string, string>> testStringMapAsync(Dictionary<string, string> thing, CancellationToken cancellationToken)
-            {
-                sb.Clear();
-                sb.Append("testStringMap({{");
-                var first = true;
-                foreach (var key in thing.Keys)
-                {
-                    if (first)
-                    {
-                        first = false;
-                    }
-                    else
-                    {
-                        sb.Append(", ");
-                    }
-                    sb.AppendFormat("{0} => {1}", key, thing[key]);
-                }
-                sb.Append("}})");
-                logger.Invoke(sb.ToString());
-                return Task.FromResult(thing);
-            }
-
-            public Task<THashSet<int>> testSetAsync(THashSet<int> thing, CancellationToken cancellationToken)
-            {
-                sb.Clear();
-                sb.Append("testSet({{");
-                var first = true;
-                foreach (int elem in thing)
-                {
-                    if (first)
-                    {
-                        first = false;
-                    }
-                    else
-                    {
-                        sb.Append(", ");
-                    }
-                    sb.AppendFormat("{0}", elem);
-                }
-                sb.Append("}})");
-                logger.Invoke(sb.ToString());
-                return Task.FromResult(thing);
-            }
-
-            public Task<List<int>> testListAsync(List<int> thing, CancellationToken cancellationToken)
-            {
-                sb.Clear();
-                sb.Append("testList({{");
-                var first = true;
-                foreach (var elem in thing)
-                {
-                    if (first)
-                    {
-                        first = false;
-                    }
-                    else
-                    {
-                        sb.Append(", ");
-                    }
-                    sb.AppendFormat("{0}", elem);
-                }
-                sb.Append("}})");
-                logger.Invoke(sb.ToString());
-                return Task.FromResult(thing);
-            }
-
-            public Task<Numberz> testEnumAsync(Numberz thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testEnum({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<long> testTypedefAsync(long thing, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testTypedef({0})", thing);
-                return Task.FromResult(thing);
-            }
-
-            public Task<Dictionary<int, Dictionary<int, int>>> testMapMapAsync(int hello, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testMapMap({0})", hello);
-                var mapmap = new Dictionary<int, Dictionary<int, int>>();
-
-                var pos = new Dictionary<int, int>();
-                var neg = new Dictionary<int, int>();
-                for (var i = 1; i < 5; i++)
-                {
-                    pos[i] = i;
-                    neg[-i] = -i;
-                }
-
-                mapmap[4] = pos;
-                mapmap[-4] = neg;
-
-                return Task.FromResult(mapmap);
-            }
-
-            public Task<Dictionary<long, Dictionary<Numberz, Insanity>>> testInsanityAsync(Insanity argument, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testInsanity()");
-
-                /** from ThriftTest.thrift:
-                 * So you think you've got this all worked, out eh?
-                 *
-                 * Creates a the returned map with these values and prints it out:
-                 *   { 1 => { 2 => argument,
-                 *            3 => argument,
-                 *          },
-                 *     2 => { 6 => <empty Insanity struct>, },
-                 *   }
-                 * @return map<UserId, map<Numberz,Insanity>> - a map with the above values
-                 */
-
-                var first_map = new Dictionary<Numberz, Insanity>();
-                var second_map = new Dictionary<Numberz, Insanity>(); ;
-
-                first_map[Numberz.TWO] = argument;
-                first_map[Numberz.THREE] = argument;
-
-                second_map[Numberz.SIX] = new Insanity();
-
-                var insane = new Dictionary<long, Dictionary<Numberz, Insanity>>
-                {
-                    [1] = first_map,
-                    [2] = second_map
-                };
-
-                return Task.FromResult(insane);
-            }
-
-            public Task<Xtruct> testMultiAsync(sbyte arg0, int arg1, long arg2, Dictionary<short, string> arg3, Numberz arg4, long arg5,
-                CancellationToken cancellationToken)
-            {
-                logger.Invoke("testMulti()");
-
-                var hello = new Xtruct(); ;
-                hello.String_thing = "Hello2";
-                hello.Byte_thing = arg0;
-                hello.I32_thing = arg1;
-                hello.I64_thing = arg2;
-                return Task.FromResult(hello);
-            }
-
-            public Task testExceptionAsync(string arg, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testException({0})", arg);
-                if (arg == "Xception")
-                {
-                    var x = new Xception
-                    {
-                        ErrorCode = 1001,
-                        Message = arg
-                    };
-                    throw x;
-                }
-                if (arg == "TException")
-                {
-                    throw new TException();
-                }
-                return Task.CompletedTask;
-            }
-
-            public Task<Xtruct> testMultiExceptionAsync(string arg0, string arg1, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testMultiException({0}, {1})", arg0, arg1);
-                if (arg0 == "Xception")
-                {
-                    var x = new Xception
-                    {
-                        ErrorCode = 1001,
-                        Message = "This is an Xception"
-                    };
-                    throw x;
-                }
-
-                if (arg0 == "Xception2")
-                {
-                    var x = new Xception2
-                    {
-                        ErrorCode = 2002,
-                        Struct_thing = new Xtruct { String_thing = "This is an Xception2" }
-                    };
-                    throw x;
-                }
-
-                var result = new Xtruct { String_thing = arg1 };
-                return Task.FromResult(result);
-            }
-
-            public Task testOnewayAsync(int secondsToSleep, CancellationToken cancellationToken)
-            {
-                logger.Invoke("testOneway({0}), sleeping...", secondsToSleep);
-                Task.Delay(secondsToSleep * 1000, cancellationToken).GetAwaiter().GetResult();
-                logger.Invoke("testOneway finished");
-
-                return Task.CompletedTask;
-            }
-        }
-
-        internal static void PrintOptionsHelp()
-        {
-            Console.WriteLine("Server options:");
-            Console.WriteLine("  --pipe=<pipe name>");
-            Console.WriteLine("  --port=<port number>");
-            Console.WriteLine("  --transport=<transport name>    one of buffered,framed  (defaults to none)");
-            Console.WriteLine("  --protocol=<protocol name>      one of compact,json  (defaults to binary)");
-            Console.WriteLine("  --server-type=<type>            one of threaded,threadpool  (defaults to simple)");
-            Console.WriteLine("  --processor=<prototype>");
-            Console.WriteLine("  --ssl");
-            Console.WriteLine();
-        }
-
-        private static X509Certificate2 GetServerCert()
-        {
-            var serverCertName = "server.p12";
-            var possiblePaths = new List<string>
-            {
-                "../../../keys/",
-                "../../keys/",
-                "../keys/",
-                "keys/",
-            };
-                        
-            string existingPath = null;
-            foreach (var possiblePath in possiblePaths)
-            {
-                var path = Path.GetFullPath(possiblePath + serverCertName);
-                if (File.Exists(path))
-                {
-                    existingPath = path;
-                    break;
-                }
-            }
-                        
-            if (string.IsNullOrEmpty(existingPath))
-            {
-                throw new FileNotFoundException($"Cannot find file: {serverCertName}");
-            }
-                                    
-            var cert = new X509Certificate2(existingPath, "thrift");
-                        
-            return cert;
-        }
-
-        public static int Execute(List<string> args)
-        {
-            var loggerFactory = new LoggerFactory();//.AddConsole().AddDebug();
-            var logger = new LoggerFactory().CreateLogger("Test");
-
-            try
-            {
-                var param = new ServerParam();
-
-                try
-                {
-                    param.Parse(args);
-                }
-                catch (Exception ex)
-                {
-                    Console.WriteLine("*** FAILED ***");
-                    Console.WriteLine("Error while  parsing arguments");
-                    Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
-                    return 1;
-                }
-
-
-                // Transport
-                TServerTransport trans;
-                if (param.pipe != null)
-                {
-                    trans = new TNamedPipeServerTransport(param.pipe);
-                }
-//                else if (param.useFramed)
-//                {
-//                    trans = new TServerFramedTransport(param.port);
-//                }
-                else
-                {
-                    if (param.useEncryption)
-                    {
-                        var cert = GetServerCert();
-                        
-                        if (cert == null || !cert.HasPrivateKey)
-                        {
-                            throw new InvalidOperationException("Certificate doesn't contain private key");
-                        }
-                        
-                        trans = new TTlsServerSocketTransport(param.port, param.useBufferedSockets, param.useFramed, cert, 
-                            (sender, certificate, chain, errors) => true, 
-                            null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12);
-                    }
-                    else
-                    {
-                        trans = new TServerSocketTransport(param.port, 0, param.useBufferedSockets, param.useFramed);
-                    }
-                }
-
-                ITProtocolFactory proto;
-                if (param.compact)
-                    proto = new TCompactProtocol.Factory();
-                else if (param.json)
-                    proto = new TJsonProtocol.Factory();
-                else
-                    proto = new TBinaryProtocol.Factory();
-
-                ITProcessorFactory processorFactory;
-
-                // Processor
-                var testHandler = new TestHandlerAsync();
-                var testProcessor = new ThriftTest.AsyncProcessor(testHandler);
-                processorFactory = new SingletonTProcessorFactory(testProcessor);
-
-                TTransportFactory transFactory = new TTransportFactory(); 
-
-                TBaseServer serverEngine = new AsyncBaseServer(processorFactory, trans, transFactory, transFactory, proto, proto, logger);
-
-                //Server event handler
-                var serverEvents = new MyServerEventHandler();
-                serverEngine.SetEventHandler(serverEvents);
-
-                // Run it
-                var where = (! string.IsNullOrEmpty(param.pipe)) ? "on pipe " + param.pipe : "on port " + param.port;
-                Console.WriteLine("Starting the AsyncBaseServer " + where +
-                                  " with processor TPrototypeProcessorFactory prototype factory " +
-                                  (param.useBufferedSockets ? " with buffered socket" : "") +
-                                  (param.useFramed ? " with framed transport" : "") +
-                                  (param.useEncryption ? " with encryption" : "") +
-                                  (param.compact ? " with compact protocol" : "") +
-                                  (param.json ? " with json protocol" : "") +
-                                  "...");
-                serverEngine.ServeAsync(CancellationToken.None).GetAwaiter().GetResult();
-                Console.ReadLine();
-            }
-            catch (Exception x)
-            {
-                Console.Error.Write(x);
-                return 1;
-            }
-            Console.WriteLine("done.");
-            return 0;
-        }
-    }
-
-}
diff --git a/test/netcore/ThriftTest.sln b/test/netcore/ThriftTest.sln
deleted file mode 100644
index 2ab241a..0000000
--- a/test/netcore/ThriftTest.sln
+++ /dev/null
@@ -1,64 +0,0 @@
-﻿Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.12
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift", "..\..\lib\netcore\Thrift\Thrift.csproj", "{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{21039F25-6ED7-4E80-A545-EBC93472EBD1}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{0C6E8685-F191-4479-9842-882A38961127}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Debug|x64 = Debug|x64
-		Debug|x86 = Debug|x86
-		Release|Any CPU = Release|Any CPU
-		Release|x64 = Release|x64
-		Release|x86 = Release|x86
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x64.Build.0 = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x86.Build.0 = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|Any CPU.Build.0 = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x64.ActiveCfg = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x64.Build.0 = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x86.ActiveCfg = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x86.Build.0 = Release|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Debug|x64.Build.0 = Debug|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Debug|x86.Build.0 = Debug|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Release|Any CPU.Build.0 = Release|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Release|x64.ActiveCfg = Release|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Release|x64.Build.0 = Release|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Release|x86.ActiveCfg = Release|Any CPU
-		{21039F25-6ED7-4E80-A545-EBC93472EBD1}.Release|x86.Build.0 = Release|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Debug|x64.Build.0 = Debug|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Debug|x86.Build.0 = Debug|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Release|Any CPU.Build.0 = Release|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Release|x64.ActiveCfg = Release|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Release|x64.Build.0 = Release|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Release|x86.ActiveCfg = Release|Any CPU
-		{0C6E8685-F191-4479-9842-882A38961127}.Release|x86.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {52CE9A12-F6CB-4F0C-BB42-0105612F5FF4}
-	EndGlobalSection
-EndGlobal
diff --git a/test/netcore/build.cmd b/test/netcore/build.cmd
deleted file mode 100644
index 9b84ef2..0000000
--- a/test/netcore/build.cmd
+++ /dev/null
@@ -1,25 +0,0 @@
-@echo off
-rem /*
-rem  * Licensed to the Apache Software Foundation (ASF) under one
-rem  * or more contributor license agreements. See the NOTICE file
-rem  * distributed with this work for additional information
-rem  * regarding copyright ownership. The ASF licenses this file
-rem  * to you under the Apache License, Version 2.0 (the
-rem  * "License"); you may not use this file except in compliance
-rem  * with the License. You may obtain a copy of the License at
-rem  *
-rem  *   http://www.apache.org/licenses/LICENSE-2.0
-rem  *
-rem  * Unless required by applicable law or agreed to in writing,
-rem  * software distributed under the License is distributed on an
-rem  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem  * KIND, either express or implied. See the License for the
-rem  * specific language governing permissions and limitations
-rem  * under the License.
-rem  */
-setlocal
-
-dotnet --info
-dotnet build
-
-:eof
diff --git a/test/netcore/build.sh b/test/netcore/build.sh
deleted file mode 100755
index c97e310..0000000
--- a/test/netcore/build.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#exit if any command fails
-set -e
-
-dotnet --info
-dotnet build
diff --git a/tutorial/Makefile.am b/tutorial/Makefile.am
index 49d18fb..f7a49d0 100755
--- a/tutorial/Makefile.am
+++ b/tutorial/Makefile.am
@@ -59,7 +59,6 @@
 endif
 
 if WITH_DOTNET
-SUBDIRS += netcore
 SUBDIRS += netstd
 endif
 
diff --git a/tutorial/netcore/.gitignore b/tutorial/netcore/.gitignore
deleted file mode 100644
index 9938bb2..0000000
--- a/tutorial/netcore/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-!**/*.pfx
\ No newline at end of file
diff --git a/tutorial/netcore/Client/Client.csproj b/tutorial/netcore/Client/Client.csproj
deleted file mode 100644
index 911272d..0000000
--- a/tutorial/netcore/Client/Client.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-    <AssemblyName>Client</AssemblyName>
-    <PackageId>Client</PackageId>
-    <OutputType>Exe</OutputType>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\Interfaces\Interfaces.csproj" />
-    <ProjectReference Include="..\..\..\lib\netcore\Thrift\Thrift.csproj" />
-  </ItemGroup>
-
-</Project>
diff --git a/tutorial/netcore/Client/Program.cs b/tutorial/netcore/Client/Program.cs
deleted file mode 100644
index ce5d8c7..0000000
--- a/tutorial/netcore/Client/Program.cs
+++ /dev/null
@@ -1,355 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Security;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
-using Thrift;
-using Thrift.Protocols;
-using Thrift.Transports;
-using Thrift.Transports.Client;
-using tutorial;
-using shared;
-
-namespace Client
-{
-    public class Program
-    {
-        private static readonly ILogger Logger = new LoggerFactory().AddConsole().AddDebug().CreateLogger(nameof(Client));
-
-        private static void DisplayHelp()
-        {
-            Logger.LogInformation(@"
-Usage: 
-    Client.exe -help
-        will diplay help information 
-
-    Client.exe -tr:<transport> -pr:<protocol> -mc:<numClients>
-        will run client with specified arguments (tcp transport and binary protocol by default) and with 1 client
-
-Options:
-    -tr (transport): 
-        tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090)
-        tcpbuffered - buffered transport over tcp will be used (host - ""localhost"", port - 9090)
-        namedpipe - namedpipe transport will be used (pipe address - "".test"")
-        http - http transport will be used (address - ""http://localhost:9090"")        
-        tcptls - tcp tls transport will be used (host - ""localhost"", port - 9090)
-        framed - tcp framed transport will be used (host - ""localhost"", port - 9090)
-
-    -pr (protocol): 
-        binary - (default) binary protocol will be used
-        compact - compact protocol will be used
-        json - json protocol will be used
-        multiplexed - multiplexed protocol will be used
-
-    -mc (multiple clients):
-        <numClients> - number of multiple clients to connect to server (max 100, default 1)
-
-Sample:
-    Client.exe -tr:tcp -p:binary
-");
-        }
-
-        public static void Main(string[] args)
-        {
-            args = args ?? new string[0];
-
-            if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
-            {
-                DisplayHelp();
-                return;
-            }
-
-            Logger.LogInformation("Starting client...");
-
-            using (var source = new CancellationTokenSource())
-            {
-                RunAsync(args, source.Token).GetAwaiter().GetResult();
-            }
-        }
-
-        private static async Task RunAsync(string[] args, CancellationToken cancellationToken)
-        {
-            var numClients = GetNumberOfClients(args);
-
-            Logger.LogInformation($"Selected # of clients: {numClients}");
-
-            var transports = new TClientTransport[numClients];
-            for (int i = 0; i < numClients; i++)
-            {
-                var t = GetTransport(args);
-                transports[i] = t;
-            }
-            
-            Logger.LogInformation($"Selected client transport: {transports[0]}");
-
-            var protocols = new Tuple<Protocol, TProtocol>[numClients];
-            for (int i = 0; i < numClients; i++)
-            {
-                var p = GetProtocol(args, transports[i]);
-                protocols[i] = p;
-            }
-
-            Logger.LogInformation($"Selected client protocol: {protocols[0].Item1}");
-
-            var tasks = new Task[numClients];
-            for (int i = 0; i < numClients; i++)
-            {
-                var task = RunClientAsync(protocols[i], cancellationToken);
-                tasks[i] = task;
-            }
-
-            Task.WaitAll(tasks);
-
-            await Task.CompletedTask;
-        }
-
-        private static TClientTransport GetTransport(string[] args)
-        {
-            var transport = args.FirstOrDefault(x => x.StartsWith("-tr"))?.Split(':')?[1];
-
-            Transport selectedTransport;
-            if (Enum.TryParse(transport, true, out selectedTransport))
-            {
-                switch (selectedTransport)
-                {
-                    case Transport.Tcp:
-                        return new TSocketClientTransport(IPAddress.Loopback, 9090);
-                    case Transport.NamedPipe:
-                        return new TNamedPipeClientTransport(".test");
-                    case Transport.Http:
-                        return new THttpClientTransport(new Uri("http://localhost:9090"), null);
-                    case Transport.TcpBuffered:
-                        return new TBufferedClientTransport(new TSocketClientTransport(IPAddress.Loopback, 9090));
-                    case Transport.TcpTls:
-                        return new TTlsSocketClientTransport(IPAddress.Loopback, 9090, GetCertificate(), CertValidator, LocalCertificateSelectionCallback);
-                    case Transport.Framed:
-                        return new TFramedClientTransport(new TSocketClientTransport(IPAddress.Loopback, 9090));
-                }
-            }
-
-            return new TSocketClientTransport(IPAddress.Loopback, 9090);
-        }
-
-        private static int GetNumberOfClients(string[] args)
-        {
-            var numClients = args.FirstOrDefault(x => x.StartsWith("-mc"))?.Split(':')?[1];
-
-            Logger.LogInformation($"Selected # of clients: {numClients}");
-
-            int c;
-            if( int.TryParse(numClients, out c) && (0 < c) && (c <= 100))
-				return c;
-			else
-				return 1;
-        }
-
-        private static X509Certificate2 GetCertificate()
-        {
-            // due to files location in net core better to take certs from top folder
-            var certFile = GetCertPath(Directory.GetParent(Directory.GetCurrentDirectory()));
-            return new X509Certificate2(certFile, "ThriftTest");
-        }
-
-        private static string GetCertPath(DirectoryInfo di, int maxCount = 6)
-        {
-            var topDir = di;
-            var certFile =
-                topDir.EnumerateFiles("ThriftTest.pfx", SearchOption.AllDirectories)
-                    .FirstOrDefault();
-            if (certFile == null)
-            {
-                if (maxCount == 0)
-                    throw new FileNotFoundException("Cannot find file in directories");
-                return GetCertPath(di.Parent, maxCount - 1);
-            }
-
-            return certFile.FullName;
-        }
-
-        private static X509Certificate LocalCertificateSelectionCallback(object sender,
-            string targetHost, X509CertificateCollection localCertificates,
-            X509Certificate remoteCertificate, string[] acceptableIssuers)
-        {
-            return GetCertificate();
-        }
-
-        private static bool CertValidator(object sender, X509Certificate certificate,
-            X509Chain chain, SslPolicyErrors sslPolicyErrors)
-        {
-            return true;
-        }
-
-        private static Tuple<Protocol, TProtocol> GetProtocol(string[] args, TClientTransport transport)
-        {
-            var protocol = args.FirstOrDefault(x => x.StartsWith("-pr"))?.Split(':')?[1];
-
-            Protocol selectedProtocol;
-            if (Enum.TryParse(protocol, true, out selectedProtocol))
-            {
-                switch (selectedProtocol)
-                {
-                    case Protocol.Binary:
-                        return new Tuple<Protocol, TProtocol>(selectedProtocol, new TBinaryProtocol(transport));
-                    case Protocol.Compact:
-                        return new Tuple<Protocol, TProtocol>(selectedProtocol, new TCompactProtocol(transport));
-                    case Protocol.Json:
-                        return new Tuple<Protocol, TProtocol>(selectedProtocol, new TJsonProtocol(transport));
-                    case Protocol.Multiplexed:
-                        // it returns BinaryProtocol to avoid making wrapped protocol as public in TProtocolDecorator (in RunClientAsync it will be wrapped into Multiplexed protocol)
-                        return new Tuple<Protocol, TProtocol>(selectedProtocol, new TBinaryProtocol(transport));
-                }
-            }
-
-            return new Tuple<Protocol, TProtocol>(selectedProtocol, new TBinaryProtocol(transport));
-        }
-
-        private static async Task RunClientAsync(Tuple<Protocol, TProtocol> protocolTuple, CancellationToken cancellationToken)
-        {
-            try
-            {
-                var protocol = protocolTuple.Item2;
-                var protocolType = protocolTuple.Item1;
-
-                TBaseClient client = null;
-
-                try
-                {
-                    if (protocolType != Protocol.Multiplexed)
-                    {
-
-                        client = new Calculator.Client(protocol);
-                        await ExecuteCalculatorClientOperations(cancellationToken, (Calculator.Client)client);
-                    }
-                    else
-                    {
-                        // it uses binary protocol there  to create Multiplexed protocols
-                        var multiplex = new TMultiplexedProtocol(protocol, nameof(Calculator));
-                        client = new Calculator.Client(multiplex);
-                        await ExecuteCalculatorClientOperations(cancellationToken, (Calculator.Client)client);
-
-                        multiplex = new TMultiplexedProtocol(protocol, nameof(SharedService));
-                        client = new SharedService.Client(multiplex);
-                        await ExecuteSharedServiceClientOperations(cancellationToken, (SharedService.Client)client);
-                    }
-                }
-                catch (Exception ex)
-                {
-                    Logger.LogError($"{client?.ClientId} " + ex);
-                }
-                finally
-                {
-                    protocol.Transport.Close();
-                }
-            }
-            catch (TApplicationException x)
-            {
-                Logger.LogError(x.ToString());
-            }
-        }
-
-        private static async Task ExecuteCalculatorClientOperations(CancellationToken cancellationToken, Calculator.Client client)
-        {
-            await client.OpenTransportAsync(cancellationToken);
-
-            // Async version
-
-            Logger.LogInformation($"{client.ClientId} PingAsync()");
-            await client.pingAsync(cancellationToken);
-
-            Logger.LogInformation($"{client.ClientId} AddAsync(1,1)");
-            var sum = await client.addAsync(1, 1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} AddAsync(1,1)={sum}");
-
-            var work = new Work
-            {
-                Op = Operation.DIVIDE,
-                Num1 = 1,
-                Num2 = 0
-            };
-
-            try
-            {
-                Logger.LogInformation($"{client.ClientId} CalculateAsync(1)");
-                await client.calculateAsync(1, work, cancellationToken);
-                Logger.LogInformation($"{client.ClientId} Whoa we can divide by 0");
-            }
-            catch (InvalidOperation io)
-            {
-                Logger.LogInformation($"{client.ClientId} Invalid operation: " + io);
-            }
-
-            work.Op = Operation.SUBTRACT;
-            work.Num1 = 15;
-            work.Num2 = 10;
-
-            try
-            {
-                Logger.LogInformation($"{client.ClientId} CalculateAsync(1)");
-                var diff = await client.calculateAsync(1, work, cancellationToken);
-                Logger.LogInformation($"{client.ClientId} 15-10={diff}");
-            }
-            catch (InvalidOperation io)
-            {
-                Logger.LogInformation($"{client.ClientId} Invalid operation: " + io);
-            }
-
-            Logger.LogInformation($"{client.ClientId} GetStructAsync(1)");
-            var log = await client.getStructAsync(1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} Check log: {log.Value}");
-
-            Logger.LogInformation($"{client.ClientId} ZipAsync() with delay 100mc on server side");
-            await client.zipAsync(cancellationToken);
-        }
-        private static async Task ExecuteSharedServiceClientOperations(CancellationToken cancellationToken, SharedService.Client client)
-        {
-            await client.OpenTransportAsync(cancellationToken);
-
-            // Async version
-
-            Logger.LogInformation($"{client.ClientId} SharedService GetStructAsync(1)");
-            var log = await client.getStructAsync(1, cancellationToken);
-            Logger.LogInformation($"{client.ClientId} SharedService Value: {log.Value}");
-        }
-
-
-        private enum Transport
-        {
-            Tcp,
-            NamedPipe,
-            Http,
-            TcpBuffered,
-            Framed,
-            TcpTls
-        }
-
-        private enum Protocol
-        {
-            Binary,
-            Compact,
-            Json,
-            Multiplexed
-        }
-    }
-}
diff --git a/tutorial/netcore/Client/Properties/AssemblyInfo.cs b/tutorial/netcore/Client/Properties/AssemblyInfo.cs
deleted file mode 100644
index 568382e..0000000
--- a/tutorial/netcore/Client/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("de78a01b-f7c6-49d1-97da-669d2ed37641")]
\ No newline at end of file
diff --git a/tutorial/netcore/Client/Properties/launchSettings.json b/tutorial/netcore/Client/Properties/launchSettings.json
deleted file mode 100644
index 6b7b60d..0000000
--- a/tutorial/netcore/Client/Properties/launchSettings.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "profiles": {
-    "Client": {
-      "commandName": "Project",
-      "commandLineArgs": "-p:multiplexed"
-    }
-  }
-}
\ No newline at end of file
diff --git a/tutorial/netcore/Client/ThriftTest.pfx b/tutorial/netcore/Client/ThriftTest.pfx
deleted file mode 100644
index f0ded28..0000000
--- a/tutorial/netcore/Client/ThriftTest.pfx
+++ /dev/null
Binary files differ
diff --git a/tutorial/netcore/Interfaces/.gitignore b/tutorial/netcore/Interfaces/.gitignore
deleted file mode 100644
index 2e7446e..0000000
--- a/tutorial/netcore/Interfaces/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# ignore for autogenerated files
-/shared
-/tutorial
diff --git a/tutorial/netcore/Interfaces/Interfaces.csproj b/tutorial/netcore/Interfaces/Interfaces.csproj
deleted file mode 100644
index 4297a06..0000000
--- a/tutorial/netcore/Interfaces/Interfaces.csproj
+++ /dev/null
@@ -1,30 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <AssemblyName>Interfaces</AssemblyName>
-    <PackageId>Interfaces</PackageId>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="../../../lib/netcore/Thrift/Thrift.csproj" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <PackageReference Include="System.ServiceModel.Primitives" Version="[4.4,)" />
-  </ItemGroup>
-
-  <Target Name="PreBuild" BeforeTargets="_GenerateRestoreProjectSpec;Restore;Compile">
-    <Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
-      <Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
-    </Exec>
-    <Exec Condition="Exists('$(PathToThrift)')" Command="$(PathToThrift) -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../tutorial.thrift" />
-    <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../tutorial.thrift" />
-    <Exec Condition="Exists('./../../../compiler/cpp/thrift')" Command="./../../../compiler/cpp/thrift -out $(ProjectDir) -gen netcore:wcf,union,serial,hashcode -r ./../../tutorial.thrift" />
-  </Target>
-
-</Project>
diff --git a/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs b/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9126b17..0000000
--- a/tutorial/netcore/Interfaces/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("4d13163d-9067-4c9c-8af0-64e08451397d")]
\ No newline at end of file
diff --git a/tutorial/netcore/Makefile.am b/tutorial/netcore/Makefile.am
deleted file mode 100644
index bd19dfe..0000000
--- a/tutorial/netcore/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-SUBDIRS = . 
-
-all-local:
-	$(DOTNETCORE) build
-
-clean-local:
-	$(RM) Interfaces.dll
-	$(RM) -r Client/bin
-	$(RM) -r Client/obj
-	$(RM) -r Server/bin
-	$(RM) -r Server/obj
-	$(RM) -r Interfaces/bin
-	$(RM) -r Interfaces/obj
-
-dist-hook:
-	$(RM) $(distdir)/Interfaces.dll
-	$(RM) -r $(distdir)/Client/bin
-	$(RM) -r $(distdir)/Client/obj
-	$(RM) -r $(distdir)/Server/bin
-	$(RM) -r $(distdir)/Server/obj
-	$(RM) -r $(distdir)/Interfaces/bin
-	$(RM) -r $(distdir)/Interfaces/obj
-
-EXTRA_DIST = \
-	Client \
-	Interfaces \
-	README.md \
-	Server \
-	Tutorial.sln \
-	build.cmd \
-	build.sh
-			 
diff --git a/tutorial/netcore/README.md b/tutorial/netcore/README.md
deleted file mode 100644
index 626ef92..0000000
--- a/tutorial/netcore/README.md
+++ /dev/null
@@ -1,278 +0,0 @@
-# Building of samples for different platforms 
-
-# Reused components 
-- NET Core Standard 2.0
-- NET Core App 2.0
-
-# How to build
-- Download and install the latest .NET Core SDK for your platform https://www.microsoft.com/net/core#windowsvs2015 (archive for SDK 1.0.0-preview2-003121 located by: https://github.com/dotnet/core/blob/master/release-notes/download-archive.md)
-- Ensure that you have thrift.exe which supports netcore lib and it added to PATH 
-- Go to current folder 
-- Run **build.sh** or **build.cmd** from the root of cloned repository
-- Check tests in **src/Tests** folder
-- Continue with /tutorials/netcore 
-
-# How to run 
-
-Notes: dotnet run supports passing arguments to app after -- symbols (https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-run) - example: **dotnet run -- -h** will show help for app
-
-- build 
-- go to folder (Client/Server) 
-- run with specifying of correct parameters **dotnet run -tr:tcp -pr:multiplexed**, **dotnet run -help** (later, after migration to csproj and latest SDK will be possibility to use more usable form **dotnet run -- arguments**)
-
-#Notes
-- Possible adding additional platforms after stabilization of .NET Core (runtimes, platforms (Red Hat Linux, OpenSuse, etc.) 
-
-#Known issues
-- In trace logging mode you can see some not important internal exceptions
-
-# Running of samples 
-Please install Thrift C# .NET Core library or copy sources and build them to correcly build and run samples 
-
-# NetCore Server
-
-Usage: 
-
-    Server.exe -h
-        will diplay help information 
-
-    Server.exe -tr:<transport> -pr:<protocol> 
-        will run server with specified arguments (tcp transport and binary protocol by default)
-
-Options:
-
-    -tr (transport): 
-        tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090)
-        tcpbuffered - tcp buffered transport will be used (host - ""localhost"", port - 9090)
-        namedpipe - namedpipe transport will be used (pipe address - "".test"")
-        http - http transport will be used (http address - ""localhost:9090"")
-        tcptls - tcp transport with tls will be used (host - ""localhost"", port - 9090)
-        framed - tcp framed transport will be used (host - ""localhost"", port - 9090)
-
-    -pr (protocol): 
-        binary - (default) binary protocol will be used
-        compact - compact protocol will be used
-        json - json protocol will be used
-		
-Sample:
-
-    Server.exe -tr:tcp
-
-**Remarks**:
-
-    For TcpTls mode certificate's file ThriftTest.pfx should be in directory with binaries in case of command line usage (or at project level in case of debugging from IDE).
-    Password for certificate - "ThriftTest".
-
-
-
-# NetCore Client
-
-Usage: 
-
-    Client.exe -h
-        will diplay help information 
-
-    Client.exe -tr:<transport> -pr:<protocol> -mc:<numClients>
-        will run client with specified arguments (tcp transport and binary protocol by default)
-
-Options:
-
-    -tr (transport): 
-        tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090)
-        tcpbuffered - buffered transport over tcp will be used (host - ""localhost"", port - 9090)
-        namedpipe - namedpipe transport will be used (pipe address - "".test"")
-        http - http transport will be used (address - ""http://localhost:9090"")        
-        tcptls - tcp tls transport will be used (host - ""localhost"", port - 9090)
-        framed - tcp framed transport will be used (host - ""localhost"", port - 9090)
-
-    -pr (protocol): 
-        binary - (default) binary protocol will be used
-        compact - compact protocol will be used
-        json - json protocol will be used
-        
-    -mc (multiple clients):
-        <numClients> - number of multiple clients to connect to server (max 100, default 1)
-
-Sample:
-
-    Client.exe -tr:tcp -pr:binary -mc:10
-
-Remarks:
-
-    For TcpTls mode certificate's file ThriftTest.pfx should be in directory 
-	with binaries in case of command line usage (or at project level in case of debugging from IDE).
-    Password for certificate - "ThriftTest".
-
-# How to test communication between NetCore and Python
-
-* Generate code with the latest **thrift.exe** util
-* Ensure that **thrift.exe** util generated folder **gen-py** with generated code for Python
-* Create **client.py** and **server.py** from the code examples below and save them to the folder with previosly generated folder **gen-py**
-* Run netcore samples (client and server) and python samples (client and server)
-
-Remarks:
-
-Samples of client and server code below use correct methods (operations) 
-and fields (properties) according to generated contracts from *.thrift files
-
-At Windows 10 add record **127.0.0.1 testserver** to **C:\Windows\System32\drivers\etc\hosts** file
-for correct work of python server
-
-
-**Python Client:**
-	
-```python
-import sys
-import glob
-sys.path.append('gen-py')
-
-from tutorial import Calculator
-from tutorial.ttypes import InvalidOperation, Operation, Work
-
-from thrift import Thrift
-from thrift.transport import TSocket
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol
-
-
-def main():
-    # Make socket
-    transport = TSocket.TSocket('127.0.0.1', 9090)
-
-    # Buffering is critical. Raw sockets are very slow
-    transport = TTransport.TBufferedTransport(transport)
-
-    # Wrap in a protocol
-    protocol = TBinaryProtocol.TBinaryProtocol(transport)
-
-    # Create a client to use the protocol encoder
-    client = Calculator.Client(protocol)
-
-    # Connect!
-    transport.open()
-
-    client.Ping()
-    print('ping()')
-
-    sum = client.Add(1, 1)
-    print(('1+1=%d' % (sum)))
-
-    work = Work()
-
-    work.Op = Operation.Divide
-    work.Num1 = 1
-    work.Num2 = 0
-
-    try:
-        quotient = client.Calculate(1, work)
-        print('Whoa? You know how to divide by zero?')
-        print('FYI the answer is %d' % quotient)
-    except InvalidOperation as e:
-        print(('InvalidOperation: %r' % e))
-
-    work.Op = Operation.Substract
-    work.Num1 = 15
-    work.Num2 = 10
-
-    diff = client.Calculate(1, work)
-    print(('15-10=%d' % (diff)))
-
-    log = client.GetStruct(1)
-    print(('Check log: %s' % (log.Value)))
-
-    client.Zip()
-    print('zip()')
-
-    # Close!
-    transport.close()
-
-if __name__ == '__main__':
-  try:
-    main()
-  except Thrift.TException as tx:
-    print('%s' % tx.message)
-```
-
-
-**Python Server:**
-
-
-```python
-import glob
-import sys
-sys.path.append('gen-py')
-
-from tutorial import Calculator
-from tutorial.ttypes import InvalidOperation, Operation
-
-from shared.ttypes import SharedStruct
-
-from thrift.transport import TSocket
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol
-from thrift.server import TServer
-
-
-class CalculatorHandler:
-    def __init__(self):
-        self.log = {}
-
-    def Ping(self):
-        print('ping()')
-
-    def Add(self, n1, n2):
-        print('add(%d,%d)' % (n1, n2))
-        return n1 + n2
-
-    def Calculate(self, logid, work):
-        print('calculate(%d, %r)' % (logid, work))
-
-        if work.Op == Operation.Add:
-            val = work.Num1 + work.Num2
-        elif work.Op == Operation.Substract:
-            val = work.Num1 - work.Num2
-        elif work.Op == Operation.Multiply:
-            val = work.Num1 * work.Num2
-        elif work.Op == Operation.Divide:
-            if work.Num2 == 0:
-                x = InvalidOperation()
-                x.WhatOp = work.Op
-                x.Why = 'Cannot divide by 0'
-                raise x
-            val = work.Num1 / work.Num2
-        else:
-            x = InvalidOperation()
-            x.WhatOp = work.Op
-            x.Why = 'Invalid operation'
-            raise x
-
-        log = SharedStruct()
-        log.Key = logid
-        log.Value = '%d' % (val)
-        self.log[logid] = log
-
-        return val
-
-    def GetStruct(self, key):
-        print('getStruct(%d)' % (key))
-        return self.log[key]
-
-    def Zip(self):
-        print('zip()')
-
-if __name__ == '__main__':
-    handler = CalculatorHandler()
-    processor = Calculator.Processor(handler)
-    transport = TSocket.TServerSocket(host="testserver", port=9090)
-    tfactory = TTransport.TBufferedTransportFactory()
-    pfactory = TBinaryProtocol.TBinaryProtocolFactory()
-
-    server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)
-    print('Starting the server...')
-    server.serve()
-    print('done.')
-
-    # You could do one of these for a multithreaded server
-    # server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
-    # server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory)
-```
diff --git a/tutorial/netcore/Server/Program.cs b/tutorial/netcore/Server/Program.cs
deleted file mode 100644
index 6a181ba..0000000
--- a/tutorial/netcore/Server/Program.cs
+++ /dev/null
@@ -1,428 +0,0 @@
-// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net.Security;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Thrift;
-using Thrift.Protocols;
-using Thrift.Server;
-using Thrift.Transports;
-using Thrift.Transports.Server;
-using tutorial;
-using shared;
-
-namespace Server
-{
-    public class Program
-    {
-        private static readonly ILogger Logger = new LoggerFactory().AddConsole(LogLevel.Trace).AddDebug(LogLevel.Trace).CreateLogger(nameof(Server));
-
-        public static void Main(string[] args)
-        {
-            args = args ?? new string[0];
-
-            if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
-            {
-                DisplayHelp();
-                return;
-            }
-
-            using (var source = new CancellationTokenSource())
-            {
-                RunAsync(args, source.Token).GetAwaiter().GetResult();
-
-                Logger.LogInformation("Press any key to stop...");
-
-                Console.ReadLine();
-                source.Cancel();
-            }
-
-            Logger.LogInformation("Server stopped");
-        }
-
-        private static void DisplayHelp()
-        {
-            Logger.LogInformation(@"
-Usage: 
-    Server.exe -help
-        will diplay help information 
-
-    Server.exe -tr:<transport> -pr:<protocol>
-        will run server with specified arguments (tcp transport and binary protocol by default)
-
-Options:
-    -tr (transport): 
-        tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090)
-        tcpbuffered - tcp buffered transport will be used (host - ""localhost"", port - 9090)
-        namedpipe - namedpipe transport will be used (pipe address - "".test"")
-        http - http transport will be used (http address - ""localhost:9090"")
-        tcptls - tcp transport with tls will be used (host - ""localhost"", port - 9090)
-        framed - tcp framed transport will be used (host - ""localhost"", port - 9090)
-
-    -pr (protocol): 
-        binary - (default) binary protocol will be used
-        compact - compact protocol will be used
-        json - json protocol will be used
-        multiplexed - multiplexed protocol will be used
-
-Sample:
-    Server.exe -tr:tcp 
-");
-        }
-
-        private static async Task RunAsync(string[] args, CancellationToken cancellationToken)
-        {
-            var selectedTransport = GetTransport(args);
-            var selectedProtocol = GetProtocol(args);
-
-            if (selectedTransport == Transport.Http)
-            {
-                new HttpServerSample().Run(cancellationToken);
-            }
-            else
-            {
-                await RunSelectedConfigurationAsync(selectedTransport, selectedProtocol, cancellationToken);
-            }
-        }
-
-        private static Protocol GetProtocol(string[] args)
-        {
-            var transport = args.FirstOrDefault(x => x.StartsWith("-pr"))?.Split(':')?[1];
-
-            Enum.TryParse(transport, true, out Protocol selectedProtocol);
-
-            return selectedProtocol;
-        }
-
-        private static Transport GetTransport(string[] args)
-        {
-            var transport = args.FirstOrDefault(x => x.StartsWith("-tr"))?.Split(':')?[1];
-
-            Enum.TryParse(transport, true, out Transport selectedTransport);
-
-            return selectedTransport;
-        }
-
-        private static async Task RunSelectedConfigurationAsync(Transport transport, Protocol protocol, CancellationToken cancellationToken)
-        {
-            var fabric = new LoggerFactory().AddConsole(LogLevel.Trace).AddDebug(LogLevel.Trace);
-            var handler = new CalculatorAsyncHandler();
-            ITAsyncProcessor processor = null;
-
-            TServerTransport serverTransport = null;
-
-            switch (transport)
-            {
-                case Transport.Tcp:
-                    serverTransport = new TServerSocketTransport(9090);
-                    break;
-                case Transport.TcpBuffered:
-                    serverTransport = new TServerSocketTransport(port: 9090, clientTimeout: 10000, useBufferedSockets: true);
-                    break;
-                case Transport.NamedPipe:
-                    serverTransport = new TNamedPipeServerTransport(".test");
-                    break;
-                case Transport.TcpTls:
-                    serverTransport = new TTlsServerSocketTransport(9090, false, GetCertificate(), ClientCertValidator, LocalCertificateSelectionCallback);
-                    break;
-                case Transport.Framed:
-                    serverTransport = new TServerFramedTransport(9090);
-                    break;
-            }
-
-            ITProtocolFactory inputProtocolFactory;
-            ITProtocolFactory outputProtocolFactory;
-
-            switch (protocol)
-            {
-                case Protocol.Binary:
-                {
-                    inputProtocolFactory = new TBinaryProtocol.Factory();
-                    outputProtocolFactory = new TBinaryProtocol.Factory();
-                    processor = new Calculator.AsyncProcessor(handler);
-                }
-                    break;
-                case Protocol.Compact:
-                {
-                    inputProtocolFactory = new TCompactProtocol.Factory();
-                    outputProtocolFactory = new TCompactProtocol.Factory();
-                    processor = new Calculator.AsyncProcessor(handler);
-                }
-                    break;
-                case Protocol.Json:
-                {
-                    inputProtocolFactory = new TJsonProtocol.Factory();
-                    outputProtocolFactory = new TJsonProtocol.Factory();
-                    processor = new Calculator.AsyncProcessor(handler);
-                }
-                    break;
-                case Protocol.Multiplexed:
-                {
-                    inputProtocolFactory = new TBinaryProtocol.Factory();
-                    outputProtocolFactory = new TBinaryProtocol.Factory();
-
-                    var calcHandler = new CalculatorAsyncHandler();
-                    var calcProcessor = new Calculator.AsyncProcessor(calcHandler);
-
-                    var sharedServiceHandler = new SharedServiceAsyncHandler();
-                    var sharedServiceProcessor = new SharedService.AsyncProcessor(sharedServiceHandler);
-
-                    var multiplexedProcessor = new TMultiplexedProcessor();
-                    multiplexedProcessor.RegisterProcessor(nameof(Calculator), calcProcessor);
-                    multiplexedProcessor.RegisterProcessor(nameof(SharedService), sharedServiceProcessor);
-
-                    processor = multiplexedProcessor;
-                }
-                    break;
-                default:
-                    throw new ArgumentOutOfRangeException(nameof(protocol), protocol, null);
-            }
-
-            try
-            {
-                Logger.LogInformation(
-                    $"Selected TAsyncServer with {serverTransport} transport, {processor} processor and {inputProtocolFactory} protocol factories");
-
-                var server = new AsyncBaseServer(processor, serverTransport, inputProtocolFactory, outputProtocolFactory, fabric);
-
-                Logger.LogInformation("Starting the server...");
-                await server.ServeAsync(cancellationToken);
-            }
-            catch (Exception x)
-            {
-                Logger.LogInformation(x.ToString());
-            }
-        }
-
-        private static X509Certificate2 GetCertificate()
-        {
-            // due to files location in net core better to take certs from top folder
-            var certFile = GetCertPath(Directory.GetParent(Directory.GetCurrentDirectory()));
-            return new X509Certificate2(certFile, "ThriftTest");
-        }
-
-        private static string GetCertPath(DirectoryInfo di, int maxCount = 6)
-        {
-            var topDir = di;
-            var certFile =
-                topDir.EnumerateFiles("ThriftTest.pfx", SearchOption.AllDirectories)
-                    .FirstOrDefault();
-            if (certFile == null)
-            {
-                if (maxCount == 0)
-                    throw new FileNotFoundException("Cannot find file in directories");
-                return GetCertPath(di.Parent, maxCount - 1);
-            }
-
-            return certFile.FullName;
-        }
-
-        private static X509Certificate LocalCertificateSelectionCallback(object sender,
-            string targetHost, X509CertificateCollection localCertificates,
-            X509Certificate remoteCertificate, string[] acceptableIssuers)
-        {
-            return GetCertificate();
-        }
-
-        private static bool ClientCertValidator(object sender, X509Certificate certificate,
-            X509Chain chain, SslPolicyErrors sslPolicyErrors)
-        {
-            return true;
-        }
-
-        private enum Transport
-        {
-            Tcp,
-            TcpBuffered,
-            NamedPipe,
-            Http,
-            TcpTls,
-            Framed
-        }
-
-        private enum Protocol
-        {
-            Binary,
-            Compact,
-            Json,
-            Multiplexed
-        }
-
-        public class HttpServerSample
-        {
-            public void Run(CancellationToken cancellationToken)
-            {
-                var config = new ConfigurationBuilder()
-                    .AddEnvironmentVariables(prefix: "ASPNETCORE_")
-                    .Build();
-
-                var host = new WebHostBuilder()
-                    .UseConfiguration(config)
-                    .UseKestrel()
-                    .UseUrls("http://localhost:9090")
-                    .UseContentRoot(Directory.GetCurrentDirectory())
-                    .UseStartup<Startup>()
-                    .Build();
-
-                host.RunAsync(cancellationToken).GetAwaiter().GetResult();
-            }
-
-            public class Startup
-            {
-                public Startup(IHostingEnvironment env)
-                {
-                    var builder = new ConfigurationBuilder()
-                        .SetBasePath(env.ContentRootPath)
-                        .AddEnvironmentVariables();
-
-                    Configuration = builder.Build();
-                }
-
-                public IConfigurationRoot Configuration { get; }
-
-                // This method gets called by the runtime. Use this method to add services to the container.
-                public void ConfigureServices(IServiceCollection services)
-                {
-                    services.AddTransient<Calculator.IAsync, CalculatorAsyncHandler>();
-                    services.AddTransient<ITAsyncProcessor, Calculator.AsyncProcessor>();
-                    services.AddTransient<THttpServerTransport, THttpServerTransport>();
-                }
-
-                // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-                public void Configure(IApplicationBuilder app, IHostingEnvironment env,
-                    ILoggerFactory loggerFactory)
-                {
-                    app.UseMiddleware<THttpServerTransport>();
-                }
-            }
-        }
-
-        public class CalculatorAsyncHandler : Calculator.IAsync
-        {
-            private readonly Dictionary<int, SharedStruct> _log = new Dictionary<int, SharedStruct>();
-
-            public CalculatorAsyncHandler()
-            {
-            }
-
-            public async Task<SharedStruct> getStructAsync(int key,
-                CancellationToken cancellationToken)
-            {
-                Logger.LogInformation("GetStructAsync({0})", key);
-                return await Task.FromResult(_log[key]);
-            }
-
-            public async Task pingAsync(CancellationToken cancellationToken)
-            {
-                Logger.LogInformation("PingAsync()");
-                await Task.CompletedTask;
-            }
-
-            public async Task<int> addAsync(int num1, int num2, CancellationToken cancellationToken)
-            {
-                Logger.LogInformation($"AddAsync({num1},{num2})");
-                return await Task.FromResult(num1 + num2);
-            }
-
-            public async Task<int> calculateAsync(int logid, Work w, CancellationToken cancellationToken)
-            {
-                Logger.LogInformation($"CalculateAsync({logid}, [{w.Op},{w.Num1},{w.Num2}])");
-
-                var val = 0;
-                switch (w.Op)
-                {
-                    case Operation.ADD:
-                        val = w.Num1 + w.Num2;
-                        break;
-
-                    case Operation.SUBTRACT:
-                        val = w.Num1 - w.Num2;
-                        break;
-
-                    case Operation.MULTIPLY:
-                        val = w.Num1 * w.Num2;
-                        break;
-
-                    case Operation.DIVIDE:
-                        if (w.Num2 == 0)
-                        {
-                            var io = new InvalidOperation
-                            {
-                                WhatOp = (int) w.Op,
-                                Why = "Cannot divide by 0"
-                            };
-
-                            throw io;
-                        }
-                        val = w.Num1 / w.Num2;
-                        break;
-
-                    default:
-                    {
-                        var io = new InvalidOperation
-                        {
-                            WhatOp = (int) w.Op,
-                            Why = "Unknown operation"
-                        };
-
-                        throw io;
-                    }
-                }
-
-                var entry = new SharedStruct
-                {
-                    Key = logid,
-                    Value = val.ToString()
-                };
-
-                _log[logid] = entry;
-
-                return await Task.FromResult(val);
-            }
-
-            public async Task zipAsync(CancellationToken cancellationToken)
-            {
-                Logger.LogInformation("ZipAsync() with delay 100mc");
-                await Task.Delay(100, CancellationToken.None);
-            }
-        }
-
-        public class SharedServiceAsyncHandler : SharedService.IAsync
-        {
-            public async Task<SharedStruct> getStructAsync(int key, CancellationToken cancellationToken)
-            {
-                Logger.LogInformation("GetStructAsync({0})", key);
-                return await Task.FromResult(new SharedStruct()
-                {
-                    Key = key,
-                    Value = "GetStructAsync"
-                });
-            }
-        }
-    }
-}
diff --git a/tutorial/netcore/Server/Properties/AssemblyInfo.cs b/tutorial/netcore/Server/Properties/AssemblyInfo.cs
deleted file mode 100644
index a044235..0000000
--- a/tutorial/netcore/Server/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-﻿// 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
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("Thrift")]
-[assembly: AssemblyCopyright("The Apache Software Foundation")]
-[assembly: AssemblyTrademark("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("e210fc10-5aff-4b04-ac21-58afc7b74b0c")]
\ No newline at end of file
diff --git a/tutorial/netcore/Server/Properties/launchSettings.json b/tutorial/netcore/Server/Properties/launchSettings.json
deleted file mode 100644
index 78076ff..0000000
--- a/tutorial/netcore/Server/Properties/launchSettings.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "profiles": {
-    "Server": {
-      "commandName": "Project",
-      "commandLineArgs": "-p:multiplexed"
-    }
-  }
-}
\ No newline at end of file
diff --git a/tutorial/netcore/Server/Server.csproj b/tutorial/netcore/Server/Server.csproj
deleted file mode 100644
index 0fbd303..0000000
--- a/tutorial/netcore/Server/Server.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
-
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.0</TargetFramework>
-    <AssemblyName>Server</AssemblyName>
-    <PackageId>Server</PackageId>
-    <OutputType>Exe</OutputType>
-    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
-    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
-    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
-    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="../Interfaces/Interfaces.csproj" />
-    <ProjectReference Include="../../../lib/netcore/Thrift/Thrift.csproj" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore" Version="[2.0,)" />
-    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="[2.0,)" />
-    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="[2.0,)" />
-    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="[2.0,)" />
-  </ItemGroup>
-
-</Project>
diff --git a/tutorial/netcore/Server/ThriftTest.pfx b/tutorial/netcore/Server/ThriftTest.pfx
deleted file mode 100644
index f0ded28..0000000
--- a/tutorial/netcore/Server/ThriftTest.pfx
+++ /dev/null
Binary files differ
diff --git a/tutorial/netcore/Tutorial.sln b/tutorial/netcore/Tutorial.sln
deleted file mode 100644
index 2ddcd46..0000000
--- a/tutorial/netcore/Tutorial.sln
+++ /dev/null
@@ -1,78 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26114.2
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift", "..\..\lib\netcore\Thrift\Thrift.csproj", "{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Interfaces", "Interfaces\Interfaces.csproj", "{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client\Client.csproj", "{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "Server\Server.csproj", "{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Debug|x64 = Debug|x64
-		Debug|x86 = Debug|x86
-		Release|Any CPU = Release|Any CPU
-		Release|x64 = Release|x64
-		Release|x86 = Release|x86
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x64.Build.0 = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x86.Build.0 = Debug|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|Any CPU.Build.0 = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x64.ActiveCfg = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x64.Build.0 = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x86.ActiveCfg = Release|Any CPU
-		{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x86.Build.0 = Release|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x64.Build.0 = Debug|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x86.Build.0 = Debug|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x64.ActiveCfg = Release|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x64.Build.0 = Release|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x86.ActiveCfg = Release|Any CPU
-		{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x86.Build.0 = Release|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x64.Build.0 = Debug|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x86.Build.0 = Debug|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|Any CPU.Build.0 = Release|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x64.ActiveCfg = Release|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x64.Build.0 = Release|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x86.ActiveCfg = Release|Any CPU
-		{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x86.Build.0 = Release|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x64.Build.0 = Debug|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x86.Build.0 = Debug|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x64.ActiveCfg = Release|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x64.Build.0 = Release|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x86.ActiveCfg = Release|Any CPU
-		{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x86.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {070A5D1D-B29D-4603-999D-693DB444AD0D}
-	EndGlobalSection
-EndGlobal
diff --git a/tutorial/netcore/build.cmd b/tutorial/netcore/build.cmd
deleted file mode 100644
index 9b84ef2..0000000
--- a/tutorial/netcore/build.cmd
+++ /dev/null
@@ -1,25 +0,0 @@
-@echo off
-rem /*
-rem  * Licensed to the Apache Software Foundation (ASF) under one
-rem  * or more contributor license agreements. See the NOTICE file
-rem  * distributed with this work for additional information
-rem  * regarding copyright ownership. The ASF licenses this file
-rem  * to you under the Apache License, Version 2.0 (the
-rem  * "License"); you may not use this file except in compliance
-rem  * with the License. You may obtain a copy of the License at
-rem  *
-rem  *   http://www.apache.org/licenses/LICENSE-2.0
-rem  *
-rem  * Unless required by applicable law or agreed to in writing,
-rem  * software distributed under the License is distributed on an
-rem  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem  * KIND, either express or implied. See the License for the
-rem  * specific language governing permissions and limitations
-rem  * under the License.
-rem  */
-setlocal
-
-dotnet --info
-dotnet build
-
-:eof
diff --git a/tutorial/netcore/build.sh b/tutorial/netcore/build.sh
deleted file mode 100755
index c97e310..0000000
--- a/tutorial/netcore/build.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# 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
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#exit if any command fails
-set -e
-
-dotnet --info
-dotnet build
diff --git a/tutorial/shared.thrift b/tutorial/shared.thrift
index 5747f06..3c6a69d 100644
--- a/tutorial/shared.thrift
+++ b/tutorial/shared.thrift
@@ -30,7 +30,6 @@
 namespace perl shared
 namespace php shared
 namespace haxe shared
-namespace netcore shared
 namespace netstd shared
 
 
diff --git a/tutorial/tutorial.thrift b/tutorial/tutorial.thrift
index ea18b73..f1e2912 100644
--- a/tutorial/tutorial.thrift
+++ b/tutorial/tutorial.thrift
@@ -71,7 +71,6 @@
 namespace php tutorial
 namespace perl tutorial
 namespace haxe tutorial
-namespace netcore tutorial
 namespace netstd tutorial
 
 /**
