Etch has become a TLP

git-svn-id: https://svn.apache.org/repos/asf/etch/branches/config@1440293 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..88fd557
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="util/src/main/java"/>
+	<classpathentry kind="src" path="util/src/test/java"/>
+	<classpathentry kind="src" path="compiler/src/main/javacc"/>
+	<classpathentry kind="src" path="compiler/src/main/java"/>
+	<classpathentry kind="src" path="compiler/src/main/resources"/>
+	<classpathentry kind="src" path="compiler/target/generated-sources/main/javacc/java"/>
+	<classpathentry kind="src" path="compiler/src/test/java"/>
+	<classpathentry kind="src" path="compiler/src/test/resources"/>
+	<classpathentry kind="src" path="plugins/ant/src/main/java"/>
+	<classpathentry kind="src" path="plugins/ant/src/main/resources"/>
+	<classpathentry kind="src" path="plugins/ant/src/test/java"/>
+	<classpathentry kind="src" path="binding-java/compiler/src/main/java"/>
+	<classpathentry kind="src" path="binding-java/compiler/src/main/resources"/>
+	<classpathentry kind="src" path="binding-java/runtime/src/main/java"/>
+	<classpathentry kind="src" path="binding-java/runtime/src/test/java"/>
+	<classpathentry kind="src" path="binding-csharp/compiler/src/main/java"/>
+	<classpathentry kind="src" path="binding-csharp/compiler/src/main/resources"/>
+	<classpathentry kind="src" path="binding-xml/compiler/src/main/java"/>
+	<classpathentry kind="src" path="binding-xml/compiler/src/main/resources"/>
+	<classpathentry kind="src" path="tests/src/main/java"/>
+	<classpathentry kind="src" path="tests/src/main/resources"/>
+	<classpathentry kind="src" path="tests/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="tests/src/test/java"/>
+	<classpathentry kind="src" path="examples/chat/src/main/java"/>
+	<classpathentry kind="src" path="examples/chat/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="examples/chat/src/test/java"/>
+	<classpathentry kind="src" path="examples/distmap/src/main/java"/>
+	<classpathentry kind="src" path="examples/distmap/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="examples/distmap/src/test/java"/>
+	<classpathentry kind="src" path="examples/example/src/main/java"/>
+	<classpathentry kind="src" path="examples/example/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="examples/example/src/test/java"/>
+	<classpathentry kind="src" path="examples/perf/src/main/java"/>
+	<classpathentry kind="src" path="examples/perf/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="examples/perf/src/test/java"/>
+	<classpathentry kind="src" path="binding-c/compiler/src/main/java"/>
+	<classpathentry kind="src" path="binding-c/compiler/src/main/resources"/>
+	<classpathentry kind="src" path="binding-python/compiler/src/main/java"/>
+	<classpathentry kind="src" path="binding-python/compiler/src/main/resources"/>
+	<classpathentry kind="src" path="interoptester/src/main/java"/>
+	<classpathentry kind="src" path="interoptester/src/test/java"/>
+	<classpathentry kind="src" path="interoptester/example/src/main/java"/>
+	<classpathentry kind="src" path="interoptester/example/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="services/config/src/main/java"/>
+	<classpathentry kind="src" path="services/config/src/test/java"/>
+	<classpathentry kind="src" path="services/config/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="src" path="services/config/example/src/main/java"/>
+	<classpathentry kind="src" path="services/config/example/target/generated-sources/main/etch/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ETCH_DEPENDENT_JARS"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/.project b/.project
new file mode 100644
index 0000000..5dd978a
--- /dev/null
+++ b/.project
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>etch</name>
+	<comment>JavaCC Nature</comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>sf.eclipse.javacc.javaccbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>sf.eclipse.javacc.javaccnature</nature>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..6c2e886
--- /dev/null
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Wed Jul 16 14:26:18 CDT 2008

+eclipse.preferences.version=1

+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>

diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644
index 0000000..d365e83
--- /dev/null
+++ b/.settings/org.eclipse.ltk.core.refactoring.prefs
@@ -0,0 +1,3 @@
+#Sat Aug 18 15:24:44 CDT 2007

+eclipse.preferences.version=1

+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

diff --git a/BUILD.txt b/BUILD.txt
new file mode 100644
index 0000000..7d20dd6
--- /dev/null
+++ b/BUILD.txt
@@ -0,0 +1,271 @@
+/*
+ * 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.                                           *
+*/
+Build Instructions for Apache Etch
+==================================
+
+Contents
+--------
+  Source tree
+  Dependencies
+  Setup Development Environment
+  Building from ANT
+  Building from Eclipse
+  
+
+Source tree
+-----------
+
+This is the source tree for Etch. It is organized as follows:
+
+   build.xml         - top-level ant build script
+   build.dependecies - locations for jars this compile depends on
+   etch.properties   - static build properties 
+   
+   compiler/      - core compiler
+   build-support/ - common ant scripts shared by all modules
+   plugins/       - extensions that embed the compiler, e.g. ant, maven, etc.
+   scripts/       - common scripts for eclipse
+   util/          - shared java classes
+   tests/         - functional tests
+   examples/      - Etch application examples
+      chat/       - simple IM application
+      distmap/    - example implementation of a distributed map in etch
+      perf/       - etch client/server performance test
+      example/    - minimal example
+   installers/    - project for NSIS installer and tar.gz, .zip archives
+       
+   binding-xml    - xml binding
+   binding-java   - java-language binding
+   binding-csharp - C#-language binding
+   
+
+  About the Structure of Etch bindings
+  ------------------------------------
+
+Each binding is factored into its own structure into the build tree. The intent
+is to provide an easy pattern for potential binding authors to emulate.
+Essentially each binding has two components:
+
+   - compiler/
+   - runtime/
+   
+The 'compiler' is always implemented in Java and is coded to implement a
+backend interface for the target of choice.
+
+The 'runtime' is coded in the target language. The most useful language
+bindings implement identical functionality as the Java and C# bindings.
+Non-languages bindings (like binding-xml) may not have a runtime component
+at all.
+
+Dependencies
+------------
+
+To build the compiler core and the Java and XML bindings and Java-based examples,
+you need the following:
+
+ * Java JDK 1.5_011 or later
+ * Apache Ant 1.7+
+ * JavaCC 4.0
+ * Junit 4.3.1
+ * Velocity 1.5
+
+To compile the C# bindings and examples:
+
+ * Apache Ant DotNet 1.0
+ * .NET Framework 2.0 (Visual Studio 2005)
+ ** (Mono 1.9 support is experimental)
+ * NUnit 2.4.7
+ 
+To compile NSIS installers:
+
+ * NSIS 2.23
+
+Setup development environment
+-----------------------------
+
+The primary development environments for the Etch committers are Win32 and
+*nix (Mac OS X). As such we have attempted to make the build process platform
+neutral. In addition, Etch builds are done daily on our internal Bamboo server
+here at Cisco on the win32 platform. This means that we tend to have a bias
+towards a working Win32 build. To further complicate matters, we have much
+development-environment divergence in our committer base, some of us being very
+shell-centric (dixson) while others of us being firmly rooted in Eclipse (sccomer).
+So the compromise has been to attempt to structure the build such it can be
+friendly and productive to both groups and keep the sectarian violence to
+a minimum. :-)
+
+1. Install JDK. Make certain that you set your JAVA_HOME environment variable
+   to point to the correct location.
+   
+Building from ANT
+-----------------
+
+1. Install Apache ANT (version 1.7 or later). 
+
+2. Put /path/to/apache-ant-1.7/bin in your PATH.
+
+3. If you have Mono, make certain MONO_HOME is set correctly. If you have .NET
+   framework, make certain msbuild.exe is in your PATH.
+
+4. If building C#, make certain NUNIT_HOME is set correctly.
+
+5. If building on Win32 and you want to build the NSIS installers, set
+   NSIS_HOME to /path/to/nsis/2.23.
+
+6. [IMPORTANT] Update 'build.dependencies' with the correct paths to the jar's
+   this project depends upon:
+
+  * javacc.home=/path/to/javacc-4.0      
+        ('${javacc.home}/bin/lib/javacc.jar' should exist)
+        
+  * junit.lib=/path/to/junit-4.3.1
+        ('${junit.lib}/junit-4.3.1.jar' should exist)
+        
+  * velocity.lib=/path/to/velocity-1.5            
+        ('${velocity.lib}/velocity-dep-1.5.jar' should exist)
+
+  --OPTIONAL--        
+  * ant-dotnet.lib=/path/to/apache-ant-dotnet-1.0 
+
+(dixson) This is a hack until I get autoconf working. Just not there yet :-(
+
+
+7. At the shell prompt type:
+
+ > ant release
+
+This will build all compilers and all the bindings for which you have setup
+dependencies. It will also build and run all unit/functional tests and build
+all the examples in examples/.
+
+Once complete, the dist tree can be found in 'target/Installers/dist'. Copy
+this directory manually to the desired install location.
+
+Building from Eclipse
+---------------------
+
+After you checkout the project in eclipse, you will likely be told that there are
+build path problems. There are three dependent projects you need to get going with
+etch for eclipse, and one plugin:
+
+ javacc 4.0
+ ant 1.7.0
+ junit 4.3.1
+ velocity 1.5
+
+JavaCC is an eclipse plugin, get it from here:
+
+ http://eclipse-javacc.sourceforge.net/
+
+On that page are directions to install the plugin from within eclipse. The other two
+you download:
+
+ http://sourceforge.net/projects/junit/
+ http://velocity.apache.org/engine/releases/velocity-1.5/
+ http://archive.apache.org/dist/ant/binaries/
+
+NOTE: junit-4.3.1 is a hard dependency. Later versions of ant, JavaCC and Velocity may
+work, but later versions of JUnit will not (true as of etch-1.0.2).
+
+Once downloaded, you will need to create an environment variable (for example):
+
+ ETCH_DEPENDENT_JARS=C:\workspace-etch\tools\velocity\1.5\velocity-dep-1.5.jar
+
+These are the extra jar files required to actually run the compiler. You will need
+to restart eclipse if it is running. Once eclipse is started, you will need to 
+configure the Etch project:
+
+ Right click on the etch project, and select Build Path / Configure Build Path
+ 
+ Select the Libraries tab on the right.
+ 
+ If ETCH_DEPENDENT_JARS is here, delete it.
+
+ Select Add Library... on the right.
+
+ Select User Library and click Next.
+
+ Select User Libraries...
+
+ Select New...
+
+ Enter the name ETCH_DEPENDENT_JARS and click Ok.
+
+ With ETCH_DEPENDENT_JARS selected, click Add JARs...
+
+ Navigate to junit-4.3.1.jar and select it.
+
+ With ETCH_DEPENDENT_JARS selected, click Add JARs... again...
+
+ Navigate to velocity-dep-1.5.jar and select it.
+
+ Navigate to ant.jar and select it.
+
+ Click Ok.
+
+ Click Finish.
+
+ Click Ok.
+
+Eclipse should rebuild the project. There may still be errors, that's ok:
+
+ Open Window / Preferences / Java / Compiler / Building.
+
+ Expand Build path problems.
+
+ Set Incomplete build path to be a warning.
+ 
+ Set Circular dependencies to be an error.
+
+ Set Incompatible required binaries to warning.
+
+ Click Ok.
+
+Make sure JavaCC compiled EtchGrammar.jj. There should be a JavaCC console
+view open. If not, open it (Window / Show View / Other... / JavaCC console /
+JavaCC console).
+
+If JavaCC console is empty, Select Project / Clean... and clean all projects.
+A few JavaCC messages should appear. It is ok if JavaCC warns about creating
+a directory.
+
+Now that the compiler is built, you will still have errors for etch build
+products which are missing. you will need to recompile all the etch files.
+You can do this by:
+
+ Select the etch project.
+
+ Select Run / External Tools / Compile Java Etch Files.
+
+(You may want to configure the external tools first. Select Run / External
+Tools / Organize Favorites... Click Add... Select All. Ok. Ok.)
+
+You should see a nice output in the Console reporting successful compilation
+of a bunch of etch files. Eclipse should then rebuilt the project.
+
+Finally, you can check things out by running the unit tests.
+
+ Right click on the etch project, select Run as... / Junit test.
+
+You'll get some output on the console window, including scary looking stack
+traces. That's ok. JUnit runner should tell you that 1197 tests passed, 22
+ignored, with 0 errors and 0 failures. This takes 66 seconds for me (sccomer).
+
+You're done, start exploring. Check out examples, perf or chat.
+
diff --git a/CSharp.sln b/CSharp.sln
new file mode 100644
index 0000000..7bd8bca
--- /dev/null
+++ b/CSharp.sln
@@ -0,0 +1,140 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EtchTestProj", "binding-csharp\runtime\src\test\csharp\EtchTestProj.csproj", "{3D44C33C-0E5F-443B-A0B4-ABDF16B64AC5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EtchProj", "binding-csharp\runtime\src\main\csharp\EtchProj.csproj", "{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfListenerProj", "examples\perf\src\main\csharp\PerfListenerProj\PerfListenerProj.csproj", "{4B9CE732-601A-4A74-A1D5-AF78251FEDD2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfClientProj", "examples\perf\src\main\csharp\PerfClientProj\PerfClientProj.csproj", "{D2AA03D8-1555-4A9B-8618-FF12A15BBB6E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistMapClientProj", "examples\distmap\src\main\csharp\DistMapClientProj\DistMapClientProj.csproj", "{7613961B-FD82-40DB-BF99-EEF50BB20887}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistMapListenerProj", "examples\distmap\src\main\csharp\DistMapListenerProj\DistMapListenerProj.csproj", "{75F8A513-4500-4AC3-8E97-8B7609A8AEA9}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatClientProj", "examples\chat\src\main\csharp\ChatClientProj\ChatClientProj.csproj", "{13BBC268-2F31-4C68-B62B-3C2CFD0228BE}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatListenerProj", "examples\chat\src\main\csharp\ChatListenerProj\ChatListenerProj.csproj", "{574C28F9-1D0D-47CB-9F18-221E5128D5A6}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleClientProj", "examples\example\src\main\csharp\ExampleClientProj\ExampleClientProj.csproj", "{38953BC0-A834-4939-A25F-8C7F2C7F8758}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleListenerProj", "examples\example\src\main\csharp\ExampleListenerProj\ExampleListenerProj.csproj", "{7EEA2F47-0D96-4187-B9EF-CA0B9E839841}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestsProj", "tests\src\test\csharp\TestsProj\TestsProj.csproj", "{70701740-652A-4E07-9B85-59DDCC9D43D4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistMapTestProj", "examples\distmap\src\test\csharp\DistMapTestProj\DistMapTestProj.csproj", "{39699FEE-D21E-42AC-ADD7-22484A985C27}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleTestProj", "examples\example\src\test\csharp\ExampleTestProj\ExampleTestProj.csproj", "{36991AC6-21DE-4F7A-8672-8CFCC8AF70C7}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfTestProj", "examples\perf\src\test\csharp\PerfTestProj\PerfTestProj.csproj", "{47FDB15C-6DE2-4191-A41C-1993B714B4CD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatTestProj", "examples\chat\src\test\csharp\ChatTestProj\ChatTestProj.csproj", "{01A7F0CC-78AB-4CFE-88DB-32AAC6D6C00B}"
+	ProjectSection(ProjectDependencies) = postProject
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846} = {0E518F2A-3016-4C2F-A21B-9BD52B2DC846}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOTListenerProj", "interoptester\example\src\main\csharp\IOTListenerProj\IOTListenerProj.csproj", "{5EED552A-09C1-42D0-9E0A-7822B0EC3603}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOTClientProj", "interoptester\example\src\main\csharp\IOTClientProj\IOTClientProj.csproj", "{14D7A923-0CB4-442A-9499-7F0C25C239EE}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3D44C33C-0E5F-443B-A0B4-ABDF16B64AC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3D44C33C-0E5F-443B-A0B4-ABDF16B64AC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3D44C33C-0E5F-443B-A0B4-ABDF16B64AC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3D44C33C-0E5F-443B-A0B4-ABDF16B64AC5}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}.Release|Any CPU.Build.0 = Release|Any CPU
+		{4B9CE732-601A-4A74-A1D5-AF78251FEDD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{4B9CE732-601A-4A74-A1D5-AF78251FEDD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{4B9CE732-601A-4A74-A1D5-AF78251FEDD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{4B9CE732-601A-4A74-A1D5-AF78251FEDD2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D2AA03D8-1555-4A9B-8618-FF12A15BBB6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D2AA03D8-1555-4A9B-8618-FF12A15BBB6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D2AA03D8-1555-4A9B-8618-FF12A15BBB6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D2AA03D8-1555-4A9B-8618-FF12A15BBB6E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7613961B-FD82-40DB-BF99-EEF50BB20887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7613961B-FD82-40DB-BF99-EEF50BB20887}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7613961B-FD82-40DB-BF99-EEF50BB20887}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7613961B-FD82-40DB-BF99-EEF50BB20887}.Release|Any CPU.Build.0 = Release|Any CPU
+		{75F8A513-4500-4AC3-8E97-8B7609A8AEA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{75F8A513-4500-4AC3-8E97-8B7609A8AEA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{75F8A513-4500-4AC3-8E97-8B7609A8AEA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{75F8A513-4500-4AC3-8E97-8B7609A8AEA9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{13BBC268-2F31-4C68-B62B-3C2CFD0228BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{13BBC268-2F31-4C68-B62B-3C2CFD0228BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{13BBC268-2F31-4C68-B62B-3C2CFD0228BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{13BBC268-2F31-4C68-B62B-3C2CFD0228BE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{574C28F9-1D0D-47CB-9F18-221E5128D5A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{574C28F9-1D0D-47CB-9F18-221E5128D5A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{574C28F9-1D0D-47CB-9F18-221E5128D5A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{574C28F9-1D0D-47CB-9F18-221E5128D5A6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{38953BC0-A834-4939-A25F-8C7F2C7F8758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{38953BC0-A834-4939-A25F-8C7F2C7F8758}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{38953BC0-A834-4939-A25F-8C7F2C7F8758}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{38953BC0-A834-4939-A25F-8C7F2C7F8758}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7EEA2F47-0D96-4187-B9EF-CA0B9E839841}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7EEA2F47-0D96-4187-B9EF-CA0B9E839841}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7EEA2F47-0D96-4187-B9EF-CA0B9E839841}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7EEA2F47-0D96-4187-B9EF-CA0B9E839841}.Release|Any CPU.Build.0 = Release|Any CPU
+		{70701740-652A-4E07-9B85-59DDCC9D43D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{70701740-652A-4E07-9B85-59DDCC9D43D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{70701740-652A-4E07-9B85-59DDCC9D43D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{70701740-652A-4E07-9B85-59DDCC9D43D4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{39699FEE-D21E-42AC-ADD7-22484A985C27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{39699FEE-D21E-42AC-ADD7-22484A985C27}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{39699FEE-D21E-42AC-ADD7-22484A985C27}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{39699FEE-D21E-42AC-ADD7-22484A985C27}.Release|Any CPU.Build.0 = Release|Any CPU
+		{36991AC6-21DE-4F7A-8672-8CFCC8AF70C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{36991AC6-21DE-4F7A-8672-8CFCC8AF70C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{36991AC6-21DE-4F7A-8672-8CFCC8AF70C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{36991AC6-21DE-4F7A-8672-8CFCC8AF70C7}.Release|Any CPU.Build.0 = Release|Any CPU
+		{47FDB15C-6DE2-4191-A41C-1993B714B4CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{47FDB15C-6DE2-4191-A41C-1993B714B4CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{47FDB15C-6DE2-4191-A41C-1993B714B4CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{47FDB15C-6DE2-4191-A41C-1993B714B4CD}.Release|Any CPU.Build.0 = Release|Any CPU
+		{01A7F0CC-78AB-4CFE-88DB-32AAC6D6C00B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{01A7F0CC-78AB-4CFE-88DB-32AAC6D6C00B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{01A7F0CC-78AB-4CFE-88DB-32AAC6D6C00B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{01A7F0CC-78AB-4CFE-88DB-32AAC6D6C00B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5EED552A-09C1-42D0-9E0A-7822B0EC3603}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5EED552A-09C1-42D0-9E0A-7822B0EC3603}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5EED552A-09C1-42D0-9E0A-7822B0EC3603}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5EED552A-09C1-42D0-9E0A-7822B0EC3603}.Release|Any CPU.Build.0 = Release|Any CPU
+		{14D7A923-0CB4-442A-9499-7F0C25C239EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{14D7A923-0CB4-442A-9499-7F0C25C239EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{14D7A923-0CB4-442A-9499-7F0C25C239EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{14D7A923-0CB4-442A-9499-7F0C25C239EE}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/ChangeLog.txt b/ChangeLog.txt
new file mode 100644
index 0000000..309952f
--- /dev/null
+++ b/ChangeLog.txt
@@ -0,0 +1,361 @@
+-------------
+Release 1.0.2
+-------------
+
+r738160 | sccomer | 2009-01-27 11:30:43 CST
+
+fix for ETCH-31: MySessionListener in TcpTransportFactory does not override
+toString() method to show something useful about the transport stack
+----------------------------------------------------------------------------
+r737984 | dixson | 2009-01-26 21:14:36 CST
+
+update SVN and homepage to apache.org URLs
+----------------------------------------------------------------------------
+r737770 | sccomer | 2009-01-26 11:59:24 CST
+
+fix for ETCH-29: Installing all Maven artifacts along with their sources.
+----------------------------------------------------------------------------
+r737767 | sccomer | 2009-01-26 11:55:12 CST
+
+fix for ETCH-27: mixins cause trouble when two or more mixed in files define a
+type with the same name.
+----------------------------------------------------------------------------
+r737764 | sccomer | 2009-01-26 11:43:19 CST
+
+fix for ETCH-28: Examples do not build due to outdated ant files.
+----------------------------------------------------------------------------
+r736737 | sccomer | 2009-01-22 12:32:13 CST
+
+fix for ETCH-24: The message direction is always "server" for the result_method
+messages in the java-binding valuefactory (also csharp)
+----------------------------------------------------------------------------
+r736725 | sccomer | 2009-01-22 11:43:19 CST
+
+comment out conflicting assignment of JAVA_HOME
+----------------------------------------------------------------------------
+r736724 | sccomer | 2009-01-22 11:42:41 CST
+
+bump the version number to 1.0.2.
+----------------------------------------------------------------------------
+r736169 | sccomer | 2009-01-20 17:25:34 CST
+
+fix for ETCH-25: DefaultDeliveryService ends call with mb.CloseDelivery() and it
+should end it with mb.CloseRead()
+----------------------------------------------------------------------------
+r733843 | rebarraz | 2009-01-12 11:11:12 CST
+
+fix for ETCH-13: added examples to distribution
+----------------------------------------------------------------------------
+r724340 | sccomer | 2008-12-08 07:32:04 CST
+
+factor perf tests into individual static functions called from main.
+
+pull configuration options to the top.
+----------------------------------------------------------------------------
+r723340 | sccomer | 2008-12-04 08:49:24 CST
+
+csharp fix for ETCH-19: Break out common tcp transport options so that they may
+be shared among various transports.
+----------------------------------------------------------------------------
+r723112 | sccomer | 2008-12-03 16:49:22 CST
+
+do the right math related to relative timing tests.
+----------------------------------------------------------------------------
+r723034 | sccomer | 2008-12-03 13:42:19 CST
+
+csharp fix for ETCH-11: AlarmManager deadlocks during shutdown(). break lock on
+AbstractStartable start() and stop() methods. Add back necessary synchronization
+for Monitor.PulseAll() in Stop0(). Port java version of unit test.
+----------------------------------------------------------------------------
+r723032 | sccomer | 2008-12-03 13:39:56 CST
+
+drop blank string for thrown exception in unit test for AlarmManager.
+----------------------------------------------------------------------------
+r722646 | sccomer | 2008-12-02 16:38:21 CST
+
+change the exception thrown by AbstractStartable for already started and is not
+started to Exception from ThreadInterruptedException.
+
+change NullReferenceException thrown by AlarmManager when listener is null to
+ArgumentNullException.
+
+shell of unit test for AlarmManager.
+----------------------------------------------------------------------------
+r722629 | sccomer | 2008-12-02 16:04:52 CST
+
+expanded unit test for AlarmManager.
+
+mostly cosmetic edits for AlarmManager, except tightened up code which notifies
+worker thread when an alarm is removed (if no alarm is removed, then notify is
+not needed).
+----------------------------------------------------------------------------
+r722262 | sccomer | 2008-12-01 16:15:09 CST
+
+java fix for ETCH-11: AlarmManager deadlocks during shutdown().
+
+AlarmManager.shutdown() just calls AbstractStartable.stop() on the static
+instance.
+the bug was actually in AbstractStartable.stop().
+created unit test for AlarmManager which covers this case.
+----------------------------------------------------------------------------
+r722250 | sccomer | 2008-12-01 15:50:56 CST
+
+csharp fix for ETCH-17: SessionListener needs to be more independent.
+----------------------------------------------------------------------------
+r722248 | sccomer | 2008-12-01 15:48:53 CST
+
+improved the comment.
+----------------------------------------------------------------------------
+r722242 | sccomer | 2008-12-01 15:31:41 CST
+
+fix ETCH-6: if free pool exceeds maximum number of threads the exception thrown
+will kill the connection.
+
+also rearrange code in StubBase sessionMessage to enable optimization of NONE
+case.
+----------------------------------------------------------------------------
+r722240 | sccomer | 2008-12-01 15:29:21 CST
+
+fix issue with clock tick quanta in free pool tests.
+----------------------------------------------------------------------------
+r722208 | sccomer | 2008-12-01 14:00:37 CST
+
+implemented unit tests for FreePool in both csharp and java bindings.
+----------------------------------------------------------------------------
+r722205 | sccomer | 2008-12-01 13:58:44 CST
+
+fix for ETCH-23: FreePool has synchronization issues with quick back to back
+calls to Run.
+----------------------------------------------------------------------------
+r722116 | sccomer | 2008-12-01 10:33:04 CST
+
+csharp fix for ETCH-18: KeepAlive throws exception while trying to shutdown
+connection.
+
+fixed both csharp and java versions to use Todo during wakeup to send request
+so as to not block AlarmManager if there is a problem with the connection.
+----------------------------------------------------------------------------
+r722098 | sccomer | 2008-12-01 09:35:14 CST
+
+fix the fix for ETCH-8: canceling mailbox notification registration throws
+exception if not registered.
+
+unit tests for fix for ETCH-8.
+
+----------------------------------------------------------------------------
+r722085 | sccomer | 2008-12-01 08:42:58 CST
+
+java unit test for fix for ETCH-8.
+----------------------------------------------------------------------------
+r720572 | sccomer | 2008-11-25 13:43:44 CST
+
+fix for ETCH-8: canceling mailbox notification registration throws exception if
+not registered.
+----------------------------------------------------------------------------
+r720115 | sccomer | 2008-11-23 22:56:45 CST
+
+changes for selector code to be compatible with jdk 1.5.0_16.
+
+regularize the start/stop handling between Tcp2Listener and Tcp2Connection.
+----------------------------------------------------------------------------
+r719644 | sccomer | 2008-11-21 11:17:48 CST
+
+fixed the test for whether a Tcp2Connection is started.
+
+finalized some instance variables, and made handler private.
+
+synchronized setHandler.
+----------------------------------------------------------------------------
+r719414 | sccomer | 2008-11-20 16:50:55 CST
+
+checkpoint on selectors and transport which uses them.
+----------------------------------------------------------------------------
+r719413 | sccomer | 2008-11-20 16:43:43 CST
+
+correct the name of this test of TcpListener.
+----------------------------------------------------------------------------
+r719286 | sccomer | 2008-11-20 11:02:42 CST
+
+fix for etch-17: SessionListener needs to be more independent.
+fix for etch-19: Break out common tcp transport options so that they may be
+shared among various transports.
+----------------------------------------------------------------------------
+r719279 | sccomer | 2008-11-20 10:47:12 CST
+
+fix for etch-18: KeepAlive throws exception while trying to shutdown connection.
+----------------------------------------------------------------------------
+r713417 | gsandhir | 2008-11-12 10:13:38 CST
+
+Test to see if commit goes through
+----------------------------------------------------------------------------
+r713257 | niclas | 2008-11-11 21:55:20 CST
+
+Checking my own access.
+----------------------------------------------------------------------------
+r712814 | sccomer | 2008-09-30 10:13:12 CDT
+
+fix bug whereby a null enum value would not deserialize correctly. this also
+caused problems when additional elements were added to a service enum and then
+a mix of old and new implementations of the service used together.
+----------------------------------------------------------------------------
+r712813 | dixson3 | 2008-09-10 10:00:41 CDT
+
+skip csharp build on non-windows
+----------------------------------------------------------------------------
+
+-------------
+Release 1.0.1
+-------------
+
+r80 | sccomer | 2008-09-08 15:33:33 CDT
+
+added antlib resource for etch ant plugin, changed chat example to use it.
+----------------------------------------------------------------------------
+r79 | sccomer | 2008-09-08 13:40:12 CDT
+
+add csharp build to dist chat example.
+----------------------------------------------------------------------------
+r78 | sccomer | 2008-09-08 13:00:36 CDT
+
+custom README.txt for chat dist and make the directions all very similar.
+----------------------------------------------------------------------------
+r77 | sccomer | 2008-09-08 12:34:02 CDT
+
+added chat source to the distribution.
+----------------------------------------------------------------------------
+r76 | dixson3 | 2008-09-08 10:30:32 CDT
+
+Filter 'etch-maven-install.bat' to include the correct version number for etch
+Update csharp-unit-test targets to only run when 'BUILD.csharp' is set
+
+----------------------------------------------------------------------------
+r75 | sccomer | 2008-09-07 10:19:23 CDT
+
+updated ChangeLog.txt to the current state of the release.
+----------------------------------------------------------------------------
+
+r74 | sccomer | 2008-09-07 09:56:18 CDT
+r73 | sccomer | 2008-09-05 16:03:49 CDT
+r72 | sccomer | 2008-09-05 15:32:36 CDT
+r71 | sccomer | 2008-09-05 15:31:46 CDT
+r70 | dixson3 | 2008-09-05 08:31:53 CDT
+r69 | sccomer | 2008-09-04 18:03:04 CDT
+r68 | sccomer | 2008-09-04 18:02:24 CDT
+r67 | sccomer | 2008-09-04 09:16:38 CDT
+r66 | sccomer | 2008-09-04 09:14:53 CDT
+r65 | sccomer | 2008-09-02 16:25:03 CDT
+r64 | dixson3 | 2008-09-02 15:44:35 CDT
+r63 | sccomer | 2008-09-02 14:39:23 CDT
+r62 | sccomer | 2008-09-02 14:07:09 CDT
+r61 | sccomer | 2008-09-02 13:42:47 CDT
+r60 | dixson3 | 2008-09-02 11:16:17 CDT
+r59 | sccomer | 2008-09-02 10:41:54 CDT
+
+(various improvements to build scripts.)
+----------------------------------------------------------------------------
+r58 | sccomer | 2008-09-02 10:27:40 CDT
+
+make TestEtchMain.test7 dump msgs upon failure.
+----------------------------------------------------------------------------
+r57 | sccomer | 2008-09-02 07:49:21 CDT
+r56 | sccomer | 2008-09-02 07:35:20 CDT
+r55 | dixson3 | 2008-08-29 21:52:03 CDT
+r54 | dixson3 | 2008-08-29 15:48:01 CDT
+r53 | sccomer | 2008-08-29 10:37:05 CDT
+r52 | sccomer | 2008-08-28 16:05:49 CDT
+r51 | sccomer | 2008-08-28 15:40:26 CDT
+r50 | sccomer | 2008-08-28 14:23:50 CDT
+r49 | sccomer | 2008-08-28 11:04:32 CDT
+
+(various improvements to build scripts.)
+----------------------------------------------------------------------------
+r48 | sccomer | 2008-08-28 10:20:18 CDT
+
+merging changes to various build.xml from release 1.0.0 rev 5-6: mono support
+is not fully baked, use -DUSE.mono to test
+----------------------------------------------------------------------------
+r47 | sccomer | 2008-08-28 09:00:13 CDT
+
+fixed problem with java generated remote rejecting exceptions which are
+subclasses of allowed exceptions.
+----------------------------------------------------------------------------
+r46 | sccomer | 2008-08-27 19:31:44 CDT
+
+fix several bugs and add missing functionality to url so that java and csharp
+versions work the same.
+----------------------------------------------------------------------------
+r45 | sccomer | 2008-08-27 12:44:50 CDT
+
+if last chance exception handler in EtchMain catches an exception, it should
+print it.
+
+correct spelling of csharp Validator.Level enum element MISSING_OK.
+
+implement name for types and fields in csharp BinaryTaggedDataOutput.
+
+add named types and fields testing for csharp binary tagged data.
+----------------------------------------------------------------------------
+r44 | sccomer | 2008-08-26 13:29:24 CDT
+
+fix csharp BinaryTaggedDataInput to support names for types and fields.
+----------------------------------------------------------------------------
+r43 | sccomer | 2008-08-26 10:24:49 CDT
+
+merge compiler driver changes (and a few misc updates to unit tests) from
+branch sccomer-compiler-1 (revs 20-42) to trunk.
+----------------------------------------------------------------------------
+r28 | sccomer | 2008-08-22 11:39:29 CDT
+
+support for java BinaryTaggedDataInput and BinaryTaggedDataOutput using names
+instead of hashes of names for types and fields.
+----------------------------------------------------------------------------
+r27 | sccomer | 2008-08-22 11:38:24 CDT
+
+change java testUrl to better name (TestUrl1).
+----------------------------------------------------------------------------
+r26 | sccomer | 2008-08-22 11:37:41 CDT
+
+changed java codes from using Integer constructor to Integer.valueOf.
+----------------------------------------------------------------------------
+r25 | sccomer | 2008-08-22 11:36:51 CDT
+
+added command line control of starting listener also.
+----------------------------------------------------------------------------
+r24 | sccomer | 2008-08-22 11:35:45 CDT
+
+fix up java URL support of non-string terms.
+
+fully support Boolean in java URL.
+
+properly implement in java URL handling of remove( name, value ) when value
+is a singleton.
+----------------------------------------------------------------------------
+r9 | sccomer | 2008-08-01 15:37:49 CDT
+
+corrected csharp project dependences.
+
+corrected port numbers in distmap test.
+----------------------------------------------------------------------------
+r8 | sccomer | 2008-08-01 14:17:27 CDT
+
+integrated remaining examples into csharp build.
+
+bumped version numbers of expected build to 1.0.1.
+----------------------------------------------------------------------------
+r7 | sccomer | 2008-07-31 15:58:29 CDT
+
+added csharp build of most of the examples.
+
+substitute DOTNET_HOME environment variable for gnarley dot net path in various
+build.xml. this allows disabling the csharp build for those that don't want it.
+
+example ant build setup (antsetup.bat), shows which environment variable and
+path manipulations you need for a build. also shows which ones are optional.
+
+corrected port numbers of distmap example.
+----------------------------------------------------------------------------
+Gaurav was Here
+
+-------------
+Release 1.0.0
+-------------
diff --git a/KEYS b/KEYS
new file mode 100644
index 0000000..987d488
--- /dev/null
+++ b/KEYS
@@ -0,0 +1,46 @@
+This file contains the PGP keys of various developers.
+
+Users: pgp < KEYS
+       gpg --import KEYS
+       Developers: 
+               pgp -kxa <your name> and append it to this file.
+               (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
+               (gpg --list-sigs <your name>
+                    && gpg --armor --export <your name>) >> this file.
+
+pub   1024D/F18E2A13 2009-02-04
+uid                  James Dixson (CODE SIGNING KEY) <dixson@apache.org>
+sig 3        F18E2A13 2009-02-04  James Dixson (CODE SIGNING KEY) <dixson@apache.org>
+sub   2048g/353721F9 2009-02-04
+sig          F18E2A13 2009-02-04  James Dixson (CODE SIGNING KEY) <dixson@apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.9 (Darwin)
+
+mQGiBEmKEnsRBAChrlGgZom8tAup/WeNnq09HjsvUw1shEGmIYmQ1My0u+zNA0OK
+iF/ZkJW4ao22eYqIvw+3a80CG/QHqf7VPUdh48TddVsDeYgpqoYCL+SaXJ0djWH2
+45piZmAawdd0gnuJkVUGjVm2lHQJIAhgpxh2dR3BN4RgMInyZAqXReq0VwCgnvRn
+iDm3doCUnfhl00UkQcl4KAED/RReavNu/tNR5Ourv62KTs36yKIBOqfz0q+9QErl
+h3E9SQsEqYp8tuQ8MqOVo50+vtrOldHEiOnBjbLG12dN8anR44l9rNT022JRA3V0
+kuXQw85chsTy5m6IBcLRemCe4cKN37YHyAzeFsSLry4wyc84B1jVJiUdajvTmW+p
+kPnGA/9MUd6oIvGTa2fbg4Vo8yPHeOq4QfgkU8hNW70uMPU4wCMMJ6BH5LdwNrNc
+iruBW4wFAbBufWYsW5FAY3j89/Lv1oHYfMIiHaU1QfrpzmvlFpnlPZEFB1uTJjQT
+MU3dQxzq9t8BvnqWrxpRx7ZxQosIGqFmKLXn5GEayhN/hyqwIrQzSmFtZXMgRGl4
+c29uIChDT0RFIFNJR05JTkcgS0VZKSA8ZGl4c29uQGFwYWNoZS5vcmc+iGAEExEC
+ACAFAkmKEnsCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRCerigk8Y4qE1Yx
+AJ495RyPWkTxVfKN3g8KGNw6UGVFUgCeLwdHaoynhtHP9TwHnK3HU/gRLK65Ag0E
+SYoSexAIAN3fRCOy0F/GhBA9oNHtDK4IRcs44YF9P3sTlmGIniJ7xKsSZlYNe5wy
+VLTrmXk2ERWFueH9jUBeDM9AzHGMQBX+8IqKI4Z3Doow1rg2VHLclERR9eyRzH3b
+Scub8Asn7qLZwhuBFpIsJ1gGygirFw+wNlmX00MVQmHwFJoudkEXBcXMxhlergeS
+NldBTIraKC5/dzTakENq5nJqCKqYj8CHp4ZDfGUFvVaw+Wza2VwzBc5sACxyIVqO
+xfPRRiEfVhEqd1Y3DXkTU4OSqTqZnnnVGZx3LZNyfyG4Ku9Fm5OWrOX4Gy2Hmp7U
+KxTrV5e/AFUri3mIBsoZIDBPlN/9VG8ABAsH/RLbnZib0He0JG3evIqzks5SCH74
+fXFjEtOSuDqcyGYu93eD+Ui3BwrMogEDUQ62MlxKRb4bvb6CqlgGhO0zr38i6i82
+yfw3iAnj8s62qKgW/Fk+M+Qi55990NIIygbRdoRp390kJESccN/gaE61j4ES+gqQ
+/F/qCxb9gmoxCNRJIbhRacRhX3Zk0dF99meygF8hc++lXF9p//Mv0/CTRch6YIW4
+V0U0+VYsS2fZdFT/wSiqI6Wt+CZxzAorEO7QZOrCSU9w/8tvFuPp5tdTvJDkO7kW
+8avQwvpwr3rOJWZj0v+BehwQ0brDKqavgR3aHr+85RzuMNe7oso34hrAfByISQQY
+EQIACQUCSYoSewIbDAAKCRCerigk8Y4qE/2zAJ0Yh12VznL3tk2/OZU2oPIMA0FR
+sACfSn/Myyx3nrpwWtQTFf83n/8Lu2E=
+=LLpx
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..1572beb
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,203 @@
+/*
+ *                                 Apache License
+ *                           Version 2.0, January 2004
+ *                        http://www.apache.org/licenses/
+ *
+ *   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ *
+ *   1. Definitions.
+ *
+ *      "License" shall mean the terms and conditions for use, reproduction,
+ *      and distribution as defined by Sections 1 through 9 of this document.
+ *
+ *      "Licensor" shall mean the copyright owner or entity authorized by
+ *      the copyright owner that is granting the License.
+ *
+ *      "Legal Entity" shall mean the union of the acting entity and all
+ *      other entities that control, are controlled by, or are under common
+ *      control with that entity. For the purposes of this definition,
+ *      "control" means (i) the power, direct or indirect, to cause the
+ *      direction or management of such entity, whether by contract or
+ *      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ *      outstanding shares, or (iii) beneficial ownership of such entity.
+ *
+ *      "You" (or "Your") shall mean an individual or Legal Entity
+ *      exercising permissions granted by this License.
+ *
+ *      "Source" form shall mean the preferred form for making modifications,
+ *      including but not limited to software source code, documentation
+ *      source, and configuration files.
+ *
+ *      "Object" form shall mean any form resulting from mechanical
+ *      transformation or translation of a Source form, including but
+ *      not limited to compiled object code, generated documentation,
+ *      and conversions to other media types.
+ *
+ *      "Work" shall mean the work of authorship, whether in Source or
+ *      Object form, made available under the License, as indicated by a
+ *      copyright notice that is included in or attached to the work
+ *      (an example is provided in the Appendix below).
+ *
+ *      "Derivative Works" shall mean any work, whether in Source or Object
+ *      form, that is based on (or derived from) the Work and for which the
+ *      editorial revisions, annotations, elaborations, or other modifications
+ *      represent, as a whole, an original work of authorship. For the purposes
+ *      of this License, Derivative Works shall not include works that remain
+ *      separable from, or merely link (or bind by name) to the interfaces of,
+ *      the Work and Derivative Works thereof.
+ *
+ *      "Contribution" shall mean any work of authorship, including
+ *      the original version of the Work and any modifications or additions
+ *      to that Work or Derivative Works thereof, that is intentionally
+ *      submitted to Licensor for inclusion in the Work by the copyright owner
+ *      or by an individual or Legal Entity authorized to submit on behalf of
+ *      the copyright owner. For the purposes of this definition, "submitted"
+ *      means any form of electronic, verbal, or written communication sent
+ *      to the Licensor or its representatives, including but not limited to
+ *      communication on electronic mailing lists, source code control systems,
+ *      and issue tracking systems that are managed by, or on behalf of, the
+ *      Licensor for the purpose of discussing and improving the Work, but
+ *      excluding communication that is conspicuously marked or otherwise
+ *      designated in writing by the copyright owner as "Not a Contribution."
+ *
+ *      "Contributor" shall mean Licensor and any individual or Legal Entity
+ *      on behalf of whom a Contribution has been received by Licensor and
+ *      subsequently incorporated within the Work.
+ *
+ *   2. Grant of Copyright License. Subject to the terms and conditions of
+ *      this License, each Contributor hereby grants to You a perpetual,
+ *      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ *      copyright license to reproduce, prepare Derivative Works of,
+ *      publicly display, publicly perform, sublicense, and distribute the
+ *      Work and such Derivative Works in Source or Object form.
+ *
+ *   3. Grant of Patent License. Subject to the terms and conditions of
+ *      this License, each Contributor hereby grants to You a perpetual,
+ *      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ *      (except as stated in this section) patent license to make, have made,
+ *      use, offer to sell, sell, import, and otherwise transfer the Work,
+ *      where such license applies only to those patent claims licensable
+ *      by such Contributor that are necessarily infringed by their
+ *      Contribution(s) alone or by combination of their Contribution(s)
+ *      with the Work to which such Contribution(s) was submitted. If You
+ *      institute patent litigation against any entity (including a
+ *      cross-claim or counterclaim in a lawsuit) alleging that the Work
+ *      or a Contribution incorporated within the Work constitutes direct
+ *      or contributory patent infringement, then any patent licenses
+ *      granted to You under this License for that Work shall terminate
+ *      as of the date such litigation is filed.
+ *
+ *   4. Redistribution. You may reproduce and distribute copies of the
+ *      Work or Derivative Works thereof in any medium, with or without
+ *      modifications, and in Source or Object form, provided that You
+ *      meet the following conditions:
+ *
+ *      (a) You must give any other recipients of the Work or
+ *          Derivative Works a copy of this License; and
+ *
+ *      (b) You must cause any modified files to carry prominent notices
+ *          stating that You changed the files; and
+ *
+ *      (c) You must retain, in the Source form of any Derivative Works
+ *          that You distribute, all copyright, patent, trademark, and
+ *          attribution notices from the Source form of the Work,
+ *          excluding those notices that do not pertain to any part of
+ *          the Derivative Works; and
+ *
+ *      (d) If the Work includes a "NOTICE" text file as part of its
+ *          distribution, then any Derivative Works that You distribute must
+ *          include a readable copy of the attribution notices contained
+ *          within such NOTICE file, excluding those notices that do not
+ *          pertain to any part of the Derivative Works, in at least one
+ *          of the following places: within a NOTICE text file distributed
+ *          as part of the Derivative Works; within the Source form or
+ *          documentation, if provided along with the Derivative Works; or,
+ *          within a display generated by the Derivative Works, if and
+ *          wherever such third-party notices normally appear. The contents
+ *          of the NOTICE file are for informational purposes only and
+ *          do not modify the License. You may add Your own attribution
+ *          notices within Derivative Works that You distribute, alongside
+ *          or as an addendum to the NOTICE text from the Work, provided
+ *          that such additional attribution notices cannot be construed
+ *          as modifying the License.
+ *
+ *      You may add Your own copyright statement to Your modifications and
+ *      may provide additional or different license terms and conditions
+ *      for use, reproduction, or distribution of Your modifications, or
+ *      for any such Derivative Works as a whole, provided Your use,
+ *      reproduction, and distribution of the Work otherwise complies with
+ *      the conditions stated in this License.
+ *
+ *   5. Submission of Contributions. Unless You explicitly state otherwise,
+ *      any Contribution intentionally submitted for inclusion in the Work
+ *      by You to the Licensor shall be under the terms and conditions of
+ *      this License, without any additional terms or conditions.
+ *      Notwithstanding the above, nothing herein shall supersede or modify
+ *      the terms of any separate license agreement you may have executed
+ *      with Licensor regarding such Contributions.
+ *
+ *   6. Trademarks. This License does not grant permission to use the trade
+ *      names, trademarks, service marks, or product names of the Licensor,
+ *      except as required for reasonable and customary use in describing the
+ *      origin of the Work and reproducing the content of the NOTICE file.
+ *
+ *   7. Disclaimer of Warranty. Unless required by applicable law or
+ *      agreed to in writing, Licensor provides the Work (and each
+ *      Contributor provides its Contributions) on an "AS IS" BASIS,
+ *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ *      implied, including, without limitation, any warranties or conditions
+ *      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ *      PARTICULAR PURPOSE. You are solely responsible for determining the
+ *      appropriateness of using or redistributing the Work and assume any
+ *      risks associated with Your exercise of permissions under this License.
+ *
+ *   8. Limitation of Liability. In no event and under no legal theory,
+ *      whether in tort (including negligence), contract, or otherwise,
+ *      unless required by applicable law (such as deliberate and grossly
+ *      negligent acts) or agreed to in writing, shall any Contributor be
+ *      liable to You for damages, including any direct, indirect, special,
+ *      incidental, or consequential damages of any character arising as a
+ *      result of this License or out of the use or inability to use the
+ *      Work (including but not limited to damages for loss of goodwill,
+ *      work stoppage, computer failure or malfunction, or any and all
+ *      other commercial damages or losses), even if such Contributor
+ *      has been advised of the possibility of such damages.
+ *
+ *   9. Accepting Warranty or Additional Liability. While redistributing
+ *      the Work or Derivative Works thereof, You may choose to offer,
+ *      and charge a fee for, acceptance of support, warranty, indemnity,
+ *      or other liability obligations and/or rights consistent with this
+ *      License. However, in accepting such obligations, You may act only
+ *      on Your own behalf and on Your sole responsibility, not on behalf
+ *      of any other Contributor, and only if You agree to indemnify,
+ *      defend, and hold each Contributor harmless for any liability
+ *      incurred by, or claims asserted against, such Contributor by reason
+ *      of your accepting any such warranty or additional liability.
+ *
+ *   END OF TERMS AND CONDITIONS
+ *
+ *   APPENDIX: How to apply the Apache License to your work.
+ *
+ *      To apply the Apache License to your work, attach the following
+ *      boilerplate notice, with the fields enclosed by brackets "[]"
+ *      replaced with your own identifying information. (Don't include
+ *      the brackets!)  The text should be enclosed in the appropriate
+ *      comment syntax for the file format. We also recommend that a
+ *      file or class name and description of purpose be included on the
+ *      same "printed page" as the copyright notice for easier
+ *      identification within third-party archives.
+ *
+ *   Copyright [yyyy] [name of copyright owner]
+ *
+ *   Licensed 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.
+ */
\ No newline at end of file
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 0000000..ad3daf3
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,8 @@
+Apache Etch (incubating)
+
+Copyright (C) 2008-2009 The Apache Software Foundation
+Copyright (C) 2007-2008 Cisco Systems Inc.
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..cee51b3
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,97 @@
+Welcome to the 1.0.2-incubating release of Apache Etch.
+
+The jumping off point for Etch information and help is here:
+
+http://cwiki.apache.org/ETCH
+
+The top-level structure of the install image is:
+
+	ChangeLog.txt
+	LICENSE.txt
+	README.txt
+    NOTICE.txt
+    RELEASE_NOTES.txt
+	bin/
+	lib/
+    examples/
+	maven/
+    uninst.exe (windows only)
+
+Please take a moment to review the RELEASE_NOTES.txt, ChangeLog.txt and
+LICENSE.txt files.
+
+The Windows installer (apache-etch-1.0.2-incubating-setup.exe) has created a 
+user environment variable (ETCH_HOME) which points to the Etch installation
+directory. If you installed Etch using either apache-etch-1.0.2-incubating-bin.tar.gz
+or apache-etch-1.0.2-incubating-bin.zip, you will want to create this environment
+variable yourself:
+
+windows:
+	set ETCH_HOME=C:\Program Files\Apache Software Foundation\apache-etch-1.0.2-incubating
+
+*nix:
+	export ETCH_HOME=/path/to/apache-etch-1.0.2-incubating
+
+The bin directory has also been put on your path by the Windows installer. If
+you are using the archives, you will need to do this yourself:
+
+windows:
+	PATH %PATH%;%ETCH_HOME%\bin
+
+*nix:
+	export PATH="$PATH:$ETCH_HOME/bin"
+
+The bin/ directory contains a Windows bat script and a unix shell script.
+
+You will also need to have a java sdk installed (later versions of 1.5 or
+any version of 1.6). A JAVA_HOME environment variable should point to the
+installation directory of the java sdk.
+
+In the end, at a command line or shell, you should be able to run the etch
+compiler and see some basic output:
+
+windows:
+	C:\>etch
+	etch: option '-b binding' must be specified on the command line
+
+unix:
+	bash-3.2$ etch
+	etch: option '-b binding' must be specified on the command line
+
+The lib directory contains the various jar files, zipped sources, and a C# dll:
+
+	Etch.dll
+	etch-ant-plugin-1.0.2-src.zip
+	etch-ant-plugin-1.0.2.jar
+	etch-java-runtime-1.0.2-src.zip
+	etch-java-runtime-1.0.2.jar
+	...
+
+The main items of interest are the language binding runtimes, which you need to
+link with your projects.
+
+For java you need to put on the classpath of your projects: etch-java-runtime-1.0.2.jar.
+There is source code to go with it in etch-java-runtime-1.0.2-src.zip.
+
+The C# (.NET 2.0) Etch.dll should be added to any C# projects.
+
+There is an ant plugin which you can use with ant 1.7.0 or later to invoke the
+compiler as a task. It is documented on the wiki referenced above.
+
+If you are using maven, then you might want to install the Etch artifacts into
+your local maven repository. There is a Windows bat script to do this in the
+maven directory:
+
+	etch-maven-install.bat
+
+You need to have maven on your path when you run this script. The file
+etch-java-runtime-1.0.2.jar will be installed into your local repository with
+group "etch.etch", artifact id "etch-java-runtime", and version "1.0.2". You
+may then reference Etch from your maven projects.
+
+Examples have been provided in the examples/ subdirectory.
+
+Unit tests can be had by checking out the source code from the
+subversion repository and performing a complete build:
+
+ https://svn.apache.org/repos/asf/incubator/etch/releases/release-1.0.2
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
new file mode 100644
index 0000000..e56cd13
--- /dev/null
+++ b/RELEASE_NOTES.txt
@@ -0,0 +1,68 @@
+Welcome to Apache Etch 1.0.2. Etch is now incubating at apache.org. You can find
+us here:
+
+Project info:
+
+	http://incubator.apache.org/projects/etch.html
+
+Documentation info:
+
+	http://cwiki.apache.org/ETCH/
+
+Issues:
+
+	https://issues.apache.org/jira/browse/ETCH
+
+SVN:
+
+	http://svn.apache.org/repos/asf/incubator/etch/
+
+Mailing lists:
+
+	mailto:etch-dev@incubator.apache.org (etch developers)
+	mailto:etch-users@incubator.apache.org (etch users)
+
+Subscribing to the mailing lists:
+
+	mailto:etch-dev-subscribe@incubator.apache.org (etch developers)
+	mailto:etch-users-subscribe@incubator.apache.org (etch users)
+
+This release of Etch is the first from our new home at Apache. It is a bug fix
+release only. While some new functionality has been committed to the tree, it
+is not yet functional enough to claim that you should use it.
+
+Here are the issues resolved in this release:
+
+Key			Res		Summary
+ETCH-6		Fixed	If free pool exceeds maximum number of threads the exception
+					thrown will kill the connection.
+ETCH-8		Fixed 	Canceling mailbox notification registration throws exception
+					if not registered.
+ETCH-11 	Fixed 	AlarmManager deadlocks during shutdown().
+ETCH-13 	Fixed 	Copy the rest of the example sources into the distribution.
+ETCH-17 	Fixed 	SessionListener needs to be more independent.
+ETCH-18 	Fixed 	KeepAlive throws exception while trying to shutdown
+					connection.
+ETCH-19 	Fixed 	Break out common tcp transport options so that they may be
+					shared among various transports.
+ETCH-23 	Fixed 	FreePool has synchronization issues with quick back to back
+					calls to Run.
+ETCH-24 	Fixed 	The message direction is always "server" for the
+					result_method messages in the java-binding valuefactory.
+ETCH-25 	Fixed 	DefaultDeliveryService ends call with mb.CloseDelivery() and
+					it should end it with mb.CloseRead().
+ETCH-27 	Fixed 	Mixins cause trouble when two or more mixed in files define
+					a type with the same name.
+ETCH-28 	Fixed 	Examples do not build due to outdated ant files.
+ETCH-29 	Fixed 	Installing all Maven artifacts along with their sources.
+ETCH-31 	Fixed 	MySessionListener in TcpTransportFactory does not override
+					toString() method to show something useful about the
+					transport stack.
+
+Here are the outstanding issues in this release:
+
+Key 		Summary
+ETCH-12 	An exception return value from a message is indistinguishable from a
+			thrown exception.
+ETCH-26 	Some unexpected exceptions are thrown if .Net Framework Language
+			Pack is installed.
diff --git a/binding-csharp/build.xml b/binding-csharp/build.xml
new file mode 100644
index 0000000..d2b4179
--- /dev/null
+++ b/binding-csharp/build.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ * 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.                                           *
+-->
+<project name="etch-csharp-binding" basedir="." default="help">
+    <description>Etch-to-Csharp Binding</description>
+    <property name="Etch.basedir" location="${basedir}/.." />
+    <import file="${Etch.basedir}/build-support/etch.common.xml" />
+	<target name="help"><echo>Please select a target...</echo></target>
+
+    <!-- standard, supported targets -->
+    <target name="Debug"         depends="debug" />
+    <target name="Release"       depends="release" />
+    <target name="Clean"         depends="clean" />
+    <target name="debug"         depends="init-debug,component-all,post-debug"   />
+    <target name="release"       depends="init-release,component-all,post-release" />
+    <target name="clean"         depends="init-clean,component-all,post-clean" />
+    <target name="maven-install" depends="init-maven,release" />
+
+    <target name="init-maven" >
+        <property name="DO.maven.install" value="true" />
+    </target>
+
+    <target name="validate-dependencies" >
+        <mkdir dir="${Etch.logDirectory}" />
+    </target>
+
+    <target name="init-debug" depends="validate-dependencies" >
+        <property name="Etch.build.target" value="Debug" />
+        <property name="Etch.javac.debug" value="on" />
+        <property name="Etch.javac.optimize" value="off" />
+    </target>
+
+    <target name="post-debug" >
+    </target>
+
+    <target name="init-release" depends="validate-dependencies">
+        <!-- For now, keep debug-symbols and no-optimize, even for release builds -->
+        <property name="Etch.build.target" value="Release" />
+        <property name="Etch.javac.debug"  value="on" />
+        <property name="Etch.javac.optimize" value="off" />
+        <!--
+        <property name="Etch.javac.debug"  value="off" />
+        <property name="Etch.javac.optimize" value="on" />
+        -->
+    </target>
+
+    <target name="post-release" >
+    </target>
+
+    <target name="init-clean" depends="validate-dependencies">
+        <property name="Etch.build.target" value="Clean" />
+    </target>
+
+    <target name="post-clean" >
+        <echo message="Executing clean" />
+    </target>
+
+    <target name="component-all" >
+        <build_component dir="compiler" />
+        <build_component dir="runtime" />
+    </target>
+
+</project>
diff --git a/binding-csharp/compiler/build.xml b/binding-csharp/compiler/build.xml
new file mode 100644
index 0000000..1f4df4c
--- /dev/null
+++ b/binding-csharp/compiler/build.xml
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ * 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.                                           *
+-->
+<project name="etch-csharp-compiler" basedir="." default="help">
+    <description>Etch-to-Csharp compiler implementation</description>
+    <property name="Etch.basedir" location="${basedir}/../.." />
+    <import file="${Etch.basedir}/build-support/etch.includes.xml" />
+
+    <!-- Static properties of the sub-project -->
+    <property name="proj"                 location="${Etch.basedir}/binding-csharp/compiler" />
+    <property name="target"               location="${proj}/target" />
+    <property name="src"                  location="${proj}/src" />
+    <property name="generatedSrc"         location="${target}/generated-sources" />
+    <property name="classesDirectory"     location="${target}/classes" />
+    <property name="resourcesDirectory"   location="${target}/resources" />
+    <property name="testResultsDirectory" location="${target}/test-results" />
+
+    <!-- MACRO: init-target -->
+    <macrodef name="init-target" >
+        <sequential>
+            <delete dir="${classesDirectory}"   failonerror="false" quiet="true" />
+            <delete dir="${resourcesDirectory}" failonerror="false" quiet="true" />
+            <mkdir dir="${classesDirectory}" />
+            <mkdir dir="${classesDirectory}/main" />
+            <mkdir dir="${classesDirectory}/test" />
+            <mkdir dir="${resourcesDirectory}" />
+        </sequential>
+    </macrodef>
+
+    <!-- MACRO: compile-sources -->
+    <macrodef name="compile-sources" >
+        <sequential>
+            <!-- compile compiler plugin -->
+            <javac  debug="${Etch.javac.debug}"
+                    target="1.5"
+                    optimize="${Etch.javac.optimize}"
+                    destdir="${classesDirectory}/main" >
+                <src path="${src}/main/java" />
+                <exclude name="**/.svn/**" />
+                <classpath refid="Etch.dependencies.jar.paths" />
+                <classpath>
+                    <pathelement location="${Etch.HOME}/lib/${etch-compiler.jar}" />
+                </classpath>
+            </javac>
+
+            <!-- compiler plugin resources -->
+            <copy todir="${classesDirectory}/main" >
+                <fileset dir="${src}/main/resources">
+                    <include name="**/*.kwd" />
+                    <include name="**/*.vm" />
+                </fileset>
+            </copy>
+
+            <!--
+            <javac  debug="${Etch.javac.debug}"
+                    target="1.5"
+                    optimize="${Etch.javac.optimize}"
+                    destdir="${classesDirectory}/test" >
+                <src path="${src}/test/java" />
+                <exclude name="**/.svn/**" />
+                <classpath refid="Etch.dependencies.jar.paths" />
+                <classpath>
+                    <pathelement location="${classesDirectory}/main" />
+                    <pathelement location="${Etch.HOME}/lib/${etch-compiler.jar}" />
+                </classpath>
+            </javac>
+            -->
+
+        </sequential>
+    </macrodef>
+
+    <!-- MACRO: bundle-jars -->
+    <macrodef name="bundle-jars" >
+        <attribute name="dist" default="${Etch.dist}" />
+        <sequential>
+            <mkdir dir="@{dist}/lib" />
+
+            <!-- CREATE jars -->
+
+            <!-- Package up etch-csharp-compiler jar -->
+            <jar jarfile="@{dist}/lib/${etch-csharp-compiler.jar}" >
+                <manifest>
+                    <attribute name="Copyright"    value="${Etch.copyrightNotice}" />
+                    <attribute name="Version"      value="${Etch.version}" />
+                    <attribute name="LongVersion"  value="${Etch.longversion}" />
+                    <attribute name="Build-Tag"    value="${Etch.buildTag}" />
+                    <attribute name="SVN-Revision" value="${Etch.runtime.revisionNumber}" />
+                </manifest>
+                <metainf dir="${Etch.basedir}" >
+                    <include name="NOTICE.txt" />
+                    <include name="LICENSE.txt" />
+                </metainf>
+                <fileset dir="${classesDirectory}/main">
+                    <include name="org/apache/etch/bindings/**" />
+                    <!-- <include name="resources/**" /> -->
+                </fileset>
+            </jar>
+
+            <!-- CREATE source archives -->
+
+            <!-- package up etch-csharp-compiler src -->
+            <zip destfile="@{dist}/lib/${etch-csharp-compiler-src.zip}" >
+                <fileset dir="${src}/main/java" >
+                    <include name="org/apache/etch/bindings/**/*.java" />
+                </fileset>
+                <fileset dir="${src}/main/resources" >
+                    <include name="**/*" />
+                </fileset>
+            </zip>
+
+        </sequential>
+    </macrodef>
+
+    <!-- INIT TARGET -->
+    <!-- Modify this target to define project specific properties that can only be set at runtime -->
+    <target name="do-init">
+        <delete dir="${target}" failonerror="false" quiet="true" />
+
+        <mkdir dir="${target}" />
+        <mkdir dir="${generatedSrc}" />
+        <mkdir dir="${classesDirectory}" />
+        <mkdir dir="${resourcesDirectory}" />
+        <mkdir dir="${testResultsDirectory}" />
+    </target>
+
+    <!-- CLEAN TARGET -->
+    <target name="do-clean">
+        <delete dir="${target}" />
+    </target>
+
+    <!-- BUILD TARGET -->
+
+    <target name="generate-sources" >
+        <!-- Generate version info -->
+        <update-tokens filename="${src}/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java" />
+    </target>
+
+    <target name="compile-for-dist" >
+        <!-- Initialize target directories -->
+        <init-target />
+
+        <!-- Compile Source -->
+        <compile-sources />
+
+        <!-- Bundle Jars -->
+        <bundle-jars dist="${Etch.dist}" />
+    </target>
+
+    <target name="compile-for-clover" if="Clover.enabled" >
+
+        <echo message="Rebuilding with clover" />
+
+        <!-- initialize-clover -->
+        <initialize-clover suffix="etchcsharpcompiler" >
+            <fileset dir="${src}/main/java">
+                <include name="**/*.java" />
+            </fileset>
+            <!--
+            <testsources dir="${src}/test/java">
+                <include name="**/*.java" />
+            </testsources>
+            -->
+        </initialize-clover>
+
+        <!-- Initialize target directories -->
+        <init-target />
+
+        <!-- Compile Source -->
+        <compile-sources />
+
+        <!-- Bundle Jars -->
+        <bundle-jars dist="${Etch.clover-dist}" />
+
+    </target>
+
+    <target name="do-build" depends="generate-sources,compile-for-dist,compile-for-clover" />
+
+    <!-- TEST TARGET -->
+    <target name="do-test">
+
+        <!-- Run Unit Tests -->
+        <!--
+        <junit printsummary="yes" haltonfailure="no" dir="${classesDirectory}"
+            errorProperty="build.tests.fail" failureProperty="build.tests.fail">
+            <classpath>
+                <pathelement location="${classesDirectory}/main" />
+                <pathelement location="${classesDirectory}/test" />
+                <pathelement location="${Etch.dependency.junit.jar}" />
+                <pathelement location="${Etch.HOME}/lib/${etch-compiler.jar}" />
+                <pathelement location="${Etch.dependency.clover.jar}"/>
+            </classpath>
+            <formatter type="xml"/>
+            <batchtest fork="true" todir="${testResultsDirectory}">
+                <fileset dir="${src}/test/java">
+                    <include name="**/*.java" />
+                </fileset>
+            </batchtest>
+        </junit>
+        -->
+    </target>
+
+    <!-- POSTBUILD TARGET -->
+    <target name="do-postbuild">
+    </target>
+
+    <target name="do-publish" if="build.tests.fail">
+        <!-- Set flag file if any tests failed -->
+        <touch file="${Etch.runtime.tests.fail}"/>
+    </target>
+
+</project>
diff --git a/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/Compiler.java b/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/Compiler.java
new file mode 100644
index 0000000..56661ab
--- /dev/null
+++ b/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/Compiler.java
@@ -0,0 +1,1161 @@
+/* $Id$
+ *
+ * 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.
+ */
+
+package org.apache.etch.bindings.csharp.compiler;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.etch.compiler.Backend;
+import org.apache.etch.compiler.CmdLineOptions;
+import org.apache.etch.compiler.EtchGrammarConstants;
+import org.apache.etch.compiler.LogHandler;
+import org.apache.etch.compiler.Output;
+import org.apache.etch.compiler.ParseException;
+import org.apache.etch.compiler.Token;
+import org.apache.etch.compiler.Version;
+import org.apache.etch.compiler.ast.Builtin;
+import org.apache.etch.compiler.ast.Except;
+import org.apache.etch.compiler.ast.Item;
+import org.apache.etch.compiler.ast.Message;
+import org.apache.etch.compiler.ast.MessageDirection;
+import org.apache.etch.compiler.ast.Module;
+import org.apache.etch.compiler.ast.MsgDirHelper;
+import org.apache.etch.compiler.ast.Name;
+import org.apache.etch.compiler.ast.Named;
+import org.apache.etch.compiler.ast.ParamList;
+import org.apache.etch.compiler.ast.Parameter;
+import org.apache.etch.compiler.ast.ReservedWordChecker;
+import org.apache.etch.compiler.ast.Service;
+import org.apache.etch.compiler.ast.Struct;
+import org.apache.etch.compiler.ast.Thrown;
+import org.apache.etch.compiler.ast.TypeRef;
+import org.apache.etch.compiler.opt.ToString;
+import org.apache.etch.compiler.opt.ToString.FieldItem;
+import org.apache.etch.compiler.opt.ToString.FmtItem;
+import org.apache.etch.compiler.opt.ToString.StringItem;
+import org.apache.etch.util.Assertion;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.log.LogChute;
+
+
+/**
+ * Compiler is a helper class not only for Backend, but also for the templates.
+ * They call methods here to perform "hard" tasks.
+ */
+public class Compiler extends Backend
+{
+	private final static String tmplPath1 = "org/apache/etch/bindings/csharp/compiler/";
+
+	private final static String tmplPath2 = "resources/org/apache/etch/bindings/csharp/compiler/";
+
+	private final static String fnSuffix = ".cs";
+
+	private final static String VERSION = Version.VERSION + " / "
+		+ CompilerVersion.VERSION;
+
+	/**
+	 * Constructs the Compiler. This is a helper class not only for Backend, but
+	 * also for the templates. They call methods here to perform "hard" tasks.
+	 *
+	 * @throws Exception
+	 */
+	public Compiler() throws Exception
+	{
+		initVelocity();
+		
+		String[] path = { tmplPath1, tmplPath2 };
+		vf_vm = getTemplate( path, "vf.vm" );
+		intf_vm = getTemplate( path, "intf.vm" );
+		remote_vm = getTemplate( path, "remote.vm" );
+		stub_vm = getTemplate( path, "stub.vm" );
+		helper_vm = getTemplate( path, "helper.vm" );
+		readme_vm = getTemplate( path, "readme.vm" );
+		main_vm = getTemplate( path, "main.vm" );
+		base_vm = getTemplate( path, "base.vm" );
+		impl_vm = getTemplate( path, "impl.vm" );
+
+		local_kwd = getPath( path, "csharpKeywords.kwd" );
+	}
+
+	private final Template vf_vm;
+
+	private final Template intf_vm;
+
+	private final Template remote_vm;
+
+	private final Template stub_vm;
+
+	private final Template helper_vm;
+
+	private final Template readme_vm;
+
+	private final Template main_vm;
+
+	private final Template base_vm;
+
+	private final Template impl_vm;
+
+	private final String local_kwd;
+
+	private LogHandler lh;
+	
+	/**
+	 * Initializes use of velocity engine and sets up
+	 * resource loaders.
+	 * @throws Exception
+	 */
+	private void initVelocity()
+		throws Exception
+	{
+		Velocity.setProperty( Velocity.RUNTIME_LOG_LOGSYSTEM, new MyLogger() );
+		
+		Velocity.setProperty( Velocity.RESOURCE_LOADER, "file, class" );
+
+		Velocity.setProperty( "file.resource.loader.description", "Velocity File Resource Loader" );
+		Velocity.setProperty( "file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader" );
+		Velocity.setProperty( "file.resource.loader.path", "." );
+
+		Velocity.setProperty( "class.resource.loader.description", "Velocity Classpath Resource Loader" );
+		Velocity.setProperty( "class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" );
+		
+		Velocity.init();
+	}
+	
+	private static class MyLogger implements LogChute
+	{
+		private final LogHandler lh = null;
+		
+		public void init( RuntimeServices rts ) throws Exception
+		{
+			// ignore.
+		}
+
+		public boolean isLevelEnabled( int level )
+		{
+			return level >= 2;
+		}
+
+		public void log( int level, String msg )
+		{
+			if (level < 2)
+				return;
+			
+			if (lh != null)
+				lh.report( level == 2 ? LogHandler.LEVEL_WARNING : LogHandler.LEVEL_ERROR, null, msg );
+			else
+				System.out.printf( "Velocity msg (%d): %s\n", level, msg );
+		}
+
+		public void log( int level, String msg, Throwable e )
+		{
+			if (level < 2)
+				return;
+			
+			if (lh != null)
+				lh.report( level == 2 ? LogHandler.LEVEL_WARNING : LogHandler.LEVEL_ERROR, null, msg );
+			else
+				System.out.printf( "Velocity msg (%d): %s: %s\n", level, msg, e );
+		}
+	}
+
+	/**
+	 * @param path
+	 * @param fn
+	 * @return the velocity template
+	 * @throws Exception
+	 */
+	private Template getTemplate( String[] path, String fn )
+		throws Exception
+	{
+		ResourceNotFoundException rnfe = null;
+		
+		for (String p: path)
+		{
+			if (p == null)
+				continue;
+			
+//			System.out.println( "trying to load template "+(p+fn) );
+			try
+			{
+				if (Velocity.resourceExists( p+fn ))
+					return Velocity.getTemplate( p+fn );
+			}
+			catch ( ResourceNotFoundException e )
+			{
+				rnfe = e;
+			}
+			catch ( Exception e )
+			{
+				System.out.println( "ignoring "+e);
+			}
+		}
+		
+		if (rnfe != null)
+			throw rnfe;
+		
+		throw new ResourceNotFoundException("could not find resource: "+fn);
+	}
+
+	@Override
+	public void generate( Module module, CmdLineOptions options )
+		throws Exception
+	{
+		lh = options.lh;
+
+		boolean ignoreGlobal = options.ignoreGlobalWordsList;
+		boolean ignoreLocal = options.ignoreLocalWordsList;
+		String userWords = options.userWordsList != null ? options.userWordsList.getPath() : null;
+		Set<String> what = options.what;
+
+		// Load the reserved words lists if any have been provided.
+		Map<String, String> words = new HashMap<String, String>();
+		if (!ignoreGlobal)
+			mapWords( global_kwd, words );
+		if (!ignoreLocal)
+			mapWords( local_kwd, words );
+		if (userWords != null)
+			mapWords( userWords, words );
+
+		// check for collisions with the reserved word list.
+		ReservedWordChecker checker = new ReservedWordChecker( words, false, lh );
+		module.treewalk( checker );
+		if (!checker.ok())
+		{
+			lh.report( LogHandler.LEVEL_ERROR, null, "Encountered errors during java generation." );
+			return;
+		}
+
+		// ok, we're ready to generate code. make sure the
+		// output directories exist.
+
+		Output dir = options.output;
+		Output templateDir = options.templateOutput;
+		
+		String m = module.name().name;
+		if (m.length() > 0)
+		{
+			dir = dir.newPackage( m );
+			templateDir = templateDir.newPackage( m );
+		}
+		
+		// generate code for each service.
+
+		for (Service intf : module)
+		{
+			generate( intf, what, dir, templateDir );
+		}
+	}
+
+	private void generate( final Service intf, Set<String> what, Output dir,
+		Output templateDir ) throws Exception
+	{
+		what = populateWhat( what );
+
+		if (what.isEmpty())
+		{
+			// lh.logMessage( lh.LEVEL_ERROR, null, "User has selected NONE\n" );
+			return;
+		}
+
+		final MessageDirection msgDir = getMessageDirection( what );
+
+		if (what.contains( WHAT_INTF ))
+		{
+			// Generate the value factory file.
+			
+			generateVf( intf, dir );
+	
+			// Generate the interface, remote, and stub files.
+	
+			generateIntfRemoteStub( intf, dir, msgDir, MessageDirection.BOTH, false );
+	
+			generateIntfRemoteStub( intf, dir, msgDir, MessageDirection.SERVER, true );
+	
+			generateIntfRemoteStub( intf, dir, msgDir, MessageDirection.CLIENT, true );
+	
+			// Generate helper file.
+	
+			generateHelper( intf, dir, msgDir );
+			
+			// Generate base file.
+			
+			generateBase( intf, dir, msgDir );
+	
+			// Generate readme file.
+			
+			generateReadme( intf, dir, msgDir );
+		}
+
+		// Generate main template file.
+
+		if (what.contains( WHAT_MAIN ))
+			generateMain( intf, templateDir, msgDir );
+
+		// Generate impl template file.
+
+		if (what.contains( WHAT_IMPL ))
+			generateImpl( intf, templateDir, msgDir );
+	}
+
+	private void generateReadme( final Service intf, Output dir,
+		final MessageDirection msgDir ) throws Exception
+	{
+		doFile( dir, "readme-etch-csharp-files.txt", lh, new Gen()
+		{
+			public void run( PrintWriter pw ) throws Exception
+			{
+				generateReadme( pw, intf, msgDir );
+			}
+		} );
+	}
+
+	private void generateVf( final Service intf, Output dir )
+		throws Exception
+	{
+		doFile( dir, getVfName( intf ) + fnSuffix, lh, new Gen()
+		{
+			public void run( PrintWriter pw ) throws Exception
+			{
+				generateVf( pw, intf );
+			}
+		} );
+	}
+
+	private void generateHelper( final Service intf, Output dir,
+		final MessageDirection msgDir ) throws Exception
+	{
+		doFile( dir, getHelperName( intf ) + fnSuffix, lh, new Gen()
+		{
+			public void run( PrintWriter pw ) throws Exception
+			{
+				generateHelper( pw, intf, msgDir );
+			}
+		} );
+	}
+
+	private void generateMain( final Service intf, Output dir,
+		MessageDirection msgDir ) throws Exception
+	{
+		if (msgDir == MessageDirection.BOTH
+				|| msgDir == MessageDirection.CLIENT)
+			doFile( dir, getMainName( intf, MessageDirection.CLIENT ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateMain( pw, intf, MessageDirection.CLIENT, false );
+				}
+			} );
+
+		if (msgDir == MessageDirection.BOTH
+				|| msgDir == MessageDirection.SERVER)
+			doFile( dir, getMainName( intf, MessageDirection.SERVER ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateMain( pw, intf, MessageDirection.SERVER, false );
+				}
+			} );
+	}
+
+	private void generateBase( final Service intf, Output dir,
+		MessageDirection msgDir ) throws Exception
+	{
+		if (msgDir == MessageDirection.BOTH || msgDir == MessageDirection.CLIENT)
+			doFile( dir, getBaseName( intf, MessageDirection.CLIENT ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateBase (pw, intf, MessageDirection.CLIENT, false );
+				}
+			} );
+
+		if (msgDir == MessageDirection.BOTH || msgDir == MessageDirection.SERVER)
+			doFile( dir, getBaseName( intf, MessageDirection.SERVER ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateBase (pw, intf, MessageDirection.SERVER, false );
+				}
+			} );
+	}
+
+	private void generateImpl( final Service intf, Output dir,
+		MessageDirection msgDir ) throws Exception
+	{
+		if (msgDir == MessageDirection.BOTH
+				|| msgDir == MessageDirection.CLIENT)
+			doFile( dir, getImplName( intf, MessageDirection.CLIENT ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateImpl( pw, intf, MessageDirection.CLIENT, false );
+				}
+			} );
+
+		if (msgDir == MessageDirection.BOTH
+				|| msgDir == MessageDirection.SERVER)
+			doFile( dir, getImplName( intf, MessageDirection.SERVER ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateImpl( pw, intf, MessageDirection.SERVER, false );
+				}
+			} );
+	}
+
+	private void generateIntfRemoteStub( final Service intf, Output dir,
+		final MessageDirection what, final MessageDirection mc,
+		final boolean hasBaseClass ) throws Exception
+	{
+		// Generate interface file
+
+		doFile( dir, getIntfName( intf, mc ) + fnSuffix, lh, new Gen()
+		{
+			public void run( PrintWriter pw ) throws Exception
+			{
+				generateIntf( pw, intf, mc, hasBaseClass );
+			}
+		} );
+
+		// Generate remote file
+
+		if (mc == MessageDirection.BOTH || what == MessageDirection.BOTH
+				|| mc != what)
+			doFile( dir, getRemoteName( intf, mc ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateRemote( pw, intf, mc, hasBaseClass );
+				}
+			} );
+
+		// Generate stub file
+
+		if (mc == MessageDirection.BOTH || what == MessageDirection.BOTH
+				|| mc == what)
+			doFile( dir, getStubName( intf, mc ) + fnSuffix, lh, new Gen()
+			{
+				public void run( PrintWriter pw ) throws Exception
+				{
+					generateStub( pw, intf, mc, hasBaseClass );
+				}
+			} );
+	}
+
+	/**
+	 * Generate the value factory for the service.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @throws Exception
+	 */
+	void generateVf( PrintWriter pw, Service intf ) throws Exception
+	{
+		// params keeps track of the total set of parameters
+		// named (for enums, structs, exceptions, and messages).
+		Set<String> params = new HashSet<String>();
+
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "params", params );
+		vf_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generate the interface for the service.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @param hasBaseClass
+	 * @throws Exception
+	 */
+	void generateIntf( PrintWriter pw, Service intf, MessageDirection mc,
+		boolean hasBaseClass ) throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+		context.put( "suffix", MsgDirHelper.getSuffix( mc ) );
+		context.put( "hasBaseClass", hasBaseClass );
+		intf_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generate the call to message implementation of the interface. This class
+	 * turns calls on its methods into messages which are sent to the remote
+	 * stub. For two-way calls, it then waits for a response message, returning
+	 * the result therein to the caller.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @param hasBaseClass
+	 * @throws Exception
+	 */
+	void generateRemote( PrintWriter pw, Service intf, MessageDirection mc,
+		boolean hasBaseClass ) throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+		context.put( "suffix", MsgDirHelper.getSuffix( mc ) );
+		context.put( "hasBaseClass", hasBaseClass );
+		context.put( "methodList", new ArrayList<String>());
+		remote_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generate the message to call implementation. This class accepts a message
+	 * and turns it back into a call on the user's implementation. For two-way
+	 * messages, the return value from the user's implementation method is turned
+	 * into the appropriate response message and sent.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @param hasBaseClass
+	 * @throws Exception
+	 */
+	void generateStub( PrintWriter pw, Service intf, MessageDirection mc,
+		boolean hasBaseClass ) throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+		context.put( "suffix", MsgDirHelper.getSuffix( mc ) );
+		context.put( "hasBaseClass", hasBaseClass );
+		stub_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generate the transport plumbing helper.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @throws Exception
+	 */
+	void generateHelper( PrintWriter pw, Service intf, MessageDirection mc )
+		throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+
+		helper_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generate the readme.txt.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @throws Exception
+	 */
+	void generateReadme( PrintWriter pw, Service intf, MessageDirection mc ) throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+
+		readme_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generate the template main program.
+	 *
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @param hasBaseClass
+	 * @throws Exception
+	 */
+	void generateMain( PrintWriter pw, Service intf, MessageDirection mc,
+		boolean hasBaseClass ) throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+		context.put( "suffix", MsgDirHelper.getSuffix( mc ) );
+		context.put( "hasBaseClass", hasBaseClass );
+		main_vm.merge( context, pw );
+	}
+
+	/**
+	 * Generates the base implementation of the interfaces, with each
+	 * method throwing an exception to the tune that it isn't implemented.
+	 * User's impl will extend this base implementation.
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @param hasBaseClass
+	 * @throws Exception
+	 */
+	void generateBase( PrintWriter pw, Service intf, MessageDirection mc,
+		boolean hasBaseClass ) throws Exception
+		{
+			VelocityContext context = new VelocityContext();
+			context.put( "now", new Date() );
+			context.put( "version", VERSION );
+			context.put( "helper", this );
+			context.put( "intf", intf );
+			context.put( "mc", mc );
+			context.put( "suffix", MsgDirHelper.getSuffix( mc ) );
+			context.put( "hasBaseClass", hasBaseClass );
+			context.put( "methodList", new ArrayList<String>());
+			base_vm.merge( context, pw );
+		}
+
+	/**
+	 * Generate the template user implemention class which extends the base
+	 * implementation generated above. This class will only have the appropriate
+	 * constructor and reference to the appropriate remote, and a comment inviting
+	 * the user to override methods.
+	 * @param pw
+	 * @param intf
+	 * @param mc
+	 * @param hasBaseClass
+	 * @throws Exception
+	 */
+	void generateImpl( PrintWriter pw, Service intf, MessageDirection mc,
+		boolean hasBaseClass ) throws Exception
+	{
+		VelocityContext context = new VelocityContext();
+		context.put( "now", new Date() );
+		context.put( "version", VERSION );
+		context.put( "helper", this );
+		context.put( "intf", intf );
+		context.put( "mc", mc );
+		context.put( "suffix", MsgDirHelper.getSuffix( mc ) );
+		context.put( "hasBaseClass", hasBaseClass );
+		impl_vm.merge( context, pw );
+	}
+
+	private String getVfName( Service intf )
+	{
+		return "ValueFactory" + getIntfName( intf, MessageDirection.BOTH );
+	}
+
+	private String getIntfName( Service intf, MessageDirection mc )
+	{
+		String suffix = MsgDirHelper.getSuffix( mc );
+		return intf.name() + suffix;
+	}
+
+	private String getMainName( Service intf, MessageDirection mc )
+	{
+		if (mc == MessageDirection.SERVER)
+			return "Main" + intf.name() + "Listener";
+		return "Main" + getIntfName( intf, mc );
+	}
+
+	private String getImplName( Service intf, MessageDirection mc )
+	{
+		return "Impl" + getIntfName( intf, mc );
+	}
+
+	private String getRemoteName( Service intf, MessageDirection mc )
+	{
+		return "Remote" + getIntfName( intf, mc );
+	}
+
+	private String getStubName( Service intf, MessageDirection mc )
+	{
+		return "Stub" + getIntfName( intf, mc );
+	}
+
+	private String getHelperName( Service intf )
+	{
+		return intf.name() + "Helper";
+	}
+	
+	private String getBaseName( Service intf, MessageDirection mc )
+	{
+		return "Base" + getIntfName( intf, mc );
+	}
+
+	@Override
+	public String asyncReceiverPoolName( Message msg )
+	{
+		return msg.getAsyncReceiver().toString().toLowerCase();
+	}
+
+	@Override
+	public String getTypeValue( TypeRef type, Token value )
+	{
+		// System.out.println( "getTypeValue called with: "+type+": "+value );
+		Token t = type.type();
+		switch (t.kind)
+		{
+			case EtchGrammarConstants.LONG:
+				return value.image + "L";
+			case EtchGrammarConstants.FLOAT:
+				return value.image + "F";
+			case EtchGrammarConstants.DOUBLE:
+				return value.image + "D";
+			case EtchGrammarConstants.STRING:
+				return protectString( value.image );
+			default:
+				return value.image;
+		}
+	}
+
+	private String protectString( String s )
+	{
+		// System.out.println( "protectString called with: "+s );
+
+		StringBuffer sb = new StringBuffer();
+		sb.append( "\"" );
+		for (char c : s.toCharArray())
+		{
+			if (c == '\t')
+			{
+				sb.append( "\\t" );
+				continue;
+			}
+			if (c == '\r')
+			{
+				sb.append( "\\r" );
+				continue;
+			}
+			if (c == '\n')
+			{
+				sb.append( "\\n" );
+				continue;
+			}
+			if (c == '\"')
+			{
+				sb.append( "\\\"" );
+				continue;
+			}
+			if (c == '\\')
+			{
+				sb.append( "\\\\" );
+				continue;
+			}
+			if (c >= 32 && c < 127)
+			{
+				sb.append( c );
+				continue;
+			}
+			sb.append( String.format( "\\u%04x", (int) c ) );
+		}
+		sb.append( "\"" );
+		return sb.toString();
+	}
+
+	/**
+	 * @param type
+	 * @return type name appropriate for use as a structure element or exception
+	 * parameter or function parameter or result.
+	 */
+	@Override
+	public String getTypeName( TypeRef type )
+	{
+		if (type.dim() > 0)
+			return getNativeTypeName( type ) + dim2spec( type.dim() );
+		return getRefTypeName( type );
+	}
+
+	/**
+	 * @param type the etch type
+	 * @return the fundamental native type for java. so etch int -> csharp int,
+	 * while etch string -> csharp string.
+	 */
+	@Override
+	public String getNativeTypeName( TypeRef type )
+	{
+		Token t = type.type();
+		switch (t.kind)
+		{
+			case EtchGrammarConstants.VOID:
+				return "void";
+			case EtchGrammarConstants.BOOLEAN:
+				return "bool";
+			case EtchGrammarConstants.BYTE:
+				return "sbyte";
+			case EtchGrammarConstants.SHORT:
+				return "short";
+			case EtchGrammarConstants.INT:
+				return "int";
+			case EtchGrammarConstants.LONG:
+				return "long";
+			case EtchGrammarConstants.FLOAT:
+				return "float";
+			case EtchGrammarConstants.DOUBLE:
+				return "double";
+			case EtchGrammarConstants.STRING:
+				return "string";
+			case EtchGrammarConstants.OBJECT:
+				return "Object";
+			default:
+			{
+				// we have to use a fully qualified name here.
+				// find the actual type...
+				Named<?> n = type.intf().get( t.image );
+				if (n == null)
+					throw new IllegalArgumentException( String.format(
+						"undefined or ambiguous name at line %d: %s",
+						t.beginLine, t.image ) );
+				return n.efqname( this );
+			}
+		}
+	}
+
+	/**
+	 * @param type the etch type
+	 * @return the fundamental native reference type for java. so etch int ->
+	 * csharp int?, while etch string -> csharp string.
+	 */
+	private String getRefTypeName( TypeRef type )
+	{
+		Token t = type.type();
+		switch (t.kind)
+		{
+			case EtchGrammarConstants.VOID:
+				return "void";
+			case EtchGrammarConstants.BOOLEAN:
+				return "bool?";
+			case EtchGrammarConstants.BYTE:
+				return "sbyte?";
+			case EtchGrammarConstants.SHORT:
+				return "short?";
+			case EtchGrammarConstants.INT:
+				return "int?";
+			case EtchGrammarConstants.LONG:
+				return "long?";
+			case EtchGrammarConstants.FLOAT:
+				return "float?";
+			case EtchGrammarConstants.DOUBLE:
+				return "double?";
+			case EtchGrammarConstants.STRING:
+				return "string";
+			case EtchGrammarConstants.OBJECT:
+				return "Object";
+			default:
+			{
+				// we have to use a fully qualified name here.
+				// find the actual type...
+				Named<?> n = type.intf().get( t.image );
+				if (n == null)
+					throw new IllegalArgumentException( String.format(
+						"undefined or ambiguous name at line %d: %s",
+						t.beginLine, t.image ) );
+				if (n.isEnumx())
+					return n.efqname( this ) + "?";
+				return n.efqname( this );
+			}
+		}
+	}
+
+	private String dim2spec( int i )
+	{
+		String s = "";
+		while (i-- > 0)
+			s += "[]";
+		return s;
+	}
+
+	@Override
+	public String formatString( ParamList<Service> n, boolean isExcept )
+		throws ParseException, IOException
+	{
+		ToString ts = (ToString) n.getOpt( "ToString" );
+		List<FmtItem> list;
+		if (ts != null)
+		{
+			list = ts.getFormat();
+			n.checkFormatList( ts.lineno(), list );
+		}
+		else if (isExcept)
+		{
+			list = n.mkFormatList( true, ((Except)n).hasExtends() );
+			// Temp Fix :remove once Scott fixes the ParamList code
+			modifyFormatList(list,true);
+		}
+		else
+		{
+			list = n.mkFormatList( false, ((Struct)n).hasExtends() );
+//			 Temp Fix :remove once Scott fixes the ParamList code
+			modifyFormatList(list,false);
+		}
+
+
+		if (list.size() == 1)
+		{
+			return list.get( 0 ).value();
+		}
+
+		StringBuffer sb = new StringBuffer();
+		sb.append( "String.Format( " );
+		sb.append( "\"" );
+		int j = 0;
+		for (FmtItem i : list)
+		{
+			if (i instanceof FieldItem)
+			{
+				sb.append( "{" + j + "}" );
+				j++;
+			}
+			else
+			{
+				escape( sb, ((StringItem) i).value() );
+			}
+		}
+		j = 0;
+
+		sb.append( "\"" );
+		for (FmtItem i : list)
+		{
+			if (i instanceof FieldItem)
+			{
+				sb.append( ", " );
+				sb.append( ((FieldItem) i).value() );
+			}
+		}
+		sb.append( " )" );
+		return sb.toString();
+	}
+
+	private void escape( StringBuffer sb, String s ) throws IOException
+	{
+		StringReader rdr = new StringReader( s );
+		int c;
+		while ((c = rdr.read()) >= 0)
+		{
+			if (c == '"')
+				sb.append( "\\\"" );
+			else if (c == '\\')
+				sb.append( "\\\\" );
+			else if (c == '\t')
+				sb.append( "\\t" );
+			else if (c == '\r')
+				sb.append( "\\r" );
+			else if (c == '\n')
+				sb.append( "\\n" );
+			else
+				sb.append( (char) c );
+		}
+	}
+
+	@Override
+	public String mfvname( String vname )
+	{
+		return "_mf_" + vname;
+	}
+
+	@Override
+	public String mtvname( String vname )
+	{
+		return "_mt_" + vname;
+	}
+
+	@Override
+	public String getLang()
+	{
+		return "csharp";
+	}
+
+	@Override
+	public String enum_efqname( String fqname, String moduleName,
+		String serviceName, String enumName )
+	{
+
+//		return moduleName + "." + "Consts" + serviceName + "." + enumName;
+		return moduleName + "." + "types" + "." + serviceName + "." + enumName;
+
+	}
+
+	@Override
+	public String except_efqname( String fqname, String moduleName,
+		String serviceName, String exceptName )
+	{
+
+//		return moduleName + "." + "Consts" + serviceName + "." + exceptName;
+		return moduleName + "." + "types" + "." + serviceName + "." + exceptName;
+	}
+
+	@Override
+	public String struct_efqname( String fqname, String moduleName,
+		String serviceName, String structName )
+	{
+
+//		return moduleName + "." + "Consts" + serviceName + "." + structName;
+		return moduleName + "." + "types" + "." + serviceName + "." + structName;
+	}
+
+	@Override
+	public String qualifyParameterName( Token name )
+	{
+		return name.image;
+	}
+
+	@Override
+	public String qualifyConstantName( Service intf, Token name )
+	{
+		String moduleName = intf.parent().name().name;
+		String serviceName = intf.name().name;
+		return moduleName + "." + "types" + "." + serviceName + "." + "Consts" + serviceName + "." + name.image;
+	}
+
+	@Override
+	public String qualifyEnumName( Service intf, Token name )
+	{
+		String moduleName = intf.parent().name().name;
+		String serviceName = intf.name().name;
+		return moduleName + "." + "types" + "." + serviceName + "." +  name.image;
+	}
+
+	@Override
+	public String getValidator( Named<?> named )
+	{
+		if (named instanceof Parameter)
+		{
+			Parameter param = (Parameter) named;
+			TypeRef type = param.type();
+
+			if (type.isBuiltin())
+				return "Validator_" + type.type() + ".Get( " + type.dim()
+					+ " )";
+
+			Named<?> n = type.getNamed( type.intf() );
+
+			if (n.isBuiltin())
+			{
+				Builtin b = (Builtin) n;
+				String cn = b.className();
+				if (cn.endsWith( "?" ))
+					cn = cn.substring( 0, cn.length()-1 );
+				
+				return String.format( "Validator_custom.Get( typeof(%s), %d, %s )",
+					cn, type.dim(), b.allowSubclass() );
+			}
+
+			// Allow subclassing for etch defined structs and externs.
+
+			if (n.isStruct() || n.isExcept())
+				return String.format( "Validator_custom.Get( typeof(%s), %d, true )",
+					n.efqname( this ), type.dim() );
+
+			// Don't allow subclassing for externs or etch defined enums.
+
+			if (!(n.isExtern() || n.isEnumx()))
+				Assertion.check( n.isExtern() || n.isEnumx(),
+					"n.isExtern() || n.isEnumx(): "+n );
+
+			return "Validator_custom.Get( typeof ( "
+				+ n.efqname( this )  + " ), " + type.dim()
+				+ ", false )";
+		}
+
+		if (named instanceof Thrown)
+		{
+			Thrown thrown = (Thrown) named;
+			Except e = (Except) thrown.getNamed();
+			return "Validator_custom.Get( typeof ( " + e.efqname( this )
+				+ " ) , 0,true )";
+		}
+
+		if (named instanceof Item)
+			return "Validator_boolean.Get( 0 )";
+
+		return "null";
+	}
+
+	/**
+	 * @param name
+	 * @return the appropriate name for a getter method.
+	 */
+	public String getGetterName( Name name )
+	{
+		String s = name.name;
+		return "Get" + s.substring( 0, 1 ).toUpperCase()+s.substring( 1 );
+	}
+
+	/**
+	 * @param name
+	 * @return the appropriate name for a setter method.
+	 */
+	public String getSetterName( Name name )
+	{
+		String s = name.name;
+		return "Set" + s.substring( 0, 1 ).toUpperCase()+s.substring( 1 );
+	}
+
+	private void modifyFormatList(List<FmtItem> list,boolean isException) {
+		for(int i=0;i<list.size();i++) {
+			FmtItem item = list.get( i );
+
+			if (item.value().contains( "super.getMessage()" )) {
+				list.remove( i );
+				list.add(i, new FieldItem(  "base.GetMessage()" ) );
+			}
+			if (item.value().contains( "super.toString()" )) {
+				list.remove( i );
+				list.add(i, new FieldItem(  "base.ToString()" ) );
+			}
+		}
+	}
+
+	@Override
+	public void addDefaults( Service service ) throws ParseException
+	{
+		addBuiltin( service, newName( "List" ), "System.Collections.IList", true );
+		addBuiltin( service, newName( "Map" ), "System.Collections.IDictionary", true );
+		addBuiltin( service, newName( "Set" ), "System.Collections.Hashtable", true );
+		addBuiltin( service, newName( "Datetime" ), "System.DateTime?", false );
+	}
+}
diff --git a/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java b/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java
new file mode 100644
index 0000000..302b787
--- /dev/null
+++ b/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java
@@ -0,0 +1,33 @@
+/* $Id$
+ *
+ * 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.
+ */
+
+package org.apache.etch.bindings.csharp.compiler;
+
+/**
+ * The version info of this Etch backend (compiler).
+ */
+public interface CompilerVersion
+{
+	// This file is edited by the production build system to replace the value
+	// of VERSION below with whatever it wants the version string to actually be.
+	
+	/** The version of this Etch backend (compiler) */
+	public String VERSION = "csharp 1.1.0-incubating (LOCAL-0)";
+}
diff --git a/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java.tmpl b/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java.tmpl
new file mode 100644
index 0000000..95c17c5
--- /dev/null
+++ b/binding-csharp/compiler/src/main/java/org/apache/etch/bindings/csharp/compiler/CompilerVersion.java.tmpl
@@ -0,0 +1,30 @@
+/* $Id$
+ *
+ * Copyright 2007-2008 Cisco Systems Inc.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.etch.bindings.csharp.compiler;
+
+/**
+ * The version info of this Etch backend (compiler).
+ */
+public interface CompilerVersion
+{
+	// This file is edited by the production build system to replace the value
+	// of VERSION below with whatever it wants the version string to actually be.
+	
+	/** The version of this Etch backend (compiler) */
+	public String VERSION = "csharp @EtchLongVersion@ (@EtchBuildTag@)";
+}
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/base.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/base.vm
new file mode 100644
index 0000000..eb8e22e
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/base.vm
@@ -0,0 +1,276 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+// Re-implement these methods by overriding them in Impl$intf.name()$suffix
+// or by making appropriate assignments to the delegates.
+#set($i = $intf.name())
+#set($vfname = "ValueFactory$i")
+#set($intfname = "$i$suffix")
+#set($clname = "Base$intfname")
+#if ($helper.isServer($mc))
+#set($peer = "client")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "server")
+#set($peerclass = "Remote${i}Server")
+#end
+
+using System;
+
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+#if ($n.hasImport( $helper ))
+using $n.getImport( $helper );
+#end
+#end
+#end
+using Org.Apache.Etch.Bindings.Csharp.Support;
+
+/// <summary>
+/// Base Implementation of $intfname, with default method implementations
+/// which throw NotSupportedException. Either implement the delegates or extend
+/// this class to provide implementations of messages from the $peer 
+/// </summary>
+
+namespace $intf.parent().name()
+{
+
+	///<summary>Call to message translator for $intfname.</summary>
+	public class $clname : $intfname, ObjSession
+	{	
+#set( $delegateTypeHeader = "_delegate_type_" )
+#set( $delegateVarHeader = "_delegate_" )
+#set( $sep = "" )
+#foreach ($mthd in $intf.iterator())
+#if ($mthd.isMsgDir($mc) || $mthd.isMsgDirBoth())
+#if (!$mthd.isHidden())
+#if(!$methodList.contains("$delegateVarHeader$mthd.name().name()"))
+#set ( $addMethodListStatus = $methodList.add("$delegateVarHeader$mthd.name().name()") )
+		/// <summary>
+    	/// Delegate Definition; Please do not modify
+    	/// </summary>
+		public delegate $helper.getTypeName( $mthd.type() ) $delegateTypeHeader$mthd.name()	(
+#set( $sep = "" )
+#foreach( $param in $mthd.iterator() )
+									$sep$helper.getTypeName( $param.type() ) $param.name()
+#set( $sep = ", " )
+#end
+									);
+		/// <summary>
+    	/// Add your implementation method to this variable
+    	/// </summary>							
+		public $delegateTypeHeader$mthd.name()  $delegateVarHeader$mthd.name();
+
+#end
+#end
+#end	
+#end
+#foreach( $x in $intf.iterator() )
+#if( $x.isMixin() )
+
+#set( $m = $x.getModule() )
+#set( $z = $m.iterator().next() )
+
+#foreach( $n in $z.messages( true ) )
+#if($n.isMsgDir($mc) || $n.isMsgDirBoth() )
+#if(!$n.isHidden())
+#if(!$methodList.contains("$delegateVarHeader$n.name().name()"))
+#set ( $addMethodListStatus = $methodList.add("$delegateVarHeader$n.name().name()") )
+#if($n.isOneway())
+		/// <summary>
+    	/// Delegate Definition; Please do not modify
+    	/// </summary>
+		public delegate $helper.getTypeName( $n.type() ) $delegateTypeHeader$n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+			);
+		
+		/// <summary>
+    	/// Add your implementation method to this variable
+    	/// </summary>							
+		public $delegateTypeHeader$n.name()  $delegateVarHeader$n.name();
+	
+#else
+		/// <summary>
+    	/// Delegate Definition; Please do not modify
+    	/// </summary>
+		public delegate $helper.getTypeName( $n.type() ) $delegateTypeHeader$n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		);
+	
+		/// <summary>
+    	/// Add your implementation method to this variable
+    	/// </summary>							
+		public $delegateTypeHeader$n.name()  $delegateVarHeader$n.name();
+	
+#end
+#end
+#end
+#end
+#end
+#end
+#end
+
+	
+		///<summary>Constructs the $clname.</summary>
+		public $clname() 
+		{
+		}
+
+		public virtual object _SessionQuery(Object query)
+		{
+			throw new NotSupportedException( "unknown query: " + query);
+		}
+
+		public virtual void _SessionControl(Object control, Object value)
+		{
+			throw new NotSupportedException( "unknown control: " + control);
+		}
+
+		public virtual void _SessionNotify( Object eventObj)
+		{
+			if (eventObj is Exception)
+				Console.WriteLine((Exception) eventObj);
+		}  
+
+
+#foreach ($mthd in $intf.iterator())
+#if ($mthd.isMsgDir($mc) || $mthd.isMsgDirBoth())
+#if (!$mthd.isHidden())
+#if(!$methodList.contains($mthd.name().name()))
+#set ( $addMethodListStatus = $methodList.add($mthd.name().name()) )
+		public virtual $helper.getTypeName( $mthd.type() ) $mthd.name() (
+#set( $sep = "" )
+#foreach( $param in $mthd.iterator() )
+				$sep$helper.getTypeName( $param.type() ) $param.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+		if ($delegateVarHeader$mthd.name() != null)
+		#if($helper.getTypeName( $mthd.type() ).equals("void"))
+				$delegateVarHeader$mthd.name()( 
+		#set( $sep = "" )
+			#foreach( $param in $mthd.iterator() )
+			$sep$param.name()
+		#set( $sep = "," )
+			#end
+			);
+		#else
+				return $delegateVarHeader$mthd.name()( 
+		#set( $sep = "" )
+			#foreach( $param in $mthd.iterator() )
+			$sep$param.name()
+		#set( $sep = "," )
+			#end
+			);
+		#end
+			else 
+				throw new NotSupportedException( "$mthd.name()" );
+		}
+#end
+#end
+#end
+#end
+#foreach( $x in $intf.iterator() )
+#if( $x.isMixin() )
+
+#set( $m = $x.getModule() )
+#set( $z = $m.iterator().next() )
+
+#foreach( $n in $z.messages( true ) )
+#if($n.isMsgDir($mc) || $n.isMsgDirBoth() )
+#if(!$n.isHidden())
+#if(!$methodList.contains($n.name().name()))
+#set ( $addMethodListStatus = $methodList.add($n.name().name()) )
+#if($n.isOneway())
+		public virtual $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+				if ($delegateVarHeader$n.name() != null)
+			#if($helper.getTypeName( $n.type() ).equals("void"))
+				$delegateVarHeader$n.name()( 
+		#set( $sep = "" )
+			#foreach( $p in $n.iterator() )
+			$sep$p.name()
+		#set( $sep = "," )
+			#end
+			);
+			#else
+				return $delegateVarHeader$n.name()( 
+		#set( $sep = "" )
+			#foreach( $p in $n.iterator() )
+			$sep$p.name()
+		#set( $sep = "," )
+			#end
+			);
+		#end
+			else 
+				throw new NotSupportedException( "$n.name()" );
+		
+	}
+#else
+		public virtual $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+			if ($delegateVarHeader$n.name() != null)
+		#if($helper.getTypeName( $n.type() ).equals("void"))
+		 	$delegateVarHeader$n.name()( 
+		#set( $sep = "" )
+			#foreach( $p in $n.iterator() )
+			$sep$p.name()
+		#set( $sep = "," )
+			#end
+			);
+		#else
+				return $delegateVarHeader$n.name()( 
+		#set( $sep = "" )
+			#foreach( $p in $n.iterator() )
+			$sep$p.name()
+		#set( $sep = "," )
+			#end
+			);
+		#end
+			else 
+				throw new NotSupportedException( "$n.name()" );
+		}
+#end
+#end
+#end
+#end
+#end
+#end
+#end
+	}
+}
\ No newline at end of file
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/csharpKeywords.kwd b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/csharpKeywords.kwd
new file mode 100644
index 0000000..1dd5eeb
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/csharpKeywords.kwd
@@ -0,0 +1,15 @@
+# $Id$
+# 
+# Copyright 2007-2008 Cisco Systems Inc.
+# 
+# Licensed 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.
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm
new file mode 100644
index 0000000..31f0b3d
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm
@@ -0,0 +1,164 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+#set($i = $intf.name())
+
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Transport;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+/// <summary>
+/// Transport helper for ${i}.
+/// </summary>
+namespace $intf.parent().name()
+{
+    public class ${i}Helper : TransportHelper
+    {
+#if ( $helper.isServer($mc) || $helper.isBoth($mc) )
+
+		/// <summary>Constructs a new server session listener per specifications
+		/// in uri and resources.</summary>
+		/// <param name="uri"> contains specifications for the server session
+		/// listener and for the server session transport stack.</param>
+		/// <param name="resources"> additional resources to aid in constructing
+		/// new server sessions.</param>
+		/// <param name="implFactory"> called upon accepting a new server session to
+		/// construct a new server implementation to handle messages
+		/// from the client during the session.</param>
+		/// <returns> an out-of-band source that may be used to control
+		/// the listener.</returns>
+
+		public static ServerFactory NewListener( string uri,		
+			Resources resources, ${i}ServerFactory implFactory )
+		{
+			Resources res = InitResources(resources);
+			Transport<ServerFactory> listener = TransportFactory.GetListener(uri, res);
+			return new MyServerFactory(listener, implFactory);
+		}
+		
+		public class MyServerFactory : DefaultServerFactory
+		{
+			public MyServerFactory(Transport<ServerFactory> listener, ${i}ServerFactory implFactory )
+				: base(listener, implFactory)
+			{
+				_listener = listener;
+				_implFactory = implFactory;
+			}
+
+		    private readonly Transport<ServerFactory> _listener;
+
+            private readonly ${i}ServerFactory _implFactory;
+
+            public override void NewServer(TransportMessage m, string uri, Resources resources)
+			{
+                ValueFactory vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY);
+                MailboxManager r = new PlainMailboxManager(m, uri, resources);
+                DeliveryService d = new DefaultDeliveryService(r, uri, resources);
+				Remote${i}Client client = new Remote${i}Client(d, vf);
+				${i}Server server = _implFactory.New${i}Server(client);
+                Pool qp = (Pool)resources[QUEUED_POOL];
+                Pool fp = (Pool)resources[FREE_POOL];
+				new Stub${i}Server(d, server, qp, fp);
+				client._Start();
+			}
+
+            public override ValueFactory NewValueFactory(string uri)
+            {
+                return new ValueFactory${i}(uri);
+            }
+
+            public override string ToString()
+            {
+                return "${i}Helper.ServerFactory/" + _listener;
+            }
+		}
+		
+		/// <summary>
+		/// Factory for a Listener to use to create new instances of ${i}Server.
+		/// </summary>
+		
+		public interface ${i}ServerFactory
+		{
+			/// <param name="client"> an Remote${i}Client instance for server implementation
+			/// to use to call back to the client.</param>
+			/// <returns> an instance of ${i}Server (e.g., Impl${i}Server) to
+			/// handle messages which arrive from the client.</returns>
+			
+			${i}Server New${i}Server( Remote${i}Client client );
+		}		
+#end
+#if ( $helper.isClient($mc) || $helper.isBoth($mc) )
+
+		/// <summary>Constructs a new client session per specifications in uri
+		/// and resources.</summary>
+		/// <param name="uri"> contains specifications for the client session
+		/// transport stack.</param>
+		/// <param name="resources"> additional resources to aid in constructing
+		/// new sessions.</param>
+		/// <param name="implFactory">factory used to construct a new instance implementing
+		/// ${i}Client. The new instance will receive and process messages from the
+		///	server session.</param>
+		/// <returns> new remote server instance initialized by uri
+		/// and resources which may be used to send messages to the
+		/// server session.</returns>
+		
+		public static Remote${i}Server NewServer( string uri,
+			Resources resources, ${i}ClientFactory implFactory )
+		{
+			resources = InitResources(resources);
+			
+			ValueFactory${i} vf= new ValueFactory${i}(uri);
+			resources.Add( TransportConsts.VALUE_FACTORY, vf );
+			
+			URL u = new URL(uri);
+
+            TransportMessage m = TransportFactory.GetTransport(uri, resources);
+            MailboxManager r = new PlainMailboxManager(m, u, resources);
+            DeliveryService d = new DefaultDeliveryService(r, u, resources);
+			Remote${i}Server server = new Remote${i}Server(d, vf);
+			${i}Client client = implFactory.New${i}Client(server);			
+			new Stub${i}Client(d,
+					client,
+					(Pool) resources[QUEUED_POOL],
+					(Pool) resources[FREE_POOL]);
+	
+			return server;
+		}
+		
+		///<summary>
+		///Factory used by
+		///{@link ${i}Helper#new${i}Server(String, Resources, ${i}ClientFactory)}
+		///to construct a new instance implementing {@link ${i}Client}. The new
+		///instance will receive and process messages from the server session.
+		///</summary>
+		
+		public interface ${i}ClientFactory
+		{
+			///<summary>
+			///Constructs a new instance implementing ${i}Client. The new
+			///instance will receive and process messages from the server session.</summary>
+		 	///<param name=server> an instance of Remote${i}Server which may be used to
+			/// send messages to the server session. </param>
+			///<returns> new instance implementing ${i}Client (typically
+			///Impl${i}Client). </returns>
+			
+			${i}Client New${i}Client( Remote${i}Server server );			
+		}
+#end
+	}
+}
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/impl.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/impl.vm
new file mode 100644
index 0000000..14a4ca5
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/impl.vm
@@ -0,0 +1,75 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+#set($i = $intf.name())
+#set($vfname = "ValueFactory$i")
+#set($intfname = "$i$suffix")
+#set($clname = "Impl$intfname")
+#set($baseclname = "Base$i$suffix")
+#if ($helper.isServer($mc))
+#set($peer = "client")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "server")
+#set($peerclass = "Remote${i}Server")
+#end
+
+using System;
+
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+#if ($n.hasImport( $helper ))
+using $n.getImport( $helper );
+#end
+#end
+#end
+
+#foreach( $x in $intf.iterator() )
+#if( $x.isMixin() )
+#set( $m = $x.getModule() )
+#set( $z = $m.iterator().next() )
+using ${m.name()}.types.$z.name();
+#end
+#end
+
+using ${intf.parent().name()}.types.${i};
+
+///<summary>Your custom implementation of $baseclname. Add methods here to provide
+///implementation of messages from the $peer. </summary>
+namespace $intf.parent().name()
+{
+	///<summary>Implementation for $clname</summary>
+	public class $clname : $baseclname
+	{
+		/// <summary>Constructs the $clname.</summary>
+ 		/// <param name="$peer">a connection to the $peer session. Use this to
+ 		/// send a message to the $peer.</param>
+		public $clname($peerclass $peer)
+		{
+			this.$peer = $peer;
+		}
+		
+		/// <summary>A connection to the $peer session. Use this to
+ 		/// send a message to the $peer.</summary>
+		private readonly $peerclass $peer;
+	
+		// TODO: Implement delegates or provide implementation of $intfname
+		// messages from the $peer	
+	}
+}
\ No newline at end of file
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/intf.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/intf.vm
new file mode 100644
index 0000000..8868d87
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/intf.vm
@@ -0,0 +1,296 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+using System;
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+#if ($n.hasImport( $helper ))
+	using $n.getImport( $helper );
+#end
+#end
+#end
+
+namespace $intf.parent().name()
+{
+#if( $intf.hasDescr() )
+	///<summary>
+#foreach( $s in $intf.descr() )
+	///$s
+#end
+	///</summary>
+#end
+#set($sep = ":")
+#if ($hasBaseClass)
+	public interface $intf.name()$suffix $sep $intf.name()
+#set ($sep = ",")
+#else
+	public interface $intf.name()$suffix
+#end
+#foreach( $n in $intf.iterator() )
+#if ($n.isMixin())
+	$sep $n.fqname()$suffix
+#set($sep = ",")
+#end
+#end
+	{
+#foreach( $n in $intf.iterator() )
+#if ($n.isMessage())
+#if ($n.isMsgDir($mc))
+#if (!$n.isHidden())
+#if ($n.hasDescr())
+		///<summary>
+#foreach($s in $n.descr())
+		///$s
+#end
+		///</summary>
+#end
+#foreach( $p in $n.iterator() )
+#set($first = true)
+#set ($count = 0)
+#foreach( $s in $p.descr() )
+#if ($first)
+#set($count = $count + 1)
+#set($first = false)
+		///<param name="$p.name()">$s
+#else
+		///$s
+#end
+#end
+#if ($count > 0)
+		///</param>
+#end		
+#end
+#if ($n.hasReturn())
+#set($first = true)
+#foreach( $s in $n.returnDescr() )
+#if ($first)
+#set($first = false)
+		///<returns>$s
+#else
+		///$s
+#end
+#end
+		///</returns>
+#end
+#if ($n.hasThrown())
+#if ($n.hasDescr())
+#foreach($t in $n.thrown().iterator())
+		///<Exception cref="$t.name().name()"> throws $t.name().name()</Exception>
+#end
+#end
+#end
+		$helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+			);
+#end
+#end
+#elseif ($n.isConstant())
+#elseif ($n.isEnumx())
+#elseif ($n.isStruct() || $n.isExcept())
+#elseif ($n.isExtern())
+## ignore extern
+#elseif ($n.isMixin())
+## ignore mixin
+#else
+
+#end
+#end
+	}
+#if (!$hasBaseClass)
+	namespace types 
+	{
+		namespace $intf.name()$suffix
+		{
+			public static class Consts$intf.name()$suffix 
+			{
+#foreach( $n in $intf.iterator() )
+#if ($n.isConstant())
+#if ($n.hasDescr())
+				///<summary>
+#foreach( $s in $n.descr() )
+				///$s
+#end
+				///</summary>
+#end
+				public static $helper.getNativeTypeName( $n.type() ) $n.name() = $helper.getTypeValue( $n.type(), $n.value() );
+#end
+#end
+			}
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx())
+#if (!$hasBaseClass)
+#if ($n.hasDescr())
+			///<summary>
+#foreach( $s in $n.descr() )
+			///$s
+#end
+			///</summary>
+#end
+			public enum $n.name()
+			{
+#set( $sep = "" )						
+#foreach( $i in $n.iterator() )
+#if ($i.hasDescr())
+				///<summary>
+#foreach( $s in $i.descr() )
+				///$s
+#end
+				///</summary>
+#end
+				$sep$i.name()
+#set( $sep = ", " )
+#end
+			}	
+#end
+#elseif ($n.isStruct() || $n.isExcept())
+#if (!$hasBaseClass)
+#if ($n.hasDescr())
+			///<summary>
+#foreach( $s in $n.descr() )
+			///$s
+#end
+			///</summary>
+#end
+#if( $n.hasExtends() )
+			public class $n.name()	: $n.getExtends().name()
+#else
+#if( $n.isExcept() )
+#if( $n.isUnchecked() )
+			public class $n.name() : Exception
+#else
+			public class $n.name() : Exception
+#end
+#else
+			[Serializable]
+			public class $n.name()
+#end
+#end
+			{
+			
+				/// <summary>Constructs the $n.name(). Don't init anything.</summary>
+				public $n.name()()
+				{
+					// don't init anything.
+				}
+
+#if ($n.hasAnyParameters())
+				///<summary>Constructs the $n.name().</summary>
+#foreach( $i in $n.getAllParameters() )
+#if ($i.hasDescr())
+				///<param name="$i.name()">
+#foreach( $s in $i.descr() )
+				///$s
+#end
+				///</param>
+#end
+#end
+				public $n.name()
+				(
+#set( $sep = "" )
+#foreach( $i in $n.getAllParameters() )
+					$sep$helper.getTypeName( $i.type() ) $i.name()
+#set( $sep = ", " )
+#end
+				)		
+#if( $n.hasExtends() )
+			 	: base(
+#set( $sep = "" )
+#foreach( $i in $n.getExtends().getAllParameters() )
+				$sep$i.name()
+#set( $sep = ", " )
+#end
+				)
+				{
+#else
+				{
+#end
+#foreach( $i in $n.getParameters() )
+					this.$i.name() = $i.name();
+#end
+				}
+#end
+
+#if( $n.isExcept() )
+#if ($n.hasExtends())
+				public new String GetMessage()
+#else
+				public String GetMessage()
+#end
+				{
+					return $helper.formatString( $n, true );
+				}
+#else
+				public override String ToString()
+				{
+					return $helper.formatString( $n, false );
+				}
+#end
+	
+#foreach( $i in $n.iterator() )
+#if ($i.hasDescr())
+				///<summary>
+#foreach( $s in $i.descr() )
+				///$s
+#end
+				///</summary>
+#end
+				public $helper.getTypeName( $i.type() ) $i.name();
+#if ($i.hasDescr())				
+				///<summary>Gets
+#foreach( $s in $i.descr() )
+		 		///$s
+#end
+				///</summary>
+#else
+				///<summary>Gets Value</summary>
+#end
+				/// <returns>return the value.</returns>
+		 		public $helper.getTypeName( $i.type() ) $helper.getGetterName( $i.name() )()
+				{					
+						return $i.name();
+				}
+#if ($i.hasDescr())					
+				///<summary>Sets
+#foreach( $s in $i.descr() )
+		 		///$s
+#end
+				///</summary>
+#else
+				///<summary>Sets Value</summary>
+#end
+				///<param name="value">the value</param>
+				public void $helper.getSetterName( $i.name() )( $helper.getTypeName( $i.type() ) value )
+				{
+					this.$i.name() = value;
+				}
+#end
+			}	
+#end
+#elseif ($n.isBuiltin())
+## nothing to do.
+#else	
+#end
+#end
+		}
+	}
+#end
+}
\ No newline at end of file
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/main.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/main.vm
new file mode 100644
index 0000000..ae1bb66
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/main.vm
@@ -0,0 +1,104 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($baseclname = "Base$intfname")
+#set($clname = "Impl$intfname")
+#if ($helper.isServer($mc))
+#set($peer = "client")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "server")
+#set($peerclass = "Remote${i}Server")
+#end
+
+using System;
+#if ($helper.isServer($mc))
+
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+using ${intf.parent().name()}.types.${i};
+#else
+
+using ${intf.parent().name()}.types.${i};
+#end 
+
+namespace $intf.parent().name()
+{
+#if ($helper.isServer($mc))
+	///<summary>Main implementation for ${i}Listener.</summary>
+#else
+	///<summary>Main implementation for $i$suffix.</summary>
+#end
+#if ($helper.isServer($mc))
+	public class Main${i}Listener : ${i}Helper.${i}ServerFactory
+#else
+	public class Main${i}Client : ${i}Helper.${i}ClientFactory
+#end
+	{
+#if ($helper.isServer($mc))
+ 		///<summary>Main for ${i}Listener.</summary>
+#else
+		///<summary>Main for ${i}Client</summary>
+#end
+		///<param name="args">Command Line Arguments</param>
+		public static void Main(String[] args)
+		{
+			// TODO: Change to correct URI
+			string uri = "tcp://localhost:4001";
+			
+#if ($helper.isServer($mc))
+			ServerFactory listener = ${i}Helper.NewListener( uri, null, new Main${i}Listener());
+			
+			// Start the Listener
+			listener.TransportControl( TransportConsts.START_AND_WAIT_UP, 4000 );
+#else
+			Remote${i}Server server = ${i}Helper.NewServer( uri, null, new Main${i}Client());
+		
+			// Connect to the service
+			server._StartAndWaitUp( 4000 );
+
+			// TODO: Insert Your Code Here
+
+			// Disconnect from the service
+			server._StopAndWaitDown( 4000 );			
+#end
+		}
+
+#if ($helper.isServer($mc))
+		///<summary>Return a new instance of ${i}Server.</summary>
+		///<param name="client">Reference to remote service</param>
+		///<returns>Server Implementation</returns>
+		public ${i}Server New${i}Server( Remote${i}Client client )
+		{
+			return new Impl${i}Server( client );
+		}
+#else
+		///<summary>Return a new instance of ${i}Client.</summary>
+		///<param name="server">Reference to remote service</param>
+		///<returns>Client Implementation</returns>
+		public ${i}Client New${i}Client( Remote${i}Server server )
+		{
+			return new Impl${i}Client( server );
+		}
+#end
+	}
+}
\ No newline at end of file
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/readme.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/readme.vm
new file mode 100644
index 0000000..196dced
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/readme.vm
@@ -0,0 +1,140 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+This is a description of the etch-generated files for your service.
+
+----------------
+- How To Build -
+----------------
+
+In the directory where the etch file is located, execute the following command:
+
+etch -q -d . -I . -b csharp -w all Blah.etch
+
+This would compile the service description Blah.etch, generating all csharp files,
+into csharp namespaces rooted in the current directory (-d .), resolving includes
+and mixins from the current directory (-I .) and being quiet about it (-q).
+
+Assuming the Blah.etch specified a module of "demo" and a service of "Blah",
+the csharp files would be generated into a sub-directory demo of the current
+directory. you may now change to that directory and compile the resulting files:
+
+cd demo
+csc "/reference:%ETCH_HOME%\lib\Etch4CS.dll" /main:demo.MainBlahListener *.cs
+csc "/reference:%ETCH_HOME%\lib\Etch4CS.dll" /main:demo.MainBlahClient *.cs
+
+(Assuming windows; for unix, read the mono directions.)
+
+Depending upon how etch was installed, you may need to install the Etch4CS.dll
+into the system global assembly cache. This command will do the trick:
+
+copy /y "%ETCH_HOME%\lib\Etch4CS.dll" %windir%\assembly
+
+You only need to do this once after each installation of etch. And once the
+installer is fixed, you won't need to do it at all.
+
+To run the service (which initially won't do anything but make a connection and
+then close it, use the following two commands in separate shells (again, from
+the demo directory):
+
+MainBlahListener
+
+MainBlahClient
+
+The first command (MainBlahListener) starts the service listener which accepts
+connections. The second command (MainBlahClient) runs a sample client, which
+makes a connection to the running listener and then closes it again.
+
+Once you've compiled the service and tested the result, you may implement your
+service by adding content to the etch file, adding implementation details to the
+Impl*.cs and Main*.cs files, and recompiling using the above steps. You may also
+load these files into an IDE such as visual studio, or use a build management
+system such as msbuild or nant. Remember, whenever you change the etch file, you
+must re-etch the service description and then re-csc all the cs
+files.
+
+-------------------
+- Generated Files -
+-------------------
+
+Here is a description of the generated files for a service named Blah.
+
+Blah.cs
+BlahClient.cs
+BlahServer.cs
+
+These three files are the generated interface classes. Service defined constants
+and types are in Blah.cs, as well as direction "both" messages, which are
+messages which are shared between client and server. BlahClient.cs and
+BlahServer.cs are respectively the messages for just the direction client or
+server. You should not edit these files.
+
+RemoteBlah.cs
+RemoteBlahClient.cs
+RemoteBlahServer.cs
+
+RemoteBlah*.cs are the generated classes which implement the interfaces,
+with message implementations which encode the message type and arguments for
+transport to the connection peer and then receive and decode any response. You
+should not edit these files.
+
+StubBlah.cs
+StubBlahClient.cs
+StubBlahServer.cs
+
+StubBlah*.cs are the generated classes which receive messages encoded by
+RemoteBlah*.cs and decode them, calling the appropriate message implementation
+and then encoding and sending any result. You should not edit these files.
+
+ValueFactoryBlah.cs
+
+ValueFactoryBlah.cs is a generated class which contains helper code to
+serialize service defined types and also the meta data which describes the
+messages and fields, field types, timeouts, etc. You should not edit this file.
+
+BaseBlah.cs
+BaseBlahClient.cs
+BaseBlahServer.cs
+
+BaseBlah*.cs are generated classes which implement the interfaces, with
+message implementations which do nothing but throw UnsupportedOperationException.
+They can be used to supply an implementation when you don't want to immediately
+implement all the messages. You should not edit these files.
+
+ImplBlahClient.cs
+ImplBlahServer.cs
+
+ImplBlah*.cs are the generated sample client and server implementation
+classes. They extend the generated base classes. These are used by the sample
+main programs to provide implementations of the client or server messages. Edit
+these files as you wish to implement your service (overriding the default
+implementations from the generated base classes).
+
+BlahHelper.cs
+
+BlahHelper.cs is a generated class which includes static methods to help
+construct transports for client and listener. You should not edit this file.
+
+MainBlahClient.cs
+MainBlahListener.cs
+
+MainBlah*.cs are the generated sample client and server main programs.
+They show how to setup a transport and start it and how to create a session.
+Edit these files as you wish to implement your service, or just copy the code
+into your own application.
+
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/remote.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/remote.vm
new file mode 100644
index 0000000..89b417c
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/remote.vm
@@ -0,0 +1,451 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+#set($i = $intf.name())
+#set($vfname = "ValueFactory$i")
+#set($intfname = "$i$suffix")
+#set($clname = "Remote$intfname")
+
+using System;
+
+namespace $intf.parent().name()
+{
+
+#if (!$hasBaseClass)
+#end
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+#if ($n.hasImport( $helper ))
+	using $n.getImport( $helper );
+#end
+#end
+#end
+	///<summary>Call to message translator for $intfname.</summary>
+#if ($hasBaseClass)
+	public class $clname : Remote$i, $intfname
+#else
+	public class $clname : Org.Apache.Etch.Bindings.Csharp.Support.RemoteBase, $intfname
+#end
+	{
+#if ($hasBaseClass)
+		///<summary>Class Instance used to hide synchronous message 
+		///implementation. Use this to invoke the asynchronous message
+		///implementation</summary> 
+		public new readonly _Async _async;
+		
+		///<summary>Deprecated.</summary>
+		public new readonly _Async _inner;
+#else
+		///<summary>Class Instance used to hide synchronous message 
+		///implementation. Use this to invoke the asynchronous message
+		///implementation</summary> 
+		public readonly _Async _async;
+		
+		///<summary>Deprecated.</summary>
+		public readonly _Async _inner;
+#end
+
+		/// <summary>Constructs the $clname.</summary>
+		/// <param name="svc"></param>
+		/// <param name="vf"></param>
+		public $clname( Org.Apache.Etch.Bindings.Csharp.Support.DeliveryService svc,
+				Org.Apache.Etch.Bindings.Csharp.Msg.ValueFactory vf )
+			: base( svc, vf )
+		{
+			_async = new _Async(this);
+			_inner = _async;
+#set( $k = 0 )
+#foreach( $x in $intf.iterator() )
+#if( $x.isMixin() )
+#set( $k = $k + 1 )
+#set( $v = "_mixin$k" )
+#set( $m = $x.getModule() )
+#set( $z = $m.iterator().next() )
+			$v = new ${m.name()}.Remote$z.name()${suffix}( svc, vf );
+#end
+#end
+		}
+
+#foreach ($n in $intf.iterator())
+#if ($n.isMsgDir($mc))
+#if (!$n.isHidden())
+#if(!$methodList.contains($n.name().name()))
+#set ( $addMethodListStatus = $methodList.add($n.name().name()))
+#if ($n.isOneway())
+#if ($n.hasDescr())
+		///<summary>
+#foreach($s in $n.descr())
+		///$s
+#end
+		///</summary>
+#end
+#foreach( $p in $n.iterator() )
+#set($first = true)
+#set ($count = 0)
+#if ($p.hasDescr())
+#foreach( $s in $p.descr() )
+#if ($first)
+#set($count = $count + 1)
+#set($first = false)
+		///<param name="$p.name()">$s
+#else
+		///$s
+#end
+#end
+#if ($count > 0)
+		///</param>
+#end
+#end
+#end
+#if ($n.hasReturn())
+#set($first = true)
+#set ($retCount = 0)
+#if ($n.hasDescr())
+#foreach( $s in $n.returnDescr() )
+#if ($first)
+#set($retCount = $retCount + 1)
+#set($first = false)
+		///<returns>$s
+#else
+		///$s
+#end
+#end
+#if ($retCount > 0)
+		///</returns>
+#end
+#end
+#end
+#if ($n.hasThrown())
+#if ($n.hasDescr())
+#foreach($t in $n.thrown().iterator())
+		///<Exception cref="$t.name().name()"> throws $t.name().name()</Exception>
+#end
+#end
+#end
+		public $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+			Org.Apache.Etch.Bindings.Csharp.Msg.Message _msg = _NewMessage( $vfname.$n.vname( $helper ) );
+#foreach( $p in $n.iterator() )
+			_msg.Add( $vfname.$p.vname( $helper ), $p.name() );
+#end
+			try
+			{
+				_Send( _msg );
+			}
+			catch ( Exception _e )
+			{
+				throw new Exception( "unexpected", _e );
+			}
+		}
+#else
+#if($n.hasDescr())
+		///<summary>
+#foreach($s in $n.descr())
+		///$s
+#end
+		///</summary>
+#end
+#foreach( $p in $n.iterator() )
+#set($first = true)
+#if ($p.hasDescr())
+#foreach( $s in $p.descr() )
+#if ($first)
+#set($first = false)
+		///<param name="$p.name()">$s
+#else
+		///$s
+#end
+#end
+		///</param>
+#end
+#end
+#if ($n.hasReturn())
+#set($first = true)
+#set($retCount = 0)
+#if ($n.hasDescr())
+#foreach( $s in $n.returnDescr() )
+#if ($first)
+#set($first = false)
+#set($retCount = $retCount + 1)
+		///<returns>$s
+#else
+		///$s
+#end
+#end
+#if ($retCount > 0)
+		///</returns>
+#end
+#end
+#end
+#if ($n.hasThrown())
+#if ($n.hasDescr())
+#foreach($t in $n.thrown().iterator())
+		///<Exception cref="$t.name().name()"> throws $t.name().name()</Exception>
+#end
+#end
+#end
+		public $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+#if ($n.hasReturn())
+			return
+#end
+			_async._end_${n.name()}( _async._begin_${n.name()}(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+				$sep$p.name()
+#set( $sep = ", " )
+#end
+			) );
+		}
+		
+#end
+#end
+#end
+#end
+#end
+#set( $k = 0 )
+#foreach( $x in $intf.iterator() )
+#if( $x.isMixin() )
+
+		// ----- mixin $x.name() ----- //
+#set( $k = $k + 1 )
+#set( $v = "_mixin$k" )
+#set( $m = $x.getModule() )
+#set( $z = $m.iterator().next() )
+		private ${m.name()}.Remote$z.name()$suffix $v;
+		
+#foreach( $n in $z.messages( true ) )
+#if($n.isMsgDir($mc))
+#if(!$n.isHidden())
+#if(!$methodList.contains($n.name().name()))
+#set ( $addMethodListStatus = $methodList.add($n.name().name()) )
+		// --- generated methods for $n.name() --- //
+#if($n.isOneway())
+		public $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+			${v}.$n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+				$sep$p.name()
+#set( $sep = ", " )
+#end
+			);
+		}
+#else
+		public $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+			$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+		)
+		{
+#if($n.hasReturn())
+			return
+#end
+			${v}.$n.name()(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+				$sep$p.name()
+#set( $sep = ", " )
+#end
+			);
+		}
+		
+#end
+#end
+#end
+#end
+#end
+#end
+#end
+
+		///<summary>Asynchronous Implementation of service methods</summary>
+#if ($hasBaseClass)
+		public new class _Async : Remote${i}._Async
+#else
+		public class _Async
+#end
+		{
+#if ($hasBaseClass)
+			public new $clname _parent;
+#else
+			public $clname _parent;
+#end
+			
+			public _Async()
+			{
+			}
+
+			public _Async($clname parent)
+			{
+				_parent = parent;
+			}
+			
+#foreach ($n in $intf.iterator())
+#if ($n.isMsgDir($mc))
+#if (!$n.isHidden())
+#if(!$methodList.contains("_begin_end_$n.name().name()"))
+#set ( $addMethodListStatus = $methodList.add("_begin_end_$n.name().name()") )
+#if (!$n.isOneway())
+			///<summary>Begins the call to ${n.name()}.</summary>
+#foreach( $p in $n.iterator() )
+#if ($p.hasDescr())
+#set($first = true)
+#foreach( $s in $p.descr() )
+#if ($first)
+#set($first = false)
+			///<param name = $p.name()>$s
+#else
+			///$s
+#end
+#end
+			///</param>
+#end
+#end
+			///<returns>mailbox to use to retrieve the result using _end_${n.name()}.</returns>			
+			public Org.Apache.Etch.Bindings.Csharp.Support.Mailbox _begin_${n.name()}(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+				$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+			)
+			{
+				Org.Apache.Etch.Bindings.Csharp.Msg.Message _msg = _parent._NewMessage( $vfname.$n.vname( $helper ) );
+#foreach( $p in $n.iterator() )
+				_msg.Add( $vfname.$p.vname( $helper ), $p.name() );
+#end
+				return _parent._BeginCall( _msg );
+			}
+	 
+			/// <summary>Waits for the call to end and returns the result.</summary>
+			/// <param name="_mb">mailbox returned by _begin_${n.name()}.</param>
+			public $helper.getTypeName( $n.type() ) _end_${n.name()}( Org.Apache.Etch.Bindings.Csharp.Support.Mailbox _mb )
+			{
+#if ($n.hasReturn())
+				return
+				($helper.getTypeName( $n.type() ))
+#if ($n.type().dim() > 0)
+					// ValueFactory${i}.to_$n.type().type()(
+					//	typeof( ${helper.getTypeName( $n.type() )} ),
+#end
+					_parent._EndCall( _mb,
+						$vfname.$n.getResultMessage().vname( $helper ) )
+#if ($n.type().dim() > 0)
+					//)
+#end
+				;
+#else
+			
+				_parent._EndCall( _mb,
+				$vfname.$n.getResultMessage().vname( $helper ) );
+#end
+
+			}
+
+#end
+#end
+#end
+#end
+#end
+#set( $k = 0 )
+#foreach( $x in $intf.iterator() )
+#if( $x.isMixin() )
+#set( $k = $k + 1 )
+#set( $v = "_mixin$k" )
+#set( $m = $x.getModule() )
+#set( $z = $m.iterator().next() )
+	
+#foreach( $n in $z.messages( true ) )
+#if($n.isMsgDir($mc))
+#if(!$n.isHidden())
+#if(!$methodList.contains("_begin_end_$n.name().name()"))
+#set ( $addMethodListStatus = $methodList.add("_begin_end_$n.name().name()") )
+			// --- generated methods for $n.name() --- //
+
+#if(! $n.isOneway())
+			///<summary>Begins a call to ${n.name()}.</summary>
+#foreach( $p in $n.iterator() )
+#if ($p.hasDescr())
+#set($first = true)
+#foreach( $s in $p.descr() )
+#if ($first)
+#set($first = false)
+			///<param name = $p.name()>$s
+#else
+			///$s
+#end
+#end
+			///</param>
+#end
+#end
+
+			public Org.Apache.Etch.Bindings.Csharp.Support.Mailbox _begin_${n.name()}(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+				$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
+#end
+			)
+			{
+				return _parent.${v}._async._begin_${n.name()}(
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+					$sep$p.name()
+#set( $sep = ", " )
+#end
+				);
+			}
+			
+			///<summary>Ends a call to ${n.name()}</summary>
+			///<param name = mb> mailbox returned by _begin_${n.name()}. </param>
+			public $helper.getTypeName( $n.type() ) _end_${n.name()}( Org.Apache.Etch.Bindings.Csharp.Support.Mailbox _mb )
+			{
+#if($n.hasReturn())
+				return
+#end
+				_parent.${v}._async._end_${n.name()}( _mb );
+			}
+#end
+#end
+#end
+#end
+#end
+#end
+#end	
+		}
+	}
+}
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/stub.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/stub.vm
new file mode 100644
index 0000000..dc2fedd
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/stub.vm
@@ -0,0 +1,154 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+#set($i = $intf.name())
+
+using System;
+	
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace $intf.parent().name()
+{	
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+#if ($n.hasImport( $helper ))
+#set($x = $n.getImport( $helper ))
+#if (!$x.equals("Etch.Util"))
+	using $x;
+#end
+#end
+#end
+#end
+
+	///<summary> Message to call translator for $i$suffix. </summary>
+	
+#if ($hasBaseClass)
+	public class Stub$i$suffix : Stub$i
+#else
+	public class Stub$i$suffix : StubBase
+#end
+	{
+		/// <summary>Stub for $i$suffix.</summary>
+		/// <param name="src">the delivery service to use.</param>
+		/// <param name="obj"> the implementation of $i$suffix responsive to requests.</param>
+		/// <param name="queued"> thread pool used to run AsyncReceiverMode.QUEUED methods.</param>
+		/// <param name="free"> thread pool used to run AsyncReceiverMode.FREE methods.</param>		
+		public Stub$i$suffix( DeliveryService src, object obj, Pool queued, Pool free )
+			: base( src, obj, queued, free )
+		{	
+			// nothing to do.
+		}
+		
+#if (!$hasBaseClass)
+		public static void init()
+#else
+		public static new void init()
+#end
+		{
+			// nothing to do.
+		}
+
+		static Stub$i$suffix()
+		{
+#foreach( $n in $intf.iterator() )
+#if( $n.isMixin() )
+#set( $m = $n.getModule() )
+#set( $z = $m.iterator().next() )
+			${m.name()}.Stub${z.name()}${suffix}.init();
+#end
+#end
+#set( $stubHelperCount=0 )
+#foreach( $mthd in $intf.iterator() )
+#if ($mthd.isMsgDir($mc))
+#if (!$mthd.isHidden())
+#set($stubHelperCount = $stubHelperCount + 1)
+			StubHelperRun helper$stubHelperCount = delegate( DeliveryService _src, object _obj, Who _sender, Message _msg ) 
+				{
+					try {
+#foreach ($param in $mthd.iterator())
+							$helper.getTypeName( $param.type() ) $param.name() = 
+								($helper.getTypeName( $param.type() ))
+								_msg.Get( ValueFactory$i.$param.vname( $helper ) );
+#end
+
+#if ($mthd.hasAuth())
+#set( $auth = $mthd.getAuth() )
+#if ($auth.isMethodFalse())
+							if (true)
+#else
+							if ((bool)!(($i$suffix)_obj).${auth.method()}(
+#set( $sep = "" )
+#foreach($arg in $auth.args())
+#if ($arg.isLiteralConstant())
+								($helper.getNativeTypeName( $arg.type() )) $sep$helper.getTypeValue( $arg.type(), $arg.value() )
+#elseif ($arg.isParameter( $mthd ))
+								$sep$helper.qualifyParameterName( $arg.value() )
+#elseif ($arg.isConstant( $intf ))
+								$sep$helper.qualifyConstantName( $intf, $arg.value() )
+#elseif ($arg.isEnum( $intf ))
+								$sep$helper.qualifyEnumName( $intf, $arg.value() )
+#else
+								${sep}null
+#end
+#set( $sep = ", " )
+#end
+							)) 
+#end
+							throw new _Etch_AuthException( "$mthd.name()" );
+#end
+
+#if ($mthd.hasReturn())
+							Object _result =
+#end
+								(($i$suffix)_obj).$mthd.name()(
+#set( $sep = "" )
+#foreach ($param in $mthd.iterator())
+								$sep$param.name()
+#set( $sep = ", " )
+#end
+								);
+								
+#if (!$mthd.isOneway())
+							Message _rmsg = _msg.Reply();
+#if ($mthd.hasReturn())
+							_rmsg.Add( ValueFactory$i._mf_result, _result );
+#end
+							_src.TransportMessage( _sender, _rmsg );
+#end
+						}
+						catch ( Exception e )
+						{
+#if (!$mthd.isOneway())
+							Message _rmsg = _msg.Reply();
+#else
+							Message _rmsg = _msg.Reply( _msg.Vf.get_mt__exception() );
+#end
+							_rmsg.Add( ValueFactory$i._mf_result, e );
+							_src.TransportMessage( _sender, _rmsg );
+						}
+					};
+			ValueFactory$i.${mthd.vname( $helper )}.SetStubHelper( helper$stubHelperCount);		
+#end
+#end
+#end
+		}
+	}
+}
+
+	
\ No newline at end of file
diff --git a/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/vf.vm b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/vf.vm
new file mode 100644
index 0000000..85d9ade
--- /dev/null
+++ b/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/vf.vm
@@ -0,0 +1,282 @@
+## Copyright 2007-2008 Cisco Systems Inc.
+##
+## Licensed 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+using System;
+using System.Collections.Generic;
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+#if ($n.hasImport( $helper ))
+using $n.getImport( $helper );
+#end
+#if ($n.hasSerializerImport( $helper ))
+using $n.getSerializerImport( $helper );
+#end
+#end
+#end
+#set( $i = $intf.name() )
+#set( $vf = "ValueFactory$i" )
+
+namespace $intf.parent().name()
+{
+
+///<summary>ValueFactory for $i.</summary>
+public class ${vf} : DefaultValueFactory
+{
+	private readonly static TypeMap types = new TypeMap();
+    
+	private readonly static Class2TypeMap class2type = new Class2TypeMap();
+	 
+	///<summary>Constructs ${vf}.</summary>
+	public ${vf}(string uri) : base(uri, types, class2type)
+	{
+#foreach ( $n in $intf.iterator() )
+#if ($n.isMixin())
+#set( $m = $n.getModule() )
+#set( $s = $m.iterator().next() )
+		addMixin( new ${m.name()}.ValueFactory${s.name()}(uri) );
+#end
+#end		
+	}
+	
+	private static void InitTypes()
+	{
+#foreach ( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExtern() || $n.isExcept() || $n.isMessage())
+		$n.vname( $helper ) =  types.Get( "$n.fqname()" );
+#end
+#end
+	}
+	
+	private static void InitResults() 
+	{
+#foreach ( $n in $intf.iterator() )
+#if ($n.isMessage())
+		${n.vname( $helper )}.SetDirection( Direction.$n.msgDir() );
+#if (!$n.isHidden())
+#if ($n.isQueuedAsyncReceiver())
+		${n.vname( $helper )}.SetAsyncMode( AsyncMode.QUEUED );
+#elseif ($n.isFreeAsyncReceiver())
+		${n.vname( $helper )}.SetAsyncMode( AsyncMode.FREE );
+#else
+		${n.vname( $helper )}.SetAsyncMode( AsyncMode.NONE );
+#end
+#if (!$n.isOneway())
+#set($r = $n.getResultMessage())
+		${n.vname( $helper )}.SetResult( $r.vname( $helper ) );
+		${r.vname( $helper )}.Timeout = $n.getTimeout();
+#end
+#end
+#end
+#end	
+	}
+	
+	private static void InitFields()
+	{
+#set( $x = $params.clear() )
+## standard params from DefaultValueFactory
+#set( $x = $params.add( "msg" ) )
+#set( $x = $params.add( "result" ) )
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#foreach( $param in $n.iterator() )
+#if (!$params.contains($param.name().name()))
+#set( $x = $params.add($param.name().name()) )
+		$param.vname( $helper ) = new Field( "$param.name().name()" );
+#end
+#end
+#end
+#end
+#foreach ( $n in $intf.iterator() )
+#if ($n.isMessage())
+#if (!$n.isHidden())
+#if (!$n.isOneway())
+#set( $r = $n.getResultMessage() )
+		${r.vname( $helper )}.ResponseField = _mf_result;
+#end
+#end
+#end
+#end	
+	}
+	
+	private static void InitParams()
+	{
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#if ($n.isStruct() || $n.isExcept())
+#foreach( $param in $n.getAllParameters() )
+		${n.vname( $helper )}.PutValidator( $param.vname( $helper ), $helper.getValidator( $param ) );
+#end
+#else
+		// params for $n.name()
+#foreach( $param in $n.iterator() )
+		${n.vname( $helper )}.PutValidator( $param.vname( $helper ), $helper.getValidator( $param ) );
+#end
+#end
+#if ($n.isMessage())
+		${n.vname( $helper )}.PutValidator( _mf__messageId, Validator_long.Get( 0 ) );
+#if ($n.isHidden())
+#set( $param = $n.getResultParam() )
+#set( $reqMsg = $n.getRequestMessage() )
+#foreach( $t in $reqMsg.thrown().iterator() )
+		${n.vname( $helper )}.PutValidator( $param.vname( $helper ), $helper.getValidator( $t ) ); // thrown $t.name()
+#end
+		${n.vname( $helper )}.PutValidator( $param.vname( $helper ), Validator_RuntimeException.Get() ); // thrown RuntimeException
+		${n.vname( $helper )}.PutValidator( _mf__inReplyTo, Validator_long.Get( 0 ) );
+#end
+#end
+#end
+#end
+	}
+	
+	
+	static ${vf}()
+	{
+		DefaultValueFactory.Init( types, class2type );
+		InitTypes();		
+		InitResults();
+		InitFields();
+		InitParams();
+
+## --- import/export ----
+
+#foreach ( $n in $intf.iterator() )
+#if ($n.isStruct() || $n.isExcept())
+#set( $tname = $n.efqname( $helper ) )
+
+		class2type.Add( typeof( ${tname} ), ${n.vname( $helper )} );
+		${n.vname( $helper )}.SetComponentType( typeof( ${tname} ) );
+		#if ($n.hasExtends())
+			${n.vname( $helper )}.SetSuperType( $n.getExtends().vname( $helper ) );
+		#end
+		${n.vname( $helper )}.SetImportExportHelper
+			( 
+				new ImportExportHelper(
+					delegate( ValueFactory vf, Object value ) 
+					{
+						StructValue sv = new StructValue( ${n.vname( $helper )}, vf );
+						$tname v = ($tname) value;
+#foreach( $p in $n.getAllParameters()  )
+						sv.Add( $p.vname( $helper ), v.$p.name() );
+#end
+						return sv;
+					}, 
+					delegate( StructValue sv ) 
+					{
+						$tname v = new ${tname}();
+						#foreach ($p in $n.getAllParameters())
+						v.$p.name() = ($helper.getTypeName( $p.type() )) sv.Get( $p.vname( $helper ) );
+						#end
+						return v;
+						
+					} 
+				)
+			);
+
+#elseif ($n.isExtern())
+#set( $tname = $n.efqname( $helper ) )
+#elseif ($n.isEnumx())
+#set( $tname = $n.efqname( $helper ) )
+
+		class2type.Add( typeof( ${tname} ), ${n.vname( $helper )} );
+		${n.vname( $helper )}.SetComponentType( typeof( ${tname} ) );
+		${n.vname( $helper )}.SetImportExportHelper
+			( 
+				new ImportExportHelper( 
+					
+					delegate( ValueFactory vf, Object value ) 
+					{
+						StructValue sv = new StructValue( ${n.vname( $helper )}, vf );
+						${tname} v = (${tname}) value;
+						switch (v)
+						{
+#foreach ($p in $n.iterator())
+							case ${tname}.$p.name(): sv.Add( $p.vname( $helper ), true ); break;
+#end
+						}
+						return sv;
+					}, 
+					delegate( StructValue sv ) 
+					{
+						// there should only be a single key, so take the first
+						// one. if there is no key, means they sent null or the
+						// key they sent was unknown.
+						Field key = null;
+						IEnumerator<Field> myEnum = sv.Keys.GetEnumerator();
+						if (myEnum.MoveNext())
+							key = myEnum.Current;
+						else
+							return null;
+						
+#foreach ($p in $n.iterator())
+						if (key == $p.vname( $helper )) return ${tname}.$p.name();
+#end
+						
+						return null;
+					} 
+				)
+			);
+
+#end
+#end
+
+		// initialize the extern serializers:
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+		${n.sname( $helper )}.Init( ${n.vname( $helper )}, class2type );
+#end
+#end
+
+		// done updating types and fields, lock them.
+		types.Lock();
+		foreach(XType t in types.Values())
+			t.Lock();
+		class2type.Lock();
+
+
+	
+	} // end of static constructor
+
+	
+	
+#foreach ( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExtern() || $n.isExcept() || $n.isMessage())
+	/// Type for $n.fqname() 
+	public static XType $n.vname( $helper );
+#end
+#end
+## ---------------------------------------------------------------------------
+	
+		
+#set( $x = $params.clear() )
+## standard params from DefaultValueFactory
+#set( $x = $params.add( "msg" ) )
+#set( $x = $params.add( "result" ) )
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#foreach( $param in $n.iterator() )
+#if (!$params.contains($param.name().name()))
+#set( $x = $params.add($param.name().name()) )
+	public static Field $param.vname( $helper );
+#end
+#end
+#end
+#end
+	}
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/build.xml b/binding-csharp/runtime/build.xml
new file mode 100644
index 0000000..ae4b205
--- /dev/null
+++ b/binding-csharp/runtime/build.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ * 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.                                           *
+-->
+<project name="etch-csharp-runtime" basedir="." default="help">
+    <description>Etch-to-Csharp runtime binding implementation</description>
+    <property name="Etch.basedir" location="${basedir}/../.." />
+    <import file="${Etch.basedir}/build-support/etch.includes.xml" />
+
+    <taskdef resource="org/apache/ant/dotnet/antlib.xml" classpath="${Etch.dependency.ant-dotnet-1.0.jar}" />
+
+    <!-- Static properties of the sub-project -->
+    <property name="proj"                 location="${Etch.basedir}/binding-csharp/runtime" />
+    <property name="target"               location="${proj}/target" />
+    <property name="src"                  location="${proj}/src" />
+    <property name="rawNUnitResults"      location="${target}/nunit-results" />
+    <property name="testResultsDirectory" location="${target}/test-results"  />
+
+    <!-- INIT TARGET -->
+    <!-- Modify this target to define project specific properties that can only be set at runtime -->
+    <target name="do-init">
+        <delete dir="${target}" failonerror="false" quiet="true" />
+
+        <mkdir dir="${target}" />
+        <mkdir dir="${rawNUnitResults}" />
+        <mkdir dir="${testResultsDirectory}" />
+    </target>
+
+    <!-- CLEAN TARGET -->
+    <target name="do-clean">
+        <delete dir="${target}" />
+        <delete dir="${src}/main/csharp/bin" />
+        <delete dir="${src}/main/csharp/obj" />
+        <delete dir="${src}/test/csharp/bin" />
+        <delete dir="${src}/test/csharp/obj" />
+    </target>
+
+    <!-- BUILD TARGET -->
+
+    <target name="generate-sources" >
+        <!-- Generate version info -->
+        <update-tokens filename="${src}/main/csharp/Properties/AssemblyInfo.cs" />
+    </target>
+
+    <target name="build-main-with-mono" if="USE.mono" >
+        <echo message="TODO: build w/ mono" />
+        <mdtool dir="${src}/main/csharp" project="EtchProj.csproj" />
+    </target>
+
+    <target name="build-main-with-dotnet" if="USE.dotnet" >
+        <!-- Build runtime -->
+        <msbuild buildfile="${src}/main/csharp/EtchProj.csproj">
+            <property name="Configuration" value="${Etch.build.target}" />
+        </msbuild>
+    </target>
+
+    <target name="build-main-csharp" depends="build-main-with-mono,build-main-with-dotnet" />
+
+    <target name="do-build" depends="generate-sources,build-main-csharp" if="BUILD.csharp" >
+
+        <mkdir dir="${Etch.dist}/lib" />
+        <mkdir dir="${Etch.clover-dist}/lib" />
+
+        <copy todir="${Etch.clover-dist}/lib" >
+            <fileset dir="${src}/main/csharp/bin/${Etch.build.target}">
+                <include name="*.pdb" />
+                <include name="*.dll" />
+            </fileset>
+        </copy>
+
+        <copy todir="${Etch.dist}/lib" >
+            <fileset dir="${src}/main/csharp/bin/${Etch.build.target}">
+                <include name="*.pdb" />
+                <include name="*.dll" />
+            </fileset>
+        </copy>
+    </target>
+
+    <!-- TEST TARGET -->
+    <target name="build-test-with-mono" if="USE.mono" >
+        <echo message="TODO: build w/ mono" />
+        <mdtool dir="${src}/test/csharp" project="EtchTestProj.csproj" />
+    </target>
+
+    <target name="build-test-with-dotnet" if="USE.dotnet" >
+        <msbuild buildfile="${src}/test/csharp/EtchTestProj.csproj" >
+            <property name="Configuration" value="${Etch.build.target}" />
+        </msbuild>
+    </target>
+
+    <target name="build-test-csharp" depends="build-test-with-mono,build-test-with-dotnet" />
+
+    <target name="do-test" depends="build-test-csharp" if="USE.dotnet" >
+        <mkdir dir="${rawNUnitResults}" />
+
+        <nunit xmlout="${rawNUnitResults}/NUnitResults.xml">
+            <testassembly name="${src}/test/csharp/bin/${Etch.build.target}/EtchTest.dll" />
+        </nunit>
+
+        <xslt style="${Etch.buildSupportDirectory}/NUnitToJUnit.xsl"
+                in="${rawNUnitResults}/NUnitResults.xml" out="${testResultsDirectory}/TEST-NUnitResults.xml" />
+    </target>
+
+    <!-- POSTBUILD TARGET -->
+    <target name="do-postbuild">
+    </target>
+
+    <target name="do-publish" if="build.tests.fail">
+        <!-- Set flag file if any tests failed -->
+        <touch file="${Etch.runtime.tests.fail}"/>
+    </target>
+
+</project>
diff --git a/binding-csharp/runtime/src/main/csharp/EtchProj.csproj b/binding-csharp/runtime/src/main/csharp/EtchProj.csproj
new file mode 100644
index 0000000..f5ee56c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/EtchProj.csproj
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <!--
+ * 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.                                           *
+ -->
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Etch</RootNamespace>
+    <AssemblyName>Etch</AssemblyName>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>etch.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\AsyncMode.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\ComboValidator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\Direction.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\Field.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\FieldMap.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\IdName.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\IdNameMap.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\ImportExportHelper.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\Message.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\StructValue.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\TypeMap.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\Validator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\ValueFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Msg\XType.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\AuthExceptionSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Class2TypeMap.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\DefaultServerFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\DefaultValueFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\DeliveryService.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\DummyValueFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\FreePool.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Mailbox.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\NullPool.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\ObjSession.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Pool.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\QueuedPool.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\RemoteBase.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\RuntimeExceptionSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\ServerFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\StubBase.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\StubHelper.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\TransportFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\TransportHelper.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\TypeValidator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_boolean.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_byte.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_custom.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_double.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_float.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_int.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_long.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_object.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_RuntimeException.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_short.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_string.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_StructValue.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\Validator_void.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\_Etch_AuthException.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Support\_Etch_RuntimeException.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\ArrayValue.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\DefaultDeliveryService.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Filter\AbstractMessageFilter.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Filter\KeepAlive.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Filter\Logger.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Filter\PwAuth.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\Binary\BinaryTaggedData.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\Binary\BinaryTaggedDataFormatFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\Binary\BinaryTaggedDataInput.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\Binary\BinaryTaggedDataOutput.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\Binary\Validator_none.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\ByteToSbyteConverter.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\TaggedData.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Fmt\TypeCode.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\FormatFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\MailboxManager.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\Messagizer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\PlainMailbox.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\PlainMailboxManager.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\SessionMessage.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\TaggedDataInput.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\TaggedDataOutput.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\TcpTransportFactory.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\TransportMessage.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Transport\UnwantedMessage.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\AbstractStartable.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\AlarmListener.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\AlarmManager.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\ArrayIterator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Assertion.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\CharIterator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\CircularQueue.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Connection.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\DateSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\EmptyIterator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\EqualsHelper.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\FlexBuffer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\HPTimer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\IdGenerator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\InputStream.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\IntCounter.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Integer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\ListSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\MapSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Monitor.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\OutputStream.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Packetizer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\PerfTest.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Resources.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Runner.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\RunnerHandler.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Session.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\SessionConsts.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\SessionData.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\SessionListener.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\SessionPacket.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\SingleIterator.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Startable.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\StringTokenizer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\StringUtil.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\StrIntHashMap.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\StrIntHashMapSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\StrStrHashMap.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\StrStrHashMapSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TcpConnection.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TcpListener.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TcpOptions.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TcpTransport.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Timer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TlsConnection.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Todo.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TodoDelegateImpl.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TodoManager.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Transport.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TransportConsts.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TransportData.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\TransportPacket.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\URL.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\URLSerializer.cs" />
+    <Compile Include="Org.Apache.Etch.Bindings.Csharp\Util\Who.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="etch.snk" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/AsyncMode.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/AsyncMode.cs
new file mode 100644
index 0000000..b1ad49e
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/AsyncMode.cs
@@ -0,0 +1,40 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    ///
+    /// The asynchronous receiver mode of this helper.
+    ///
+    public enum AsyncMode
+    {
+        /// <summary>
+        /// synchronous mode
+        /// </summary>
+        NONE,
+        /// <summary>
+        ///  the operation is queued to a thread pool for execution 
+        /// </summary>
+        QUEUED,
+        /// <summary>
+        ///  the operation is executed by a newly allocated thread 
+        /// </summary>
+        FREE
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ComboValidator.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ComboValidator.cs
new file mode 100644
index 0000000..ec070da
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ComboValidator.cs
@@ -0,0 +1,113 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// Validates values using one of two validators
+    /// </summary>
+    public class ComboValidator : Validator
+    {
+        /// <summary>
+        /// Constructs the combo validator
+        /// </summary>
+        /// <param name="a"></param>
+        /// <param name="b"></param>
+        public ComboValidator( Validator a, Validator b )
+        {
+            this.a = a;
+            this.b = b;
+        }
+
+        private readonly Validator a;
+        private readonly Validator b;
+
+        public override string ToString()
+        {
+            return String.Format( "({0} OR {1})", a, b );
+        }
+
+        public override Validator ElementValidator()
+        {
+            Validator na;
+
+            try
+            {
+                na = a.ElementValidator();
+            }
+            catch ( Exception )
+            {
+                na = null;
+            }
+
+            Validator nb;
+            try
+            {
+                nb = b.ElementValidator();
+            }
+            catch ( Exception )
+            {
+                nb = null;
+            }
+
+            if ( na == null && nb == null )
+                throw new ArgumentException( "na == null and nb == null" );
+
+            if ( na == null )
+                return nb;
+
+            if ( nb == null )
+                return na;
+
+            return new ComboValidator( na, nb );
+
+        }
+
+        public override bool Validate( object value )
+        {
+            return a.Validate( value ) || b.Validate( value );
+        }
+
+      
+
+        public override object ValidateValue(object value)
+        {
+            try
+            {
+                return a.ValidateValue(value);
+            }
+            catch (Exception)
+            {
+                return b.ValidateValue(value);
+            }
+        }
+
+        public Validator A()
+        {
+            return a;
+        }
+
+        public Validator B()
+        {
+            return b;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Direction.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Direction.cs
new file mode 100644
index 0000000..57d152b
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Direction.cs
@@ -0,0 +1,40 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// The direction of a message.
+    /// </summary>
+    public enum Direction
+    {
+        /// <summary>
+        /// Message is both toward client and toward server.
+        /// </summary>
+        BOTH,
+        /// <summary>
+        /// Message is toward server.
+        /// </summary>
+        SERVER,
+        /// <summary>
+        /// Message is toward client.
+        /// </summary>
+        CLIENT
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Field.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Field.cs
new file mode 100644
index 0000000..70f75f1
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Field.cs
@@ -0,0 +1,38 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+
+   /// <summary>Field is an IdName which denotes a field of a struct or message (i.e., a key for a value).</summary>
+    public class Field : IdName
+    {
+        ///<summary>Constructs the Field.</summary>
+        ///<param name="id">id the id of the field.</param>
+        ///<param name="name">name the name of the field.</param>
+        public Field(int id, string name)
+            : base(id, name)
+        { }
+
+        ///<param name="name">name the name of the field.</param>
+        public Field(string name)
+            : base(name)
+        { }
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/FieldMap.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/FieldMap.cs
new file mode 100644
index 0000000..fa68786
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/FieldMap.cs
@@ -0,0 +1,32 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// FieldMap is an IdNameMap for Field
+    /// </summary>
+    public class FieldMap : IdNameMap<Field>
+    {
+        public override Field MakeNew( string name )
+        {
+            return new Field( name );
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/IdName.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/IdName.cs
new file mode 100644
index 0000000..1a96ab8
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/IdName.cs
@@ -0,0 +1,122 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>An IdName is a base class for Field or Type. It is used
+    /// to bind together a type or field name with the associated id. The id
+    /// is used for certain operations, such as the key in a Map, comparisons,
+    /// and binary encoding on the wire, while the name is used for display.
+    /// <see cref=""/> Field
+    /// <see cref=""/> Type</summary>
+    public class IdName
+    {
+        /// <summary>Constructs the IdName.
+        /// <param name="id">id for the name (normally computed using</param> 
+        /// <param name="name"></param>
+        /// {<link>#hash(String)})</link></summary>
+        public IdName(int id, String name)
+        {
+            this.id = id;
+            this.name = name;
+        }
+
+        /// <summary>Constructs the IdName by computing the appropriate id given the name.
+        /// <param name="name"> name the name of the item.</param>
+        /// <see cref=""/> #hash(String)
+        /// </summary>
+        public IdName(string name)
+            : this(Hash(name), name)
+        { }
+
+        private readonly int id;
+
+        private readonly string name;
+
+        /// <returns>the id of the item. </returns> 
+        public int Id
+        {
+            get
+            {
+                return id;
+            }
+        }
+
+        /// <returns> the name of the item.</returns>
+        public string Name
+        {
+            get
+            {
+                return name;
+            }
+        }
+
+        /// Override 
+        public override string ToString() 
+        {
+            return String.Format( "{0}({1})", name, id );
+        }
+
+        /// Override 
+        public override bool Equals(object obj) 
+        {
+            if(obj == this)
+                return true;
+
+            if(obj == null)
+                return false;
+
+            if(this.GetType() != obj.GetType())
+                return false;
+
+            IdName other = (IdName) obj;
+
+            return id.Equals( other.Id ) && name.Equals( other.Name );
+        }
+
+        /// Override
+        public override int GetHashCode() 
+        {
+            return id.GetHashCode() ^ name.GetHashCode();
+        }
+
+        /// <summary>Computes the hash value of the name to be used as the id when
+        /// constructing an IdName.</summary>
+        /// <param name="name"> name the name of the type or field. </param>
+        /// <returns>a hash of name in the unicode character encoding which is
+        /// very likely to be unique over reasonable name spaces. Collisions
+        /// should be very unlikely as they will force the user to change the
+        /// name.</returns>
+        public static int Hash(String name)
+        {
+            // combination of djb2 and sdbm hash algorithm:
+            int hash = 5381;
+            int n = name.Length;
+            for(int i = 0; i < n; i++)
+            {
+                char c = name[i]; 
+                int h6 = hash << 6;
+                hash = (h6 << 10) + h6 - hash + c;
+            }
+            return hash;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/IdNameMap.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/IdNameMap.cs
new file mode 100644
index 0000000..6acf093
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/IdNameMap.cs
@@ -0,0 +1,184 @@
+// $Id$
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Msg
+{
+
+    /// <summary>Map by id and name of IdNames (or subclasses thereof).</summary>
+    /// <typeparam name="T">the specific subclass of IdName that is in the map.</typeparam>
+    public abstract class IdNameMap<T> where T : IdName
+    {
+
+        public IdNameMap()
+        {
+            // nothing to do
+        }
+
+        /// <summary>Constructs the IdNameMap.</summary>
+        /// <param name="maxAutoCount">maxAutoCount the maximum number of automatically declared IdNames 
+        /// allowed. Set to 0 if you don't want any, but this may prevent working with a slightly different
+        /// version of a service.</param>
+        public IdNameMap( int maxAutoCount )
+        {
+            this.maxAutoCount = maxAutoCount;
+        }
+    	
+        private int maxAutoCount;
+    	
+        /// <summary>Gets the IdName subclass which corresponds to the specified id, or creates it if it isn't found 
+        /// and if autoCount less than maxAutoCount. If created, the IdName is given the name which is 
+        /// id.toString().</summary>
+        /// <param name="id">id the id of an IdName.</param>
+        /// <returns>the IdName subclass found or created.</returns>
+        public T Get( int id ) 
+        {
+            T t;
+
+            if (byId.TryGetValue(id, out t))
+                return t;
+
+            return null;
+        }
+
+       public T GetById( int id )
+       {
+           T t;
+
+           if (byId.TryGetValue(id, out t))
+               return t;
+
+           return null;
+       }
+
+        /// <summary>Gets the IdName subclass which corresponds to the specified name, or creates it if it isn't 
+        /// found and if autoCount maxAutoCount. If created, the IdName is given the id which is 
+        /// IdName.hash( name ).</summary>
+        /// <param name="name">name the name of an IdName.</param>
+        /// <returns>the IdName subclass found or created.</returns>
+        public T Get( String name )
+        {
+            T t;
+
+            if (byName.TryGetValue(name, out t))
+                return t;
+
+            if (!locked)
+                return Add( MakeNew( name ) );
+
+            return null;
+        }
+
+        public T GetByName(String name)
+        {
+            T t;
+
+            if (byName.TryGetValue(name, out t))
+                return t;
+
+            if (!locked)
+                return Add(MakeNew(name));
+
+            return null;
+        }
+    	
+        /// <summary>
+        /// Adds the IdName subclass to the map. 
+        /// </summary>
+        /// <param name="t">the IdName subclass to add.</param>
+        /// <returns>the IdName from the map</returns>
+        /// Exception:
+        ///             throws Exception (state) if there is a collision with id or name, or a collision with 
+        ///             id and name where they are not associated with the same object.
+        public T Add( T t ) 
+        {
+            if ( locked )
+                throw new Exception( "state exception -- locked" );
+
+            if ( byId.ContainsKey( t.Id ) )
+            {
+                if ( ( t.Name == "msg" ) || ( t.Name == "result" ) )
+                    return t;
+
+                throw new ArgumentException( "id collision" );
+            }
+
+            if ( byName.ContainsKey( t.Name ) )
+            {
+                if ( ( t.Name == "msg" ) || ( t.Name == "result" ) )
+                    return t;
+            
+                throw new ArgumentException( "name collision" );
+            }
+            byId.Add ( t.Id, t);  
+            byName.Add(t.Name, t);
+            return t;
+        }
+
+        /// <summary>
+        /// Adds all the IdNames to this IdNameMap
+        /// </summary>
+        /// <param name="ts"></param>
+        public void AddAll( IdNameMap<T> ts )
+        {
+            if ( locked )
+                throw new Exception( "locked" );
+
+            foreach ( T t in ts.byId.Values )
+                Add( t );
+        }
+
+        /// <summary></summary>
+        /// <returns>a snapshot collection of all the values.</returns>
+        public List<T> Values() 
+        {
+            return new List<T>( byId.Values );
+        }
+
+        /// <summary>
+        /// Locks the map, preventing further changes
+        /// </summary>
+        public void Lock()
+        {
+            locked = true;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the number of values in the map</returns>
+        public int Size()
+        {
+            return byId.Count;
+        }
+
+        /// <summary>Makes a new subclass of IdName to put in this map.</summary>
+        /// <param name="name">name the name of the new subclass of IdName.</param>
+        /// <returns>a newly constructed subclass of IdName to put in this map.</returns>
+        abstract public T MakeNew( String name );
+
+        private Dictionary<int, T> byId = new Dictionary<int, T>();
+
+        private Dictionary<String, T> byName = new Dictionary<String, T>();
+
+        private Boolean locked;
+}
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ImportExportHelper.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ImportExportHelper.cs
new file mode 100644
index 0000000..c2478b8
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ImportExportHelper.cs
@@ -0,0 +1,94 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// class used to implement ValueFactory based import / export code
+    /// for service defined types.
+    /// </summary>
+    public class ImportExportHelper
+    {
+        protected ImportExportHelper()
+        {
+            ev = delegate(ValueFactory vf, Object value)
+            {
+                throw new NotImplementedException("must override ExportValue method");
+            };
+            iv = delegate(StructValue sv)
+            {
+                throw new NotImplementedException("must override ImportValue method");
+            };
+        }
+
+        public ImportExportHelper( ExportValueDelegate ev, ImportValueDelegate iv )
+        {
+            if (ev == null)
+                throw new ArgumentNullException("ev == null");
+
+            if (iv == null)
+                throw new ArgumentNullException("iv == null");
+
+            this.ev = ev;
+            this.iv = iv;
+        }
+
+        private readonly ExportValueDelegate ev;
+
+        private readonly ImportValueDelegate iv;
+
+        /// <summary>
+        /// Exports a value by creating an equivalent StructValue.
+        /// </summary>
+        /// <param name="vf">the value factory used to export.</param>
+        /// <param name="value">a service defined type to export.</param>
+        /// <returns>a StructValue representing the exported value.</returns>
+        public virtual StructValue ExportValue( ValueFactory vf, Object value )
+        {
+            return ev( vf, value );
+        }
+
+        /// <summary>
+        /// Imports a value from an equivalent StructValue.
+        /// </summary>
+        /// <param name="sv">a StructValue representing the exported value.</param>
+        /// <returns>a service defined type.</returns>
+        public virtual Object ImportValue( StructValue sv )
+        {
+            return iv( sv );
+        }
+
+        /// <summary>
+        /// Exports a value by creating an equivalent StructValue.
+        /// </summary>
+        /// <param name="vf">the value factory to use for export.</param>
+        /// <param name="value">a service defined type to export.</param>
+        /// <returns>a StructValue representing the exported value.</returns>
+        public delegate StructValue ExportValueDelegate(ValueFactory vf, Object value);
+
+        /// <summary>
+        /// Imports a value from an equivalent StructValue.
+        /// </summary>
+        /// <param name="sv">a StructValue representing the exported value.</param>
+        /// <returns>a service defined type.</returns>
+        public delegate Object ImportValueDelegate( StructValue sv );
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Message.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Message.cs
new file mode 100644
index 0000000..4525b9a
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Message.cs
@@ -0,0 +1,106 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    ///<summary> A message is modeled as a command and some argments. The command is an arbitrary
+    /// integer value, and the arguments are key / value pairs, where the key is an arbitrary integer 
+    /// value and the value is any one of the standard C# objects, an ArrayValue, a StructValue, or any type
+    /// which may be serialized by the ValueFactory.</summary>
+    public sealed class Message : StructValue
+    {
+        ///<summary>Constructs the Message.</summary>
+        ///<param name="type">type of the message (command).</param> 
+        ///<param name="vf"> vf the value factory.</param>
+        public Message(XType type, ValueFactory vf)
+            : this(type, vf, 0)
+        {
+            // nothing to do.
+        }
+
+        ///<summary>Constructs the Message.</summary>
+        ///<param name="type">type of the message (command).</param> 
+        ///<param name="vf">vf the value factory.</param>
+        ///<param name="length"> the expected number of name/value pairs</param>
+        public Message(XType type, ValueFactory vf, int length)
+            : base(type, vf, length)
+        {
+            this.vf = vf;
+        }
+
+        private readonly ValueFactory vf;
+
+        ///<returns>the value factory.</returns>     
+        public ValueFactory Vf
+        {
+            get
+            {
+                return vf;
+            }
+        }
+
+   
+       /// <summary>Creates a message which is a reply to the current message. The current message's value 
+       /// factory is copied to the new message. The message-id of the current message (if any) is copied into 
+       /// the in-reply-to field of the new message.</summary>
+       /// <param name="rType"> rType the type of the reply.</param>
+       /// <returns> a reply message.</returns>       
+        public Message Reply( XType rType )
+        {
+            Message rmsg = new Message( rType, vf );
+            rmsg.InReplyTo = MessageId; //rmsg.InReplyTo(GetMessageId()); changed
+            return rmsg;
+        }
+
+        public Message Reply()
+        {
+            Message rmsg = new Message( GetXType.GetResult(), vf );
+            rmsg.InReplyTo = MessageId;
+            return rmsg;
+        }
+
+        /// <returns>the connection specific unique identifier of this message, or null if there was no 
+        /// such identifier.</returns>
+        public long? MessageId
+        {
+            get
+            {
+                return vf.GetMessageId(this);
+            }
+            set
+            {
+                vf.SetMessageId(this, value);
+            }
+        }
+
+       /// <returns>the message-id of the message that this is a response to. Null if this is an original message 
+       /// or if the original message did not have a message-id.</returns>
+        public long? InReplyTo
+        {
+            get
+            {
+                return vf.GetInReplyTo(this);
+            }
+            set
+            {
+                vf.SetInReplyTo(this, value);
+            }
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/StructValue.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/StructValue.cs
new file mode 100644
index 0000000..9953e10
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/StructValue.cs
@@ -0,0 +1,223 @@
+// $Id$
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Msg
+{
+
+    ///A typed map of key/value pairs, where the type is a Type, each key is a Field, 
+    ///and each value is of arbitrary type chosen from the basic java types boolean, byte, 
+    ///short, int, long, float, double, String, an array of those, the extended types ArrayValue 
+    ///and StructValue, and specific types supported by ValueFactory. 
+    ///StructValue is not protected against concurrent access.
+    public class StructValue 
+    {
+        ///<summary>Constructs the StructValue with default length.</summary>
+        ///<param name="type">the type of the struct (or the action or event if
+        ///this is a message).</param>
+        ///<param name="vf">the value factory for this struct</param>
+        public StructValue(XType type, ValueFactory vf)
+            : this(type, vf, 0)
+        {
+            // nothing to do.
+        }
+
+        ///<summary>Constructs the StructValue.</summary>
+        ///<param name="type">the type of the struct (or the action or event if
+        ///this is a message).</param>
+        ///<param name="length">the expected number of name/value pairs.</param>
+        public StructValue(XType type, ValueFactory vf, int length)
+        {
+            if (type == null)
+                throw new ArgumentNullException("type == null");
+
+            if (vf == null)
+                throw new ArgumentNullException("vf == null");
+
+            this.type = type;
+            this.fields = new Dictionary<Field, Object>(length > 0 ? (length * 4 + 2) / 3 : DEFAULT_SIZE);
+            this.level = vf.GetLevel();
+        }
+
+        private const int DEFAULT_SIZE = 8;
+
+        private readonly XType type;
+
+        private readonly Dictionary<Field, Object> fields;
+
+        private readonly Validator.Level level;
+
+        /// <summary>
+        /// The struct type, or message action or event.
+        /// </summary>
+        public XType GetXType
+        {
+            get
+            {
+                return type;
+            }
+        }
+
+        /// <summary>
+        /// The validation level.
+        /// </summary>
+        public Validator.Level Level
+        {
+            get
+            {
+                return level;
+            }
+        }
+
+        /// <summary>Compares the type of this struct to another type.</summary>
+        /// <param name="otherType">otherType the type to compare this type to.</param>
+        /// <returns>true if this struct is of the specified type.</returns>
+        public bool IsType(XType otherType)
+        {
+            return type.Equals(otherType);
+        }
+
+        /// <summary>Checks a struct for having the expected type.</summary>
+        /// <param name="expectedType">expectedType the expected type of this struct.</param>
+        /// Exception:
+        ///         throws IllegalArgumentException if the type is not as expected.
+        public void CheckType(XType expectedType)
+        {
+            if(!IsType(expectedType))
+                throw new ArgumentException();
+        }
+
+        public Dictionary<Field, Object>.Enumerator GetEnumerator()
+        {
+            return fields.GetEnumerator();
+        }
+
+        public Dictionary<Field, Object>.KeyCollection Keys
+        {
+            get
+            {
+                return fields.Keys;
+            }
+        }
+
+        public bool ContainsKey(Field key)
+        {
+            return fields.ContainsKey(key);
+        }
+
+        /// <summary>Defined to get the Object return type</summary>
+        /// <param name="key"></param>
+        /// <returns></returns>
+        public Object Get(Field key)
+        {
+            object value;
+            return fields.TryGetValue(key, out value) ? value : null;
+        }
+      
+        /// <summary>
+        /// Overriding Dictionary's Add(key, value) function
+        /// </summary>
+        /// <param name="key"></param>
+        /// <param name="value"></param>
+        public void Add(Field key, Object value)
+        {
+            if (value == null)
+            {
+                fields.Remove(key);
+                return;
+            }
+
+            if (level != Validator.Level.NONE)
+            {
+                Validator v = type.GetValidator(key);
+
+                if (v == null && level == Validator.Level.FULL)
+                    throw new ArgumentException(String.Format(
+                        "validator missing for type {0} field {1}", type, key));
+
+                if (v != null && !v.Validate(value))
+                    throw new ArgumentException(String.Format(
+                        "validator {0} failed for type {1} field {2} : value {3}",
+                        v, type, key, value));
+            }
+
+            fields[key] = value;
+        }
+
+        public Object this[Field key]
+        {
+            get
+            {
+                return Get(key);
+            }
+            set
+            {
+                Add(key, value);
+            }
+        }
+
+        public void Remove(Field key)
+        {
+            fields.Remove(key);
+        }
+
+        public int Count
+        {
+            get
+            {
+                return fields.Count;
+            }
+        }
+
+        /// Override
+        public override string ToString()
+        {
+            return string.Format( "{0}: {1}", type, PrintElementsOfMap() );
+        }
+
+        /// <summary>
+        /// Utility function to print the elements of a 
+        /// map like the way Java does (for hashmap). 
+        /// </summary>
+        /// <returns></returns>
+        private string PrintElementsOfMap()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append( "{" );
+            int i = 0;
+            foreach ( KeyValuePair<Field, Object> me in this )
+            {
+                if ( i != 0 )
+                    sb.Append( ", " );
+                sb.Append( me.Key );
+                sb.Append( "=" );
+                sb.Append( me.Value );
+                i++;
+            }
+
+            sb.Append( "}" );
+
+            return sb.ToString();
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/TypeMap.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/TypeMap.cs
new file mode 100644
index 0000000..0d77445
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/TypeMap.cs
@@ -0,0 +1,32 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// TypeMap is an IdNameMap for Type
+    /// </summary>
+    public class TypeMap : IdNameMap<XType>
+    {
+        public override XType MakeNew( string name )
+        {
+            return new XType( name );
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Validator.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Validator.cs
new file mode 100644
index 0000000..63fe985
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/Validator.cs
@@ -0,0 +1,85 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// Validate values put into messages
+    /// </summary>
+    abstract public class Validator
+    {
+        /// <summary>
+        /// The validation level.
+        /// </summary>
+        public enum Level
+        {
+            /// <summary>
+            /// No validation on put or output.
+            /// </summary>
+            NONE,
+            /// <summary>
+            /// Validation on put or output if validator defined.
+            /// </summary>
+            MISSING_OK,
+            /// <summary>
+            /// Like MISSING_OK, but fail if no validator defined.
+            /// </summary>
+            FULL
+        }
+
+        /// <summary>
+        /// The maximum number of dimensions for arrays
+        /// </summary>
+        public const int MAX_NDIMS = 9;
+
+        /// <summary>
+        /// The maximum number of validators to cache per type.
+        /// </summary>
+        protected const int MAX_CACHED = 4;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>for an array type, return a validator for an element of
+        /// the array (which might be a scalar or another array element).</returns>
+        abstract public Validator ElementValidator();
+
+        /// <summary>
+        /// Checks the value for being valid. If the value is valid
+        /// by this validator, return true.
+        /// </summary>
+        /// <param name="value">the value to be validated.</param>
+        /// <returns>true if the value is valid by any validator in the
+        /// chain, or false if all reject it.</returns>
+        abstract public bool Validate( Object value );
+
+       
+
+        /// <summary>
+        /// </summary>
+        /// <param name="value"></param>
+	    /// <returns> return the appropriate value given the input value and this
+	    /// validator's sensibility about what it should be really (e.g.,
+	    /// input Byte but output Long. </returns>
+	 
+        abstract public Object ValidateValue(Object value);
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ValueFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ValueFactory.cs
new file mode 100644
index 0000000..681cc2c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/ValueFactory.cs
@@ -0,0 +1,170 @@
+// $Id$
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Msg
+{ 
+    /// <summary>Interface which defines the value factory which helps
+    ///  the idl compiler serialize and deserialize messages, convert values, etc.</summary>
+    public interface ValueFactory 
+    {
+        //////////
+        // XType //
+        //////////
+
+        /// <summary>Translates a type id into the appropriate XType object.
+        /// If the type does not exist, and if dynamic typing is enabled,
+        /// adds it to the dynamic types.</summary>
+        ///<param> id a type id.</param>
+        /// <returns> id translated into the appropriate XType.</returns>  
+        XType GetType(int id);
+
+        /// <summary>Translates a type name into the appropriate XType object.
+        /// If the type does not exist, and if dynamic typing is enabled,
+        /// adds it to the dynamic types.</summary>
+        /// <param>name a type name.</param>
+        /// <returns> name translated into the appropriate XType.</returns>
+        
+        XType GetType(string name);
+
+        /// <summary>
+        /// Adds the type if it doesn't already exist. Use this to dynamically add
+        /// types to a ValueFactory. The type is per instance of the ValueFactory,
+        /// not global. Not available if dynamic typing is locked.
+        /// </summary>
+        /// <param name="type"></param>
+        void AddType(XType type);
+
+        /// <summary>
+        /// Locks the dynamic typing so that no new types may be created by addType
+        /// or getType.
+        /// </summary>
+        void LockDynamicTypes();
+
+        /// <summary>
+        /// Unlocks the dynamic typing so that new types may be created by addType
+        /// or getType.
+        /// </summary>
+        void UnlockDynamicTypes();
+
+        /// <returns> a collection of all the types.</returns>
+        ICollection<XType> GetTypes();
+
+        /////////////////////
+        // STRING ENCODING //
+        /////////////////////
+
+        ///<returns> the encoding to use for strings.
+        Encoding GetStringEncoding();
+
+        ////////////////
+        // MESSAGE ID //
+        ////////////////
+
+        /// <param name="msg">msg the message whose well-known message-id field is to be returned.</param>
+        /// <returns>the value of the well-known message-id field. This is a unique identifier 
+        /// for this message on a particular transport during a particular session. If there is no well-known 
+        /// message-id field defined, or if the message-id field has not been set, then return null.</returns>
+
+        long? GetMessageId(Message msg);
+        
+        /// <summary> Sets the value of the well-known message-id field. This is a unique identifier 
+        /// for this message on a particular transport during a particular session. If there is no 
+        /// well-known message-id field defined then nothing is done. If msgid is null, then the field is cleared.
+        /// </summary>
+        /// <param>msg the message whose well-known message-id field is to be set.</param> 
+        /// <param>msgid the value of the well-known message-id field.</param> 
+        
+        void SetMessageId(Message msg, long? msgid);
+
+        /// <summary>
+        /// Gets well-known message field for message id.
+        /// </summary>
+        /// <returns>well-known message field for message id.</returns>
+        Field Get_mf__messageId();
+
+        /////////////////
+        // IN REPLY TO //
+        /////////////////
+
+        /// <returns>the value of the in-reply-to field, or null if there is none or if there is no such field defined.
+        /// </returns>
+        ///<param> msg the message whose well-known in-reply-to field is to be returned.</param>
+
+        long? GetInReplyTo(Message msg);
+
+        /// <param>msg the message whose well-known in-reply-to field is to be set.</param>
+        /// <param>msgid the value of the well-known in-reply-to field. If there is no well-known 
+        /// in-reply-to field defined then nothing is done. If msgid is null, then the field is cleared.</param>
+        /// </summary> 
+        
+        void SetInReplyTo(Message msg, long? msgid);
+
+        /// <summary>
+        /// Gets well-known message field for in reply to.
+        /// </summary>
+        /// <returns>well-known message field for in reply to.</returns>
+        Field Get_mf__inReplyTo();
+
+        //////////////////////
+        // VALUE CONVERSION //
+        //////////////////////
+
+        /// <summary>Converts a value to a struct value representation to be exported to a tagged data output.</summary>
+        /// <param>value a custom type defined by a service, or a well-known standard type (e.g., date).</param> 
+        /// <returns> a struct value representing the value.</returns>
+        /// <throws>UnsupportedOperationException if the type cannot be exported.</throws> 
+        
+        StructValue ExportCustomValue(object value);
+
+        /// <summary>Converts a struct value imported from a tagged data input to a normal type.</summary>
+        /// <param>sv a struct value representation of a custom type, or a well known standard type.</param> 
+        /// <returns> a custom type, or a well known standard type.</returns>
+        /// <throws> UnsupportedOperationException if the type cannot be imported.</throws>
+        
+        Object ImportCustomValue(StructValue sv);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="c">the class of a custom value.</param>
+        /// <returns>the struct type of a custom value class.</returns>
+        XType GetCustomStructType( Type c );
+
+        ///<summary></summary>
+        /// <returns>well-known message type for exception thrown by one-way message</returns>	
+        XType get_mt__exception();
+
+        /// <summary>
+        /// Gets the put / write validation level.
+        /// </summary>
+        /// <returns>the put / write validation level</returns>
+        Validator.Level GetLevel();
+
+        /// <summary>
+        /// Sets the put / write validation level.
+        /// </summary>
+        /// <param name="level">the new put / write validation level</param>
+        /// <returns>the old put / write validation level</returns>
+        Validator.Level SetLevel(Validator.Level level);
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/XType.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/XType.cs
new file mode 100644
index 0000000..da026fc
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Msg/XType.cs
@@ -0,0 +1,341 @@
+// $Id$
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Msg
+{
+    /// <summary>
+    /// Type denotes the type of a struct or message. When used with a
+    /// message it typically denotes an action or event.
+    /// </summary>
+    public class XType : IdName
+    {
+        /// <summary>Constructs the Type.</summary>
+        /// <param name="id">id of the type.</param>
+        /// <param name="name">name of the type.</param>
+        public XType( int id, String name )
+            : base( id, name )
+        {
+            // nothing else.
+        }
+
+        /// <summary>Constructs the Type, computing the appropriate value for the id.</summary>
+        /// <param name="name">name the name of the type.</param>
+        public XType( String name )
+            : base( name )
+        {
+            // nothing else.
+        }
+
+        public Validator GetValidator( Field key )
+        {
+            Validator v;
+            return validators.TryGetValue(key, out v) ? v : null;
+        }
+
+        private readonly FieldMap fieldMap = new FieldMap();
+
+        /// <summary>
+        /// Adds the validator to the chain for this key.
+        /// </summary>
+        /// <param name="key"></param>
+        /// <param name="vldtr"></param>
+        public void PutValidator( Field key, Validator vldtr )
+        {
+            CheckNotLocked();
+
+            if ( vldtr == null )
+                return;
+
+            if ( fieldMap.Get( key.Id ) == null )
+                AddField( key );
+
+            Validator v;
+            if (validators.TryGetValue(key, out v))
+                validators[key] = new ComboValidator(v, vldtr);
+            else
+                validators[key] = vldtr;
+        }
+
+        /// <summary>
+        /// Removes the validator chain for this key
+        /// </summary>
+        /// <param name="key"></param>
+        public void ClearValidator( Field key )
+        {
+            CheckNotLocked();
+            validators.Remove( key );
+        }
+
+        public Dictionary<Field, Validator> validators = new Dictionary<Field, Validator>();
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the result type of this message type</returns>
+        public XType GetResult()
+        {
+            return rType;
+        }
+
+        public void SetResult( XType rType )
+        {
+            CheckNotLocked();
+            this.rType = rType;
+        }
+
+        private XType rType;
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the associated import / export helper</returns>
+        public ImportExportHelper GetImportExportHelper()
+        {
+            return helper;
+        }
+
+        /// <summary>
+        /// Sets the associated import / export helper.
+        /// </summary>
+        /// <param name="helper"></param>
+        public void SetImportExportHelper( ImportExportHelper helper )
+        {
+            CheckNotLocked();
+            this.helper = helper;
+        }
+
+        private ImportExportHelper helper;
+
+       /// <summary>
+       /// 
+       /// </summary>
+        /// <returns>the associated component type for an array of this type</returns>
+
+        public Type GetComponentType()
+	    {
+            return componentType;
+	    }
+
+        /// <summary>
+        /// Sets the associated component type for an array of this type.
+	    /// This type is not used when de-serializing the array components,
+	    /// just when allocating the array itself.
+        /// </summary>
+        /// <param name="type"></param>
+
+        public void SetComponentType(Type type)
+        {
+            CheckNotLocked();
+            this.componentType = type;
+        }
+
+        private Type componentType;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>an object to help dispatch the received message</returns>
+        public Object GetStubHelper()
+        {
+            return stubHelper;
+        }
+
+        /// <summary>
+        /// Sets an object to help the stub dispatch the received message
+        /// </summary>
+        /// <param name="stubHelper"></param>
+        public void SetStubHelper( Object stubHelper )
+        {
+            // CheckNotLocked(); called from stub and not from value factory.
+            if (this.stubHelper != null)
+                throw new Exception("this.stubHelper != null");
+            this.stubHelper = stubHelper;
+        }
+
+        private Object stubHelper;
+
+
+        ///<summary>Locks the fields for this type.</summary>
+        public void Lock()
+        {
+            locked = true;
+            fieldMap.Lock();
+        }
+
+        private void CheckNotLocked()
+        {
+            if (locked)
+                throw new Exception("locked");
+        }
+
+        private bool locked;
+
+        
+        ///<summary>Adds a field to the set of fields.</summary>
+        ///<param name="field"> A field to all </param>
+        ///<returns>Returns the argument. If there is a collision with
+        /// an id and name, both associated with the same field,
+        /// then that field is returned instead of the argument </returns>
+        /// <Exception cref="ArgumentException">hrows IllegalArgumentException if there is a
+        /// collision in the id or name, or both id and name when not associated 
+        /// with the same field.</Exception>
+        public Field AddField( Field field )
+        {
+            return fieldMap.Add( field );
+        }
+
+        ///<summary>Translates a field id into the appropriate Field object.</summary>
+        ///<param name="id">field id</param>
+        ///<returns>id translated into the appropriate Field.</returns>
+        public Field GetField( int id )
+        {
+            return fieldMap.Get( id );
+        }
+
+       
+        ///<summary>Translates a field name into the appropriate Field.</summary>
+        ///<param name="name">A field name</param>
+        ///<returns>name translated into the appropriate Field.</returns>
+        public Field GetField( string name )
+        {
+            return fieldMap.Get( name );
+        }
+
+        ///<returns>a set of all the fields.</returns>
+        public List<Field> GetFields()
+        {
+            return fieldMap.Values();
+        }
+
+        /// <summary>
+        /// Every type ( => message) carries a timeout
+        /// </summary>
+        private int timeout;
+
+        public int Timeout
+        {
+            get
+            {
+                return timeout;
+            }
+            set
+            {
+                CheckNotLocked();
+                timeout = value;
+            }
+        }
+
+        /// <summary>
+        /// Field containing result value
+        /// </summary>
+        private Field responseField;
+
+        public Field ResponseField
+        {
+            get
+            {
+                return responseField;
+            }
+            set
+            {
+                CheckNotLocked();
+                responseField = value;
+            }
+        }
+
+        ///<summary>Checks whether this type is assignment compatible with other. This
+        ///means that other is a subclass of this.</summary>
+        ///<param name="other"></param>
+        ///<returns>true if this type is assignable from other</returns>
+        
+        public bool IsAssignableFrom( XType other )
+        {
+            return other != null && ( this.Equals( other ) || IsAssignableFrom( other.SuperType() ) );
+        }
+
+        public void CheckIsAssignableFrom( XType other )
+        {
+            if ( !IsAssignableFrom( other ) )
+                throw new ArgumentOutOfRangeException();
+        }
+
+        public XType SuperType()
+        {
+            return superType;
+        }
+
+        ///<summary>Sets the super type of this type. If struct A extends B, then
+        ///B is the super type of A.</summary>
+        ///<param name="superType"></param>
+        public void SetSuperType( XType superType )
+        {
+            CheckNotLocked();
+            this.superType = superType;
+        }
+
+        private XType superType;
+
+       /// <summary>
+       /// Gets AsyncMode for this Type
+       /// </summary>
+       /// <returns>AsyncMode</returns>
+        public AsyncMode GetAsyncMode()
+        {
+            return asyncMode;
+        }
+
+        /// <summary>
+        /// Sets the AysncMode
+        /// </summary>
+        /// <param name="mode"></param>
+        public void SetAsyncMode(AsyncMode mode)
+        {
+            CheckNotLocked();
+            asyncMode = mode;
+        }
+
+        private AsyncMode asyncMode;
+
+        /// <summary>
+        /// Gets the message direction.
+        /// </summary>
+        /// <returns>the message direction</returns>
+        public Direction GetDirection()
+        {
+            return direction;
+        }
+
+        /// <summary>
+        /// Sets the message direction.
+        /// </summary>
+        /// <param name="direction"></param>
+        public void SetDirection(Direction direction)
+        {
+            CheckNotLocked();
+            this.direction = direction;
+        }
+
+        private Direction direction;
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/AuthExceptionSerializer.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/AuthExceptionSerializer.cs
new file mode 100644
index 0000000..9f29b88
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/AuthExceptionSerializer.cs
@@ -0,0 +1,62 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class AuthExceptionSerializer : ImportExportHelper
+    {
+        private const String FIELD_NAME = "msg";
+
+        public static void Init(XType type, Class2TypeMap class2type)
+        {
+            Field field = type.GetField(FIELD_NAME);
+            class2type.Add(typeof(_Etch_AuthException), type);
+            type.SetComponentType(typeof(_Etch_AuthException));
+            type.SetImportExportHelper(new AuthExceptionSerializer(type, field));
+            type.PutValidator(field, Validator_string.Get(0));
+            type.Lock();
+        }
+
+        public AuthExceptionSerializer(XType type, Field field)
+        {
+            this.type = type;
+            this.field = field;
+        }
+
+        private readonly XType type;
+
+        private readonly Field field;
+
+        public override StructValue ExportValue(ValueFactory vf, Object value)
+        {
+            StructValue sv = new StructValue(type, vf);
+            sv.Add(field, value.ToString());
+            return sv;
+        }
+
+        public override Object ImportValue(StructValue sv)
+        {
+            sv.CheckType(type);
+            return new _Etch_AuthException((String)sv.Get(field));
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Class2TypeMap.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Class2TypeMap.cs
new file mode 100644
index 0000000..3f142b0
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Class2TypeMap.cs
@@ -0,0 +1,101 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class Class2TypeMap
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="c"></param>
+        /// <returns>the Type for the specified class, or null</returns>
+        public XType Get( Type c )
+        {
+            try
+            {
+                return c2t[ c ];
+            }
+            catch ( KeyNotFoundException )
+            {
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Adds a map entry from c to t
+        /// </summary>
+        /// <param name="c"></param>
+        /// <param name="t"></param>
+        public void Add( Type c, XType t )
+        {
+            if ( locked )
+                throw new Exception( "locked" );
+
+            XType x;
+            try
+            {
+                x = c2t[ c ];
+            }
+            catch ( KeyNotFoundException )
+            {
+                x = null;
+            }
+
+            if ( x != null )
+            {
+                if ( !x.Equals( t ) )
+                    throw new ArgumentException( String.Format( "type {0} : class {1} is already mapped to type {2}", t, c, x ) );
+                return;
+            }
+            c2t.Add( c, t );
+        }
+
+        /// <summary>
+        /// Adds all the mappings from other to this
+        /// </summary>
+        /// <param name="other"></param>
+        public void AddAll( Class2TypeMap other )
+        {
+            if ( locked )
+                throw new Exception( "locked" );
+
+            foreach ( KeyValuePair<Type, XType> me in other.c2t )
+            {
+                Add( me.Key, me.Value );
+            }
+        }
+
+        /// <summary>
+        /// Locks the map, disallowing any more changes
+        /// </summary>
+        public void Lock()
+        {
+            locked = true;
+        }
+
+        private readonly Dictionary<Type, XType> c2t = new Dictionary<Type, XType>();
+
+        private Boolean locked;
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs
new file mode 100644
index 0000000..dbfdbda
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs
@@ -0,0 +1,103 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Transport;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    abstract public class DefaultServerFactory : ServerFactory
+    {
+        protected DefaultServerFactory(Transport<ServerFactory> listener, object implFactory)
+        {
+            this.listener = listener;
+            if (implFactory is Session)
+                SetSession((Session)implFactory);
+            listener.SetSession(this);
+        }
+
+        private readonly Transport<ServerFactory> listener;
+
+        public Object SessionQuery(Object query)
+        {
+            if (session != null)
+                return session.SessionQuery(query);
+
+            throw new NotSupportedException("unknown query " + query);
+        }
+
+        public void SessionControl(Object control, Object value)
+        {
+            if (session != null)
+            {
+                session.SessionControl(control, value);
+                return;
+            }
+
+            throw new NotSupportedException("unknown control " + control);
+        }
+
+        public void SessionNotify(Object evnt)
+        {
+            if (session != null)
+                session.SessionNotify(evnt);
+        }
+
+        #region Transport Members
+
+        public Session GetSession()
+        {
+            return session;
+        }
+
+        public void SetSession(Session session)
+        {
+            this.session = session;
+        }
+
+        private Session session;
+
+        public object TransportQuery(object query)
+        {
+            return listener.TransportQuery(query);
+        }
+
+        public void TransportControl(object control, object value)
+        {
+            listener.TransportControl(control, value);
+        }
+
+        public void TransportNotify(object eventObj)
+        {
+            listener.TransportNotify(eventObj);
+        }
+
+        #endregion
+
+        #region ServerFactory Members
+
+        abstract public void NewServer(TransportMessage transport, string uri, Resources resources);
+
+        abstract public ValueFactory NewValueFactory(string uri);
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultValueFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultValueFactory.cs
new file mode 100644
index 0000000..6d08ec2
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultValueFactory.cs
@@ -0,0 +1,395 @@
+// $Id$
+// 
+// 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;
+using System.Collections.Generic;
+using System.Text;
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+
+    /// <summary>Default implementation of ValueFactory which provides some dynamic type and field support, as well 
+    /// as standard value conversions and import and export.</summary>
+    public class DefaultValueFactory : ValueFactory
+    {
+        private const String ETCH_RUNTIME_EXCEPTION_TYPE_NAME = "_Etch_RuntimeException";
+
+        private const String ETCH_LIST_TYPE_NAME = "_Etch_List";
+
+	    private const String ETCH_MAP_TYPE_NAME = "_Etch_Map";
+
+	    private const String ETCH_SET_TYPE_NAME = "_Etch_Set";
+
+	    private const String ETCH_DATETIME_TYPE_NAME = "_Etch_Datetime";
+
+	    private const String ETCH_AUTH_EXCEPTION_TYPE_NAME = "_Etch_AuthException";
+
+	    private const String ETCH_EXCEPTION_MESSAGE_NAME = "_exception";
+
+	    private const String MSG_FIELD_NAME = "msg";
+
+	    private const String MESSAGE_ID_FIELD_NAME = "_messageId";
+
+	    private const String IN_REPLY_TO_FIELD_NAME = "_inReplyTo";
+
+        private const String RESULT_FIELD_NAME = "result";
+     
+
+        public static void Init( TypeMap types, Class2TypeMap class2type )
+        {
+            RuntimeExceptionSerializer.Init(
+             types.Get(ETCH_RUNTIME_EXCEPTION_TYPE_NAME), class2type);
+
+            ListSerializer.Init(
+                types.Get(ETCH_LIST_TYPE_NAME), class2type);
+
+            MapSerializer.Init(
+                types.Get(ETCH_MAP_TYPE_NAME), class2type);
+
+        /*    SetSerializer.Init(
+                types.Get(ETCH_SET_TYPE_NAME), class2type); */
+
+            DateSerializer.Init(
+                types.Get(ETCH_DATETIME_TYPE_NAME), class2type);
+
+            AuthExceptionSerializer.Init(
+                types.Get(ETCH_AUTH_EXCEPTION_TYPE_NAME), class2type);
+         
+            XType t3 = types.Get(ETCH_EXCEPTION_MESSAGE_NAME);
+            t3.PutValidator(_mf_result, Validator_RuntimeException.Get());
+            t3.PutValidator(_mf__messageId, Validator_long.Get(0));
+            t3.PutValidator(_mf__inReplyTo, Validator_long.Get(0));
+        }
+
+        /// <summary>The msg field of the standard unchecked exception.</summary>
+        public readonly static Field _mf_msg = new Field(MSG_FIELD_NAME);
+
+        /// <summary>The well-known _messageId field.</summary>
+        public readonly static Field _mf__messageId = new Field(MESSAGE_ID_FIELD_NAME);
+
+        /// <summary>The well-known _inReplyTo field. </summary>
+        public readonly static Field _mf__inReplyTo = new Field(IN_REPLY_TO_FIELD_NAME);
+
+        /// <summary> The well-known result field </summary>
+        public readonly static Field _mf_result = new Field(RESULT_FIELD_NAME);
+
+        private readonly TypeMap types;
+
+        private readonly TypeMap dynamicTypes = new TypeMap();
+
+	    private readonly Class2TypeMap class2type;
+	
+	    private readonly XType _mt__Etch_RuntimeException;
+	
+	    private readonly XType _mt__Etch_AuthException;
+	
+	    private readonly XType _mt__exception;
+
+        private readonly XType _mt__Etch_List;
+	
+	    private readonly XType _mt__Etch_Map;
+	
+	    private readonly XType _mt__Etch_Set;
+	
+	    private readonly XType _mt__Etch_Datetime;
+	
+
+       /// <summary>
+        /// Constructs the DefaultValueFactory.
+       /// </summary>
+       /// <param name="uri"></param>
+       /// <param name="types"></param>
+       /// <param name="class2type"></param>
+        public DefaultValueFactory(String uri, TypeMap types, Class2TypeMap class2type)
+        {
+            URL u = new URL(uri);
+            
+            String s = u.GetTerm("DefaultValueFactory.level", "FULL");
+            level = (Validator.Level) Enum.Parse(typeof(Validator.Level), s);
+
+            this.types = types;
+            this.class2type = class2type;
+
+            _mt__Etch_RuntimeException = types.Get(ETCH_RUNTIME_EXCEPTION_TYPE_NAME);
+            _mt__Etch_AuthException = types.Get(ETCH_AUTH_EXCEPTION_TYPE_NAME);
+            _mt__exception = types.Get(ETCH_EXCEPTION_MESSAGE_NAME);
+            _mt__Etch_List = types.Get(ETCH_LIST_TYPE_NAME);
+            _mt__Etch_Map = types.Get(ETCH_MAP_TYPE_NAME);
+            _mt__Etch_Set = types.Get(ETCH_SET_TYPE_NAME);
+            _mt__Etch_Datetime = types.Get(ETCH_DATETIME_TYPE_NAME);
+        }
+
+        public XType get_mt__Etch_RuntimeException()
+	    {
+		    return _mt__Etch_RuntimeException;
+	    }
+	
+	    public XType get_mt__Etch_AuthException()
+	    {
+		    return _mt__Etch_AuthException;
+	    }
+	
+	    public  XType get_mt__exception()
+	    {
+		    return _mt__exception;
+	    }
+
+        public XType Get_mt__Etch_List()
+	    {
+		    return _mt__Etch_List;
+	    }
+	
+	    public XType Get_mt__Etch_Map()
+	    {
+		    return _mt__Etch_Map;
+	    }
+	
+	    public XType Get_mt__Etch_Set()
+	    {
+		    return _mt__Etch_Set;
+	    }
+	
+	    public XType Get_mt__Etch_Datetime()
+	    {
+	    	return _mt__Etch_Datetime;
+	    }
+
+        protected void addMixin(ValueFactory vf)
+        {
+            ValueFactory[] newMixins = new ValueFactory[mixins.Length + 1];
+            System.Array.Copy(mixins,newMixins,mixins.Length);
+            newMixins[mixins.Length] = vf;
+            mixins = newMixins;
+        }
+
+        private ValueFactory[] mixins = { };
+
+     
+
+        /////////////////////
+        // STRING ENCODING //
+        /////////////////////
+
+        public Encoding GetStringEncoding()
+        {
+            return Encoding.UTF8;
+        }
+
+        ////////////////
+        // MESSAGE ID //
+        ////////////////
+
+        public long? GetMessageId(Message msg)
+        {
+            return (long?)(msg.Get(_mf__messageId));
+        }
+
+        public void SetMessageId(Message msg, long? msgid)
+        {
+            msg[_mf__messageId] = msgid;
+        }
+
+        public Field Get_mf__messageId()
+        {
+            return _mf__messageId;
+        }
+
+        /////////////////
+        // IN REPLY TO //
+        /////////////////
+
+        public long? GetInReplyTo(Message msg)
+        {
+            return (long?)(msg.Get(_mf__inReplyTo));
+        }
+
+        public void SetInReplyTo(Message msg, long? msgid)
+        {
+            msg[_mf__inReplyTo] = msgid;
+        }
+
+        public Field Get_mf__inReplyTo()
+        {
+            return _mf__inReplyTo;
+        }
+
+        //////////////////////
+        // VALUE CONVERSION //
+        //////////////////////
+
+       
+
+        public Object ImportCustomValue( StructValue sv )
+        {
+            ImportExportHelper helper = sv.GetXType.GetImportExportHelper();
+
+            if ( helper == null )
+                return null;
+
+            return helper.ImportValue( sv );
+        }
+
+       
+
+        #region ValueFactory members
+
+        public StructValue ExportCustomValue( Object value )
+        {
+            Type clss = value.GetType();
+            XType type;
+            try
+            {
+                type = GetCustomStructType(value.GetType());
+            }
+            catch (KeyNotFoundException)
+            {
+                type = null;
+            }
+
+            if (type == null && clss == typeof(StructValue) )
+		    {
+			    StructValue struct1 = (StructValue) value;
+		        type = struct1.GetXType;
+		    }
+
+            if (type == null)
+                //       if (value is Exception)
+                if (typeof(Exception).IsAssignableFrom(clss))
+                    type = _mt__Etch_RuntimeException;
+                else if (typeof(IList).IsAssignableFrom(clss))
+                    type = _mt__Etch_List;
+                else if (typeof(IDictionary).IsAssignableFrom(clss))
+                    type = _mt__Etch_Map;
+                // Need to add set, but in 2.0 there is no set so just use keys of IDictionary, 
+                else
+                    return null;
+		
+		    ImportExportHelper helper = type.GetImportExportHelper();
+		
+		    if (helper == null)
+			    return null;
+		
+		    return helper.ExportValue( this, value );
+        }
+
+        public XType GetCustomStructType( Type t )
+        {
+            XType type = class2type.Get( t );
+		    if (type != null)
+			    return type;
+		
+		    foreach (ValueFactory vf in mixins)
+			    if ((type = vf.GetCustomStructType( t )) != null)
+				    return type;
+		
+		    return null;
+           
+        }
+
+        public XType GetType( int id )
+        {
+            XType type = types.Get(id);
+            if (type != null)
+                return type;
+
+            foreach (ValueFactory vf in mixins)
+                if ((type = vf.GetType(id)) != null)
+                    return type;
+
+            lock (dynamicTypes)
+            {
+                return dynamicTypes.Get(id);
+            }
+        }
+
+        public XType GetType( string name )
+        {
+            XType type = types.Get(name);
+            if (type != null)
+                return type;
+
+            foreach (ValueFactory vf in mixins)
+                if ((type = vf.GetType(name)) != null)
+                    return type;
+
+            lock (dynamicTypes)
+            {
+                return dynamicTypes.Get(name);
+            }
+        }
+
+        public void AddType(XType type)
+        {
+            lock (dynamicTypes)
+            {
+                dynamicTypes.Add(type);
+            }
+        }
+
+        public  ICollection<XType> GetTypes()
+        {
+            ICollection<XType> values = types.Values();
+
+            foreach (ValueFactory vf in mixins)
+                foreach (XType x in vf.GetTypes())
+                    if (!values.Contains(x))
+                        values.Add(x);
+
+            lock (dynamicTypes)
+            {
+                foreach (XType x in dynamicTypes.Values())
+                    if (!values.Contains(x))
+                        values.Add(x);
+            }
+
+            return values;
+        }
+
+        #endregion
+
+
+        public void LockDynamicTypes()
+        {
+            dynamicTypes.Lock();
+        }
+
+        public void UnlockDynamicTypes()
+        {
+            // TODO dynamicTypes.Unlock();
+            throw new NotSupportedException("The method or operation is not implemented.");
+        }
+
+        public Validator.Level GetLevel()
+        {
+            return level;
+        }
+
+        public Validator.Level SetLevel(Validator.Level level)
+        {
+            Validator.Level oldLevel = this.level;
+            this.level = level;
+            return oldLevel;
+        }
+
+        private Validator.Level level = Validator.Level.FULL;
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DeliveryService.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DeliveryService.cs
new file mode 100644
index 0000000..3983e8e
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DeliveryService.cs
@@ -0,0 +1,51 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Transport;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support{
+
+    ///<summary>Adapter between remote and message source.</summary>
+    public interface DeliveryService : TransportMessage,SessionMessage
+    {
+	
+        
+
+        /// <summary>
+        /// Sends the message which begins a call sequence.
+        /// </summary>
+        /// <param name="msg">the message to send.</param>
+        /// <returns>a mailbox which can be used to read response</returns>
+        Mailbox BeginCall( Message msg );
+
+        /// <summary>Finishes a call sequence by waiting for the response message.</summary>
+        /// <param name="mb"></param>
+        /// <param name="responseType">responseType the type of the expected response.</param>
+        /// which would contain any result value or thrown exception.</param>
+	    /// <returns>the value of the response field if it isn't an exception.</returns>
+        /// Exception:
+        ///             throws Exception if there is a problem sending or a timeout waiting or if the result 
+        ///             value was an exception.
+        Object EndCall(Mailbox mb, XType responseType );
+
+       
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DummyValueFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DummyValueFactory.cs
new file mode 100644
index 0000000..edba23a
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DummyValueFactory.cs
@@ -0,0 +1,128 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class DummyValueFactory : ValueFactory
+    {
+        #region ValueFactory Members
+
+        public XType GetType(int id)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public XType GetType(string name)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public void AddType(XType type)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public void LockDynamicTypes()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public void UnlockDynamicTypes()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public ICollection<XType> GetTypes()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public Encoding GetStringEncoding()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public long? GetMessageId(Message msg)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public void SetMessageId(Message msg, long? msgid)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public Field Get_mf__messageId()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public long? GetInReplyTo(Message msg)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public void SetInReplyTo(Message msg, long? msgid)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public Field Get_mf__inReplyTo()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public StructValue ExportCustomValue(object value)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public object ImportCustomValue(StructValue sv)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public XType GetCustomStructType(Type c)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public XType get_mt__exception()
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        public Validator.Level GetLevel()
+        {
+            return Validator.Level.FULL;
+        }
+
+        public Validator.Level SetLevel(Validator.Level level)
+        {
+            throw new Exception("The method or operation is not implemented.");
+        }
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/FreePool.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/FreePool.cs
new file mode 100644
index 0000000..81e9e09
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/FreePool.cs
@@ -0,0 +1,137 @@
+// $Id$
+// 
+// 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.Runtime.CompilerServices;
+using System.Threading;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// A free implementation of pool
+    /// </summary>
+    public class FreePool : Pool
+    {
+        /// <summary>
+        /// Constructs a FreePool with specified maxSize.
+        /// </summary>
+        /// <param name="maxSize">maximum number of free threads at one time
+        /// after which reject requests. </param>
+        public FreePool( int maxSize )
+        {
+            this.maxSize = maxSize;
+        }
+
+        /// <summary>
+        /// Constructs a FreePool with maxSize 50
+        /// </summary>
+        public FreePool()
+            : this( 50 )
+        { }
+
+        private readonly int maxSize;
+
+        private readonly Dictionary<Thread, Thread> group = new Dictionary<Thread, Thread>();
+
+        private Boolean open = true;
+
+        /// <summary>
+        /// Closes the pool. This just marks the pool as being closed, it doesn't
+        /// actually do anything to the currently running thread. But no more
+        /// threads are allowed to start.
+        /// </summary>
+        public void Close()
+        {
+            open = false;
+        }
+
+        /// <summary>
+        /// Joins each of the threads in this pool until there
+        /// are none left. The pool will be closed first.
+        /// Exception:
+        ///     throws ThreadInterruptedException
+        /// </summary>
+        public void Join()
+        {
+            Close();
+            while (true)
+            {
+                Thread x;
+                lock (group)
+                {
+                    Dictionary<Thread, Thread>.Enumerator e = group.GetEnumerator();
+                    if (!e.MoveNext())
+                        break;
+                    
+                    x = e.Current.Key;
+                    group.Remove(x);
+                }
+                x.Join();
+            }
+        }
+
+        /// <summary>
+        /// Finds the number of active threads in this pool
+        /// </summary>
+        /// <returns>the number of active threads</returns>
+        public int ActiveCount()
+        {
+            return group.Count;
+        }
+
+        #region Pool Members
+
+        [MethodImpl( MethodImplOptions.Synchronized )]
+        public void Run( RunDelegate d1, ExceptionDelegate d2 )
+        {
+            if (!open || ActiveCount() >= maxSize)
+                throw new Exception("free pool thread count exceeded or pool closed");
+
+            Thread t = new Thread(
+                delegate()
+                {
+                    try
+                    {
+                        d1();
+                    }
+                    catch (Exception e)
+                    {
+                        d2(e);
+                    }
+                    finally
+                    {
+                        lock (group)
+                        {
+                            group.Remove(Thread.CurrentThread);
+                        }
+                    }
+                });
+
+            lock (group)
+            {
+                group.Add(t, t);
+            }
+
+            t.Start();
+        }
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Mailbox.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Mailbox.cs
new file mode 100644
index 0000000..9f26adc
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Mailbox.cs
@@ -0,0 +1,113 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>An interface used to deliver responses to a message. Support for the mechanism is somewhat 
+    /// dependent upon properties of the transport and message format.</summary>
+    /// 
+    public interface Mailbox 
+    {
+        /// <returns>the message id of this mailbox.</returns>
+        long GetMessageId();
+
+        /// <returns>the next message to be read from the mailbox, or null if the mailbox is empty and closed. 
+        /// Wait forever for such a message to be delivered.</returns>
+        /// Exception: 
+        ///             throws InterruptedException thread interrupt.
+        Element Read();
+
+       /// <param name="maxDelay">maxDelay the maximum amount of time in milliseconds to wait to read a message 
+       /// from an empty mailbox. 0 means wait forever, -1 means don't wait at all.</param>
+       /// <returns>the message read from the mailbox, or null if the mailbox is empty and closed, or if the time 
+       /// limit was exceeeded.</returns>
+       /// Exception:
+       ///              throws InterruptedException thread interrupt.
+       Element Read(int maxDelay);
+
+       /// <summary>Closes the mailbox so that no more messages can be delivered. Queued messages remain to be read. 
+       /// Reading an empty closed mailbox returns null.</summary>
+       /// <returns> true if this call closed the mailbox (that is, if action was taken), false if the mailbox was already closed. </returns>
+       bool CloseDelivery();
+
+       /// <summary>Closes the mailbox so that no more messages will be delivered or read. Any remaining queued 
+       /// messages are delivered to a default handler.</summary>
+       /// throws Exception 
+       bool CloseRead();
+
+       ///<summary>Registers a Notify interface implementation to receive a callback
+	   ///when a mailbox's status is changed.</summary>
+	   ///<param> newNotify a Notify interface implementation to report the
+	   ///delivery status to. </param>
+	   ///<param> state a state value to pass thru to the Notify interface
+	   /// implementation. </param>
+	   ///<param> maxDelay the maximum amount of time in milliseconds to
+	   ///wait for delivery of a message to the mailbox. 0 means wait
+	   ///forever. The mailbox is closed upon timeout.<param>
+    	
+	   void RegisterNotify( Notify newNotify, Object state, int maxDelay );
+	
+	
+	   /// <summary>Unregisters a Notify interface implementation from receiving a callback
+	   /// when a mailbox's status is changed. Cancels any timeout. </summary>
+       ///<param> oldNotify a Notify interface implementation which was previously
+	   ///registered. </param>    	
+	   void UnregisterNotify( Notify oldNotify );
+
+
+        bool Message(Who sender, Message msg);
+    }
+    
+        ///<summary>The message as queued, including src and sender.</summary>
+        public class Element : Who
+        {
+            /// <param name="sender">sender the message sender.</param>
+            /// <param name="msg">msg the message.</param>
+            public Element(Who sender, Message msg)
+            {
+                this.sender = sender;
+                this.msg = msg;
+            }
+
+            /// <summary>The message sender.</summary>
+            public Who sender;
+
+            /// <summary>the message.</summary>
+            public Message msg;
+        }
+
+        public interface Notify
+        {
+
+		    /// <summary>Notifies of mailbox status change.</summary>
+		    ///<param> mb the mailbox whose status has changed.</param>
+		    ///<param> state the state object passed in the register
+		    /// method.</param>
+		    /// <param> closed true if the mailbox timeout has expired and
+		    ///the mailbox is now closed to delivery, false if a message
+		    /// has arrived.</param>
+		 
+            void mailboxStatus(Mailbox mb, Object state, bool closed);
+            
+        }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/NullPool.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/NullPool.cs
new file mode 100644
index 0000000..06d9469
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/NullPool.cs
@@ -0,0 +1,50 @@
+// $Id$
+// 
+// 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;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// A pool which runs runnable directly
+    /// </summary>
+    public class NullPool : Pool
+    {
+        #region Pool Members
+
+        public void Run( RunDelegate d1, ExceptionDelegate d2 )
+        {
+            new Thread(
+                new ThreadStart( delegate()
+                                {
+                                    try
+                                    {
+                                        d1();
+                                    }
+                                    catch ( Exception e )
+                                    {
+                                        d2( e );
+                                    }
+                                } ) ).Start();
+        }
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ObjSession.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ObjSession.cs
new file mode 100644
index 0000000..9dfc6f9
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ObjSession.cs
@@ -0,0 +1,81 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Out-of-band query, control, and notification interface for sessions.
+    /// This is exactly the same as etch.bindings.java.transport.Session except
+    /// the names are changed to prevent collisions with service defined names.
+    /// </summary>
+    public interface ObjSession
+    {
+        /// <summary>
+        /// Gets a configuration or operational value from the handler. The
+        /// request is passed up the chain of sessions until some session
+        /// recognises the query, whereupon it returns the requested value.
+        /// </summary>
+        /// <param name="query">an object representing a query, which could be as
+        /// simple as a string, integer, or enum, or more complex such as
+        /// a class with instance variables for query terms.</param>
+        /// <returns>the requested value, or null if not defined.</returns>
+        /// Exception: 
+        ///     UnsupportedOperationException if the query is not recognised
+        ///     by any session (which is to say, if the last session in the session
+        ///     chain does not recognise it, it should throw this exception). Typically
+        ///     this would be a service's client or server implementation.
+        ///     
+        Object _SessionQuery( Object query );
+
+        /// <summary>
+        /// Sets a configuration or operational value in the session. The
+        /// request is passed up the chain of sessions until some session
+        /// recognises the control, whereupon it stores the specified value
+        /// and returns.
+        /// </summary>
+        /// <param name="control">an object representing a control, which could be as
+        /// simple as a string, integer, or enum, or more complex such as
+        /// a class with instance variables for control terms.</param>
+        /// <param name="value">the value to set.</param>
+        /// Exception:
+        ///     ArgumentException if the value is not the right
+        ///     type or if the value is inappropriate.
+        ///     
+        ///     UnsupportedOperationException if the control is not recognised
+        ///     by any session (which is to say, if the last session in the session
+        ///     chain does not recognise it, it should throw this exception). Typically
+        ///     this would be a service's client or server implementation.
+        ///
+        void _SessionControl( Object control, Object value );
+
+        /// <summary>
+        /// Notifies the chain of sessions of the specified event. Unlike query
+        /// and control operations above, events are always passed up to the
+        /// top to allow all sessions to notice them.
+        /// </summary>
+        /// <param name="eventObj">event a class which represents the event, possibly with
+        /// parameters. The simplest event could be a string, integer,
+        /// or enum, but any class instance will do (as long as some session
+        /// in the chain expects it).</param>
+        void _SessionNotify( Object eventObj );
+
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Pool.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Pool.cs
new file mode 100644
index 0000000..93cc317
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Pool.cs
@@ -0,0 +1,42 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Interface to a queued or free thread pool.
+    /// </summary>
+    public interface Pool
+    {
+        void Run( RunDelegate d1, ExceptionDelegate d2 );
+    }
+
+    /// <summary>
+    /// Delegate for what to run
+    /// </summary>
+    public delegate void RunDelegate();
+
+    /// <summary>
+    /// Delegate that can throw an exception
+    /// </summary>
+    /// <param name="e"></param>
+    public delegate void ExceptionDelegate( Exception e );
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/QueuedPool.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/QueuedPool.cs
new file mode 100644
index 0000000..85d3dc1
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/QueuedPool.cs
@@ -0,0 +1,81 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// A queued implementation of pool
+    /// </summary>
+    public class QueuedPool : Pool
+    {
+        /// <summary>
+        /// Constructs the queued pool with a specified todo manager.
+        /// </summary>
+        /// <param name="mgr"></param>
+        public QueuedPool( TodoManager mgr )
+        {
+            this.mgr = mgr;
+        }
+
+        /// <summary>
+        /// Constructs the queued pool with a default todo manager.
+        /// </summary>
+        /// Exception: 
+        ///     throws Exception
+        ///     
+        public QueuedPool() : this( TodoManager.GetTodoManager() )
+        {}
+
+        private TodoManager mgr;
+
+        public void Run( RunDelegate d1, ExceptionDelegate d2 )
+        {
+            MyTodo inst = new MyTodo ( d1, d2 );
+            mgr.Add( inst );
+        }
+
+        /// <summary>
+        /// Implementation of Todo
+        /// </summary>
+        public class MyTodo : Todo
+        {
+            public MyTodo ( RunDelegate d1, ExceptionDelegate d2 )
+            {
+                this.d1 = d1;
+                this.d2 = d2;
+            }
+
+            public void Doit( TodoManager mgr )
+            {
+                d1();
+            }
+
+            public void Exception( TodoManager mgr, Exception e ) 
+            {
+                d2( e );
+            }
+
+            private RunDelegate d1;
+            private ExceptionDelegate d2;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/RemoteBase.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/RemoteBase.cs
new file mode 100644
index 0000000..2383fcf
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/RemoteBase.cs
@@ -0,0 +1,206 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class RemoteBase
+    {
+        /// <summary>Constructs the RemoteBase.</summary>
+        /// <param name="svc">svc</param>
+        /// <param name="vf">vf </param>
+        public RemoteBase(DeliveryService svc, ValueFactory vf)
+        {
+            this._svc = svc;
+            this._vf = vf;
+        }
+
+       
+        private DeliveryService _svc;
+
+        /// <summary>The value factory used to create messages and encode/decode types.</summary>
+        public ValueFactory _vf;
+
+        public override string ToString()
+        {
+            return String.Format("{0}/{1}", GetType(), _svc);
+        }
+
+        /// <summary> Constructs a new message to send using _send(Message) or _beginCall(Message)</summary>
+        /// <param name="type">type</param>
+        /// <returns>a new message</returns>
+        public Message _NewMessage(XType type)
+        {
+            return new Message(type, _vf);
+        }
+
+        	
+	    ///<summary>Sends the message to the recipient, but does not wait for any response.</summary>
+	    ///<param name = msg> the message to send </param>
+	    ///<throws> Exception if there is a problem sending </throws>
+	    public void _Send( Message msg )
+	    {
+		    _svc.TransportMessage(null,msg);
+	    }
+	
+	
+        ///<summary>Sends the message which begins a call sequence.</summary>
+        ///<param name = msg> the message to send </param>
+        ///<returns>A mailbox which can be used to read the response, using _EndCall</returns>
+	    public Mailbox _BeginCall( Message msg )
+	    {
+		    return _svc.BeginCall( msg );
+	    }
+
+       
+	    ///<summary>Finishes a call sequence by waiting for the response message.</summary>
+	    ///<param name = mb>a mailbox which will be used to read the response, returned by
+	    /// _BeginCall(Message) </param>
+	    ///<param name = responseType> the type of the expected response </param>
+	    ///<returns>the value of the response field if it isn't an exception.</returns>
+	    ///<throws> Exception if there is a problem sending or a timeout waiting or
+	    /// if the result value was an exception.</throws>
+	    public Object _EndCall( Mailbox mb, XType responseType ) 
+	    {
+		    return _svc.EndCall( mb, responseType );
+	    }
+
+
+        /// <summary>
+        /// Gets a configuration or operational value from the source. The
+        /// request is passed down the chain of sources until some source
+        /// recognises the query, whereupon it returns the requested value.
+        /// </summary>
+        /// 
+        /// <param name="query">an object representing a query, which could be as
+        /// simple as a string, integer, or enum, or more complex such as
+        /// a class with instance variables for query terms.</param>
+        /// <returns>the requested value, or null if not defined.</returns>
+        /// 
+        /// Exception:
+        ///     throws Exception if the query is not recognised
+        ///     by any source (which is to say, if the last source in the source
+        ///     chain does not recognise it, it should throw this exception).
+        ///     
+        public object _TransportQuery( object query )
+        {
+            return _svc.TransportQuery( query );
+        }
+
+        /// <summary>
+        /// Sets a configuration or operational value in the source. The
+        /// request is passed down the chain of sources until some source
+        /// recognises the control, whereupon it stores the specified value
+        /// and returns.
+        /// </summary>
+        /// 
+        /// <param name="control">an object representing a control, which could be as
+        /// simple as a string, integer, or enum, or more complex such as
+        /// a class with instance variables for control terms.</param>
+        /// 
+        /// <param name="value">the value to set.</param>
+        /// 
+        /// Exception: 
+        ///     throws ArgumentException if the value is not the right
+        ///     type or if the value is inappropriate.
+        ///     
+        ///     throws Exception if the control is not recognised
+        ///     by any source (which is to say, if the last source in the source
+        ///     chain does not recognise it, it should throw this exception).
+        /// 
+        public void _TransportControl( object control, object value )
+        {
+            _svc.TransportControl( control, value );
+        }
+
+        /// <summary>
+        /// Notifies the chain of sources of the specified event. Unlike query
+        /// and control operations above, events are always passed down to the
+        /// bottom to allow all sources to notice them.
+        /// </summary>
+        /// 
+        /// <param name="eventObj">a class which represents the event, possibly with
+        /// parameters. The simplest event could be a string, integer,
+        /// or enum, but any class instance will do (as long as some source
+        /// in the chain expects it).</param>
+        /// 
+        public void _TransportNotify( object eventObj )
+        {
+            _svc.TransportNotify( eventObj );
+        }
+
+        /// <summary>
+        /// Start the transport
+        /// </summary>
+        public void _Start()
+        {
+            _svc.TransportControl( TransportConsts.START, null );
+        }
+
+        /// <summary>
+        /// Waits for the transport to come up.
+        /// </summary>
+        /// <param name="maxDelay"></param>
+        public void _WaitUp( int maxDelay )
+        {
+            _svc.TransportQuery( new TransportConsts.WaitUp( maxDelay ) );
+        }
+
+        /// <summary>
+        /// Starts the transport and waits for it to come up.
+        /// </summary>
+        /// <param name="maxDelay"></param>
+        public void _StartAndWaitUp( int maxDelay )
+        {
+           _Start();
+            _WaitUp(maxDelay);
+        }
+
+        /// <summary>
+        /// Stops the transport.
+        /// </summary>
+        public void _Stop()
+        {
+            _svc.TransportControl( TransportConsts.STOP, null );
+        }
+
+        /// <summary>
+        /// Waits for the transport to go down.
+        /// </summary>
+        /// <param name="maxDelay"></param>
+        public void _WaitDown( int maxDelay )
+        {
+            _svc.TransportQuery( new TransportConsts.WaitDown( maxDelay ) );
+        }
+
+        /// <summary>
+        /// Stops the transport and waits for it to go down.
+        /// </summary>
+        /// <param name="maxDelay">maxdelay in milliseconds</param>
+        public void _StopAndWaitDown( int maxDelay )
+        {
+            _Stop();
+            _WaitDown(maxDelay);
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/RuntimeExceptionSerializer.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/RuntimeExceptionSerializer.cs
new file mode 100644
index 0000000..0cd8bac
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/RuntimeExceptionSerializer.cs
@@ -0,0 +1,62 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class RuntimeExceptionSerializer : ImportExportHelper
+    {
+        private const String FIELD_NAME = "msg";
+
+        public static void Init(XType type, Class2TypeMap class2type)
+        {
+            Field field = type.GetField(FIELD_NAME);
+            class2type.Add(typeof(_Etch_RuntimeException), type);
+            type.SetComponentType(typeof(_Etch_RuntimeException));
+            type.SetImportExportHelper(new RuntimeExceptionSerializer(type, field));
+            type.PutValidator(field, Validator_string.Get(0));
+            type.Lock();
+        }
+
+        public RuntimeExceptionSerializer(XType type, Field field)
+        {
+            this.type = type;
+            this.field = field;
+        }
+
+        private readonly XType type;
+
+        private readonly Field field;
+
+        public override StructValue ExportValue(ValueFactory vf, Object value)
+        {
+            StructValue sv = new StructValue(type, vf);
+            sv.Add(field, value.ToString());
+            return sv;
+        }
+
+        public override Object ImportValue(StructValue sv)
+        {
+            sv.CheckType(type);
+            return new _Etch_RuntimeException((String)sv.Get(field));
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs
new file mode 100644
index 0000000..b3d2587
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs
@@ -0,0 +1,47 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Transport;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Interface to use for constructing new server instances by 
+    /// TransportHelper
+    /// </summary>
+    public interface ServerFactory : Session, Transport<Session>
+    {
+        /// <summary>
+        /// Constructs a new server session.
+        /// </summary>
+        /// <param name="transport">the TransportMessage to use with the new server instance.</param>
+        /// <param name="uri">the uri to use to configure the new server instance.</param>
+        /// <param name="resources">the resources to use for the new server instance.</param>
+        void NewServer(TransportMessage transport, string uri, Resources resources);
+
+        /// <summary>
+        /// Constructs a new instance of value factory for this session.
+        /// </summary>
+        /// <param name="uri">the uri to use to configure the new value factory.</param>
+        /// <returns>a new instance of value factory for this session.</returns>
+        ValueFactory NewValueFactory(string uri);
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/StubBase.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/StubBase.cs
new file mode 100644
index 0000000..5f7a75c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/StubBase.cs
@@ -0,0 +1,162 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Transport;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+
+    /// <summary>
+    /// Base class of stub implementations
+    /// </summary>
+    public class StubBase : SessionMessage
+    {
+        /// <summary>Constructs the StubBase.</summary>
+        /// <param name="src">the message source</param>
+        /// <param name="obj">the target of decoded messages</param>
+        /// <param name="queued">thread pool used to run AsyncReceiverMode.QUEUED methods.</param>
+        /// <param name="free">thread pool used to run AsyncReceiverMode.FREE methods.</param>
+        public StubBase(DeliveryService src, object obj, Pool queued, Pool free)
+        {
+            _src = src;
+            _obj = obj;
+            _queued = queued;
+            _free = free;
+            src.SetSession(this);
+        }
+
+        /// <summary>
+        /// The message source.
+        /// </summary>
+        protected readonly DeliveryService _src;
+
+        /// <summary>
+        /// The target of decoded messages.
+        /// </summary>
+        protected readonly object _obj;
+
+        /// <summary>
+        /// Thread pool used to run AsyncReceiverMode.QUEUED methods.
+        /// </summary>
+        protected readonly Pool _queued;
+
+        /// <summary>
+        /// Thread pool used to run AsyncReceiverMode.FREE methods.
+        /// </summary>
+        protected readonly Pool _free;
+
+        
+
+        public Object SessionQuery(Object query)
+        {
+            if (_obj is ObjSession)
+                return ((ObjSession)_obj)._SessionQuery(query);
+            throw new NotSupportedException("unknown query: " + query);
+        }
+
+        public void SessionControl(Object control, Object value)
+        {
+            if (_obj is ObjSession)
+                ((ObjSession)_obj)._SessionControl(control, value);
+            else
+                throw new NotSupportedException("unknown control: " + control);
+        }
+
+        public void SessionNotify(Object eventObj)
+        {
+            SessionNotify(_obj, eventObj);
+        }
+
+        public static void SessionNotify( object obj, object eventObj )
+        {
+            if (obj is ObjSession)
+                ((ObjSession)obj)._SessionNotify(eventObj);
+            else if (eventObj is Exception)
+                Console.WriteLine(eventObj);
+        }
+
+        /// <summary>
+        /// Delegate that helps the stub dispatch the received message
+        /// </summary>
+        /// <param name="_src"></param>
+        /// <param name="_obj"></param>
+        /// <param name="sender"></param>
+        /// <param name="msg"></param> 
+        public delegate void StubHelperRun(DeliveryService _src, Object _obj, Who sender, Message msg);
+
+
+        #region SessionMessage Members
+
+        public bool SessionMessage(Who sender, Message msg)
+        {
+            XType type = msg.GetXType;
+
+            StubHelperRun helper = (StubHelperRun) type.GetStubHelper();
+            if (helper == null)
+                return false;
+
+            switch (type.GetAsyncMode())
+            {
+                case AsyncMode.QUEUED:
+                    try
+                    {
+                        _queued.Run(
+                            delegate { helper(_src, _obj, sender, msg); },
+                            delegate(Exception e) { SessionNotify(_obj, e); });
+                    }
+                    catch (Exception e)
+                    {
+                        SessionNotify(_obj, e);
+                    }
+                    break;
+                case AsyncMode.FREE:
+                    try
+                    {
+                        _free.Run(
+                            delegate { helper(_src, _obj, sender, msg); },
+                            delegate(Exception e) { SessionNotify(_obj, e); });
+                    }
+                    catch (Exception e)
+                    {
+                        SessionNotify(_obj, e);
+                    }
+                    break;
+                case AsyncMode.NONE:
+                    try
+                    {
+                        helper(_src, _obj, sender, msg);
+                    }
+                    catch (Exception e)
+                    {
+                        SessionNotify(_obj, e);
+                    }
+                    break;
+                default:
+                    throw new ArgumentException("unknown async mode "+type.GetAsyncMode());
+            }
+
+            return true;
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/StubHelper.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/StubHelper.cs
new file mode 100644
index 0000000..64c9143
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/StubHelper.cs
@@ -0,0 +1,68 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class StubHelper
+    {
+        public StubHelper(Delegate del, AsyncMode mode)
+        {
+            this.mode = mode;
+            this.del = del;
+        }
+
+        /// <summary>Constructs a StubHelper which uses synchronous mode to dispatch
+        /// method from message.</summary>
+        public StubHelper() : this(AsyncMode.NONE)
+        {
+        }
+
+
+        ///<summary>Constructs a StubHelper which uses specified mode to
+        ///dispatch method from message.</summary>
+        ///<param name="mode">param mode</param>
+        public StubHelper(AsyncMode mode)
+        {
+            this.mode = mode;
+        }
+
+        private AsyncMode mode;
+        private Delegate del;
+
+        ///<returns>true if the mode is AsyncMode.QUEUED.</returns>
+        public bool IsQueued()
+        {
+            return mode == AsyncMode.QUEUED;
+        }
+
+        ///<returns>true if the mode is AsyncMode.FREE.</returns>
+        public bool IsFree()
+        {
+            return mode == AsyncMode.FREE;
+        }
+
+        public Delegate GetDelegate()
+        {
+            return del;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TransportFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TransportFactory.cs
new file mode 100644
index 0000000..9523583
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TransportFactory.cs
@@ -0,0 +1,235 @@
+// $Id$
+// 
+// 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.Reflection;
+using Org.Apache.Etch.Bindings.Csharp.Transport;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Interface to transport factory
+    /// </summary>
+	public abstract class TransportFactory
+	{
+        /// <summary>
+        /// Constructs a new Transport stack topped by a TransportMessage
+        /// which is used by the remote service implementations to send
+        /// messages.
+        /// </summary>
+        /// <param name="uri">transport configuration parameters.</param>
+        /// <param name="resources">additional resources needed by the stack.</param>
+        /// <returns>the TransportMessage topping the transport stack.</returns>
+        protected abstract TransportMessage NewTransport(string uri, Resources resources);
+
+        /// <summary>
+        /// Constructs a new Transport stack topped by a TransportMessage
+        /// which is used by the remote service implementations to send
+        /// messages.
+        /// </summary>
+        /// <param name="uri">transport configuration parameters.</param>
+        /// <param name="resources">additional resources needed by the stack.</param>
+        /// <returns>the TransportMessage topping the transport stack.</returns>
+        public static TransportMessage GetTransport(string uri, Resources resources) 
+	    {
+            URL u = new URL(uri);
+            TransportFactory f = GetTransportFactory(u.Scheme);
+            return f.NewTransport(uri, resources);
+	    }
+
+        /// <summary>
+        /// Constructs a new Transport Listener which is used to construct
+        /// server sessions.
+        /// </summary>
+        /// <param name="uri">listener configuration parameters.</param>
+        /// <param name="resources">additional resources needed by the listener.</param>
+        /// <returns>an out-of-band source which may be used to control the listener.</returns>
+        protected abstract Transport<ServerFactory> NewListener(string uri, Resources resources);
+
+        /// <summary>
+        /// Constructs a new Transport Listener which is used to construct
+        /// server sessions.
+        /// </summary>
+        /// <param name="uri">listener configuration parameters.</param>
+        /// <param name="resources">additional resources needed by the listener.</param>
+        /// <returns>an out-of-band source which may be used to control the listener.</returns>
+        public static Transport<ServerFactory> GetListener(string uri, Resources resources) 
+	    {
+            URL u = new URL(uri);
+            TransportFactory f = GetTransportFactory(u.Scheme);
+            return f.NewListener(uri, resources);
+	    }
+
+        /// <summary>
+        /// Adds any message filters specified on the uri. They are added in order
+        /// from transport to session. The first filter is the session for Messagizer,
+        /// the second is the session for the first, etc. The last filter added is
+        /// returned, and becomes the TransportMessage for what follows.
+        /// </summary>
+        /// <param name="transport"></param>
+        /// <param name="uri"></param>
+        /// <param name="resources"></param>
+        /// <returns>the most recently added filter</returns>
+        protected TransportMessage AddFilters(TransportMessage transport, URL uri, Resources resources)
+        {
+            string s = uri.GetTerm(FILTER);
+            if (s == null || s.Length == 0)
+                return transport;
+
+            StringTokenizer st = new StringTokenizer(s, ",:;| \t\r\n");
+            while (st.HasMoreTokens())
+            {
+                string t = st.NextToken();
+                transport = AddFilter(transport, t, uri, resources);
+            }
+
+            return transport;
+        }
+
+        /// <summary>
+        /// Query term on the transport uri which defines a set of filters which
+        /// process messages as they move up and down the transport stack. Filter
+        /// names are separated by one or more of these characters: ",:;| \t\r\n".
+        /// 
+        /// Usage example: tcp://host:port?filter=KeepAlive,PwAuth
+        /// </summary>
+        public const string FILTER = "filter";
+
+        private TransportMessage AddFilter(TransportMessage transport, string name,
+            URL uri, Resources resources)
+        {
+            string typeName = GetFilter(name);
+
+            if (typeName == null)
+                throw new ArgumentException(
+                    string.Format( "Class '{0}' for filter name '{1}' not defined", typeName, name ) );
+
+            Type type = Type.GetType(typeName);
+
+            ConstructorInfo c = type.GetConstructor(FILTER_PARAMS);
+
+            return (TransportMessage) c.Invoke(new object[] { transport, uri, resources });
+        }
+
+        private readonly static Type[] FILTER_PARAMS = { typeof(TransportMessage), typeof(URL), typeof(Resources) };
+
+        /// <summary>
+        /// Gets the fully qualified type name of the filter.
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns>the fully qualified type name of the filter.</returns>
+        public static string GetFilter(string name)
+        {
+            lock (filters)
+            {
+                string value;
+                return filters.TryGetValue(name, out value) ? value : null;
+            }
+        }
+
+        /// <summary>
+        /// Sets the fully qualified type name of the filter.
+        /// </summary>
+        /// <param name="name"></param>
+        /// <param name="typeName"></param>
+        public static void DefineFilter(string name, string typeName)
+        {
+            lock (filters)
+            {
+                filters.Add(name, typeName);
+            }
+        }
+
+        private static readonly Dictionary<string, string> filters =
+            new Dictionary<string, string>();
+
+        /// <summary>
+        /// Gets the named transport factory.
+        /// </summary>
+        /// <param name="name">the name of a configured transport factory.</param>
+        /// <returns>the named transport factory.</returns>
+        private static TransportFactory GetTransportFactory( string name )
+        {
+            object tfspec = Get(name);
+
+            if (tfspec == null)
+                throw new IOException("transport factory scheme '" + name + "' unknown");
+
+            if (tfspec is string)
+                tfspec = Type.GetType((string)tfspec);
+
+            if (tfspec is Type)
+            {
+                ConstructorInfo c = ((Type)tfspec).GetConstructor(FACTORY_PARAMS);
+                tfspec = c.Invoke(FACTORY_ARGS);
+            }
+
+            if (tfspec is TransportFactory)
+                return (TransportFactory)tfspec;
+
+            throw new ArgumentException(String.Format(
+                "Cannot create an instance of TransportFactory from transport factory name '{0}'", name));
+        }
+
+        private readonly static Type[] FACTORY_PARAMS = { };
+
+        private readonly static object[] FACTORY_ARGS = { };
+
+        public static object Get(string name)
+        {
+            lock (transportFactories)
+            {
+                object value;
+                return transportFactories.TryGetValue(name, out value) ? value : null;
+            }
+        }
+
+
+        /// <summary>
+        /// Puts a named transport factory.
+        /// </summary>
+        /// <param name="name">the uri scheme of this transport factory.</param>
+        /// <param name="tfspec">the transport factory spec to associate with the
+        /// name. This can be an instance of TransportFactory or the name of a subclass
+        /// of TransportFactory to instantiate.</param>
+        public static void Define( string name, object tfspec )
+        {
+            lock (transportFactories)
+            {
+                transportFactories.Add(name, tfspec);
+            }
+        }
+
+        private readonly static Dictionary<string, object> transportFactories =
+            new Dictionary<string, object>();
+
+        static TransportFactory()
+        {
+            Define("tcp", new TcpTransportFactory(false));
+            Define("tls", new TcpTransportFactory(true));
+
+            DefineFilter("KeepAlive", "Org.Apache.Etch.Bindings.Csharp.Transport.Filter.KeepAlive");
+            DefineFilter("PwAuth", "Org.Apache.Etch.Bindings.Csharp.Transport.Filter.PwAuth");
+            DefineFilter("Logger", "Org.Apache.Etch.Bindings.Csharp.Transport.Filter.Logger");
+        }
+	}
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TransportHelper.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TransportHelper.cs
new file mode 100644
index 0000000..c68249c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TransportHelper.cs
@@ -0,0 +1,80 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Class to help construct transport stacks.
+    /// </summary>
+    public class TransportHelper
+    {
+        #region RESOURCES
+
+        /// <summary>
+        /// The Pool to use to execute queued async receiver messages. */
+	    /// </summary>
+        public const String QUEUED_POOL = "QUEUED_POOL";
+    	
+	    /// <summary>
+	    /// The Pool to use to execute free async receiver messages.
+	    /// </summary>
+ 	    public const String FREE_POOL = "FREE_POOL";
+    	
+	    /// <summary>
+	    /// Binary transport format
+	    /// </summary>
+	    public const String BINARY = "binary";
+    	
+	    /// <summary>
+        /// Xml transport format
+	    /// </summary>
+	    public const String XML = "xml";
+
+        #endregion
+
+        #region UTILITIES
+
+        /// <summary>
+        /// Initializes standard resources.
+        /// </summary>
+        /// <param name="resources">some initial values for resources. May be null to accept
+        /// all the defaults.</param>
+        /// <returns>copy of resources initialized with default values for standard items</returns>
+        public static Resources InitResources( Resources resources )
+        {
+            if ( resources == null )
+                resources = new Resources();
+            else
+                resources = new Resources(resources);
+
+            if ( !resources.ContainsKey( QUEUED_POOL ) )
+                resources.Add( QUEUED_POOL, new QueuedPool() );
+
+            if ( !resources.ContainsKey( FREE_POOL ) )
+                resources.Add( FREE_POOL, new FreePool() );
+
+            return resources;
+        }
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TypeValidator.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TypeValidator.cs
new file mode 100644
index 0000000..d0609cb
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/TypeValidator.cs
@@ -0,0 +1,142 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Base class of validators which validate based on exact type.
+    /// </summary>
+    abstract public class TypeValidator : Validator
+    {
+        
+        /// <summary>
+        /// Constructs the TypeValidator.
+        /// </summary>
+        /// <param name="scalarClass">class to use if nDims == 0</param>
+        /// <param name="arrayClass">class to use if nDims > 0</param>
+        /// <param name="nDims">the number of dimensions. 0 for a scalar.</param>
+        /// <param name="descr"></param>
+        public TypeValidator( Type scalarClass, Type arrayClass, int nDims,
+            String descr)
+            : this(scalarClass, arrayClass, nDims, descr, false)
+        {
+          
+        }
+
+        /// <summary>
+        /// Constructs the TypeValidator.
+        /// </summary>
+        /// <param name="scalarClass">class to use if nDims == 0</param>
+        /// <param name="arrayClass">class to use if nDims > 0</param>
+        /// <param name="nDims">the number of dimensions. 0 for a scalar.</param>
+        /// <param name="descr"></param>
+        /// <param name="subclassOk">true of a subclass of the expected class is ok</param>
+        public TypeValidator(Type scalarClass, Type arrayClass, int nDims,
+            String descr, bool subclassOk)
+        {
+            CheckDims(nDims);
+
+            this.expectedClass = MkExpectedClass(scalarClass, arrayClass, nDims);
+            this.nDims = nDims;
+            this.descr = descr;
+            this.subclassOk = subclassOk;
+        }
+
+        /// <summary>
+        /// Checks the number of dimensions for standard validators.
+        /// </summary>
+        /// <param name="nDims"></param>
+        public static void CheckDims( int nDims )
+        {
+            if ( nDims < 0 || nDims > MAX_NDIMS )
+                throw new ArgumentOutOfRangeException( "nDims < 0 || nDims > MAX_NDIMS" );
+        }
+
+        private Type expectedClass;
+
+        /// <summary>
+        /// number of dimensions if this is an array
+        /// </summary>
+        protected int nDims;
+
+        protected bool subclassOk;
+
+        public int GetNDims()
+        {
+            return nDims;
+        }
+
+        private String descr;
+
+        public Type GetExpectedClass()
+        {
+            return expectedClass;
+        }
+
+        public override string ToString()
+        {
+            return descr;
+        }
+
+        public override bool Validate( object value )
+        {
+            if (value == null)
+                return false;
+            Type clss = value.GetType();
+          
+            if (clss == expectedClass)
+                return true;
+     
+            return subclassOk && expectedClass.IsAssignableFrom(clss);
+        }
+
+        public override object ValidateValue(object value)
+        {
+            if (Validate(value))
+                return value;
+
+            throw new Exception("value not appropriate for " + descr + ": " + value);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="scalarClass">class to use if nDims == 0</param>
+        /// <param name="arrayClass">class to use if nDims > 0</param>
+        /// <param name="nDims">number of dimensions, 0 for scalar</param>
+        /// <returns>an appropriate class given nDims.</returns>
+        /// 
+        private static Type MkExpectedClass( Type scalarClass, Type arrayClass, int nDims )
+        {
+            if ( nDims == 0 )
+                return scalarClass;
+
+            Array tempArray = Array.CreateInstance( arrayClass, 1 );
+            // Note: About C# jagged arrays
+            // 
+            for ( int i = 0; i < ( nDims - 1 ); i++ )
+                tempArray =  Array.CreateInstance( tempArray.GetType(), 1 );
+
+            return tempArray.GetType();
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_RuntimeException.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_RuntimeException.cs
new file mode 100644
index 0000000..06b01b6
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_RuntimeException.cs
@@ -0,0 +1,65 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for Runtime Exceptions
+    /// </summary>
+    public class Validator_RuntimeException : Validator
+    {
+        /// <summary></summary>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_RuntimeException Get()
+        {
+            if ( validator == null )
+                validator = new Validator_RuntimeException();
+
+            return validator;
+        }
+
+        private static Validator_RuntimeException validator;
+
+        public Validator_RuntimeException()
+        {
+            // nothing to do
+        }
+
+        public override Validator ElementValidator()
+        {
+            throw new Exception( "not an array" );
+        }
+
+        public override bool Validate( object value )
+        {
+            return ( value is Exception );
+        }
+
+        public override object ValidateValue(object value)
+        {
+            if (Validate(value))
+                return value;
+
+            throw new Exception("value not appropriate for RuntimeException: " + value);
+        }      
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_StructValue.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_StructValue.cs
new file mode 100644
index 0000000..d1ef4a0
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_StructValue.cs
@@ -0,0 +1,63 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for structvalue
+    /// </summary>
+    public class Validator_StructValue : TypeValidator
+    {
+        public static Validator_StructValue Get(XType type, int nDims)
+        {
+            CheckDims(nDims);          
+            return new Validator_StructValue(type,nDims);
+        }
+
+       
+
+        private Validator_StructValue(XType type, int nDims)
+            : base( typeof( StructValue ), typeof( StructValue ), nDims, string.Format("StructValue[{0},{1}]",type,nDims) )
+        {
+            this.type = type;
+        }
+
+        private XType type;
+
+        public XType GetXType()
+        {
+            return type;
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get(type, nDims - 1);
+        }
+
+        public override bool Validate( object value )
+        {
+            return
+                base.Validate(value) &&
+                (value.GetType() != typeof (StructValue) || type.IsAssignableFrom(((StructValue) value).GetXType));
+ 
+        }     
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_boolean.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_boolean.cs
new file mode 100644
index 0000000..f60b541
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_boolean.cs
@@ -0,0 +1,68 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for Boolean
+    /// </summary>
+    public class Validator_boolean : TypeValidator
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_boolean Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_boolean( nDims );
+
+            Validator_boolean v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_boolean( nDims );
+
+            return v;
+        }
+
+        private static Validator_boolean[] validators = new Validator_boolean[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_boolean( int nDims )
+            : base( typeof( bool ), typeof( bool ), nDims, "boolean["+nDims+"]" )
+        { 
+        }
+
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+
+       
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_byte.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_byte.cs
new file mode 100644
index 0000000..532b386
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_byte.cs
@@ -0,0 +1,109 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for byte
+    /// </summary>
+    public class Validator_byte : TypeValidator
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="nDims">number of dimensions. 0 for scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_byte Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_byte( nDims );
+
+            Validator_byte v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_byte( nDims );
+
+            return v;
+        }
+
+        private static Validator_byte[] validators = new Validator_byte[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_byte( int nDims )
+            : base( typeof( sbyte ), typeof( sbyte ), nDims, "byte["+nDims+"]" )
+        {
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+      	    
+	    public override bool Validate( object value )
+	    {
+		    if (nDims > 0)
+			   return base.Validate(value);
+		
+		    if (value == null)
+			    return false;
+
+            if (value.GetType() == typeof(sbyte))
+			    return true;
+		
+		    if (value.GetType() == typeof(short))
+		    {
+			    short v = (short) value;
+			    return v >= SByte.MinValue && v <= SByte.MaxValue;
+               
+		    }
+		
+		   if (value.GetType() == typeof(Int32))
+		    {
+			    int v = (Int32) value;
+			    return v >= SByte.MinValue && v <= SByte.MaxValue;
+		    }
+		
+		   if (value.GetType() == typeof(long))
+		   {
+			    long v = (long) value;
+			    return v >= SByte.MinValue && v <= SByte.MaxValue;
+		    }
+		
+		    return false;
+	    }
+		
+	    public override object ValidateValue( object value )
+	    {
+		    value = base.ValidateValue(value);
+		
+		    if ((value.GetType() == typeof(sbyte)) || nDims > 0)
+			    return value;
+
+            return Convert.ToSByte(value);
+	    }      
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_custom.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_custom.cs
new file mode 100644
index 0000000..ec7a9b6
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_custom.cs
@@ -0,0 +1,129 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for custom type
+    /// </summary>
+    public class Validator_custom : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="clss">Class of the custom type</param>
+        /// <param name="nDims">number of dimensions. 0 for scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator Get( Type clss, int nDims, bool subclassOk )
+        {
+            CheckDims( nDims );
+
+            if ( nDims > MAX_CACHED )
+                return new Validator_custom( clss, nDims, subclassOk );
+
+            Key key = new Key(clss, nDims, subclassOk);
+            Validator v = null;
+            
+            try
+            {
+                 v = validators[key];
+            }
+            catch(Exception)
+            {
+                v = null;
+            }
+
+            if (v == null)
+            {
+                v = new Validator_custom(clss, nDims, subclassOk);
+                validators.Add(key, v);
+            }
+
+            return v;
+
+        }
+
+
+        private  class Key
+	    {
+		    public Key( Type clss, int dims, bool subclassOk )
+		    {
+			    this.clss = clss;
+			    this.dims = dims;
+			    this.subclassOk = subclassOk;
+		    }
+		
+		    private Type clss;
+		
+		    private int dims;
+		
+		    private bool subclassOk;
+		
+		
+		    public override int GetHashCode()
+		    {
+			    return clss.GetHashCode() ^ (dims * 9131) ^ (subclassOk ? 21357 : 8547);
+		    }
+		
+	
+		    public override bool Equals( Object obj )
+		    {
+			    if (obj == this)
+				    return true;
+			
+			    if (obj == null)
+				    return false;
+			
+			    if (obj.GetType() != GetType())
+				    return false;
+			
+			    Key other = (Key) obj;
+			
+			    return other.clss.Equals( clss)
+				    && other.dims == dims
+				    && other.subclassOk == subclassOk;
+		    }
+	    }
+
+        private static Dictionary<Key, Validator> validators = 
+            new Dictionary<Key, Validator>();
+
+        /// <summary>
+        /// Constructs the validator
+        /// </summary>
+        /// <param name="clss">the class of the custom type</param>
+        /// <param name="nDims">the number of dimensions. 0 for scalar. </param>
+        private Validator_custom( Type clss, int nDims, bool subclassOk )
+            : base(clss, clss, nDims, subclassOk ? clss.ToString() + "[" + nDims + "]*" : clss.ToString() + "[" + nDims + "]", subclassOk)
+        {
+            this.clss = clss;
+        }
+
+        private Type clss;
+
+        public override Validator ElementValidator()
+        {
+            return Get( clss, nDims - 1, subclassOk );
+        }
+
+        
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_double.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_double.cs
new file mode 100644
index 0000000..48635e4
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_double.cs
@@ -0,0 +1,65 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for double
+    /// </summary>
+    public class Validator_double : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_double Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_double( nDims );
+
+            Validator_double v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_double( nDims );
+
+            return v;
+        }
+
+        private static Validator_double[] validators = new Validator_double[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_double( int nDims )
+            : base( typeof( Double ), typeof( double ), nDims, "double["+nDims+"]" )
+        { 
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+       
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_float.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_float.cs
new file mode 100644
index 0000000..9744b8f
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_float.cs
@@ -0,0 +1,62 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class Validator_float : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_float Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_float( nDims );
+
+            Validator_float v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_float( nDims );
+
+            return v;
+        }
+
+        private static Validator_float[] validators = new Validator_float[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_float( int nDims )
+            : base( typeof( float ), typeof( float ), nDims, "float["+nDims+"]" )
+        { 
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+
+        
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_int.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_int.cs
new file mode 100644
index 0000000..af5b05c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_int.cs
@@ -0,0 +1,99 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for int
+    /// </summary>
+    public class Validator_int : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_int Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_int( nDims );
+
+            Validator_int v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_int( nDims );
+
+            return v;
+        }
+
+        private static Validator_int[] validators = new Validator_int[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_int( int nDims )
+            : base( typeof( int ), typeof( int ), nDims, "int["+nDims+"]" )
+        { 
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+
+       
+	    public override bool Validate( object value )
+	    {
+		    if (nDims > 0)
+			return base.Validate( value );
+		
+		    if (value == null)
+			    return false;
+		
+		    Type type = value.GetType();
+		
+		    if ( type == typeof(Int32) || type == typeof(Int16) || type == typeof(sbyte) )
+			    return true;
+		
+		    if (type == typeof(long))
+		    {
+			    long v = (long) value;
+			    return v >= Int32.MinValue && v <= Int32.MaxValue;
+		    }
+		
+		    return false;
+	    }
+	
+	
+	    public override object  ValidateValue( object value )
+	    {
+		    value = base.ValidateValue( value );
+		
+		    if ( value.GetType() == typeof(Int32) || nDims > 0)
+			 return value;
+			   
+            return Convert.ToInt32(value);
+    	}
+       
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_long.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_long.cs
new file mode 100644
index 0000000..e8056dc
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_long.cs
@@ -0,0 +1,92 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for long
+    /// </summary>
+    public class Validator_long : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_long Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_long( nDims );
+
+            Validator_long v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_long( nDims );
+
+            return v;
+        }
+
+        private static Validator_long[] validators = new Validator_long[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_long( int nDims )
+            : base( typeof( long ), typeof( long ), nDims, "long["+nDims+"]" )
+        { 
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+
+        
+	    public override bool Validate( object value )
+	    {
+		    if (nDims > 0)
+			    return base.Validate( value );
+		
+		    if (value == null)
+			    return false;
+		
+		    Type type = value.GetType();
+		
+		    return type == typeof(long) || type == typeof(Int32) ||
+			type == typeof(short) || type == typeof(sbyte);
+	    }
+	
+	   
+	    public override object ValidateValue( object value )
+	    {
+		    value = base.ValidateValue( value );
+		
+		    if (value.GetType() == typeof(long) || nDims > 0)
+			    return value;
+
+            return Convert.ToInt64(value);
+	    }
+
+      
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_object.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_object.cs
new file mode 100644
index 0000000..6a19e8d
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_object.cs
@@ -0,0 +1,55 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class Validator_object : TypeValidator
+    {
+
+        private static Validator_object[] validators = new Validator_object[MAX_CACHED];
+
+        public override Validator ElementValidator()
+        {
+            return nDims > 0 ? Get(nDims - 1) : this;
+        }
+
+        private Validator_object(int nDims)
+            : base(typeof (object), typeof (object), nDims, string.Format("object[{0}]", nDims), true)
+        {
+            
+        }
+
+        public static Validator_object Get( int nDims )
+        {
+            CheckDims(nDims);
+
+            if (nDims >= validators.Length)
+                return new Validator_object(nDims);
+
+            Validator_object v = validators[nDims];
+
+            if ( v == null )
+                v=validators[nDims]= new Validator_object(nDims);
+
+            return v;
+        }      
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_short.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_short.cs
new file mode 100644
index 0000000..89f063a
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_short.cs
@@ -0,0 +1,106 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for short
+    /// </summary>
+    public class Validator_short : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_short Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_short( nDims );
+
+            Validator_short v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_short( nDims );
+
+            return v;
+        }
+
+        private static Validator_short[] validators = new Validator_short[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_short( int nDims )
+            : base( typeof( short ), typeof( short ), nDims, "short["+nDims+"]" )
+        { 
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+
+       
+	    public override bool Validate( object value )
+	    {
+		    if (nDims > 0)
+			    return base.Validate( value );
+    		
+		    if (value == null)
+			    return false;
+    		
+		    Type type = value.GetType();
+    		
+		    if ( type == typeof(short) || type == typeof(sbyte))
+			    return true;
+    		
+		    if (type == typeof(Int32))
+		    {
+			    int v = (Int32) value;
+			    return v >= short.MinValue&& v <= short.MaxValue;
+		    }
+    		
+		    if (type == typeof(long))
+		    {
+			    long v = (long) value;
+			    return v >= short.MinValue && v <= short.MaxValue;
+		    }
+    		
+		    return false;
+	    }
+	
+	
+	    public override object ValidateValue( object value )
+	    {
+		    value = base.ValidateValue( value );
+    		
+		    if (value.GetType() == typeof(short) || nDims > 0)
+			    return value;
+
+            return Convert.ToInt16(value);
+	    }
+
+       
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_string.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_string.cs
new file mode 100644
index 0000000..f7dadc3
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_string.cs
@@ -0,0 +1,65 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for strings
+    /// </summary>
+    public class Validator_string : TypeValidator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">number of dimensions. 0 for a scalar.</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_string Get( int nDims )
+        {
+            CheckDims( nDims );
+
+            if ( nDims >= validators.Length )
+                return new Validator_string( nDims );
+
+            Validator_string v = validators[ nDims ];
+
+            if ( v == null )
+                v = validators[ nDims ] = new Validator_string( nDims );
+
+            return v;
+        }
+
+        private static Validator_string[] validators = new Validator_string[ MAX_CACHED ];
+
+        /// <summary>
+        /// Constructs the validator.
+        /// </summary>
+        /// <param name="nDims"></param>
+        private Validator_string( int nDims )
+            : base( typeof( string ), typeof( string ), nDims, "string["+nDims+"]" )
+        { 
+        }
+
+        public override Validator ElementValidator()
+        {
+            return Get( nDims - 1 );
+        }
+
+        
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_void.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_void.cs
new file mode 100644
index 0000000..5534682
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/Validator_void.cs
@@ -0,0 +1,69 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Support
+{
+    /// <summary>
+    /// Validator for void
+    /// </summary>
+    public class Validator_void : Validator
+    {
+        /// <summary></summary>
+        /// <param name="nDims">the number of dimensions. 0 for scalar</param>
+        /// <returns>an instance of the validator</returns>
+        public static Validator_void Get( int nDims )
+        {
+            if ( nDims != 0 )
+                throw new ArgumentException( "nDims != 0" );
+
+            if ( validator == null )
+                validator = new Validator_void();
+
+            return validator;
+        }
+
+        private static Validator_void validator;
+
+        private Validator_void()
+        {
+            // nothing to do
+        }
+
+        public override Validator ElementValidator()
+        {
+            return null;
+        }
+
+        public override bool Validate( object value )
+        {
+            return value == null;
+        }
+
+        public override object ValidateValue(object value)
+        {
+            if (Validate(value))
+                return value;
+
+            throw new Exception("value not appropriate for void: " + value);
+        }      
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/_Etch_AuthException.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/_Etch_AuthException.cs
new file mode 100644
index 0000000..de09419
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/_Etch_AuthException.cs
@@ -0,0 +1,35 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Support
+{
+    public class _Etch_AuthException : _Etch_RuntimeException
+    {
+        public _Etch_AuthException()
+        {
+            // dont initialize anything
+        }
+
+        public _Etch_AuthException( String msg ) : base( msg )
+        {
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/_Etch_RuntimeException.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/_Etch_RuntimeException.cs
new file mode 100644
index 0000000..908a097
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/_Etch_RuntimeException.cs
@@ -0,0 +1,74 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Support
+{
+
+    /// <summary>
+    /// Constructs the EtchRuntimeException. Don't init anything.
+    /// 
+    /// Some common runtime exceptions are:
+    /// 
+    /// ArgumentException
+    /// ArgumentNullException
+    /// ArgumentOutOfRangeException
+    /// ArithmeticException
+    /// DivideByZeroException
+    /// IndexOutOfRangeException
+    /// InvalidCastException
+    /// NotImplementedException
+    /// NotSupportedException
+    /// NullReferenceException
+    /// OverflowException
+    /// </summary>
+    public class _Etch_RuntimeException
+        : Exception
+    {
+        /// <summary>
+        /// Constructs the EtchRuntimeException. Don't init anything.
+        /// </summary>
+        public _Etch_RuntimeException()
+        {
+            // don't init anything.
+        }
+
+       /// <summary>Constructs the EtchRuntimeException</summary>
+       /// <param name = "msg">msg description of the exception that was caught by the stub on the remote side.</param>
+        public _Etch_RuntimeException(String msg)
+        {
+            this.msg = msg;
+        }
+
+       
+        public String GetMessage()
+        {
+            return msg;
+        }
+
+        /// <summary>Description of the exception that was caught by the stub on the remote side. </summary>
+        public String msg;
+
+        public override string ToString()
+        {
+            return "Remote side threw this runtime exception: " + GetMessage();
+        }
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/ArrayValue.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/ArrayValue.cs
new file mode 100644
index 0000000..76aa8b3
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/ArrayValue.cs
@@ -0,0 +1,188 @@
+// $Id$
+// 
+// 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;
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+
+/// <summary>An array of values, where each value is of arbitrary type
+/// chosen from the basic java types boolean, byte, short, int,
+/// long, float, double, String, an array of those, the extended
+/// types ArrayValue and StructValue, and specific types supported
+/// by ValueFactory. 
+/// 
+/// ArrayValue is not protected against concurrent access. </summary>
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+
+    public class ArrayValue : IEnumerable
+    {
+        /// <summary>Constructs the ArrayValue.</summary>
+        public ArrayValue( Object array, sbyte typecode, XType customStructType, int dim )
+        {
+            if ( array == null )
+                throw new NullReferenceException( "array == null" );
+
+            if ( !( ( array.GetType() ).IsArray ) )
+                throw new ArgumentException( "object is not of type array" );
+
+            this.array = array;
+            this.typecode = typecode;
+		    this.CustomStructType = customStructType;
+		    this.Dim = dim;
+        }
+
+        /// <summary>
+        /// Constructs the arrayvalue without any type information
+        /// </summary>
+        public ArrayValue( Object array ) : this( array, ( sbyte ) 0, null, 0 )
+        {
+        }
+
+        private Object array;
+        private sbyte typecode;
+        private XType customStructType;
+        private int dim;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the TypeCode for this array value.
+        /// For example, if the array is int[][], then
+        /// the type would be TypeCode.INT4.
+        /// </returns>
+        public sbyte Type
+        {
+            get
+            {
+                return typecode;
+            }
+            set
+            {
+                typecode = value;
+            }
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>a struct type if a custom type code.</returns>
+        public XType CustomStructType
+        {
+            get
+            {
+                return customStructType;
+            }
+            private set
+            {
+                customStructType = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the dimsionality of the array.
+        /// For example, if the array is int[][], the
+        /// dimensionality would be 2.</returns>
+        public int Dim
+        {
+            get
+            {
+                return dim;
+            }
+            private set
+            {
+                dim = value;
+            }
+        }
+
+        public int Size()
+        {
+            return ( ( Array ) array ).Length;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns>the element at the specified index</returns>
+        public Object Get( int index )
+        {
+            return ( ( Array ) array ).GetValue( index );
+        }
+
+        /// <summary>
+        /// Reallocates the array so that it is only as long as needed.
+        /// </summary>
+        public void Compact()
+        {
+            if ( addIndex == Size() )
+                return;
+
+            Object narray = Array.CreateInstance( array.GetType().GetElementType(), addIndex );
+            Array.Copy( (Array)array, (Array)narray, addIndex );
+            array = narray;
+        }
+
+        /// <summary>
+        /// Adds the value to the end of the array, making more space
+        /// if needed
+        /// </summary>
+        /// <param name="value"></param>
+        public void Add( Object value )
+        {
+            int n = Size();
+
+            if ( addIndex >= n )
+            {
+                if ( n == 0 )
+                    n = 8;
+                else
+                    n *= 2;
+
+                Object narray = Array.CreateInstance( array.GetType().GetElementType(), n );
+                Array.Copy( (Array)array, (Array)narray, ( ( Array ) array ).Length );
+                array = narray;
+            }
+            ( ( Array ) array ).SetValue( value, addIndex++ );
+        }
+
+        private int addIndex;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the array</returns>
+        public Object GetArray()
+        {
+            return array;
+        }
+
+
+        #region IEnumerable Members
+
+        public IEnumerator GetEnumerator()
+        {
+            return ( ( Array ) array ).GetEnumerator();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/DefaultDeliveryService.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/DefaultDeliveryService.cs
new file mode 100644
index 0000000..f740ca8
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/DefaultDeliveryService.cs
@@ -0,0 +1,249 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    public class DefaultDeliveryService : DeliveryService
+    {
+        public DefaultDeliveryService(MailboxManager transport, string uri, Resources resources)
+            : this(transport, new URL(uri), resources)
+        {
+        }
+
+
+        public DefaultDeliveryService(MailboxManager transport, URL uri, Resources resources)
+        {
+            this.transport = transport;
+            transport.SetSession(this);
+            disableTimeout = uri.GetBooleanTerm(DISABLE_TIMEOUT, false);
+        }
+
+        
+        /// <summary>
+        /// Parameter to Globally Disable Timeout.
+        /// </summary>
+        
+        public const string DISABLE_TIMEOUT = "DefaultDeliveryService.disableTimeout";
+        
+        
+        private bool disableTimeout = false;
+
+
+        private SessionMessage _stub;
+
+        private MailboxManager transport;
+
+        
+
+        /// <summary>
+        /// Removes all the stubs in the set of stubs
+        /// </summary>
+        public void RemoveStub()
+        {
+            _stub = null;
+        }
+
+        public Object SessionQuery(object query)
+        {
+            if (_stub != null)
+                return _stub.SessionQuery(query);
+
+            throw new NotSupportedException("unknown query: " + query);
+        }
+
+        public void SessionControl(Object control, Object value)
+        {
+            if (_stub != null)
+                _stub.SessionControl(control, value);
+
+            throw new NotSupportedException("unknown control: " + control);
+        }
+
+        public void SessionNotify(Object eventObj)
+        {
+            if (eventObj is string)
+            {
+                string stringObj = (string) eventObj;
+                if (stringObj == SessionConsts.UP)
+                {
+                    status.Set(SessionConsts.UP);
+                }
+                else if (stringObj == SessionConsts.DOWN)
+                {
+                    status.Set(SessionConsts.DOWN);
+                }
+                
+            }
+           
+                _stub.SessionNotify(eventObj);
+                
+  
+            
+
+        }
+
+        private Monitor<string> status = new Monitor<string>("session status");
+
+       
+        public Object TransportQuery(Object query)
+        {
+            if(query.GetType() == typeof(TransportConsts.WaitUp))
+            {
+                waitUp(((TransportConsts.WaitUp) query)._maxDelay);
+                return null;
+            }
+            else if (query.GetType() == typeof(TransportConsts.WaitDown))
+            {
+                waitDown(((TransportConsts.WaitDown)query)._maxDelay);
+                return null;
+            }
+            else
+            {
+                return transport.TransportQuery(query);
+            }
+
+        }
+
+        private void waitUp(int maxDelay)
+        {
+            status.WaitUntilEq(SessionConsts.UP,maxDelay);
+        }
+
+        private void waitDown(int maxDelay)
+        {
+            status.WaitUntilEq(SessionConsts.DOWN, maxDelay);
+        }
+
+        public void TransportControl(Object control, Object value)
+        {
+            if (control is string)
+            {
+                string stringObj = (string) control;
+
+                if (stringObj == TransportConsts.START_AND_WAIT_UP)
+                {
+                    transport.TransportControl(TransportConsts.START, null);
+                    waitUp((int) value);
+                }
+                else if (stringObj == TransportConsts.STOP_AND_WAIT_DOWN)
+                {
+                    transport.TransportControl(TransportConsts.STOP,null);
+                    waitDown((int)value);
+                }
+                else
+                {
+                    transport.TransportControl(control, value);
+                }       
+            }
+            else
+            {
+                transport.TransportControl(control, value); 
+            }
+           
+        }
+
+        public void TransportNotify(Object eventObj)
+        {
+            transport.TransportNotify(eventObj);
+        }
+
+       
+
+        public Mailbox BeginCall(Message msg)
+        {
+            return transport.TransportCall(null, msg);
+        }
+
+        public Object EndCall(Mailbox mb, XType responseType)
+        {
+            try
+            {
+                int timeout = disableTimeout ? 0 : responseType.Timeout;
+                Element mbe = mb.Read(timeout);
+                if (mbe == null)
+                    throw new TimeoutException("timeout waiting for " + responseType);
+                Message rmsg = mbe.msg;
+                rmsg.CheckType(responseType);
+                Object r = rmsg.Get(responseType.ResponseField);
+                if (r is Exception)
+                {
+                    Exception e = (Exception)r;
+                    throw e;
+                }
+                return r;
+            }
+            finally
+            {
+                mb.CloseRead();
+            }
+        }
+
+        public override string ToString()
+        {
+            return transport.ToString();
+        }
+
+    
+
+     
+        #region SessionMessage Members
+
+        public bool SessionMessage(Who sender, Message msg)
+        {
+           return  _stub.SessionMessage(sender, msg);
+        }
+
+        /// <summary>
+        /// Adds a stub to a list of stub
+        /// </summary>
+        /// <param name="stb"></param>
+        public void SetSession(SessionMessage stb)
+        {
+            if (_stub != null)
+                throw new Exception("Unsupported -- only one stub for now");
+            _stub = stb;
+        }
+
+        #endregion
+
+        #region TransportMessage Members
+
+        public void TransportMessage(Who recipient, Message msg)
+        {
+            transport.TransportMessage(recipient,msg);
+        }
+
+        #endregion
+
+        #region Transport<SessionMessage> Members
+
+
+        public SessionMessage GetSession()
+        {
+            return _stub;
+        }
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/AbstractMessageFilter.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/AbstractMessageFilter.cs
new file mode 100644
index 0000000..532c62c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/AbstractMessageFilter.cs
@@ -0,0 +1,131 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Filter
+{
+    abstract public class AbstractMessageFilter : TransportMessage, SessionMessage
+    {
+        protected AbstractMessageFilter(TransportMessage transport, URL uri, Resources resources)
+        {
+            this.transport = transport;
+            transport.SetSession(this);
+        }
+
+        /// <summary>
+        /// Our transport.
+        /// </summary>
+        protected readonly TransportMessage transport;
+
+        /// <summary>
+        /// Returns a string such as "Filter/"+transport.
+        /// </summary>
+        /// <returns>a string such as "Filter/"+transport.</returns>
+        abstract public override string ToString();
+
+        public virtual void TransportMessage(Who recipient, Message msg)
+        {
+            transport.TransportMessage(recipient, msg);
+        }
+
+        public SessionMessage GetSession()
+        {
+            return session;
+        }
+
+        public void SetSession(SessionMessage session)
+        {
+            this.session = session;
+        }
+
+        /// <summary>
+        /// Our session.
+        /// </summary>
+        protected SessionMessage session;
+
+        public virtual object TransportQuery(object query)
+        {
+            return transport.TransportQuery(query);
+        }
+
+        public virtual void TransportControl(object control, object value)
+        {
+            transport.TransportControl(control, value);
+        }
+
+        public void TransportNotify(object evnt)
+        {
+            transport.TransportNotify(evnt);
+        }
+
+        public virtual bool SessionMessage(Who sender, Message msg)
+        {
+            return session.SessionMessage(sender, msg);
+        }
+
+        public object SessionQuery(object query)
+        {
+            return session.SessionQuery(query);
+        }
+
+        public void SessionControl(object control, object value)
+        {
+            session.SessionControl(control, value);
+        }
+
+        public void SessionNotify(object evnt)
+        {
+            if (evnt == (object) SessionConsts.UP)
+                if (!SessionUp())
+                    return;
+
+            if (evnt == (object) SessionConsts.DOWN)
+                if (!SessionDown())
+                    return;
+
+            session.SessionNotify(evnt);
+        }
+
+        /**
+         * Tells the filter that the session is up.
+         * @return true if the event should be passed on to our session, false
+         * if it should be swallowed.
+         * @throws Exception 
+         */
+        protected virtual bool SessionUp()
+        {
+            // nothing to do.
+            return true;
+        }
+
+        /**
+         * Tells the filter that the session is down.
+         * @return true if the event should be passed on to our session, false
+         * if it should be swallowed.
+         * @throws Exception 
+         */
+        protected virtual bool SessionDown()
+        {
+            // nothing to do.
+            return true;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/KeepAlive.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/KeepAlive.cs
new file mode 100644
index 0000000..1c66192
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/KeepAlive.cs
@@ -0,0 +1,308 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Filter
+{
+    public class KeepAlive : AbstractMessageFilter, AlarmListener
+    {
+
+
+        public const String DELAY = "KeepAlive.delay";
+
+
+        public const String COUNT = "KeepAlive.count";
+
+        public KeepAlive(TransportMessage transport, URL uri, Resources resources)
+            : base(transport, uri, resources)
+        {
+
+            delay = uri.GetIntegerTerm(DELAY, 15);
+            if (delay <= 0)
+                throw new ArgumentException("delay <= 0");
+
+            count = uri.GetIntegerTerm(COUNT, 4);
+            if (count <= 0)
+                throw new ArgumentException("count <= 0");
+
+            server = (Boolean) transport.TransportQuery(TransportConsts.IS_SERVER);
+
+            //		Log.report( "KeepAliveInstalled",
+            //			"delay", delay, "count", count, "server", server );
+
+            vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY);
+
+            mf_delay = new Field("delay");
+            mf_count = new Field("count");
+
+            mt_request = new XType("_Etch_KeepAliveReq");
+            mt_request.PutValidator(mf_delay, Validator_int.Get(0));
+            mt_request.PutValidator(mf_count, Validator_int.Get(0));
+            vf.AddType(mt_request);
+
+            mt_response = new XType("_Etch_KeepAliveResp");
+            vf.AddType(mt_response);
+
+            mt_request.SetResult(mt_response);
+        }
+
+        private int delay;
+
+        private int count;
+
+        private readonly bool server;
+
+        private readonly ValueFactory vf;
+
+        private readonly Field mf_delay;
+
+        private readonly Field mf_count;
+
+        private readonly XType mt_request;
+
+        private readonly XType mt_response;
+
+        public int GetDelay()
+        {
+            return delay;
+        }
+
+        public int GetCount()
+        {
+            return count;
+        }
+
+       
+        public bool GetServer()
+        {
+            return server;
+        }
+
+
+        public override bool SessionMessage(Who sender, Message msg)
+        {
+            if (msg.IsType(mt_request))
+            {
+                handleRequest(msg);
+                return true;
+            }
+
+            if (msg.IsType(mt_response))
+            {
+                handleResponse(msg);
+                return true;
+            }
+
+            return base.SessionMessage(sender, msg);
+        }
+
+
+
+        protected override bool SessionUp()
+        {
+            //		Log.report( "KeepAliveSessionUp", "server", server );
+            up = true;
+            AlarmManager.staticAdd(this, null, delay * 1000);
+            tickle();
+            return true;
+        }
+
+        protected override bool SessionDown()
+        {
+            //		Log.report( "KeepAliveSessionDown", "server", server );
+            up = false;
+            AlarmManager.staticRemove(this);
+            return true;
+        }
+
+        private bool up;
+
+        private void handleRequest(Message msg)
+        {
+            if (!server)
+            {
+                // we're a client that got a request, likely we're talking to a
+                // server that is confused.
+                return;
+            }
+
+            //Log.report( "GotKeepAliveReq", "msg", msg );
+           // Console.WriteLine("GotKeepAliveReq:Msg " + msg);
+
+            int? d = (int?)msg.Get(mf_delay);
+            if (d != null && d.Value > 0)
+            {
+               //Console.WriteLine("KeepAliveResetDelay delay " +  d );
+                delay = d.Value;
+            }
+
+            int? c = (int?)msg.Get(mf_count);
+            if (c != null && c.Value > 0)
+            {
+               // Console.WriteLine( "KeepAliveResetCount count " + c );
+                count = c.Value;
+            }
+
+            tickle();
+
+            sendKeepAliveResp(msg);
+        }
+
+        private void handleResponse(Message msg)
+        {
+            if (server)
+            {
+                // we're a server that got a response, which means either we sent
+                // a request (but we shouldn't do that if we're a server) or the
+                // client is confused.
+                return;
+            }
+
+            //Log.report( "GotKeepAliveResp", "msg", msg );
+            //Console.WriteLine(" GotKeepAliveResp: msg " + msg);
+
+            tickle();
+        }
+
+        private void tickle()
+        {
+            //	lastTickle = Timer.GetNanos();
+      //      lastTickle = HPTimer.Now();
+            lastTickle = HPTimer.Now();
+        }
+
+        private long lastTickle;
+
+        private void checkTickle()
+        {
+           
+
+            long ms = HPTimer.MillisSince(lastTickle);
+            //		Log.report( "KeepAliveIdle", "ms", ms, "server", server );
+            if (ms >= count * delay * 1000)
+            {
+                try
+                {
+                    //				Log.report( "KeepAliveReset", "server", server );
+                    session.SessionNotify("KeepAlive resetting dead connection");
+                    transport.TransportControl(TransportConsts.RESET, 0);
+                }
+                catch (Exception e)
+                {
+                    reportError(e);
+                }
+            }
+        }
+
+        private void sendKeepAliveReq()
+        {
+            Message msg = new Message(mt_request, vf);
+            msg.Add(mf_delay, delay);
+            msg.Add(mf_count, count);
+            try
+            {
+                //		Log.report( "SendKeepAliveReq", "msg", msg );
+                transport.TransportMessage(null, msg);
+            }
+            catch (Exception e)
+            {
+                reportError(e);
+            }
+        }
+
+        private void sendKeepAliveResp(Message msg)
+        {
+            Message rmsg = msg.Reply();
+            try
+            {
+                //Log.report( "SendKeepAliveResp", "rmsg", rmsg );
+                transport.TransportMessage(null, rmsg);
+            }
+            catch (Exception e)
+            {
+                reportError(e);
+            }
+        }
+
+        public int Wakeup(AlarmManager manager, Object state, long due)
+        {
+            //		Log.report( "KeepAliveWakeup", "server", server );
+
+            if (!up)
+                return 0;
+
+            if (!server)
+            {
+                TodoManager.AddTodo(new MyTodo(sendKeepAliveReq, reportError));
+            }
+
+            checkTickle();
+
+            return delay * 1000;
+        }
+
+        private void reportError(Exception e)
+        {
+            try
+            {
+                session.SessionNotify(e);
+            }
+            catch (Exception e1)
+            {
+                Console.WriteLine(e1);
+            }
+        }
+
+        public override string ToString()
+        {
+            return "KeepAlive/" + transport;
+        }
+    }
+
+    public class MyTodo : Todo
+    {
+        public delegate void doit();
+
+        public delegate void report(Exception e);
+
+        public MyTodo(doit d, report r)
+        {
+            this.d = d;
+            this.r = r;
+        }
+
+        private readonly doit d;
+
+        private readonly report r;
+
+        public void Doit(TodoManager mgr)
+        {
+            d();
+        }
+
+        public void Exception(TodoManager mgr, Exception e)
+        {
+            r(e);
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/Logger.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/Logger.cs
new file mode 100644
index 0000000..3ff9ede
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/Logger.cs
@@ -0,0 +1,166 @@
+// $Id$
+// 
+// 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.Globalization;
+using System.IO;
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Filter
+{
+    public class Logger : AbstractMessageFilter
+    {
+
+        private const String FILE_PATH = "Logger.filePath";
+
+        private String fileName = null;
+
+        private TextWriter writer = null;
+
+        public static bool testFlag = false;
+
+        private string testRenamedFileName = null;
+
+        enum Direction
+        {
+            UP, DOWN
+        }
+
+        public Logger(TransportMessage transport, URL uri, Resources resources)
+            : base(transport, uri, resources)
+        {
+            InitializeLogger(uri);
+           
+        }
+
+        private void InitializeLogger(URL uri)
+        {
+            string newFullFileName;
+            fileName = uri.GetTerm(FILE_PATH);
+            if (fileName == null)
+            {
+                fileName = "Log.txt";
+            }
+            
+            if (!testFlag)
+            {
+                if (File.Exists(fileName))
+                {
+                    //      string newFileName = Path.GetFileNameWithoutExtension(fileName) + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss", CultureInfo.CreateSpecificCulture("en-US")) + Path.GetExtension(fileName);
+                    //    newFullFileName = Path.Combine(new FileInfo(fileName).DirectoryName, newFileName);
+                    newFullFileName = GenerateNewFileName(fileName, new FileInfo(fileName).DirectoryName);
+                    File.Move(fileName, newFullFileName);
+                    File.Delete(fileName);
+                }
+                writer = TextWriter.Synchronized(new StreamWriter(fileName));
+            }
+            else
+            {
+                testRenamedFileName = GenerateNewFileName(fileName,null);
+            }
+        }
+
+        private string GenerateNewFileName(string fileName, string pathName )
+        {
+            if (pathName == null)
+                pathName = "";
+            string newFileName = Path.GetFileNameWithoutExtension(fileName) + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss", CultureInfo.CreateSpecificCulture("en-US")) + Path.GetExtension(fileName);
+            string newFullFileName = Path.Combine(pathName, newFileName);
+            return newFullFileName;
+        }
+
+        public override string ToString()
+        {
+            return "Logger/" + transport;
+        }
+
+        public string GetFileName()
+        {
+            return fileName;
+        }
+
+        public string GetTestRenamedFileName()
+        {
+            return testRenamedFileName;
+        }
+
+        public override bool SessionMessage(Who sender, Message msg)
+        {
+            WriteToFile(Direction.UP, sender, msg.ToString());
+            return base.SessionMessage(sender, msg);
+        }
+
+        public override void TransportMessage(Who recipient, Message msg)
+        {
+            WriteToFile(Direction.DOWN, recipient, msg.ToString());
+            base.TransportMessage(recipient, msg);
+        }
+        protected override bool SessionUp()
+        {
+            WriteToFile(Direction.UP, null, transport.ToString());
+            return true;
+        }
+
+        protected override bool SessionDown()
+        {
+            WriteToFile(Direction.DOWN, null, transport.ToString());
+            return true;
+        }
+
+        private void WriteToFile(Direction direction, Who msgOrigin, String msg)
+        {
+            if (writer == null)
+                return;
+            try
+            {
+                lock (writer)
+                {
+                    writer.Write(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.CreateSpecificCulture("en-US")));
+                    writer.Write(": ");
+                    writer.Write(ConvertDirToString(direction));
+                    writer.Write(": ");
+                    if (msgOrigin != null)
+                    {
+                        writer.Write(msgOrigin.ToString());
+                        writer.Write(": ");
+                    }
+                    writer.Write(msg);
+                    writer.WriteLine();
+                    writer.Flush();
+                }
+            }
+            catch (Exception e)
+            {
+                writer.Close();
+                throw e;
+            }
+
+        }
+
+        private String ConvertDirToString(Direction dir)
+        {
+            if (Direction.DOWN == dir)
+                return "Outgoing";
+            return "Incoming";
+        }
+
+
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/PwAuth.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/PwAuth.cs
new file mode 100644
index 0000000..bd4ea24
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Filter/PwAuth.cs
@@ -0,0 +1,365 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Filter
+{
+    /// <summary>
+    /// PwAuth is a message filter which watches for Session.UP and attempts to
+    /// authenticate the user by sending a message to the server with the name and
+    /// password in it. If the server responds, the session is notified with the
+    /// user name. If the server responds negatively, the session is notified of the
+    /// failure (using a PwAuthFail event). A transport control may also be sent to
+    /// force a login or logout or to set the name or password. The name and password
+    /// are initialized from the uri, or prompted for if not specified.
+    /// </summary>
+    public class PwAuth : AbstractMessageFilter
+    {
+
+
+
+        /// <summary>
+        /// client sessionQuery: return user name to use for authentication.
+        /// transportQuery: return the current user name (on server it has been validated).
+        /// client transportControl: set user name to use for authentication.
+        /// </summary>
+
+        public const String USER = "PwAuth.user";
+
+
+
+        /// <summary>
+        /// client sessionQuery: return password to use for authentication.
+        /// transportQuery: return the current password (on server it has been validated).
+        /// client transportControl: set password to use for authentication.
+        /// </summary>
+        /// 
+        public const String PASSWORD = "PwAuth.password";
+
+        /// <summary>
+        /// client transportControl: send authentication request
+        /// </summary>
+        private const String AUTHENTICATE = "PwAuth.authenticate";
+
+        public PwAuth(TransportMessage transport, URL uri, Resources resources)
+            : base(transport, uri, resources)
+        {
+
+            server = (Boolean)transport.TransportQuery(TransportConsts.IS_SERVER);
+
+            if (!server)
+            {
+                user = uri.User;
+                password = uri.Password;
+            }
+
+            //		Log.report( "KeepAliveInstalled",
+            //			"delay", delay, "count", count, "server", server );
+
+            vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY);
+
+            mt_request = new XType("_Etch_PwAuthReq");
+            mt_response = new XType("_Etch_PwAuthResp");
+
+            vf.AddType(mt_request);
+            vf.AddType(mt_response);
+
+            mf_user = new Field("user");
+            mf_password = new Field("password");
+            mf_ok = new Field("ok");
+            mf_status = new Field("status");
+
+            mt_request.PutValidator(mf_user, Validator_string.Get(0));
+            mt_request.PutValidator(mf_password, Validator_string.Get(0));
+            mt_request.SetResult(mt_response);
+            mt_request.Lock();
+
+            mt_response.PutValidator(mf_ok, Validator_boolean.Get(0));
+            mt_response.PutValidator(mf_status, Validator_string.Get(0));
+            mt_response.Lock();
+        }
+
+        private String user;
+
+        private String password;
+
+        private readonly bool server;
+
+        private readonly ValueFactory vf;
+
+        private readonly Field mf_user;
+
+        private readonly Field mf_password;
+
+        private readonly Field mf_ok;
+
+        private readonly Field mf_status;
+
+        private readonly XType mt_request;
+
+        private readonly XType mt_response;
+
+        public bool GetServer()
+        {
+            return server;
+        }
+
+        public override bool SessionMessage(Who sender, Message msg)
+        {
+            if (msg.IsType(mt_request))
+            {
+                HandlePwAuthReq(sender, msg);
+                return true;
+            }
+
+            if (msg.IsType(mt_response))
+            {
+                HandlePwAuthResp(sender, msg);
+                return true;
+            }
+
+            return base.SessionMessage(sender, msg);
+        }
+
+
+        protected override bool SessionUp()
+        {
+            if (!server)
+            {
+                // client: send authentication request.
+                SendPwAuthReq();
+            }
+            return true;
+        }
+
+
+        protected override bool SessionDown()
+        {
+            if (server)
+            {
+                // make sure that server session's idea of user is cleared.
+                SessionNotifyUser(null, null);
+            }
+
+            return true;
+        }
+
+        private void SendPwAuthReq()
+        {
+            if (user == null)
+            {
+                user = (String)session.SessionQuery(USER);
+                if (user == null)
+                    throw new Exception("PwAuth: user == null");
+            }
+
+            if (password == null)
+            {
+                password = (String)session.SessionQuery(PASSWORD);
+                if (password == null)
+                    throw new Exception("PwAuth: password == null");
+            }
+
+            Message msg = new Message(mt_request, vf);
+            msg.Add(mf_user, user);
+            msg.Add(mf_password, password);
+            transport.TransportMessage(null, msg);
+        }
+
+        private void HandlePwAuthReq(Who sender, Message msg)
+        {
+            if (!server)
+            {
+                // we're a client that got a request, likely we're talking to a
+                // server that is confused.
+                return;
+            }
+
+            Console.WriteLine(" Sender: " + sender);
+            Console.WriteLine(" Message: " + msg);
+
+            String u = (String)msg.Get(mf_user);
+            String p = (String)msg.Get(mf_password);
+
+            try
+            {
+                OkStatus as1 = (OkStatus)SessionQuery(new UserPassword(u, p));
+
+                if (as1.ok)
+                    SessionNotifyUser(u, p);
+                else
+                    SessionNotifyUser(null, null);
+
+                sendPwAuthResp(sender, msg, as1.ok, as1.status);
+            }
+            catch (Exception e)
+            {
+                SessionNotifyUser(null, null);
+                sendPwAuthResp(sender, msg, false, e.ToString());
+                throw e;
+            }
+        }
+
+        private void sendPwAuthResp(Who recipient, Message msg, bool result, String status)
+        {
+            Message rmsg = msg.Reply();
+            rmsg.Add(mf_ok, result);
+            rmsg.Add(mf_status, status);
+            transport.TransportMessage(recipient, rmsg);
+        }
+
+        private void HandlePwAuthResp(Who sender, Message msg)
+        {
+            if (server)
+            {
+                // we're a server that got a response, likely we're talking to a
+                // client that is confused.
+                return;
+            }
+
+            // Log.report( "GotPwAuthResp", "sender", sender, "msg", msg );
+
+            bool result = (Boolean)msg.Get(mf_ok);
+            String status = (String)msg.Get(mf_status);
+
+            session.SessionNotify(new OkStatus(result, status));
+        }
+
+
+        public override object TransportQuery(Object query)
+        {
+            if ((string)query == USER)
+                return user;
+
+            if ((string)query == PASSWORD)
+                return password;
+
+            return base.TransportQuery(query);
+        }
+
+
+        public override void TransportControl(Object control, Object value)
+        {
+            if ((string)control == USER)
+            {
+                CheckNotServer();
+                user = (String)value;
+                return;
+            }
+
+            if ((string)control == PASSWORD)
+            {
+                CheckNotServer();
+                password = (String)value;
+                return;
+            }
+
+            if ((string)control == AUTHENTICATE)
+            {
+                CheckNotServer();
+                SendPwAuthReq();
+                return;
+            }
+
+            base.TransportControl(control, value);
+        }
+
+        private void CheckNotServer()
+        {
+            if (server)
+                throw new Exception("control not permitted by server");
+        }
+
+
+        private void SessionNotifyUser(String user, String password)
+        {
+            this.user = user;
+            this.password = password;
+            session.SessionNotify(new UserPassword(user, password));
+        }
+
+        /// <summary>
+        /// Server session query response to AuthUserPassword.
+        /// </summary>
+        public class OkStatus
+        {
+            /// <summary>Constructs the AuthOkStatus.</summary>
+            /// <param name="ok">true if user / password valid.</param>
+            /// <param name="status">message related to ok.</param>
+            public OkStatus(bool ok, String status)
+            {
+                this.ok = ok;
+                this.status = status;
+            }
+
+
+            public override String ToString()
+            {
+                return String.Format("AuthOkStatus( %s, %s )", ok, status);
+            }
+
+            // true if the user / password matched 
+            public readonly bool ok;
+
+            // message related to ok
+            public readonly String status;
+        }
+
+        /// <summary>
+        /// Server session query to get AuthOkStatus, also server session event
+        /// to report changes in authentication status.
+        /// </summary>
+        public class UserPassword
+        {
+
+            /// <summary>Constructs the CheckAuth.</summary>
+            /// <param name="user">name to check</param>
+            /// <param name="password">password of the user</param>
+            public UserPassword(String user, String password)
+            {
+                this.user = user;
+                this.password = password;
+            }
+
+
+            public override String ToString()
+            {
+                return String.Format("AuthUserPassword( %s )", user);
+            }
+
+            // The user name to check
+            public readonly String user;
+
+            // The password of the user
+            public readonly String password;
+        }
+
+
+        public override string ToString()
+        {
+            return "PwAuth/" + transport;
+        }
+    }
+
+
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedData.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedData.cs
new file mode 100644
index 0000000..26efbfc
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedData.cs
@@ -0,0 +1,247 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Fmt.Binary
+{
+    /// <summary>
+    /// Common elements for binary tagged data input and output.
+    /// </summary>
+    public class BinaryTaggedData : TaggedData
+    {
+        /// <summary>
+        /// Sentinel which marks the end of a struct or array item list
+        /// in a binary input or output stream.
+        /// </summary>
+
+        public class SentinelObject
+        {
+            public override string ToString()
+            {
+                return "NONE";
+            }
+        }
+        public static readonly SentinelObject NONE = new SentinelObject();
+
+
+        /// <summary>
+        /// This is the current version of the protocol.
+        /// </summary>
+        public const sbyte VERSION = 3;
+
+        public BinaryTaggedData()
+        {
+            // do nothing
+        }
+
+        /// <summary>
+        /// Constructs the BinaryTaggedData.
+        /// </summary>
+        /// <param name="vf"></param>
+        public BinaryTaggedData(ValueFactory vf)
+            : base(vf)
+        {
+        }
+
+
+        public override sbyte CheckValue(object value)
+        {
+            if (value == null)
+                return TypeCode.NULL;
+            else if (value == NONE)
+                return TypeCode.NONE;
+
+            Type type = value.GetType();
+
+            if (value is long)
+                return CheckLong((long)value);
+
+            else if (value is Int32)
+                return CheckInteger((Int32)value);
+
+            else if (value is short)
+                return CheckShort((short)value);
+
+            else if (value is SByte)
+                return CheckByte((sbyte)value);
+
+            else if (value is Double)
+                return (sbyte)TypeCode.DOUBLE;
+
+            else if (value is float)
+                return (sbyte)TypeCode.FLOAT;
+
+            else if (value is String)
+            {
+                String s = (String)value;
+                if (s.Length == 0)
+                    return TypeCode.EMPTY_STRING;
+
+                return TypeCode.STRING;
+            }
+
+            else if (value is Boolean)
+            {
+                if ((Boolean)value)
+                    return TypeCode.BOOLEAN_TRUE;
+
+                return TypeCode.BOOLEAN_FALSE;
+            }
+
+            else if (value is StructValue)
+                return TypeCode.CUSTOM;
+
+
+            else if (value is Array)
+            {
+                Array a = (Array)value;
+                //if (a.GetType() == typeof(Int32[]))
+                //    return TypeCode.INTS;
+                //if (a.GetType() == typeof(Int16[]))
+                //    return TypeCode.SHORTS;
+                //if (a.GetType() == typeof(Boolean[]))
+                //    return TypeCode.BOOLS;
+                if (a.GetType() == typeof(SByte[]))
+                    return TypeCode.BYTES;
+                //if (a.GetType() == typeof(Int64[]))
+                //    return TypeCode.LONGS;
+                //if (a.GetType() == typeof(Single[]))
+                //    return TypeCode.FLOATS;
+                //if (a.GetType() == typeof(Double[]))
+                //    return TypeCode.DOUBLES;
+                return TypeCode.ARRAY;
+
+            }
+
+            return TypeCode.CUSTOM;
+
+        }
+
+        public override sbyte GetNativeTypeCode(Type c)
+        {
+            if (c == typeof(Boolean))
+                return TypeCode.BOOLEAN_TRUE;
+
+            if (c == typeof(SByte))
+                return TypeCode.BYTE;
+
+            if (c == typeof(short))
+                return TypeCode.SHORT;
+
+            if (c == typeof(int))
+                return TypeCode.INT;
+
+            if (c == typeof(long))
+                return TypeCode.LONG;
+
+            if (c == typeof(float))
+                return TypeCode.FLOAT;
+
+            if (c == typeof(double))
+                return TypeCode.DOUBLE;
+
+            if (c == typeof(string))
+                return TypeCode.STRING;
+
+            if (c == typeof(Object))
+                return TypeCode.ANY;
+
+            return TypeCode.CUSTOM;
+        }
+
+        public override XType GetCustomStructType(Type c)
+        {
+            return vf.GetCustomStructType(c);
+        }
+
+
+
+        public override Type GetNativeType(sbyte type)
+        {
+            switch (type)
+            {
+                case TypeCode.BOOLEAN_TRUE:
+                case TypeCode.BOOLEAN_FALSE:
+                    return typeof(Boolean);
+
+                case TypeCode.BYTE:
+                    return typeof(sbyte);
+
+                case TypeCode.SHORT:
+                    return typeof(short);
+
+                case TypeCode.INT:
+                    return typeof(int);
+
+                case TypeCode.LONG:
+                    return typeof(long);
+
+                case TypeCode.FLOAT:
+                    return typeof(float);
+
+                case TypeCode.DOUBLE:
+                    return typeof(double);
+
+                case TypeCode.EMPTY_STRING:
+                case TypeCode.STRING:
+                    return typeof(string);
+
+                case TypeCode.ANY:
+                    return typeof(Object);
+
+                default:
+                    throw new Exception("unsupported native type " + type);
+            }
+        }
+
+        private static sbyte CheckByte(sbyte v)
+        {
+            if (v >= TypeCode.MIN_TINY_INT && v <= TypeCode.MAX_TINY_INT)
+                return v;
+            return TypeCode.BYTE;
+        }
+
+        private static sbyte CheckShort(short v)
+        {
+            if (v >= SByte.MinValue && v <= SByte.MaxValue)
+                return CheckByte((sbyte)v);
+
+            return TypeCode.SHORT;
+        }
+
+        private static sbyte CheckInteger(int v)
+        {
+            if (v >= short.MinValue && v <= short.MaxValue)
+                return CheckShort((short)v);
+
+            return TypeCode.INT;
+        }
+
+        private static sbyte CheckLong(long v)
+        {
+            if (v >= int.MinValue && v <= int.MaxValue)
+                return CheckInteger((int)v);
+
+            return TypeCode.LONG;
+        }
+
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataFormatFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataFormatFactory.cs
new file mode 100644
index 0000000..97e1ec4
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataFormatFactory.cs
@@ -0,0 +1,38 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Transport.Fmt.Binary
+ 
+{
+    public class BinaryTaggedDataFormatFactory : FormatFactory
+    {
+        
+        public BinaryTaggedDataFormatFactory() {}
+        
+        public override TaggedDataInput NewTaggedDataInput( Org.Apache.Etch.Bindings.Csharp.Msg.ValueFactory vf, string uri )
+        {
+            return new BinaryTaggedDataInput( vf, uri );
+        }
+
+        public override TaggedDataOutput NewTaggedDataOutput( Org.Apache.Etch.Bindings.Csharp.Msg.ValueFactory vf, string uri )
+        {
+            return new BinaryTaggedDataOutput( vf, uri );
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataInput.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataInput.cs
new file mode 100644
index 0000000..fbf9b3c
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataInput.cs
@@ -0,0 +1,398 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Fmt.Binary
+{
+    /// <summary>
+    /// TaggedDataInputStream has methods to support reading little-endian integer
+    /// and floating point data types as well as tagged values from an input
+    /// stream.
+    /// </summary>
+    public class BinaryTaggedDataInput : BinaryTaggedData, TaggedDataInput
+    {
+        /// <summary>
+        /// Constructs the BinaryTaggedDataInput.
+        /// </summary>
+        /// <param name="vf">the value factory for the service.</param>
+        /// <param name="uri">the uri used to construct the transport stack.</param>
+        public BinaryTaggedDataInput( ValueFactory vf, string uri )
+            : base( vf )
+        {
+            // do nothing.
+        }
+
+        /////////////////////////////
+        // TaggedDataInput methods //
+        /////////////////////////////
+
+
+        public Message ReadMessage(FlexBuffer buf1)
+        {
+            buf = buf1;
+            
+            // lengthBudget is how many array elements total are reasonable to
+            // allocate while parsing this message. the largest value comes as each
+            // byte of the incoming message turned into an array element. the total
+            // will always be lower than this as often it takes multiple bytes to
+            // make a single array element. so, each time we make an array, we
+            // deduct the specified length from lengthBudget. if the result is
+            // negative, then either the incoming message is misformed or someone is
+            // trying to spoof us.
+            
+            lengthBudget = buf.Avail();
+
+            try
+            {
+                Message msg = StartMessage();
+                ReadKeysAndValues(msg);
+                EndMessage(msg);
+                return msg;
+            }
+            finally
+            {
+                buf = null;
+                lengthBudget = 0;
+            }
+        }
+
+        private FlexBuffer buf;
+
+        private int lengthBudget;
+
+        private StructValue ReadStruct()
+        {
+            StructValue sv = StartStruct();
+            ReadKeysAndValues( sv );
+            EndStruct( sv );
+            return sv;
+
+        }
+
+        private ArrayValue ReadArray( Validator v )
+        {
+            ArrayValue av = StartArray();
+            ReadValues( av, v );
+            EndArray( av );
+            return av;
+        }
+
+
+        private void ReadKeysAndValues( StructValue sv )
+        {
+            XType t = sv.GetXType;
+
+            while ( true )
+            {
+                Field key = ReadField( t );
+                if (key == null)
+                    break;
+
+                //Object obj = ReadValue( intValidator, true );
+                //if ( obj == NONE )
+                //    break;
+
+                //int id = ( int ) obj;
+                //Field key = t.GetField( id );
+                //if (key == null)
+                //    key = new Field(id, id.ToString());
+
+                Validator v = t.GetValidator( key );
+                if (v != null)
+                {
+                    sv.Add(key, ReadValue(v));
+                }
+                else
+                {
+                    // read the value but ignore it.
+                    Object obj = ReadValue(Validator_object.Get(0));
+                    if (false)
+                        sv.Add( key, obj );
+                }
+            }
+        }
+
+        private void ReadValues( ArrayValue av, Validator v )
+        {
+            Validator ev = v.ElementValidator();
+            while ( true )
+            {
+                Object value = ReadValue( ev, true );
+                if ( value == NONE )
+                    break;
+
+                av.Add( value );
+            }
+        }
+
+        ////////////////////////
+        // Main input methods //
+        ////////////////////////
+
+        private Message StartMessage()
+        {
+            sbyte version = buf.GetByte();
+			
+			if (version != VERSION)
+				throw new IOException(
+					"binary tagged data version mismatch: got "+version+" expected "+VERSION );
+
+            XType t = ReadType();
+            int length = ReadLength();
+
+            return new Message(t, vf, length);
+        }
+
+        private void EndMessage( Message msg )
+        {
+            // nothing to do., readKeysAndValues swallowed the NONE.
+        }
+
+        private StructValue StartStruct() 
+	    {
+            XType t = ReadType();
+            int length = ReadLength();
+
+            return new StructValue(t, vf, length);
+	    }
+
+        private void EndStruct( StructValue sv )
+        {
+            // nothing to do, readKeysAndValues swallowed the NONE.
+        }
+
+        private ArrayValue StartArray()
+        {
+            sbyte type = buf.GetByte();
+
+            XType customStructType;
+            if(type == TypeCode.CUSTOM || type == TypeCode.STRUCT)
+                customStructType = ReadType();
+            else
+                customStructType = null;
+
+            int dim = ReadIntegerValue();
+            if (dim <= 0 || dim > Validator.MAX_NDIMS)
+                throw new ArgumentException("dim <= 0 || dim > Validator.MAX_NDIMS");
+
+            int length = ReadLength();
+
+            Object array = AllocateArrayValue( type, customStructType, dim, length );
+
+            return new ArrayValue( array, type, customStructType, dim );
+        }
+
+        private void EndArray(ArrayValue array)
+        {
+            array.Compact();
+        }
+
+        private XType ReadType()
+        {
+            Object obj = ReadValue(intOrStrValidator, false);
+            if (obj is int)
+            {
+                int id = (int)obj;
+                XType type = vf.GetType(id);
+
+                if (type == null)
+                    type = new XType(id, id.ToString());
+
+                return type;
+            }
+
+            String name = (String)obj;
+            XType ntype = vf.GetType(name);
+
+            if (ntype == null)
+                ntype = new XType(name);
+
+            return ntype;
+        }
+
+        private Field ReadField( XType type )
+        {
+            Object obj = ReadValue(intOrStrValidator, true);
+
+            if (obj == NONE)
+                return null;
+
+            if (obj is int)
+            {
+                int id = (int)obj;
+                Field field = type.GetField(id);
+
+                if (field == null)
+                    field = new Field(id, id.ToString());
+
+                return field;
+            }
+
+            String name = (String)obj;
+            Field nfield = type.GetField(name);
+
+            if (nfield == null)
+                nfield = new Field(name);
+
+            return nfield;
+        }
+        
+        private readonly Validator intOrStrValidator =
+		    new ComboValidator( Validator_int.Get( 0 ), Validator_string.Get( 0 ) );
+
+        private int ReadLength()
+        {
+            int length = ReadIntegerValue();
+
+            if (length < 0 || length > lengthBudget)
+                throw new ArgumentException(
+                    "length < 0 || length > lengthBudget");
+            
+            lengthBudget -= length;
+
+            return length;
+        }
+
+        private int ReadIntegerValue() 
+	    {
+            return (int)ReadValue(intValidator);
+	    }
+
+        private readonly Validator intValidator = Validator_int.Get( 0 );
+
+        ///////////////////////////
+        // LOCAL UTILITY METHODS //
+        ///////////////////////////
+
+        private Object ValidateValue(Validator v, Object value)
+        {
+            // v == null more or less implies that a field is not known
+            // for a type. thus we don't care about the field value as
+            // we are going to ignore it. therefore, return null.
+
+            if (v == null)
+                return null;
+
+            if (value == null)
+                return null;
+
+            return v.ValidateValue(value);
+        }
+
+        private Object ValidateValue( Validator v, Boolean noneOk, Object value )
+        {
+            if (noneOk && value == NONE)
+                return value;
+
+            return ValidateValue(v, value);
+        }
+
+        private Object ReadValue( Validator v )
+        {
+            return ReadValue( v, false );
+        }
+
+        private Object ReadValue( Validator v, Boolean noneOk )
+        {
+            sbyte type = buf.GetByte();
+
+            switch ( type )
+            {
+                case TypeCode.NULL:
+                    return ValidateValue( v, null );
+
+                case TypeCode.NONE:
+                    return ValidateValue(v, noneOk, NONE);
+
+                case TypeCode.BOOLEAN_FALSE:
+                    return ValidateValue( v, false );
+
+                case TypeCode.BOOLEAN_TRUE:
+                    return ValidateValue( v, true );
+
+                case TypeCode.BYTE:
+                    return  ValidateValue( v, buf.GetByte() );
+
+                case TypeCode.SHORT:
+                    return  ValidateValue( v, buf.GetShort() );
+
+                case TypeCode.INT:
+                    return  ValidateValue( v, buf.GetInt() );
+
+                case TypeCode.LONG:
+                    return ValidateValue( v, buf.GetLong() );
+
+                case TypeCode.FLOAT:
+                    return ValidateValue( v, buf.GetFloat() );
+
+                case TypeCode.DOUBLE:
+                    return ValidateValue( v, buf.GetDouble() );
+
+                case TypeCode.BYTES:
+                    return ValidateValue( v, ReadSbytes() );
+
+                case TypeCode.EMPTY_STRING:
+                    return ValidateValue( v, "" );
+
+                case TypeCode.STRING:
+                    return ValidateValue( v, Encoding.UTF8.GetString( ReadBytes() ) );
+
+                //case TypeCode.BOOLS:
+                //case TypeCode.SHORTS:
+                //case TypeCode.INTS:
+                //case TypeCode.LONGS:
+                //case TypeCode.FLOATS:
+                //case TypeCode.DOUBLES:
+                case TypeCode.ARRAY:
+                    return ValidateValue( v, FromArrayValue( ReadArray( v ) ) );
+
+                case TypeCode.STRUCT:
+                case TypeCode.CUSTOM:
+                    return ValidateValue( v, vf.ImportCustomValue( ReadStruct() ) );
+
+                default:
+                    if (type >= TypeCode.MIN_TINY_INT && type <= TypeCode.MAX_TINY_INT)
+                        return ValidateValue(v, type);
+                    throw new Exception( "unsupported type code "+type );
+            }
+        }
+
+        private byte[] ReadBytes()
+        {
+            int length = ReadLength();
+            byte[] b = new byte[ length ];
+            buf.GetFully( b );
+            return b;
+        }
+
+        private sbyte[] ReadSbytes()
+        {
+            int length = ReadLength();
+            sbyte[] b = new sbyte[length];
+            buf.GetFully((byte[])(Array)b);
+            return b;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataOutput.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataOutput.cs
new file mode 100644
index 0000000..f1508f7
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/BinaryTaggedDataOutput.cs
@@ -0,0 +1,364 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Fmt.Binary
+{
+    /// <summary>
+    /// An implementation of TaggedDataOutput which uses a binary encoding.
+    /// </summary>
+    public sealed class BinaryTaggedDataOutput : BinaryTaggedData, TaggedDataOutput
+    {
+        /// <summary>
+        /// Name of uri parameter which controls whether we write ints or strings
+        /// for types and fields.
+        /// </summary>
+        public const String STRING_TYPE_AND_FIELD =
+		    "BinaryTaggedDataOutput.stringTypeAndField";
+
+        /// <summary>
+        /// Constructs the BinaryTaggedDataOutput with a null buffer.
+        /// </summary>
+        /// <param name="vf">the value factory for the service.</param>
+        /// <param name="uri">the uri used to construct the transport stack.</param>
+        public BinaryTaggedDataOutput(ValueFactory vf, string uri)
+            : base(vf)
+        {
+            this.level = vf.GetLevel();
+            URL u = new URL(uri);
+            stringTypeAndField = u.GetBooleanTerm(STRING_TYPE_AND_FIELD, false);
+        }
+
+        private readonly Validator.Level level;
+
+        private readonly bool stringTypeAndField;
+
+        //////////////////////////////
+        // TaggedDataOutput methods //
+        //////////////////////////////
+
+        #region TaggedDataOutput methods
+
+        public void WriteMessage(Message msg, FlexBuffer buf)
+        {
+            try
+            {
+                this.buf = buf;
+                StartMessage(msg);
+                WriteKeysAndValues(msg);
+                EndMessage(msg);
+            }
+            finally
+            {
+                this.buf = null;
+            }
+        }
+
+        private FlexBuffer buf;
+
+        private void WriteStruct(StructValue sv)
+        {
+            StartStruct(sv);
+            WriteKeysAndValues(sv);
+            EndStruct(sv);
+        }
+
+        private void WriteArray(ArrayValue av, Validator v)
+        {
+            StartArray(av);
+            WriteValues(av, v);
+            EndArray(av);
+        }
+
+        private void WriteKeysAndValues(StructValue sv)
+        {
+            XType t = sv.GetXType;
+            foreach (KeyValuePair<Field, Object> me in sv)
+            {
+                Field f = me.Key;
+                WriteField(f);
+                WriteValue(t.GetValidator(f), me.Value);
+            }
+        }
+
+        private void WriteValues(ArrayValue av, Validator v)
+        {
+            Validator ev = v.ElementValidator();
+            foreach (Object value in av)
+                WriteValue(ev, value);
+        }
+
+
+        /////////////////////////
+        // Main output methods //
+        /////////////////////////
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="msg"></param>
+        /// Exception:
+        ///     throws Exception
+        private void StartMessage(Message msg)
+        {
+            // since message is top-level, no type code is written to
+            // indicate a message is starting. we do write a version number
+            // to indicate this version of the binary tagged data output
+            buf.PutByte(VERSION);
+            StartStruct(msg);
+            //       WriteType( msg.GetXType );
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="msg"></param>
+        /// Exception:
+        ///     throws Exception
+        private void EndMessage(Message msg)
+        {
+            EndStruct(msg);
+
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sv"></param>
+        /// Exception:
+        ///     throws Exception
+        private void StartStruct(StructValue sv)
+        {
+            // the caller has already written a type code to indicate a
+            // struct is starting.
+            WriteType(sv.GetXType);
+            WriteIntValue(sv.Count);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sv"></param>
+        /// Exception:
+        ///     throws Exception
+        private void EndStruct(StructValue sv)
+        {
+            WriteNoneValue();
+        }
+
+        private readonly IList<StructValue> structs = new List<StructValue>();
+
+        private void StartArray(ArrayValue array)
+        {
+            // the caller has already written a type code to indicate an
+            // array is starting.
+            sbyte type = array.Type;
+            buf.PutByte(type);
+            if (type == TypeCode.CUSTOM)
+                WriteType(array.CustomStructType);
+            WriteIntValue(array.Dim);
+            WriteIntValue(array.Size());
+
+        }
+
+        private void WriteType(XType type)
+        {
+            if (stringTypeAndField)
+                WriteStringValue(type.Name);
+            else
+                WriteIntValue(type.Id);
+        }
+
+        private void WriteField(Field field)
+        {
+            if (stringTypeAndField)
+                WriteStringValue(field.Name);
+            else
+                WriteIntValue(field.Id);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="array"></param>
+        /// Exception:
+        ///     throws Exception
+        private void EndArray(ArrayValue array)
+        {
+            WriteNoneValue();
+        }
+
+        private void WriteIntValue(int value)
+        {
+            WriteValue(intValidator, value);
+        }
+
+        private readonly Validator intValidator = Validator_int.Get(0);
+
+        private void WriteStringValue(String value)
+        {
+            WriteValue(stringValidator, value);
+        }
+
+        private readonly Validator stringValidator = Validator_string.Get(0);
+
+        private void WriteNoneValue()
+        {
+            WriteValue(noneValidator, NONE);
+        }
+
+        private readonly Validator noneValidator = Validator_none.Get();
+
+        #endregion
+
+        ///////////////////////////
+        // LOCAL UTILITY METHODS //
+        ///////////////////////////
+
+        #region Local Utility Methods
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="v">the validator for this value, or none if there
+        /// isn't one</param>
+        /// <param name="value"></param>
+        /// Exception:
+        ///     throws Exception
+        private void WriteValue(Validator v, Object value)
+        {
+            sbyte typeCode = CheckValue(value);
+
+            if (level != Validator.Level.NONE && value != null)
+            {
+                if (level == Validator.Level.FULL && v == null)
+                    throw new ArgumentException("validator missing");
+                
+                if (v != null && !v.Validate(value))
+                    throw new ArgumentException( String.Format(
+                        "validator {0} failed for value {1}", v, value));
+            }
+
+            buf.PutByte(typeCode);
+
+            switch (typeCode)
+            {
+                case TypeCode.NULL:
+                case TypeCode.BOOLEAN_FALSE:
+                case TypeCode.BOOLEAN_TRUE:
+                case TypeCode.EMPTY_STRING:
+                case TypeCode.NONE:
+                    return;
+
+                case TypeCode.BYTE:
+                    buf.PutByte((Convert.ToSByte(value)));
+                    return;
+                case TypeCode.SHORT:
+                    buf.PutShort(Convert.ToInt16(value));
+                    return;
+
+                case TypeCode.INT:
+                    buf.PutInt(Convert.ToInt32(value));
+                    return;
+
+                case TypeCode.LONG:
+                    buf.PutLong(Convert.ToInt64(value));
+                    return;
+
+                case TypeCode.FLOAT:
+                    buf.PutFloat(Convert.ToSingle(value));
+                    return;
+
+                case TypeCode.DOUBLE:
+                    buf.PutDouble(Convert.ToDouble(value));
+                    return;
+
+                case TypeCode.BYTES:
+                    WriteBytes((sbyte[])value);
+                    return;
+
+                // reserved for future use
+                //case TypeCode.BOOLS:
+                //case TypeCode.SHORTS:
+                //case TypeCode.INTS:
+                //case TypeCode.LONGS:
+                //case TypeCode.FLOATS:
+                //case TypeCode.DOUBLES:
+                case TypeCode.ARRAY:
+                    WriteArray(ToArrayValue(value, v), v);
+                    return;
+
+                case TypeCode.STRING:
+                    WriteBytes(Encoding.UTF8.GetBytes((String)value));
+                    return;
+
+                case TypeCode.CUSTOM:
+                    {
+                        StructValue sv = vf.ExportCustomValue(value);
+                        if (sv == null)
+                            throw new Exception("unsupported type " + value.GetType());
+
+                        WriteStruct(sv);
+                        return;
+                    }
+
+                default:
+                    // type is either "tiny" integer or unused...
+                    if (typeCode >= TypeCode.MIN_TINY_INT && typeCode <= TypeCode.MAX_TINY_INT)
+                        return;
+
+                    throw new Exception("unsupported typecode " + typeCode);
+            }
+        }
+
+        /// <summary>
+        /// Writes a value (signed or unsigned) to the output stream.
+        /// </summary>
+        /// <param name="value">the value to write to the output stream.</param>
+        /// Exception:
+        ///     throws Exception if there's a problem with the output stream
+        private void WriteBytes(sbyte[] value)
+        {
+            int n = value.Length;
+            WriteIntValue(n);
+            buf.Put((byte[])(Array)value, 0, n);
+        }
+
+        /// <summary>
+        /// Writes a value (signed or unsigned) to the output stream.
+        /// </summary>
+        /// <param name="value">the value to write to the output stream.</param>
+        /// Exception:
+        ///     throws Exception if there's a problem with the output stream
+        private void WriteBytes(byte[] value)
+        {
+            int n = value.Length;
+            WriteIntValue(n);
+            buf.Put(value, 0, n);
+        }
+
+        #endregion Local utility methods
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/Validator_none.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/Validator_none.cs
new file mode 100644
index 0000000..3705dc9
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/Binary/Validator_none.cs
@@ -0,0 +1,68 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Fmt.Binary
+{
+    /// <summary>
+    /// A validator for the special end of list marker,
+    /// </summary>
+    public class Validator_none : Validator
+    {
+        public static Validator_none Get()
+        {
+            if ( validator == null )
+                validator = new Validator_none();
+            return validator;
+        }
+
+        private static Validator_none validator;
+
+        /// <summary>
+        /// constructs the validator
+        /// </summary>
+        public Validator_none()
+        {
+            //nothing to do
+        }
+
+        public override Validator ElementValidator()
+        {
+        
+            throw new ArgumentException("not an array");
+        }
+
+        public override bool Validate( Object value )
+        {
+            return value == BinaryTaggedData.NONE;
+        }
+
+      
+
+        public override object ValidateValue(object value)
+        {
+            if (Validate(value))
+                return value;
+
+            throw new Exception("value not appropriate for none: " + value);
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/ByteToSbyteConverter.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/ByteToSbyteConverter.cs
new file mode 100644
index 0000000..5c8b6a7
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/ByteToSbyteConverter.cs
@@ -0,0 +1,55 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Transport.Fmt
+{
+    /// <summary>
+    /// Class that provides methods for : 
+    /// 1) Converting a single value from byte to sbyte.
+    /// 2) Converting a single value for sbyte to byte.
+    /// 3) Converting an array of values of the 2 above.
+    /// </summary>
+    public static class ByteConverter
+    {
+        /// <summary>
+        /// Converts a byte value to an sbyte value.
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public static sbyte ByteToSbyte( byte value )
+        {
+            sbyte convertedValue = 0;
+
+            if ( value > 127 )
+                convertedValue = ( sbyte ) ( 127 - value );
+
+            return convertedValue;
+        }
+
+        public static byte SbyteToByte( sbyte value )
+        {
+            byte convertedValue = 0;
+
+            if ( value < 0 )
+                convertedValue = ( byte ) ( 127 - value );
+
+            return convertedValue;
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/TaggedData.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/TaggedData.cs
new file mode 100644
index 0000000..85195d4
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/TaggedData.cs
@@ -0,0 +1,203 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport.Fmt
+{
+    /// <summary>
+    /// Common interface for various types of tagged data input and output.
+    /// </summary>
+    abstract public class TaggedData
+    {
+        public TaggedData()
+        { 
+        }
+
+        /// <summary>
+        /// Constructs the TaggedData.
+        /// </summary>
+        /// <param name="vf"></param>
+        public TaggedData( ValueFactory vf )
+        {
+            this.vf = vf;
+        }
+
+        /// <summary>
+        /// The value factory to use for tagged input and output.
+        /// </summary>
+        protected readonly ValueFactory vf;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>the value factory to use for tagged input and output.</returns>
+        public ValueFactory GetValueFactory()
+        {
+            return vf;
+        }
+
+
+        protected ArrayValue ToArrayValue( Object value, Validator v )
+        {
+
+            Type c = value.GetType();
+            int dim = 0;
+
+            while ( c.IsArray )
+            {
+                dim++;
+                c = c.GetElementType();
+            }
+            
+            // now we want the type code for c, and if the type code is custom,
+            // we'll also want the struct type code.
+
+            sbyte typeCode = GetNativeTypeCode( c );
+
+            XType customStructType;
+            if (typeCode == TypeCode.CUSTOM || typeCode == TypeCode.STRUCT)
+            {
+                customStructType = GetCustomStructType(c);
+
+                if (customStructType == null && c == typeof(StructValue))
+			    {
+				    Validator_StructValue x = FindStructValueValidator( v );
+                    if (x != null)
+                        customStructType = x.GetXType();
+			    }
+			
+			if (customStructType == null )
+				throw new ArgumentException(" In tagged Data" );
+   
+            }
+               
+            else
+                customStructType = null;
+
+            return new ArrayValue( value, typeCode, customStructType, dim );
+        }
+
+        private Validator_StructValue FindStructValueValidator( Validator v )
+	    {
+		    if (v is Validator_StructValue)
+			return (Validator_StructValue) v;
+		
+		    if (v is ComboValidator)
+		    {
+			    ComboValidator x = (ComboValidator) v;
+			    Validator_StructValue y = FindStructValueValidator( x.A() );
+			
+			    if (y != null)
+				    return y;
+			
+		    	 return FindStructValueValidator( x.B() );
+		    }
+		
+		    return null;
+	    }
+
+        protected Object FromArrayValue( ArrayValue av )
+        {
+            return av.GetArray();
+        }
+
+        protected Object AllocateArrayValue( sbyte typeCode, XType customStructType,
+            int dim, int length )
+        {
+            Type clss = GetComponentType( typeCode, customStructType, dim );
+            if ( clss == null )
+                throw new ArgumentException(String.Format(
+                    "could not get array for {0}, {1}, {2}",
+                    typeCode, customStructType, dim));
+            
+            return Array.CreateInstance( clss, length );
+        }
+
+        private Type GetComponentType( sbyte typeCode, XType customStructType, int dim )
+        {
+            Type c;
+            if (typeCode == TypeCode.CUSTOM || typeCode == TypeCode.STRUCT)
+            {
+                //    c = GetCustomType( customStructType );
+                c = customStructType.GetComponentType();
+                if (c == null)
+                    c = typeof (StructValue);
+            }
+                
+            else
+                c = GetNativeType(typeCode);
+            //Console.WriteLine( "c = " + c );
+            if ( c == null )
+                return null;
+
+            if ( dim == 0 )
+                return c;
+
+            int[] dims;
+
+            while ( dim > 0 )
+            {
+                dims = new int[ dim ];
+                if ( dim > 1 )
+                    c = c.MakeArrayType();
+                dim--;
+            }
+
+            //Object o = Array.CreateInstance( c, 1 );
+
+            //c = ( ( Array ) o ).GetType();
+            //Console.WriteLine( "type= "+c );
+            return c;
+        }
+
+        /// <summary>
+        /// Returns the type code for the specified class. This
+	    /// is needed when we have an array and we have determine
+	    /// the base type and now we're fixing to serialize it.
+	    /// We use the base type code to reconstitute it on the
+	    /// other side. So we don't return a perfect code the way
+	    /// checkValue does, but rather just something that let's
+	    /// us recreate the appropriate array type on import.
+        /// </summary>
+        /// <param name="c"></param>
+        /// <returns>a type code for the specified class.</returns>
+        abstract public sbyte GetNativeTypeCode( Type c );
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="c"></param>
+        /// <returns>a struct type for the specified custom class.</returns>
+        abstract public XType GetCustomStructType( Type c );
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns>the class for a specified (native) type code.</returns>
+        abstract public Type GetNativeType( sbyte type );
+
+        
+
+        abstract public sbyte CheckValue( Object value );
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/TypeCode.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/TypeCode.cs
new file mode 100644
index 0000000..3faffc3
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Fmt/TypeCode.cs
@@ -0,0 +1,185 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Transport.Fmt
+{
+    /// <summary>
+    /// Values denoting types of encoded values. There are two value ranges:
+    /// 
+    ///  -128 to -65: codes for defined types.
+    /// -64 to 127: tiny integer values.
+    ///            
+    /// Tiny integers are completely encoded within the type byte.
+    /// </summary>
+    public class TypeCode
+    {
+        /// <summary>
+        /// A code denoting a null value.
+        /// </summary>
+        public const sbyte NULL = -128;
+
+        /// <summary>
+        /// A code denoting no value. 
+        /// For example, an array is a sequence of values (some of which may
+	    /// be NULL), terminated by a NONE.
+        /// </summary>
+        public const sbyte NONE = -127;
+
+
+        /// <summary>
+        /// A code denoting a false boolean value.
+        /// </summary>
+        public const sbyte BOOLEAN_FALSE = -126;
+
+        /// <summary>
+        /// A code denoting a true boolean value.
+        /// </summary>
+        public const sbyte BOOLEAN_TRUE = -125;
+
+        /// <summary>
+        /// A code denoting a signed const sbyte.
+        /// </summary>
+        public const sbyte BYTE = -124;
+
+        /// <summary>
+        /// A code denoting a single const sbyte signed short.
+        /// </summary>
+        public const sbyte SHORT = -123;
+
+        /// <summary>
+        /// A code denoting a four sbyte signed integer.
+        /// </summary>
+        public const sbyte INT = -122;
+             
+        /// <summary>
+        /// A code denoting an eight const sbyte signed long, lsb first.
+        /// </summary>
+        public const sbyte LONG = -121;
+
+        /// <summary>
+        /// A code denoting a four const sbyte ieee floating format number.
+        /// </summary>
+        public const sbyte FLOAT = -120;
+
+        /// <summary>
+        /// A code denoting an eight const sbyte ieee floating format number.
+        /// </summary>
+        public const sbyte DOUBLE = -119;
+
+        //// Arrays /////
+
+        /// <summary>
+        /// A code denoting an array of booleans.
+        /// </summary>
+        //public const sbyte BOOLS = -118;
+
+        /// <summary>
+        /// A code denoting an array of bytes.
+        /// </summary>
+        public const sbyte BYTES = -117;
+
+        /// <summary>
+        /// A code denoting an array of shorts.
+        /// </summary>
+        //public const sbyte SHORTS = -116;
+
+        /// <summary>
+        /// A code denoting an array of ints.
+        /// </summary>
+        //public const sbyte INTS = -115;
+
+        /// <summary>
+        /// A code denoting an array of longs.
+        /// </summary>
+        //public const sbyte LONGS = -114;
+
+        /// <summary>
+        /// A code denoting an array of singles.
+        /// </summary>
+        //public const sbyte FLOATS = -113;
+
+        /// <summary>
+        /// A code denoting an array of doubles.
+        /// </summary>
+        //public const sbyte DOUBLES = -112;
+
+        /// <summary>
+        /// A code denoting a sequence of values.
+        /// </summary>
+        public const sbyte ARRAY = -111;
+
+
+        //// strings /////
+        
+        /// <summary>
+        /// A code denoting an empty string.
+        /// </summary>
+        public const sbyte EMPTY_STRING = -110;
+
+        /// <summary>
+        /// A code denoting a utf-8 encoded string.
+        /// </summary>
+        public const sbyte STRING = -109;
+
+        /// <summary>
+        /// A code denoting a custom value (struct, exception, enum, extern)
+	    /// from a value factory. An associated value identifies the specific
+	    /// type. The format on the wire of STRUCT and CUSTOM are the same.
+	    /// Emit CUSTOM instead of STRUCT, and accept STRUCT as if it were
+	    /// CUSTOM.
+        /// </summary>
+        public const sbyte STRUCT = -108;
+
+
+
+        /// <summary>
+        /// A code denoting a custom value (struct, exception, enum, extern)
+        /// from a value factory. An associated value identifies the specific
+        /// type. The format on the wire of STRUCT and CUSTOM are the same.
+        /// Emit CUSTOM instead of STRUCT, and accept STRUCT as if it were
+        /// CUSTOM.
+        /// </summary>
+        public const sbyte CUSTOM = -107;
+
+
+        /// <summary>
+        /// A code denoting that any value is ok (as long as we know how
+        /// to serialize it). Dynamic methods should be applied to determine
+        /// the type. This type never appears on the wire.
+        /// </summary>
+        public const sbyte ANY = -106;
+
+        ////////////////////
+        // tiny integers //
+        ////////////////////
+
+        /// <summary>
+        /// Minimum "small" integer.
+        /// </summary>
+        public const sbyte MIN_TINY_INT = -64;
+
+        /// <summary>
+        /// Maximum "small" integer. Small integers are encoded asis
+        /// (with embedded type code)
+        /// </summary>
+        public const sbyte MAX_TINY_INT = 127;
+
+        
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/FormatFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/FormatFactory.cs
new file mode 100644
index 0000000..a48fed6
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/FormatFactory.cs
@@ -0,0 +1,101 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    public abstract class FormatFactory
+    {
+	    public const String BINARY = "binary";
+    	
+	    public const String XML = "xml";
+	
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="vf"></param>
+        /// <param name="uri"></param>
+        /// <returns>the tagged data input with the specified value factory and
+        /// initialized by terms from the uri.</returns>
+        abstract public TaggedDataInput NewTaggedDataInput( ValueFactory vf, string uri );
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="vf"></param>
+        /// <param name="uri"></param>
+        /// <returns>the tagged data output with the specified value factory and
+        /// initialized by terms from the uri.</returns>
+        abstract public TaggedDataOutput NewTaggedDataOutput( ValueFactory vf, string uri );
+
+        private readonly static Dictionary<String, Object> formatFactories = new Dictionary<String, Object>();
+
+        /// <summary>
+        /// Gets the named format factory.
+        /// </summary>
+        /// <param name="name">the name of a configured format factory.</param>
+        /// <returns>the named format factory, or null if it isn't defined.</returns>
+        public static FormatFactory Get( String name )
+        {
+            Object factory = formatFactories[name];
+
+            if (factory == null)
+                return null;
+            if (factory is string)
+            {
+                try
+                {
+                
+                    Type c = Type.GetType((string) factory);
+                    factory = Activator.CreateInstance(c);
+                    if (!(factory is FormatFactory))
+                        throw new ArgumentException(
+                            String.Format(" Instance for format name {0} does not implement FormatFactory {1}", name, factory));
+                    
+                 //   formatFactories.Add(name,factory);
+                   
+                }
+                catch(Exception e)
+                {
+                    throw new ArgumentException(" Could not create instance of format name " + name,e);
+                }
+            }
+           return (FormatFactory) factory;
+        }
+
+        /// <summary>
+        /// Puts a named format factory.
+        /// </summary>
+        /// <param name="name">the uri scheme of this format factory.</param>
+        /// <param name="factory">thefully qualified class name or instance
+        /// of the FormatFactory to associate with the name</param>
+        public static void Put( String name, Object factory )
+        {
+            formatFactories.Add( name, factory );
+        }
+
+        static FormatFactory()
+        {
+            Put(BINARY, "Org.Apache.Etch.Bindings.Csharp.Transport.Fmt.Binary.BinaryTaggedDataFormatFactory");
+        }
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/MailboxManager.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/MailboxManager.cs
new file mode 100644
index 0000000..ce49226
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/MailboxManager.cs
@@ -0,0 +1,53 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    public interface MailboxManager : TransportMessage, SessionMessage
+    {
+        /// <summary>
+        /// Removes the mailbox from the set of mailbox receiving responses
+        /// to messages
+        /// </summary>
+        /// <param name="mb"></param>
+        
+        void Unregister(Mailbox mb);
+
+        /// <summary>
+        /// Redelivers defunct messages from a closed mailbox.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="msg"></param>
+
+        void Redeliver(Who sender, Message msg);
+
+        /// <summary>
+        /// Begin a call sequence and return the mailbox which will receive the
+        /// response.
+        /// </summary>
+        /// <param name="recipient"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        Mailbox TransportCall(Who recipient, Message msg);
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Messagizer.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Messagizer.cs
new file mode 100644
index 0000000..219f968
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/Messagizer.cs
@@ -0,0 +1,197 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    /// <summary>
+    /// Messagizer is a PacketHandler which accepts packets from
+    /// a PacketSource and turns them into messages for delivery
+    /// to a MessageHandler. Messagizer is also a MessageSource,
+    /// accepting messages and turning them into packets for delivery
+    /// to a PacketSource.
+    /// </summary>
+    public class Messagizer : TransportMessage, SessionPacket
+    {
+        /// <summary>
+        /// Name of format name in uri or resources. The value is "Messagizer.format".
+        /// The result of looking up this name should be a String.
+        /// <seealso cref="Messagizer(TransportPacket, URL, Resources)"/>
+        /// </summary>
+        public const String FORMAT = "Messagizer.format";
+
+        /// <summary>
+        /// Constructs the Messagizer as a session of transport using uri and resources.
+        /// </summary>
+        /// <param name="transport">used to deliver packets to the peer.</param>
+        /// <param name="uri">the uri being used to configure the transport stack.</param>
+        /// <param name="resources">the associated set of resources for this service.</param>      
+        
+        public Messagizer(TransportPacket transport, string uri, Resources resources)
+        	: this(transport, new URL(uri), resources)
+        {
+        }
+
+
+        /// <summary>
+        /// Constructs the Messagizer as a session of transport using uri and resources.
+        /// </summary>
+        /// <param name="transport">used to deliver packets to the peer.</param>
+        /// <param name="uri">the uri being used to configure the transport stack.</param>
+        /// <param name="resources">the associated set of resources for this service.</param>
+        public Messagizer(TransportPacket transport, URL uri, Resources resources)
+        {
+            // find the format.
+
+            this.transport = transport;
+
+            String format = uri.GetTerm(FORMAT, FormatFactory.BINARY);
+
+            // find the format factory.
+
+            FormatFactory ff = FormatFactory.Get( format );
+            if ( ff == null )
+                throw new ArgumentException(
+                String.Format( "format factory is not defined as '{0}' in format factories", format ) );
+
+            // find the value factory.
+
+            ValueFactory vf = ( ValueFactory ) resources.Get( TransportConsts.VALUE_FACTORY );
+            if ( vf == null )
+                throw new ArgumentException(String.Format(
+                    "value factory is not defined as '{0}' in resources",
+                    TransportConsts.VALUE_FACTORY));
+
+            tdi = ff.NewTaggedDataInput( vf, uri.ToString() );
+            tdo = ff.NewTaggedDataOutput( vf, uri.ToString() );
+
+            transport.SetSession(this);
+        }
+
+      
+        // private readonly ValueFactory vf;
+        private readonly TaggedDataInput tdi;
+        private readonly TaggedDataOutput tdo;
+        private TransportPacket transport;
+        private SessionMessage session;
+
+        public override string ToString()
+        {
+            return String.Format("Messagizer : {0}", transport);
+        }
+
+        public TransportPacket GetTransport()
+        {
+            return transport;
+        }
+
+       
+
+        
+
+
+        private readonly FlexBuffer msgBuf = new FlexBuffer();
+
+        
+        public Object SessionQuery( Object query )
+        {
+            return session.SessionQuery( query );
+        }
+
+        public void SessionControl( Object control, Object value )
+        {
+            session.SessionControl( control, value );
+        }
+
+        public void SessionNotify( Object eventObj )
+        {
+            session.SessionNotify( eventObj );
+        }
+
+        
+
+        public Object TransportQuery( Object query )
+        {
+            return transport.TransportQuery( query );
+        }
+
+        public void TransportControl( Object control, Object value )
+        {
+            transport.TransportControl( control, value );
+        }
+
+        public void TransportNotify( Object eventObj )
+        {
+            transport.TransportNotify( eventObj );
+        }
+
+        #region TransportMessage Members
+
+        public void SetSession(SessionMessage session)
+        {
+            this.session = session;
+        }
+
+        public SessionMessage GetSession()
+        {
+            return this.session;
+        }
+
+        public void TransportMessage(Who recipient, Message msg)
+        {
+
+            // packetize the message.
+
+            lock (msgBuf)
+            {
+                try
+                {
+                    // assert that msgBuf is reset.
+                    // leave space for the packet header
+                    msgBuf.Skip(transport.HeaderSize(), true);
+                    tdo.WriteMessage(msg, msgBuf);
+                    msgBuf.SetIndex(0);
+                    transport.TransportPacket(recipient,msgBuf);
+                }
+                finally
+                {
+                    msgBuf.Reset();
+                }
+            }
+           
+        }
+
+        #endregion
+
+        #region SessionPacket Members
+
+        public void SessionPacket(Who sender, FlexBuffer buf)
+        {
+            Message msg = tdi.ReadMessage(buf);
+            bool handled = session.SessionMessage(sender,msg);
+            if (!handled)
+                session.SessionNotify(new UnwantedMessage(sender,msg));
+        }
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/PlainMailbox.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/PlainMailbox.cs
new file mode 100644
index 0000000..a870860
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/PlainMailbox.cs
@@ -0,0 +1,276 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    /// <summary>
+    /// A plain implementation of a mailbox using a fixed size circular queue.
+    /// </summary>
+    /// 
+    public class PlainMailbox : Mailbox, AlarmListener
+    {
+        /// <summary>
+        /// Constructs the PlainMailbox
+        /// </summary>
+        /// <param name="mailboxManager">The mailbox manager to use to unregister this mailbox
+        /// and to deliver undelivered messages.</param>
+        /// <param name="messageId"></param>
+        public PlainMailbox(MailboxManager mailboxManager, long messageId)
+        {
+            if (mailboxManager == null)
+                throw new NullReferenceException("mailboxManager == null");
+
+            this.mailboxManager = mailboxManager;
+            this.messageId = messageId;
+
+            queue = new CircularQueue<Element>(1);
+        }
+
+        private readonly MailboxManager mailboxManager;
+
+        private readonly long messageId;
+
+        private readonly CircularQueue<Element> queue;
+
+        private bool alarmSet;
+
+        private Notify notify;
+
+        private Object state;
+
+        public MailboxManager GetMailboxManager()
+        {
+            return mailboxManager;
+        }
+
+        public long GetMessageId()
+        {
+            return messageId;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="msg"></param>
+        /// Exception:
+        ///     throws Exception
+        public bool Message(Who sender, Message msg)
+        {
+            bool ok = queue.Put(new Element(sender, msg), -1);
+            if (ok)
+                fireNotify();
+            return ok;
+        }
+
+        private void fireNotify()
+        {
+            Notify n;
+            Object s;
+            bool c;
+
+            lock (queue)
+            {
+                n = notify;
+                s = state;
+                c = queue.IsClosed();
+            }
+
+            if (n != null)
+                n.mailboxStatus(this, s, c);
+        }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        /// Exception:
+        ///     throws ThreadInterruptedException
+        public Element Read()
+        {
+            Element elem = null;
+            try
+            {
+                elem = queue.Get();
+            }
+
+            catch (Exception)
+            {
+
+            }
+            return elem;
+        }
+
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="maxDelay"></param>
+        /// <returns></returns>
+        /// Exception:
+        ///     throw ThreadInterruptedException
+        public Element Read(int maxDelay)
+        {
+            Element elem = null;
+            try
+            {
+                elem = queue.Get(maxDelay);
+            }
+
+            catch (Exception)
+            {
+
+            }
+            return elem;
+        }
+
+        public bool CloseDelivery()
+        {
+
+
+            lock (queue)
+            {
+                if (queue.IsClosed())
+                    return false;
+
+
+                if (alarmSet)
+                {
+                    alarmSet = false;
+                    AlarmManager.staticRemove(this);
+                }
+                mailboxManager.Unregister(this);
+                queue.Close();
+
+            }
+
+
+            fireNotify();
+            return true;
+
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// Exception:
+        ///     throws Exception
+        public bool CloseRead()
+        {
+            if (CloseDelivery())
+            {
+                Element mbe;
+                while ((mbe = Read()) != null)
+                    mailboxManager.Redeliver(mbe.sender, mbe.msg);
+                return true;
+            }
+
+            return false;
+
+        }
+
+
+
+        public int Wakeup(AlarmManager manager, Object state, long due)
+        {
+            //Console.WriteLine(" In wakeup");
+            CloseDelivery();
+            return 0;
+        }
+
+        public void RegisterNotify(Notify newNotify, Object state, int maxDelay)
+        {
+            if (newNotify == null)
+                throw new ArgumentNullException("newNotify == null");
+
+            if (maxDelay < 0)
+                throw new ArgumentException("maxDelay < 0");
+
+            bool isNotEmptyOrIsClosed;
+
+            lock (queue)
+            {
+                if (this.notify != null)
+                    throw new Exception("this.notify != null");
+
+                this.notify = newNotify;
+                this.state = state;
+
+                if (maxDelay > 0)
+                {
+                    alarmSet = true;
+                    AlarmManager.staticAdd(this, null, maxDelay);
+                }
+
+                isNotEmptyOrIsClosed = !queue.IsEmpty() || queue.IsClosed();
+            }
+
+            if (isNotEmptyOrIsClosed)
+                fireNotify();
+        }
+
+        public void UnregisterNotify(Notify oldNotify)
+        {
+            if (oldNotify == null)
+                throw new ArgumentNullException("oldNotify == null");
+
+            if (this.notify == null)
+                return;
+
+            lock (queue)
+            {
+                if (oldNotify != this.notify)
+                    throw new ArgumentException("oldNotify != this.notify");
+
+                if (alarmSet)
+                {
+                    alarmSet = false;
+                    AlarmManager.staticRemove(this);
+                }
+
+                this.notify = null;
+                this.state = null;
+            }
+        }
+
+        public bool IsEmpty()
+        {
+            return queue.IsEmpty();
+        }
+
+        public bool IsClosed()
+        {
+            return queue.IsClosed();
+        }
+
+        public bool IsFull()
+        {
+            return queue.IsFull();
+        }
+
+
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/PlainMailboxManager.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/PlainMailboxManager.cs
new file mode 100644
index 0000000..7f11c5d
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/PlainMailboxManager.cs
@@ -0,0 +1,269 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    /// <summary>
+    /// MailboxManager is a MessageHandler which accepts packets for
+    /// possible delivery to a mailbox, or to another message handler
+    /// if an appropriate mailbox cannot be found. MailboxManager is
+    /// forwarding them to another MessageSource. If requested, a
+    /// mailbox is created with a message's msgid and added to the
+    /// set of mailboxes waiting for messages.
+    /// </summary>
+    public class PlainMailboxManager : MailboxManager
+    {
+        /// <summary>
+        /// Constructs the PlainMailboxManager.
+        /// </summary>
+        /// <param name="transport">a transport to send messages </param>
+        /// <param name="uri">the uri of this transport stack</param>
+        /// <param name="resources">the resources of this transport stack</param>
+        public PlainMailboxManager(TransportMessage transport, string uri, Resources resources)
+            : this(transport, new URL(uri), resources)
+        {
+            // nothing else.
+        }
+
+        /// <summary>
+        /// Constructs the PlainMailboxManager.
+        /// </summary>
+        /// <param name="transport">a transport to send messages </param>
+        /// <param name="uri">the uri of this transport stack</param>
+        /// <param name="resources">the resources of this transport stack</param>
+        public PlainMailboxManager(TransportMessage transport, URL uri, Resources resources)
+        {
+            this.transport = transport;
+            transport.SetSession(this);
+        }
+
+        private readonly TransportMessage transport;
+
+        public override string ToString()
+        {
+            return String.Format( "PlainMailboxManager/{0} ", transport );
+        }
+    	
+	    private readonly IdGenerator idGen = new IdGenerator( DateTime.Now.Ticks, 37 );
+
+        /////////////////////
+        // Mailbox methods //
+        /////////////////////
+
+        private Dictionary<long, Mailbox> mailboxes =
+            new Dictionary<long, Mailbox>();
+
+        /// <summary>
+        /// Adds a mailbox to the set of mailbox receiving responses
+        /// to messages.
+        /// </summary>
+        /// <param name="mb"></param>
+        public void Register( Mailbox mb )
+	    {
+            long msgid = mb.GetMessageId();
+		    lock (mailboxes)
+		    {
+                if (!up)
+                    throw new InvalidOperationException("connection down");
+
+			    if (mailboxes.ContainsKey( msgid ))
+				    throw new ArgumentException( "dup msgid in mailboxes" );
+    			
+			    mailboxes.Add( msgid, mb );
+		    }
+	    }
+       
+        public void Unregister( Mailbox mb )
+        {
+            lock ( mailboxes )
+            {
+                mailboxes.Remove( mb.GetMessageId() );
+            }
+        }
+
+        private Mailbox GetMailbox( long msgid )
+        {
+            lock ( mailboxes )
+            {
+                return mailboxes[msgid];
+            }
+        }
+      
+        public void Redeliver( Who sender, Message msg ) 
+        {
+            session.SessionMessage(sender, msg);
+        }
+
+        public Object SessionQuery( Object query )
+        {
+            return session.SessionQuery( query );
+        }
+
+        public void SessionControl( Object control, Object value )
+        {
+            session.SessionControl( control, value );
+        }
+
+        public void SessionNotify( Object eventObj )
+        {
+           if(eventObj.Equals(SessionConsts.UP))
+           {
+               up = true;
+           }
+           else if (eventObj.Equals(SessionConsts.DOWN))
+           {
+               up = false;
+               UnRegisterAll();
+           }
+            session.SessionNotify(eventObj);
+        }
+
+        private bool up;
+
+        public Object TransportQuery( Object query )
+        {
+            return transport.TransportQuery( query );
+        }
+
+        public void TransportControl( Object control, Object value )
+        {
+            transport.TransportControl( control, value );
+        }
+
+        public void TransportNotify( Object eventObj )
+        {
+            transport.TransportNotify( eventObj );
+        }
+
+        public void UnRegisterAll()
+        {
+            Mailbox[] mbs;
+            lock (mailboxes) 
+            {
+                mbs = new Mailbox[mailboxes.Values.Count];
+                mailboxes.Values.CopyTo(mbs, 0);
+            }
+            foreach (Mailbox mb in mbs)
+            {
+                mb.CloseDelivery();
+            }
+        }
+
+
+        #region SessionMessage Members
+
+        public bool SessionMessage(Who sender, Message msg)
+        {
+            long? msgid = msg.InReplyTo;
+            if (msgid != null)
+            {
+                Mailbox mb;
+                try
+                {
+                    mb = GetMailbox(msgid.Value);
+                }
+                catch
+                {
+                    mb = null;
+                }
+                if (mb != null)
+                {
+                    try
+                    {
+                        return mb.Message(sender, msg);
+
+                    }
+                    catch (Exception)
+                    {
+                        // timeout or mailbox closed - fall through
+                    }
+                }
+                // no such mailbox - fall through
+                return false;
+            }
+            // no such mailbox or no msgid - fall through
+            return session.SessionMessage(sender, msg);
+
+          
+        }
+
+        #endregion
+
+        #region MailboxManager Members
+
+
+        public Mailbox TransportCall(Who recipient, Message msg)
+        {
+            if (msg.MessageId != null)
+                throw new Exception(" message has already been sent");
+            if (msg.InReplyTo != null)
+                throw new Exception(" message is marked as a reply");
+
+            long mid = idGen.Next();
+
+            msg.MessageId = mid;
+            Mailbox mb = new PlainMailbox(this, mid);
+            Register(mb);
+            try
+            {
+                transport.TransportMessage(recipient, msg);
+            }
+            catch(Exception e)
+            {
+                Unregister(mb);
+                throw e;
+            }
+            return mb;
+        }
+
+        #endregion
+
+        #region TransportMessage Members
+
+        public void TransportMessage(Who recipient, Message msg)
+        {
+            transport.TransportMessage(recipient,msg);
+        }
+
+        #endregion
+
+        #region Transport<SessionMessage> Members
+
+
+        public void SetSession(SessionMessage session)
+        {
+            this.session = session;
+        }
+
+        public SessionMessage GetSession()
+        {
+            return this.session;
+        }
+
+        private SessionMessage session;
+
+        #endregion
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/SessionMessage.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/SessionMessage.cs
new file mode 100644
index 0000000..28f3293
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/SessionMessage.cs
@@ -0,0 +1,29 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    public interface SessionMessage : Session
+    {
+        bool SessionMessage(Who sender, Message msg);
+    }
+}
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TaggedDataInput.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TaggedDataInput.cs
new file mode 100644
index 0000000..38c940e
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TaggedDataInput.cs
@@ -0,0 +1,38 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    /// <summary>A TaggedDataInputStream reads type tagged values from an input stream.</summary>
+    public interface TaggedDataInput
+    {
+       
+        
+        /// <summary>
+        /// Reads a message from the buf.
+        /// </summary>
+        /// <returns>a message read from the buf.</returns>
+        Message ReadMessage(FlexBuffer buf);
+
+      
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TaggedDataOutput.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TaggedDataOutput.cs
new file mode 100644
index 0000000..386f8c4
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TaggedDataOutput.cs
@@ -0,0 +1,39 @@
+// $Id$
+// 
+// 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 Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    /// <summary>
+    /// A TaggedDataOutputStream writes type tagged data values to an output stream.
+    /// </summary>
+    public interface TaggedDataOutput
+    {
+       
+        /// <summary>
+        /// Writes the message to the buf.
+        /// </summary>
+        /// <param name="msg">the message to be written</param>
+        void WriteMessage(Message msg, FlexBuffer msgBuf);
+
+        
+    }
+}
\ No newline at end of file
diff --git a/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs
new file mode 100644
index 0000000..9721ab8
--- /dev/null
+++ b/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs
@@ -0,0 +1,170 @@
+// $Id$
+// 
+// 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.Sockets;
+using Org.Apache.Etch.Bindings.Csharp.Msg;
+using Org.Apache.Etch.Bindings.Csharp.Support;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+using TcpListener=Org.Apache.Etch.Bindings.Csharp.Util.TcpListener;
+
+namespace Org.Apache.Etch.Bindings.Csharp.Transport
+{
+    /// <summary>
+    /// TransportFactory for tcp connections and listeners.
+    /// </summary>
+    public class TcpTransportFactory : TransportFactory
+    {
+        /// <summary>
+        /// Constructs a TcpTransportFactory which delivers TcpConnection or a
+        /// TlsConnection depending upon the isSecure parameter.
+        /// </summary>
+        /// <param name="isSecure">true if TlsConnection is desired, false otherwise</param>
+        public TcpTransportFactory(bool isSecure)
+        {
+            this.isSecure = isSecure;
+        }
+
+        private readonly bool isSecure;
+        
+        private const String SOCKET = "TcpTransportFactory.socket";
+
+        protected override TransportMessage NewTransport(string uri, Resources resources)
+        {
+            URL u = new URL(uri);
+
+            Object socket = resources.Get(SOCKET);
+
+            TransportData c;
+
+            if (isSecure)
+                c = new TlsConnection((Socket)socket, u, resources);
+            else
+                c = new TcpConnection((Socket)socket, u, resources);
+
+            TransportPacket p = new Packetizer(c, u, resources);
+
+            TransportMessage m = new Messagizer(p, u, resources);
+
+            m = AddFilters(