Browse Source

Implementation of service interface generator

csharptest 14 years ago
parent
commit
68d831e3a4

+ 3 - 0
.hgignore

@@ -3,3 +3,6 @@ glob:build_temp/
 glob:bin/
 glob:obj/
 glob:*.cache
+glob:*.suo
+glob:*.user
+glob:_ReSharper*

+ 5 - 0
build/build.csproj

@@ -38,6 +38,7 @@
 
     <Protos Include="$(ProtosDirectory)\extest\unittest_extras_full.proto" />
     <Protos Include="$(ProtosDirectory)\extest\unittest_extras_lite.proto" />
+    <Protos Include="$(ProtosDirectory)\extest\unittest_rpc_interop.proto" />
     <Protos Include="$(ProtosDirectory)\google\protobuf\descriptor.proto" />
     <Protos Include="$(ProtosDirectory)\google\protobuf\csharp_options.proto" />
     <Protos Include="$(ProtosDirectory)\google\protobuf\unittest.proto" />
@@ -97,6 +98,9 @@
     <GeneratedSource Include="$(BuildTempDirectory)\UnitTestProtoFile.cs">
       <TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
     </GeneratedSource>
+    <GeneratedSource Include="$(BuildTempDirectory)\UnitTestRpcInterop.cs">
+      <TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
+    </GeneratedSource>
     <!-- Lite unit test -->
     <GeneratedSource Include="$(BuildTempDirectory)\UnitTestExtrasFullProtoFile.cs">
       <TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
@@ -145,6 +149,7 @@
   <Target Name="Build" DependsOnTargets="_Compile;_Test" />
   <Target Name="Test" DependsOnTargets="_RunTests" />
   <Target Name="Rebuild" DependsOnTargets="Clean;Build" />
+  <Target Name="GenerateSource" DependsOnTargets="_GenerateSource;_CopyGeneratedSource" />
   <Target Name="BuildPackage" DependsOnTargets="PrepareOutputDirectory;PreparePackageComponent;GeneratePackage" />
   <Target Name="PrepareOutputDirectory" DependsOnTargets="_CleanOutputDirectory" />
   <Target Name="PreparePackageComponent" DependsOnTargets="_PreparePackageComponent" />

+ 34 - 0
protos/extest/unittest_rpc_interop.proto

@@ -0,0 +1,34 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestRpcInterop";
+
+option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
+
+option optimize_for = SPEED;
+
+message SearchRequest {
+  repeated string Criteria = 1;
+}
+
+message SearchResponse {
+  message ResultItem {
+    required string url = 1;
+    optional string name = 2;
+  }
+  
+  repeated ResultItem results = 1;
+}
+
+message RefineSearchRequest {
+  repeated string Criteria = 1;
+  required SearchResponse previous_results = 2;
+}
+
+service SearchService {
+  option (google.protobuf.csharp_service_options).interface_id = "{A65F0925-FD11-4f94-B166-89AC4F027205}";
+  rpc Search (SearchRequest) returns (SearchResponse) { option (google.protobuf.csharp_method_options).dispatch_id = 5; };
+  
+  rpc RefineSearch (RefineSearchRequest) returns (SearchResponse);
+}

+ 103 - 73
protos/google/protobuf/csharp_options.proto

@@ -1,73 +1,103 @@
-// Extra options for C# generator
-
-import "google/protobuf/descriptor.proto";
-
-package google.protobuf;
-
-message CSharpFileOptions {
-
-  // Namespace for generated classes; defaults to the package.
-  optional string namespace = 1;
-  
-  // Name of the "umbrella" class used for metadata about all
-  // the messages within this file. Default is based on the name
-  // of the file.
-  optional string umbrella_classname = 2;
-  
-  // Whether classes should be public (true) or internal (false)
-  optional bool public_classes = 3 [default = true];
-
-  // Whether to generate a single file for everything within the
-  // .proto file (false), or one file per message (true).
-  // This option is not currently honored; please log a feature
-  // request if you really want it.
-  optional bool multiple_files = 4;
-
-  // Whether to nest messages within a single umbrella class (true)
-  // or create the umbrella class as a peer, with messages as
-  // top-level classes in the namespace (false)
-  optional bool nest_classes = 5;
-  
-  // Generate appropriate support for Code Contracts
-  // (Ongoing; support should improve over time)
-  optional bool code_contracts = 6;
-  
-  // Create subdirectories for namespaces, e.g. namespace "Foo.Bar"
-  // would generate files within [output directory]/Foo/Bar
-  optional bool expand_namespace_directories = 7;
-
-  // Generate attributes indicating non-CLS-compliance
-  optional bool cls_compliance = 8 [default = true];
-
-  // The extension that should be appended to the umbrella_classname when creating files.
-  optional string file_extension = 221 [default = ".cs"];
-  
-  // A nested namespace for the umbrella class.  Helpful for name collisions caused by 
-  // umbrella_classname conflicting with an existing type.  This will be automatically
-  // set to 'Proto' if a collision is detected with types being generated.  This value
-  // is ignored when nest_classes == true
-  optional string umbrella_namespace = 222;
-  
-  // The output path for the source file(s) generated
-  optional string output_directory = 223 [default = "."];
-
-  // Will ignore the type generations and remove dependencies for the descriptor proto
-  // files that declare their package to be "google.protobuf"
-  optional bool ignore_google_protobuf = 224 [default = false];
-}
-
-extend FileOptions {
-  optional CSharpFileOptions csharp_file_options = 1000;
-}
-
-extend FieldOptions {
-  optional CSharpFieldOptions csharp_field_options = 1000;
-}
-
-message CSharpFieldOptions {
-  // Provides the ability to override the name of the property
-  // generated for this field. This is applied to all properties
-  // and methods to do with this field, including HasFoo, FooCount,
-  // FooList etc.
-  optional string property_name = 1;
-}
+// Extra options for C# generator
+
+import "google/protobuf/descriptor.proto";
+
+package google.protobuf;
+
+message CSharpFileOptions {
+
+  // Namespace for generated classes; defaults to the package.
+  optional string namespace = 1;
+  
+  // Name of the "umbrella" class used for metadata about all
+  // the messages within this file. Default is based on the name
+  // of the file.
+  optional string umbrella_classname = 2;
+  
+  // Whether classes should be public (true) or internal (false)
+  optional bool public_classes = 3 [default = true];
+
+  // Whether to generate a single file for everything within the
+  // .proto file (false), or one file per message (true).
+  // This option is not currently honored; please log a feature
+  // request if you really want it.
+  optional bool multiple_files = 4;
+
+  // Whether to nest messages within a single umbrella class (true)
+  // or create the umbrella class as a peer, with messages as
+  // top-level classes in the namespace (false)
+  optional bool nest_classes = 5;
+  
+  // Generate appropriate support for Code Contracts
+  // (Ongoing; support should improve over time)
+  optional bool code_contracts = 6;
+  
+  // Create subdirectories for namespaces, e.g. namespace "Foo.Bar"
+  // would generate files within [output directory]/Foo/Bar
+  optional bool expand_namespace_directories = 7;
+
+  // Generate attributes indicating non-CLS-compliance
+  optional bool cls_compliance = 8 [default = true];
+
+  // The extension that should be appended to the umbrella_classname when creating files.
+  optional string file_extension = 221 [default = ".cs"];
+  
+  // A nested namespace for the umbrella class.  Helpful for name collisions caused by 
+  // umbrella_classname conflicting with an existing type.  This will be automatically
+  // set to 'Proto' if a collision is detected with types being generated.  This value
+  // is ignored when nest_classes == true
+  optional string umbrella_namespace = 222;
+  
+  // The output path for the source file(s) generated
+  optional string output_directory = 223 [default = "."];
+
+  // Will ignore the type generations and remove dependencies for the descriptor proto
+  // files that declare their package to be "google.protobuf"
+  optional bool ignore_google_protobuf = 224 [default = false];
+
+  // Controls how services are generated, GENERIC is the deprecated original implementation
+  // INTERFACE generates service interfaces only, RPCINTEROP generates interfaces and 
+  // implementations using the included Windows RPC interop libarary.
+  optional CSharpServiceType service_generator_type = 225 [default = GENERIC];
+}
+
+enum CSharpServiceType {
+  // Generates the original Java generic service implementations
+  GENERIC = 1;
+  // Generates an interface for the service and nothing else
+  INTERFACE = 2;
+  // Generates an interface for the service and client/server wrappers for the interface
+  IRPCDISPATCH = 3;
+}
+
+extend FileOptions {
+  optional CSharpFileOptions csharp_file_options = 1000;
+}
+
+extend FieldOptions {
+  optional CSharpFieldOptions csharp_field_options = 1000;
+}
+
+message CSharpFieldOptions {
+  // Provides the ability to override the name of the property
+  // generated for this field. This is applied to all properties
+  // and methods to do with this field, including HasFoo, FooCount,
+  // FooList etc.
+  optional string property_name = 1;
+}
+
+message CSharpServiceOptions {
+  optional string interface_id = 1;
+}
+
+extend ServiceOptions {
+  optional CSharpServiceOptions csharp_service_options = 1000;
+}
+
+message CSharpMethodOptions {
+  optional int32 dispatch_id = 1;
+}
+
+extend MethodOptions {
+  optional CSharpMethodOptions csharp_method_options = 1000;
+}

+ 1 - 2
src/ProtoGen/Generator.cs

@@ -63,8 +63,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
       List<FileDescriptorSet> descriptorProtos = new List<FileDescriptorSet>();
       foreach (string inputFile in options.InputFiles) {
         ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance();
-        extensionRegistry.Add(CSharpOptions.CSharpFileOptions);
-        extensionRegistry.Add(CSharpOptions.CSharpFieldOptions);
+        CSharpOptions.RegisterAllExtensions(extensionRegistry);
         using (Stream inputStream = File.OpenRead(inputFile)) {
             descriptorProtos.Add(FileDescriptorSet.ParseFrom(inputStream, extensionRegistry));
         }

+ 120 - 119
src/ProtoGen/ProtoGen.csproj

@@ -1,126 +1,127 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{250ADE34-82FD-4BAE-86D5-985FBE589C4A}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Google.ProtocolBuffers.ProtoGen</RootNamespace>
-    <AssemblyName>ProtoGen</AssemblyName>
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.ProtoGen.snk</AssemblyOriginatorKeyFile>
-    <FileUpgradeFlags>
-    </FileUpgradeFlags>
-    <UpgradeBackupLocation>
-    </UpgradeBackupLocation>
-    <OldToolsVersion>3.5</OldToolsVersion>
-    <PublishUrl>publish\</PublishUrl>
-    <Install>true</Install>
-    <InstallFrom>Disk</InstallFrom>
-    <UpdateEnabled>false</UpdateEnabled>
-    <UpdateMode>Foreground</UpdateMode>
-    <UpdateInterval>7</UpdateInterval>
-    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
-    <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
-    <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>0</ApplicationRevision>
-    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
-    <UseApplicationTrust>false</UseApplicationTrust>
-    <BootstrapperEnabled>true</BootstrapperEnabled>
-    <StartupObject>Google.ProtocolBuffers.ProtoGen.ProgramPreprocess</StartupObject>
-  </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>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </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>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-	  <Reference Include="mscorlib" />
-    <Reference Include="System" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="DescriptorUtil.cs" />
-    <Compile Include="EnumFieldGenerator.cs" />
-    <Compile Include="EnumGenerator.cs" />
-    <Compile Include="ExtensionGenerator.cs" />
-    <Compile Include="FieldGeneratorBase.cs" />
-    <Compile Include="IFieldSourceGenerator.cs" />
-    <Compile Include="ISourceGenerator.cs" />
-    <Compile Include="MessageFieldGenerator.cs" />
-    <Compile Include="MessageGenerator.cs" />
-    <Compile Include="PrimitiveFieldGenerator.cs" />
-    <Compile Include="ProgramPreprocess.cs" />
-    <Compile Include="RepeatedEnumFieldGenerator.cs" />
-    <Compile Include="RepeatedMessageFieldGenerator.cs" />
-    <Compile Include="RepeatedPrimitiveFieldGenerator.cs" />
-    <Compile Include="ServiceGenerator.cs" />
-    <Compile Include="DependencyResolutionException.cs" />
-    <Compile Include="Generator.cs" />
-    <Compile Include="GeneratorOptions.cs" />
-    <Compile Include="Helpers.cs" />
-    <Compile Include="InvalidOptionsException.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="SourceGeneratorBase.cs" />
-    <Compile Include="SourceGenerators.cs" />
-    <Compile Include="UmbrellaClassGenerator.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="app.config" />
-    <None Include="Properties\Google.ProtocolBuffers.ProtoGen.snk" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\ProtocolBuffers\ProtocolBuffers.csproj">
-      <Project>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</Project>
-      <Name>ProtocolBuffers</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
-      <Install>false</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
-      <Visible>False</Visible>
-      <ProductName>Windows Installer 3.1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{250ADE34-82FD-4BAE-86D5-985FBE589C4A}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Google.ProtocolBuffers.ProtoGen</RootNamespace>
+    <AssemblyName>ProtoGen</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.ProtoGen.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+    <StartupObject>Google.ProtocolBuffers.ProtoGen.ProgramPreprocess</StartupObject>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="DescriptorUtil.cs" />
+    <Compile Include="EnumFieldGenerator.cs" />
+    <Compile Include="EnumGenerator.cs" />
+    <Compile Include="ExtensionGenerator.cs" />
+    <Compile Include="FieldGeneratorBase.cs" />
+    <Compile Include="IFieldSourceGenerator.cs" />
+    <Compile Include="ISourceGenerator.cs" />
+    <Compile Include="MessageFieldGenerator.cs" />
+    <Compile Include="MessageGenerator.cs" />
+    <Compile Include="PrimitiveFieldGenerator.cs" />
+    <Compile Include="ProgramPreprocess.cs" />
+    <Compile Include="RepeatedEnumFieldGenerator.cs" />
+    <Compile Include="RepeatedMessageFieldGenerator.cs" />
+    <Compile Include="RepeatedPrimitiveFieldGenerator.cs" />
+    <Compile Include="ServiceGenerator.cs" />
+    <Compile Include="DependencyResolutionException.cs" />
+    <Compile Include="Generator.cs" />
+    <Compile Include="GeneratorOptions.cs" />
+    <Compile Include="Helpers.cs" />
+    <Compile Include="InvalidOptionsException.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ServiceInterfaceGenerator.cs" />
+    <Compile Include="SourceGeneratorBase.cs" />
+    <Compile Include="SourceGenerators.cs" />
+    <Compile Include="UmbrellaClassGenerator.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+    <None Include="Properties\Google.ProtocolBuffers.ProtoGen.snk" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\ProtocolBuffers\ProtocolBuffers.csproj">
+      <Project>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</Project>
+      <Name>ProtocolBuffers</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\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>

+ 4 - 4
src/ProtoGen/ServiceGenerator.cs

@@ -35,14 +35,14 @@
 using Google.ProtocolBuffers.Descriptors;
 
 namespace Google.ProtocolBuffers.ProtoGen {
-  internal class ServiceGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {
+  internal class GenericServiceGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {
 
     private enum RequestOrResponse {
       Request,
       Response
-    }
-
-    internal ServiceGenerator(ServiceDescriptor descriptor)
+    }
+
+    internal GenericServiceGenerator(ServiceDescriptor descriptor)
       : base(descriptor) {
     }
 

+ 235 - 0
src/ProtoGen/ServiceInterfaceGenerator.cs

@@ -0,0 +1,235 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// http://github.com/jskeet/dotnet-protobufs/
+// Original C++/Java/Python code:
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using Google.ProtocolBuffers.DescriptorProtos;
+using Google.ProtocolBuffers.Descriptors;
+
+namespace Google.ProtocolBuffers.ProtoGen {
+  internal class ServiceGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {
+
+    readonly CSharpServiceType svcType;
+    ISourceGenerator _generator;
+
+    internal ServiceGenerator(ServiceDescriptor descriptor)
+      : base(descriptor) {
+      svcType = descriptor.File.CSharpOptions.ServiceGeneratorType;
+      switch (svcType) {
+        case CSharpServiceType.GENERIC:
+          _generator = new GenericServiceGenerator(descriptor);
+          break;
+        case CSharpServiceType.INTERFACE:
+          _generator = new ServiceInterfaceGenerator(descriptor);
+          break;
+        case CSharpServiceType.IRPCDISPATCH:
+          _generator = new RpcServiceGenerator(descriptor);
+          break;
+        default: throw new ApplicationException("Unknown ServiceGeneratorType = " + svcType.ToString());
+      }
+    }
+
+    public void Generate(TextGenerator writer) {
+      _generator.Generate(writer);
+    }
+
+    class ServiceInterfaceGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {
+      
+      public ServiceInterfaceGenerator(ServiceDescriptor descriptor)
+        : base(descriptor) {
+      }
+
+      public virtual void Generate(TextGenerator writer) {
+
+        CSharpServiceOptions options = Descriptor.Options.GetExtension(CSharpOptions.CsharpServiceOptions);
+        if (options != null && options.HasInterfaceId) {
+          writer.WriteLine("[global::System.Runtime.InteropServices.GuidAttribute(\"{0}\")]", new Guid(options.InterfaceId));
+        }
+        writer.WriteLine("{0} partial interface I{1} {{", ClassAccessLevel, Descriptor.Name);
+        writer.Indent();
+
+        foreach (MethodDescriptor method in Descriptor.Methods)
+        {
+          CSharpMethodOptions mth = method.Options.GetExtension(CSharpOptions.CsharpMethodOptions);
+          if(mth.HasDispatchId) {
+            writer.WriteLine("[global::System.Runtime.InteropServices.DispId({0})]", mth.DispatchId);
+          }
+          writer.WriteLine("{0} {1}({2} {3});", GetClassName(method.OutputType), NameHelpers.UnderscoresToPascalCase(method.Name), GetClassName(method.InputType), NameHelpers.UnderscoresToCamelCase(method.InputType.Name));
+        }
+
+        writer.Outdent();
+        writer.WriteLine("}");
+      }
+    }
+    
+    class RpcServiceGenerator : ServiceInterfaceGenerator {
+
+      public RpcServiceGenerator(ServiceDescriptor descriptor)
+        : base(descriptor) {
+      }
+
+      public override void Generate(TextGenerator writer)
+      {
+        base.Generate(writer);
+
+        writer.WriteLine();
+
+        // CLIENT Proxy
+        {
+          if (Descriptor.File.CSharpOptions.ClsCompliance)
+            writer.WriteLine("[global::System.CLSCompliant(false)]");
+          writer.WriteLine("{0} partial class {1} : I{1}, pb::IRpcDispatch, global::System.IDisposable {{", ClassAccessLevel, Descriptor.Name);
+          writer.Indent();
+          writer.WriteLine("private readonly bool dispose;");
+          writer.WriteLine("private readonly pb::IRpcDispatch dispatch;");
+
+          writer.WriteLine("public {0}(pb::IRpcDispatch dispatch) : this(dispatch, true) {{", Descriptor.Name);
+          writer.WriteLine("}");
+          writer.WriteLine("public {0}(pb::IRpcDispatch dispatch, bool dispose) {{", Descriptor.Name);
+          writer.WriteLine("  if (null == (this.dispatch = dispatch)) throw new global::System.ArgumentNullException();");
+          writer.WriteLine("  this.dispose = dispose && dispatch is global::System.IDisposable;");
+          writer.WriteLine("}");
+          writer.WriteLine();
+
+          writer.WriteLine("public void Dispose() {");
+          writer.WriteLine("  if (dispose) ((global::System.IDisposable)dispatch).Dispose();");
+          writer.WriteLine("}");
+          writer.WriteLine();
+          writer.WriteLine("TMessage pb::IRpcDispatch.CallMethod<TMessage, TBuilder>(string method, pb::IMessageLite request, pb::IBuilderLite<TMessage, TBuilder> response) {");
+          writer.WriteLine("  return dispatch.CallMethod(method, request, response);");
+          writer.WriteLine("}");
+          writer.WriteLine();
+
+          foreach (MethodDescriptor method in Descriptor.Methods) {
+            writer.WriteLine("public {0} {1}({2} {3}) {{", GetClassName(method.OutputType), NameHelpers.UnderscoresToPascalCase(method.Name), GetClassName(method.InputType), NameHelpers.UnderscoresToCamelCase(method.InputType.Name));
+            writer.WriteLine("   return dispatch.CallMethod(\"{0}\", {1}, {2}.CreateBuilder());",
+                             method.Name,
+                             NameHelpers.UnderscoresToCamelCase(method.InputType.Name),
+                             GetClassName(method.OutputType)
+              );
+            writer.WriteLine("}");
+            writer.WriteLine();
+          }
+        }
+        // SERVER - DISPATCH
+        {
+          if (Descriptor.File.CSharpOptions.ClsCompliance)
+            writer.WriteLine("[global::System.CLSCompliant(false)]");
+          writer.WriteLine("public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable {");
+          writer.Indent();
+          writer.WriteLine("private readonly bool dispose;");
+          writer.WriteLine("private readonly I{0} implementation;", Descriptor.Name);
+
+          writer.WriteLine("public Dispatch(I{0} implementation) : this(implementation, true) {{", Descriptor.Name);
+          writer.WriteLine("}");
+          writer.WriteLine("public Dispatch(I{0} implementation, bool dispose) {{", Descriptor.Name);
+          writer.WriteLine("  if (null == (this.implementation = implementation)) throw new global::System.ArgumentNullException();");
+          writer.WriteLine("  this.dispose = dispose && implementation is global::System.IDisposable;");
+          writer.WriteLine("}");
+          writer.WriteLine();
+
+          writer.WriteLine("public void Dispose() {");
+          writer.WriteLine("  if (dispose) ((global::System.IDisposable)implementation).Dispose();");
+          writer.WriteLine("}");
+          writer.WriteLine();
+
+          writer.WriteLine("public TMessage CallMethod<TMessage, TBuilder>(string methodName, pb::IMessageLite request, pb::IBuilderLite<TMessage, TBuilder> response)");
+          writer.WriteLine("  where TMessage : IMessageLite<TMessage, TBuilder>");
+          writer.WriteLine("  where TBuilder : IBuilderLite<TMessage, TBuilder> {");
+          writer.Indent();
+          writer.WriteLine("switch(methodName) {");
+          writer.Indent();
+
+          foreach (MethodDescriptor method in Descriptor.Methods) {
+            writer.WriteLine("case \"{0}\": return response.MergeFrom(implementation.{1}(({2})request)).Build();", method.Name, NameHelpers.UnderscoresToPascalCase(method.Name), GetClassName(method.InputType));
+          }
+          writer.WriteLine("default: throw new global::System.MissingMethodException(typeof(ISearchService).FullName, methodName);");
+          writer.Outdent();
+          writer.WriteLine("}");//end switch
+          writer.Outdent();
+          writer.WriteLine("}");//end invoke
+          writer.Outdent();
+          writer.WriteLine("}");//end server
+        }
+        // SERVER - STUB
+        {
+          if (Descriptor.File.CSharpOptions.ClsCompliance)
+            writer.WriteLine("[global::System.CLSCompliant(false)]");
+          writer.WriteLine("public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable {");
+          writer.Indent();
+          writer.WriteLine("private readonly bool dispose;");
+          writer.WriteLine("private readonly pb::IRpcDispatch implementation;", Descriptor.Name);
+
+          writer.WriteLine("public ServerStub(I{0} implementation) : this(implementation, true) {{", Descriptor.Name);
+          writer.WriteLine("}");
+          writer.WriteLine("public ServerStub(I{0} implementation, bool dispose) : this(new Dispatch(implementation, dispose), dispose) {{", Descriptor.Name);
+          writer.WriteLine("}");
+
+          writer.WriteLine("public ServerStub(pb::IRpcDispatch implementation) : this(implementation, true) {");
+          writer.WriteLine("}");
+          writer.WriteLine("public ServerStub(pb::IRpcDispatch implementation, bool dispose) {");
+          writer.WriteLine("  if (null == (this.implementation = implementation)) throw new global::System.ArgumentNullException();");
+          writer.WriteLine("  this.dispose = dispose && implementation is global::System.IDisposable;");
+          writer.WriteLine("}");
+          writer.WriteLine();
+
+          writer.WriteLine("public void Dispose() {");
+          writer.WriteLine("  if (dispose) ((global::System.IDisposable)implementation).Dispose();");
+          writer.WriteLine("}");
+          writer.WriteLine();
+
+          writer.WriteLine("public pb::IMessageLite CallMethod(string methodName, pb::CodedInputStream input, pb::ExtensionRegistry registry) {{", Descriptor.Name);
+          writer.Indent();
+          writer.WriteLine("switch(methodName) {");
+          writer.Indent();
+
+          foreach (MethodDescriptor method in Descriptor.Methods)
+          {
+            writer.WriteLine("case \"{0}\": return implementation.CallMethod(methodName, {1}.ParseFrom(input, registry), {2}.CreateBuilder());", method.Name, GetClassName(method.InputType), GetClassName(method.OutputType));
+          }
+          writer.WriteLine("default: throw new global::System.MissingMethodException(typeof(ISearchService).FullName, methodName);");
+          writer.Outdent();
+          writer.WriteLine("}");//end switch
+          writer.Outdent();
+          writer.WriteLine("}");//end invoke
+          writer.Outdent();
+          writer.WriteLine("}");//end server
+        }
+
+        writer.Outdent();
+        writer.WriteLine("}");
+      }
+    }
+  }
+}

+ 136 - 134
src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj

@@ -1,141 +1,143 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{DD01ED24-3750-4567-9A23-1DB676A15610}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Google.ProtocolBuffers</RootNamespace>
-    <AssemblyName>Google.ProtocolBuffers.Test</AssemblyName>
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.Test.snk</AssemblyOriginatorKeyFile>
-    <FileUpgradeFlags>
-    </FileUpgradeFlags>
-    <UpgradeBackupLocation>
-    </UpgradeBackupLocation>
-    <OldToolsVersion>3.5</OldToolsVersion>
-    <PublishUrl>publish\</PublishUrl>
-    <Install>true</Install>
-    <InstallFrom>Disk</InstallFrom>
-    <UpdateEnabled>false</UpdateEnabled>
-    <UpdateMode>Foreground</UpdateMode>
-    <UpdateInterval>7</UpdateInterval>
-    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
-    <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
-    <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>0</ApplicationRevision>
-    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
-    <UseApplicationTrust>false</UseApplicationTrust>
-    <BootstrapperEnabled>true</BootstrapperEnabled>
-  </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>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </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>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\NUnit 2.2.8.0\nunit.framework.dll</HintPath>
-    </Reference>
-    <Reference Include="Rhino.Mocks, Version=3.5.0.2, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\lib\Rhino.Mocks.dll</HintPath>
-    </Reference>
-    <Reference Include="mscorlib" />
-    <Reference Include="System" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AbstractMessageTest.cs" />
-    <Compile Include="ByteStringTest.cs" />
-    <Compile Include="CodedInputStreamTest.cs" />
-    <Compile Include="CodedOutputStreamTest.cs" />
-    <Compile Include="Collections\PopsicleListTest.cs" />
-    <Compile Include="CSharpOptionsTest.cs" />
-    <Compile Include="DescriptorsTest.cs" />
-    <Compile Include="Descriptors\MessageDescriptorTest.cs" />
-    <Compile Include="DynamicMessageTest.cs" />
-    <Compile Include="ExtendableMessageTest.cs" />
-    <Compile Include="GeneratedMessageTest.cs" />
-    <Compile Include="MessageStreamIteratorTest.cs" />
-    <Compile Include="MessageStreamWriterTest.cs" />
-    <Compile Include="MessageTest.cs" />
-    <Compile Include="MessageUtilTest.cs" />
-    <Compile Include="NameHelpersTest.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="ReflectionTester.cs" />
-    <Compile Include="ServiceTest.cs" />
-    <Compile Include="TestProtos\UnitTestCSharpOptionsProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestCustomOptionsProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestEmbedOptimizeForProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestEmptyProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestImportProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestMessageSetProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestNoGenericServicesProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestOptimizeForProtoFile.cs" />
-    <Compile Include="TestProtos\UnitTestProtoFile.cs" />
-    <Compile Include="TestUtil.cs" />
-    <Compile Include="TextFormatTest.cs" />
-    <Compile Include="UnknownFieldSetTest.cs" />
-    <Compile Include="WireFormatTest.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\ProtocolBuffers\ProtocolBuffers.csproj">
-      <Project>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</Project>
-      <Name>ProtocolBuffers</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Properties\Google.ProtocolBuffers.Test.snk" />
-  </ItemGroup>
-  <ItemGroup>
-    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
-      <Install>false</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
-      <Visible>False</Visible>
-      <ProductName>Windows Installer 3.1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Debug' " />  
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Release' " />
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DD01ED24-3750-4567-9A23-1DB676A15610}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Google.ProtocolBuffers</RootNamespace>
+    <AssemblyName>Google.ProtocolBuffers.Test</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.Test.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\lib\NUnit 2.2.8.0\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="Rhino.Mocks, Version=3.5.0.2, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\lib\Rhino.Mocks.dll</HintPath>
+    </Reference>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AbstractMessageTest.cs" />
+    <Compile Include="ByteStringTest.cs" />
+    <Compile Include="CodedInputStreamTest.cs" />
+    <Compile Include="CodedOutputStreamTest.cs" />
+    <Compile Include="Collections\PopsicleListTest.cs" />
+    <Compile Include="CSharpOptionsTest.cs" />
+    <Compile Include="DescriptorsTest.cs" />
+    <Compile Include="Descriptors\MessageDescriptorTest.cs" />
+    <Compile Include="DynamicMessageTest.cs" />
+    <Compile Include="ExtendableMessageTest.cs" />
+    <Compile Include="GeneratedMessageTest.cs" />
+    <Compile Include="MessageStreamIteratorTest.cs" />
+    <Compile Include="MessageStreamWriterTest.cs" />
+    <Compile Include="MessageTest.cs" />
+    <Compile Include="MessageUtilTest.cs" />
+    <Compile Include="NameHelpersTest.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ReflectionTester.cs" />
+    <Compile Include="ServiceTest.cs" />
+    <Compile Include="TestProtos\UnitTestCSharpOptionsProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestCustomOptionsProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestEmbedOptimizeForProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestEmptyProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestImportProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestMessageSetProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestNoGenericServicesProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestOptimizeForProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestProtoFile.cs" />
+    <Compile Include="TestProtos\UnitTestRpcInterop.cs" />
+    <Compile Include="TestRpcGenerator.cs" />
+    <Compile Include="TestUtil.cs" />
+    <Compile Include="TextFormatTest.cs" />
+    <Compile Include="UnknownFieldSetTest.cs" />
+    <Compile Include="WireFormatTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\ProtocolBuffers\ProtocolBuffers.csproj">
+      <Project>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</Project>
+      <Name>ProtocolBuffers</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Properties\Google.ProtocolBuffers.Test.snk" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Debug' " />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Release' " />
   <!-- 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>

+ 1212 - 0
src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs

@@ -0,0 +1,1212 @@
+// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd.  DO NOT EDIT!
+
+using pb = global::Google.ProtocolBuffers;
+using pbc = global::Google.ProtocolBuffers.Collections;
+using pbd = global::Google.ProtocolBuffers.Descriptors;
+using scg = global::System.Collections.Generic;
+namespace Google.ProtocolBuffers.TestProtos {
+  
+  public static partial class UnitTestRpcInterop {
+  
+    #region Extension registration
+    public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
+    }
+    #endregion
+    #region Static variables
+    internal static pbd::MessageDescriptor internal__static_SearchRequest__Descriptor;
+    internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.SearchRequest, global::Google.ProtocolBuffers.TestProtos.SearchRequest.Builder> internal__static_SearchRequest__FieldAccessorTable;
+    internal static pbd::MessageDescriptor internal__static_SearchResponse__Descriptor;
+    internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.SearchResponse, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder> internal__static_SearchResponse__FieldAccessorTable;
+    internal static pbd::MessageDescriptor internal__static_SearchResponse_ResultItem__Descriptor;
+    internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder> internal__static_SearchResponse_ResultItem__FieldAccessorTable;
+    internal static pbd::MessageDescriptor internal__static_RefineSearchRequest__Descriptor;
+    internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest, global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.Builder> internal__static_RefineSearchRequest__FieldAccessorTable;
+    #endregion
+    #region Descriptor
+    public static pbd::FileDescriptor Descriptor {
+      get { return descriptor; }
+    }
+    private static pbd::FileDescriptor descriptor;
+    
+    static UnitTestRpcInterop() {
+      byte[] descriptorData = global::System.Convert.FromBase64String(
+          "CiFleHRlc3QvdW5pdHRlc3RfcnBjX2ludGVyb3AucHJvdG8aJGdvb2dsZS9w" + 
+          "cm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIhCg1TZWFyY2hSZXF1ZXN0" + 
+          "EhAKCENyaXRlcmlhGAEgAygJImYKDlNlYXJjaFJlc3BvbnNlEisKB3Jlc3Vs" + 
+          "dHMYASADKAsyGi5TZWFyY2hSZXNwb25zZS5SZXN1bHRJdGVtGicKClJlc3Vs" + 
+          "dEl0ZW0SCwoDdXJsGAEgAigJEgwKBG5hbWUYAiABKAkiUgoTUmVmaW5lU2Vh" + 
+          "cmNoUmVxdWVzdBIQCghDcml0ZXJpYRgBIAMoCRIpChBwcmV2aW91c19yZXN1" + 
+          "bHRzGAIgAigLMg8uU2VhcmNoUmVzcG9uc2UypQEKDVNlYXJjaFNlcnZpY2US" + 
+          "MAoGU2VhcmNoEg4uU2VhcmNoUmVxdWVzdBoPLlNlYXJjaFJlc3BvbnNlIgXC" + 
+          "PgIIBRI1CgxSZWZpbmVTZWFyY2gSFC5SZWZpbmVTZWFyY2hSZXF1ZXN0Gg8u" + 
+          "U2VhcmNoUmVzcG9uc2UaK8I+KAome0E2NUYwOTI1LUZEMTEtNGY5NC1CMTY2" + 
+          "LTg5QUM0RjAyNzIwNX1CP0gBwj46CiFHb29nbGUuUHJvdG9jb2xCdWZmZXJz" + 
+          "LlRlc3RQcm90b3MSElVuaXRUZXN0UnBjSW50ZXJvcIgOAw==");
+      pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
+        descriptor = root;
+        internal__static_SearchRequest__Descriptor = Descriptor.MessageTypes[0];
+        internal__static_SearchRequest__FieldAccessorTable = 
+            new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.SearchRequest, global::Google.ProtocolBuffers.TestProtos.SearchRequest.Builder>(internal__static_SearchRequest__Descriptor,
+                new string[] { "Criteria", });
+        internal__static_SearchResponse__Descriptor = Descriptor.MessageTypes[1];
+        internal__static_SearchResponse__FieldAccessorTable = 
+            new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.SearchResponse, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder>(internal__static_SearchResponse__Descriptor,
+                new string[] { "Results", });
+        internal__static_SearchResponse_ResultItem__Descriptor = internal__static_SearchResponse__Descriptor.NestedTypes[0];
+        internal__static_SearchResponse_ResultItem__FieldAccessorTable = 
+            new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder>(internal__static_SearchResponse_ResultItem__Descriptor,
+                new string[] { "Url", "Name", });
+        internal__static_RefineSearchRequest__Descriptor = Descriptor.MessageTypes[2];
+        internal__static_RefineSearchRequest__FieldAccessorTable = 
+            new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest, global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.Builder>(internal__static_RefineSearchRequest__Descriptor,
+                new string[] { "Criteria", "PreviousResults", });
+        pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();
+        RegisterAllExtensions(registry);
+        global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry);
+        return registry;
+      };
+      pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
+          new pbd::FileDescriptor[] {
+          global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, 
+          }, assigner);
+    }
+    #endregion
+    
+  }
+  #region Messages
+  public sealed partial class SearchRequest : pb::GeneratedMessage<SearchRequest, SearchRequest.Builder> {
+    private static readonly SearchRequest defaultInstance = new Builder().BuildPartial();
+    public static SearchRequest DefaultInstance {
+      get { return defaultInstance; }
+    }
+    
+    public override SearchRequest DefaultInstanceForType {
+      get { return defaultInstance; }
+    }
+    
+    protected override SearchRequest ThisMessage {
+      get { return this; }
+    }
+    
+    public static pbd::MessageDescriptor Descriptor {
+      get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchRequest__Descriptor; }
+    }
+    
+    protected override pb::FieldAccess.FieldAccessorTable<SearchRequest, SearchRequest.Builder> InternalFieldAccessors {
+      get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchRequest__FieldAccessorTable; }
+    }
+    
+    public const int CriteriaFieldNumber = 1;
+    private pbc::PopsicleList<string> criteria_ = new pbc::PopsicleList<string>();
+    public scg::IList<string> CriteriaList {
+      get { return pbc::Lists.AsReadOnly(criteria_); }
+    }
+    public int CriteriaCount {
+      get { return criteria_.Count; }
+    }
+    public string GetCriteria(int index) {
+      return criteria_[index];
+    }
+    
+    public override bool IsInitialized {
+      get {
+        return true;
+      }
+    }
+    
+    public override void WriteTo(pb::CodedOutputStream output) {
+      int size = SerializedSize;
+      if (criteria_.Count > 0) {
+        foreach (string element in criteria_) {
+          output.WriteString(1, element);
+        }
+      }
+      UnknownFields.WriteTo(output);
+    }
+    
+    private int memoizedSerializedSize = -1;
+    public override int SerializedSize {
+      get {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+        
+        size = 0;
+        {
+          int dataSize = 0;
+          foreach (string element in CriteriaList) {
+            dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
+          }
+          size += dataSize;
+          size += 1 * criteria_.Count;
+        }
+        size += UnknownFields.SerializedSize;
+        memoizedSerializedSize = size;
+        return size;
+      }
+    }
+    
+    public static SearchRequest ParseFrom(pb::ByteString data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(byte[] data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(global::System.IO.Stream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static SearchRequest ParseDelimitedFrom(global::System.IO.Stream input) {
+      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
+    }
+    public static SearchRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(pb::CodedInputStream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static SearchRequest ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static Builder CreateBuilder() { return new Builder(); }
+    public override Builder ToBuilder() { return CreateBuilder(this); }
+    public override Builder CreateBuilderForType() { return new Builder(); }
+    public static Builder CreateBuilder(SearchRequest prototype) {
+      return (Builder) new Builder().MergeFrom(prototype);
+    }
+    
+    public sealed partial class Builder : pb::GeneratedBuilder<SearchRequest, Builder> {
+      protected override Builder ThisBuilder {
+        get { return this; }
+      }
+      public Builder() {}
+      
+      SearchRequest result = new SearchRequest();
+      
+      protected override SearchRequest MessageBeingBuilt {
+        get { return result; }
+      }
+      
+      public override Builder Clear() {
+        result = new SearchRequest();
+        return this;
+      }
+      
+      public override Builder Clone() {
+        return new Builder().MergeFrom(result);
+      }
+      
+      public override pbd::MessageDescriptor DescriptorForType {
+        get { return global::Google.ProtocolBuffers.TestProtos.SearchRequest.Descriptor; }
+      }
+      
+      public override SearchRequest DefaultInstanceForType {
+        get { return global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance; }
+      }
+      
+      public override SearchRequest BuildPartial() {
+        if (result == null) {
+          throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+        }
+        result.criteria_.MakeReadOnly();
+        SearchRequest returnMe = result;
+        result = null;
+        return returnMe;
+      }
+      
+      public override Builder MergeFrom(pb::IMessage other) {
+        if (other is SearchRequest) {
+          return MergeFrom((SearchRequest) other);
+        } else {
+          base.MergeFrom(other);
+          return this;
+        }
+      }
+      
+      public override Builder MergeFrom(SearchRequest other) {
+        if (other == global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance) return this;
+        if (other.criteria_.Count != 0) {
+          base.AddRange(other.criteria_, result.criteria_);
+        }
+        this.MergeUnknownFields(other.UnknownFields);
+        return this;
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input) {
+        return MergeFrom(input, pb::ExtensionRegistry.Empty);
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+        pb::UnknownFieldSet.Builder unknownFields = null;
+        while (true) {
+          uint tag = input.ReadTag();
+          switch (tag) {
+            case 0: {
+              if (unknownFields != null) {
+                this.UnknownFields = unknownFields.Build();
+              }
+              return this;
+            }
+            default: {
+              if (pb::WireFormat.IsEndGroupTag(tag)) {
+                if (unknownFields != null) {
+                  this.UnknownFields = unknownFields.Build();
+                }
+                return this;
+              }
+              if (unknownFields == null) {
+                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+              }
+              ParseUnknownField(input, unknownFields, extensionRegistry, tag);
+              break;
+            }
+            case 10: {
+              AddCriteria(input.ReadString());
+              break;
+            }
+          }
+        }
+      }
+      
+      
+      public pbc::IPopsicleList<string> CriteriaList {
+        get { return result.criteria_; }
+      }
+      public int CriteriaCount {
+        get { return result.CriteriaCount; }
+      }
+      public string GetCriteria(int index) {
+        return result.GetCriteria(index);
+      }
+      public Builder SetCriteria(int index, string value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.criteria_[index] = value;
+        return this;
+      }
+      public Builder AddCriteria(string value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.criteria_.Add(value);
+        return this;
+      }
+      public Builder AddRangeCriteria(scg::IEnumerable<string> values) {
+        base.AddRange(values, result.criteria_);
+        return this;
+      }
+      public Builder ClearCriteria() {
+        result.criteria_.Clear();
+        return this;
+      }
+    }
+    static SearchRequest() {
+      object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null);
+    }
+  }
+  
+  public sealed partial class SearchResponse : pb::GeneratedMessage<SearchResponse, SearchResponse.Builder> {
+    private static readonly SearchResponse defaultInstance = new Builder().BuildPartial();
+    public static SearchResponse DefaultInstance {
+      get { return defaultInstance; }
+    }
+    
+    public override SearchResponse DefaultInstanceForType {
+      get { return defaultInstance; }
+    }
+    
+    protected override SearchResponse ThisMessage {
+      get { return this; }
+    }
+    
+    public static pbd::MessageDescriptor Descriptor {
+      get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse__Descriptor; }
+    }
+    
+    protected override pb::FieldAccess.FieldAccessorTable<SearchResponse, SearchResponse.Builder> InternalFieldAccessors {
+      get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse__FieldAccessorTable; }
+    }
+    
+    #region Nested types
+    public static class Types {
+      public sealed partial class ResultItem : pb::GeneratedMessage<ResultItem, ResultItem.Builder> {
+        private static readonly ResultItem defaultInstance = new Builder().BuildPartial();
+        public static ResultItem DefaultInstance {
+          get { return defaultInstance; }
+        }
+        
+        public override ResultItem DefaultInstanceForType {
+          get { return defaultInstance; }
+        }
+        
+        protected override ResultItem ThisMessage {
+          get { return this; }
+        }
+        
+        public static pbd::MessageDescriptor Descriptor {
+          get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse_ResultItem__Descriptor; }
+        }
+        
+        protected override pb::FieldAccess.FieldAccessorTable<ResultItem, ResultItem.Builder> InternalFieldAccessors {
+          get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse_ResultItem__FieldAccessorTable; }
+        }
+        
+        public const int UrlFieldNumber = 1;
+        private bool hasUrl;
+        private string url_ = "";
+        public bool HasUrl {
+          get { return hasUrl; }
+        }
+        public string Url {
+          get { return url_; }
+        }
+        
+        public const int NameFieldNumber = 2;
+        private bool hasName;
+        private string name_ = "";
+        public bool HasName {
+          get { return hasName; }
+        }
+        public string Name {
+          get { return name_; }
+        }
+        
+        public override bool IsInitialized {
+          get {
+            if (!hasUrl) return false;
+            return true;
+          }
+        }
+        
+        public override void WriteTo(pb::CodedOutputStream output) {
+          int size = SerializedSize;
+          if (HasUrl) {
+            output.WriteString(1, Url);
+          }
+          if (HasName) {
+            output.WriteString(2, Name);
+          }
+          UnknownFields.WriteTo(output);
+        }
+        
+        private int memoizedSerializedSize = -1;
+        public override int SerializedSize {
+          get {
+            int size = memoizedSerializedSize;
+            if (size != -1) return size;
+            
+            size = 0;
+            if (HasUrl) {
+              size += pb::CodedOutputStream.ComputeStringSize(1, Url);
+            }
+            if (HasName) {
+              size += pb::CodedOutputStream.ComputeStringSize(2, Name);
+            }
+            size += UnknownFields.SerializedSize;
+            memoizedSerializedSize = size;
+            return size;
+          }
+        }
+        
+        public static ResultItem ParseFrom(pb::ByteString data) {
+          return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+        }
+        public static ResultItem ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
+          return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+        }
+        public static ResultItem ParseFrom(byte[] data) {
+          return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+        }
+        public static ResultItem ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
+          return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+        }
+        public static ResultItem ParseFrom(global::System.IO.Stream input) {
+          return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+        }
+        public static ResultItem ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+          return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+        }
+        public static ResultItem ParseDelimitedFrom(global::System.IO.Stream input) {
+          return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
+        }
+        public static ResultItem ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+          return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
+        }
+        public static ResultItem ParseFrom(pb::CodedInputStream input) {
+          return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+        }
+        public static ResultItem ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+          return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+        }
+        public static Builder CreateBuilder() { return new Builder(); }
+        public override Builder ToBuilder() { return CreateBuilder(this); }
+        public override Builder CreateBuilderForType() { return new Builder(); }
+        public static Builder CreateBuilder(ResultItem prototype) {
+          return (Builder) new Builder().MergeFrom(prototype);
+        }
+        
+        public sealed partial class Builder : pb::GeneratedBuilder<ResultItem, Builder> {
+          protected override Builder ThisBuilder {
+            get { return this; }
+          }
+          public Builder() {}
+          
+          ResultItem result = new ResultItem();
+          
+          protected override ResultItem MessageBeingBuilt {
+            get { return result; }
+          }
+          
+          public override Builder Clear() {
+            result = new ResultItem();
+            return this;
+          }
+          
+          public override Builder Clone() {
+            return new Builder().MergeFrom(result);
+          }
+          
+          public override pbd::MessageDescriptor DescriptorForType {
+            get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Descriptor; }
+          }
+          
+          public override ResultItem DefaultInstanceForType {
+            get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance; }
+          }
+          
+          public override ResultItem BuildPartial() {
+            if (result == null) {
+              throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+            }
+            ResultItem returnMe = result;
+            result = null;
+            return returnMe;
+          }
+          
+          public override Builder MergeFrom(pb::IMessage other) {
+            if (other is ResultItem) {
+              return MergeFrom((ResultItem) other);
+            } else {
+              base.MergeFrom(other);
+              return this;
+            }
+          }
+          
+          public override Builder MergeFrom(ResultItem other) {
+            if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance) return this;
+            if (other.HasUrl) {
+              Url = other.Url;
+            }
+            if (other.HasName) {
+              Name = other.Name;
+            }
+            this.MergeUnknownFields(other.UnknownFields);
+            return this;
+          }
+          
+          public override Builder MergeFrom(pb::CodedInputStream input) {
+            return MergeFrom(input, pb::ExtensionRegistry.Empty);
+          }
+          
+          public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+            pb::UnknownFieldSet.Builder unknownFields = null;
+            while (true) {
+              uint tag = input.ReadTag();
+              switch (tag) {
+                case 0: {
+                  if (unknownFields != null) {
+                    this.UnknownFields = unknownFields.Build();
+                  }
+                  return this;
+                }
+                default: {
+                  if (pb::WireFormat.IsEndGroupTag(tag)) {
+                    if (unknownFields != null) {
+                      this.UnknownFields = unknownFields.Build();
+                    }
+                    return this;
+                  }
+                  if (unknownFields == null) {
+                    unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+                  }
+                  ParseUnknownField(input, unknownFields, extensionRegistry, tag);
+                  break;
+                }
+                case 10: {
+                  Url = input.ReadString();
+                  break;
+                }
+                case 18: {
+                  Name = input.ReadString();
+                  break;
+                }
+              }
+            }
+          }
+          
+          
+          public bool HasUrl {
+            get { return result.HasUrl; }
+          }
+          public string Url {
+            get { return result.Url; }
+            set { SetUrl(value); }
+          }
+          public Builder SetUrl(string value) {
+            pb::ThrowHelper.ThrowIfNull(value, "value");
+            result.hasUrl = true;
+            result.url_ = value;
+            return this;
+          }
+          public Builder ClearUrl() {
+            result.hasUrl = false;
+            result.url_ = "";
+            return this;
+          }
+          
+          public bool HasName {
+            get { return result.HasName; }
+          }
+          public string Name {
+            get { return result.Name; }
+            set { SetName(value); }
+          }
+          public Builder SetName(string value) {
+            pb::ThrowHelper.ThrowIfNull(value, "value");
+            result.hasName = true;
+            result.name_ = value;
+            return this;
+          }
+          public Builder ClearName() {
+            result.hasName = false;
+            result.name_ = "";
+            return this;
+          }
+        }
+        static ResultItem() {
+          object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null);
+        }
+      }
+      
+    }
+    #endregion
+    
+    public const int ResultsFieldNumber = 1;
+    private pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem> results_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem>();
+    public scg::IList<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem> ResultsList {
+      get { return results_; }
+    }
+    public int ResultsCount {
+      get { return results_.Count; }
+    }
+    public global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem GetResults(int index) {
+      return results_[index];
+    }
+    
+    public override bool IsInitialized {
+      get {
+        foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) {
+          if (!element.IsInitialized) return false;
+        }
+        return true;
+      }
+    }
+    
+    public override void WriteTo(pb::CodedOutputStream output) {
+      int size = SerializedSize;
+      foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) {
+        output.WriteMessage(1, element);
+      }
+      UnknownFields.WriteTo(output);
+    }
+    
+    private int memoizedSerializedSize = -1;
+    public override int SerializedSize {
+      get {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+        
+        size = 0;
+        foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) {
+          size += pb::CodedOutputStream.ComputeMessageSize(1, element);
+        }
+        size += UnknownFields.SerializedSize;
+        memoizedSerializedSize = size;
+        return size;
+      }
+    }
+    
+    public static SearchResponse ParseFrom(pb::ByteString data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(byte[] data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(global::System.IO.Stream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static SearchResponse ParseDelimitedFrom(global::System.IO.Stream input) {
+      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
+    }
+    public static SearchResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(pb::CodedInputStream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static SearchResponse ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static Builder CreateBuilder() { return new Builder(); }
+    public override Builder ToBuilder() { return CreateBuilder(this); }
+    public override Builder CreateBuilderForType() { return new Builder(); }
+    public static Builder CreateBuilder(SearchResponse prototype) {
+      return (Builder) new Builder().MergeFrom(prototype);
+    }
+    
+    public sealed partial class Builder : pb::GeneratedBuilder<SearchResponse, Builder> {
+      protected override Builder ThisBuilder {
+        get { return this; }
+      }
+      public Builder() {}
+      
+      SearchResponse result = new SearchResponse();
+      
+      protected override SearchResponse MessageBeingBuilt {
+        get { return result; }
+      }
+      
+      public override Builder Clear() {
+        result = new SearchResponse();
+        return this;
+      }
+      
+      public override Builder Clone() {
+        return new Builder().MergeFrom(result);
+      }
+      
+      public override pbd::MessageDescriptor DescriptorForType {
+        get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Descriptor; }
+      }
+      
+      public override SearchResponse DefaultInstanceForType {
+        get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; }
+      }
+      
+      public override SearchResponse BuildPartial() {
+        if (result == null) {
+          throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+        }
+        result.results_.MakeReadOnly();
+        SearchResponse returnMe = result;
+        result = null;
+        return returnMe;
+      }
+      
+      public override Builder MergeFrom(pb::IMessage other) {
+        if (other is SearchResponse) {
+          return MergeFrom((SearchResponse) other);
+        } else {
+          base.MergeFrom(other);
+          return this;
+        }
+      }
+      
+      public override Builder MergeFrom(SearchResponse other) {
+        if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) return this;
+        if (other.results_.Count != 0) {
+          base.AddRange(other.results_, result.results_);
+        }
+        this.MergeUnknownFields(other.UnknownFields);
+        return this;
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input) {
+        return MergeFrom(input, pb::ExtensionRegistry.Empty);
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+        pb::UnknownFieldSet.Builder unknownFields = null;
+        while (true) {
+          uint tag = input.ReadTag();
+          switch (tag) {
+            case 0: {
+              if (unknownFields != null) {
+                this.UnknownFields = unknownFields.Build();
+              }
+              return this;
+            }
+            default: {
+              if (pb::WireFormat.IsEndGroupTag(tag)) {
+                if (unknownFields != null) {
+                  this.UnknownFields = unknownFields.Build();
+                }
+                return this;
+              }
+              if (unknownFields == null) {
+                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+              }
+              ParseUnknownField(input, unknownFields, extensionRegistry, tag);
+              break;
+            }
+            case 10: {
+              global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.CreateBuilder();
+              input.ReadMessage(subBuilder, extensionRegistry);
+              AddResults(subBuilder.BuildPartial());
+              break;
+            }
+          }
+        }
+      }
+      
+      
+      public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem> ResultsList {
+        get { return result.results_; }
+      }
+      public int ResultsCount {
+        get { return result.ResultsCount; }
+      }
+      public global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem GetResults(int index) {
+        return result.GetResults(index);
+      }
+      public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.results_[index] = value;
+        return this;
+      }
+      public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) {
+        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+        result.results_[index] = builderForValue.Build();
+        return this;
+      }
+      public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.results_.Add(value);
+        return this;
+      }
+      public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) {
+        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+        result.results_.Add(builderForValue.Build());
+        return this;
+      }
+      public Builder AddRangeResults(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem> values) {
+        base.AddRange(values, result.results_);
+        return this;
+      }
+      public Builder ClearResults() {
+        result.results_.Clear();
+        return this;
+      }
+    }
+    static SearchResponse() {
+      object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null);
+    }
+  }
+  
+  public sealed partial class RefineSearchRequest : pb::GeneratedMessage<RefineSearchRequest, RefineSearchRequest.Builder> {
+    private static readonly RefineSearchRequest defaultInstance = new Builder().BuildPartial();
+    public static RefineSearchRequest DefaultInstance {
+      get { return defaultInstance; }
+    }
+    
+    public override RefineSearchRequest DefaultInstanceForType {
+      get { return defaultInstance; }
+    }
+    
+    protected override RefineSearchRequest ThisMessage {
+      get { return this; }
+    }
+    
+    public static pbd::MessageDescriptor Descriptor {
+      get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_RefineSearchRequest__Descriptor; }
+    }
+    
+    protected override pb::FieldAccess.FieldAccessorTable<RefineSearchRequest, RefineSearchRequest.Builder> InternalFieldAccessors {
+      get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_RefineSearchRequest__FieldAccessorTable; }
+    }
+    
+    public const int CriteriaFieldNumber = 1;
+    private pbc::PopsicleList<string> criteria_ = new pbc::PopsicleList<string>();
+    public scg::IList<string> CriteriaList {
+      get { return pbc::Lists.AsReadOnly(criteria_); }
+    }
+    public int CriteriaCount {
+      get { return criteria_.Count; }
+    }
+    public string GetCriteria(int index) {
+      return criteria_[index];
+    }
+    
+    public const int PreviousResultsFieldNumber = 2;
+    private bool hasPreviousResults;
+    private global::Google.ProtocolBuffers.TestProtos.SearchResponse previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance;
+    public bool HasPreviousResults {
+      get { return hasPreviousResults; }
+    }
+    public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults {
+      get { return previousResults_; }
+    }
+    
+    public override bool IsInitialized {
+      get {
+        if (!hasPreviousResults) return false;
+        if (!PreviousResults.IsInitialized) return false;
+        return true;
+      }
+    }
+    
+    public override void WriteTo(pb::CodedOutputStream output) {
+      int size = SerializedSize;
+      if (criteria_.Count > 0) {
+        foreach (string element in criteria_) {
+          output.WriteString(1, element);
+        }
+      }
+      if (HasPreviousResults) {
+        output.WriteMessage(2, PreviousResults);
+      }
+      UnknownFields.WriteTo(output);
+    }
+    
+    private int memoizedSerializedSize = -1;
+    public override int SerializedSize {
+      get {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+        
+        size = 0;
+        {
+          int dataSize = 0;
+          foreach (string element in CriteriaList) {
+            dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
+          }
+          size += dataSize;
+          size += 1 * criteria_.Count;
+        }
+        if (HasPreviousResults) {
+          size += pb::CodedOutputStream.ComputeMessageSize(2, PreviousResults);
+        }
+        size += UnknownFields.SerializedSize;
+        memoizedSerializedSize = size;
+        return size;
+      }
+    }
+    
+    public static RefineSearchRequest ParseFrom(pb::ByteString data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(byte[] data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(global::System.IO.Stream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseDelimitedFrom(global::System.IO.Stream input) {
+      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
+    }
+    public static RefineSearchRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(pb::CodedInputStream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static RefineSearchRequest ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static Builder CreateBuilder() { return new Builder(); }
+    public override Builder ToBuilder() { return CreateBuilder(this); }
+    public override Builder CreateBuilderForType() { return new Builder(); }
+    public static Builder CreateBuilder(RefineSearchRequest prototype) {
+      return (Builder) new Builder().MergeFrom(prototype);
+    }
+    
+    public sealed partial class Builder : pb::GeneratedBuilder<RefineSearchRequest, Builder> {
+      protected override Builder ThisBuilder {
+        get { return this; }
+      }
+      public Builder() {}
+      
+      RefineSearchRequest result = new RefineSearchRequest();
+      
+      protected override RefineSearchRequest MessageBeingBuilt {
+        get { return result; }
+      }
+      
+      public override Builder Clear() {
+        result = new RefineSearchRequest();
+        return this;
+      }
+      
+      public override Builder Clone() {
+        return new Builder().MergeFrom(result);
+      }
+      
+      public override pbd::MessageDescriptor DescriptorForType {
+        get { return global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.Descriptor; }
+      }
+      
+      public override RefineSearchRequest DefaultInstanceForType {
+        get { return global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance; }
+      }
+      
+      public override RefineSearchRequest BuildPartial() {
+        if (result == null) {
+          throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+        }
+        result.criteria_.MakeReadOnly();
+        RefineSearchRequest returnMe = result;
+        result = null;
+        return returnMe;
+      }
+      
+      public override Builder MergeFrom(pb::IMessage other) {
+        if (other is RefineSearchRequest) {
+          return MergeFrom((RefineSearchRequest) other);
+        } else {
+          base.MergeFrom(other);
+          return this;
+        }
+      }
+      
+      public override Builder MergeFrom(RefineSearchRequest other) {
+        if (other == global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance) return this;
+        if (other.criteria_.Count != 0) {
+          base.AddRange(other.criteria_, result.criteria_);
+        }
+        if (other.HasPreviousResults) {
+          MergePreviousResults(other.PreviousResults);
+        }
+        this.MergeUnknownFields(other.UnknownFields);
+        return this;
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input) {
+        return MergeFrom(input, pb::ExtensionRegistry.Empty);
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+        pb::UnknownFieldSet.Builder unknownFields = null;
+        while (true) {
+          uint tag = input.ReadTag();
+          switch (tag) {
+            case 0: {
+              if (unknownFields != null) {
+                this.UnknownFields = unknownFields.Build();
+              }
+              return this;
+            }
+            default: {
+              if (pb::WireFormat.IsEndGroupTag(tag)) {
+                if (unknownFields != null) {
+                  this.UnknownFields = unknownFields.Build();
+                }
+                return this;
+              }
+              if (unknownFields == null) {
+                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+              }
+              ParseUnknownField(input, unknownFields, extensionRegistry, tag);
+              break;
+            }
+            case 10: {
+              AddCriteria(input.ReadString());
+              break;
+            }
+            case 18: {
+              global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder();
+              if (HasPreviousResults) {
+                subBuilder.MergeFrom(PreviousResults);
+              }
+              input.ReadMessage(subBuilder, extensionRegistry);
+              PreviousResults = subBuilder.BuildPartial();
+              break;
+            }
+          }
+        }
+      }
+      
+      
+      public pbc::IPopsicleList<string> CriteriaList {
+        get { return result.criteria_; }
+      }
+      public int CriteriaCount {
+        get { return result.CriteriaCount; }
+      }
+      public string GetCriteria(int index) {
+        return result.GetCriteria(index);
+      }
+      public Builder SetCriteria(int index, string value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.criteria_[index] = value;
+        return this;
+      }
+      public Builder AddCriteria(string value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.criteria_.Add(value);
+        return this;
+      }
+      public Builder AddRangeCriteria(scg::IEnumerable<string> values) {
+        base.AddRange(values, result.criteria_);
+        return this;
+      }
+      public Builder ClearCriteria() {
+        result.criteria_.Clear();
+        return this;
+      }
+      
+      public bool HasPreviousResults {
+       get { return result.HasPreviousResults; }
+      }
+      public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults {
+        get { return result.PreviousResults; }
+        set { SetPreviousResults(value); }
+      }
+      public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.hasPreviousResults = true;
+        result.previousResults_ = value;
+        return this;
+      }
+      public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder builderForValue) {
+        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+        result.hasPreviousResults = true;
+        result.previousResults_ = builderForValue.Build();
+        return this;
+      }
+      public Builder MergePreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        if (result.HasPreviousResults &&
+            result.previousResults_ != global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) {
+            result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder(result.previousResults_).MergeFrom(value).BuildPartial();
+        } else {
+          result.previousResults_ = value;
+        }
+        result.hasPreviousResults = true;
+        return this;
+      }
+      public Builder ClearPreviousResults() {
+        result.hasPreviousResults = false;
+        result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance;
+        return this;
+      }
+    }
+    static RefineSearchRequest() {
+      object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null);
+    }
+  }
+  
+  #endregion
+  
+  #region Services
+  [global::System.Runtime.InteropServices.GuidAttribute("a65f0925-fd11-4f94-b166-89ac4f027205")]
+  public partial interface ISearchService {
+    [global::System.Runtime.InteropServices.DispId(5)]
+    global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest);
+    global::Google.ProtocolBuffers.TestProtos.SearchResponse RefineSearch(global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest refineSearchRequest);
+  }
+  
+  [global::System.CLSCompliant(false)]
+  public partial class SearchService : ISearchService, pb::IRpcDispatch, global::System.IDisposable {
+    private readonly bool dispose;
+    private readonly pb::IRpcDispatch dispatch;
+    public SearchService(pb::IRpcDispatch dispatch) : this(dispatch, true) {
+    }
+    public SearchService(pb::IRpcDispatch dispatch, bool dispose) {
+      if (null == (this.dispatch = dispatch)) throw new global::System.ArgumentNullException();
+      this.dispose = dispose && dispatch is global::System.IDisposable;
+    }
+    
+    public void Dispose() {
+      if (dispose) ((global::System.IDisposable)dispatch).Dispose();
+    }
+    
+    TMessage pb::IRpcDispatch.CallMethod<TMessage, TBuilder>(string method, pb::IMessageLite request, pb::IBuilderLite<TMessage, TBuilder> response) {
+      return dispatch.CallMethod(method, request, response);
+    }
+    
+    public global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest) {
+       return dispatch.CallMethod("Search", searchRequest, global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder());
+    }
+    
+    public global::Google.ProtocolBuffers.TestProtos.SearchResponse RefineSearch(global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest refineSearchRequest) {
+       return dispatch.CallMethod("RefineSearch", refineSearchRequest, global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder());
+    }
+    
+    [global::System.CLSCompliant(false)]
+    public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable {
+      private readonly bool dispose;
+      private readonly ISearchService implementation;
+      public Dispatch(ISearchService implementation) : this(implementation, true) {
+      }
+      public Dispatch(ISearchService implementation, bool dispose) {
+        if (null == (this.implementation = implementation)) throw new global::System.ArgumentNullException();
+        this.dispose = dispose && implementation is global::System.IDisposable;
+      }
+      
+      public void Dispose() {
+        if (dispose) ((global::System.IDisposable)implementation).Dispose();
+      }
+      
+      public TMessage CallMethod<TMessage, TBuilder>(string methodName, pb::IMessageLite request, pb::IBuilderLite<TMessage, TBuilder> response)
+        where TMessage : IMessageLite<TMessage, TBuilder>
+        where TBuilder : IBuilderLite<TMessage, TBuilder> {
+        switch(methodName) {
+          case "Search": return response.MergeFrom(implementation.Search((global::Google.ProtocolBuffers.TestProtos.SearchRequest)request)).Build();
+          case "RefineSearch": return response.MergeFrom(implementation.RefineSearch((global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest)request)).Build();
+          default: throw new global::System.MissingMethodException(typeof(ISearchService).FullName, methodName);
+        }
+      }
+    }
+    [global::System.CLSCompliant(false)]
+    public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable {
+      private readonly bool dispose;
+      private readonly pb::IRpcDispatch implementation;
+      public ServerStub(ISearchService implementation) : this(implementation, true) {
+      }
+      public ServerStub(ISearchService implementation, bool dispose) : this(new Dispatch(implementation, dispose), dispose) {
+      }
+      public ServerStub(pb::IRpcDispatch implementation) : this(implementation, true) {
+      }
+      public ServerStub(pb::IRpcDispatch implementation, bool dispose) {
+        if (null == (this.implementation = implementation)) throw new global::System.ArgumentNullException();
+        this.dispose = dispose && implementation is global::System.IDisposable;
+      }
+      
+      public void Dispose() {
+        if (dispose) ((global::System.IDisposable)implementation).Dispose();
+      }
+      
+      public pb::IMessageLite CallMethod(string methodName, pb::CodedInputStream input, pb::ExtensionRegistry registry) {
+        switch(methodName) {
+          case "Search": return implementation.CallMethod(methodName, global::Google.ProtocolBuffers.TestProtos.SearchRequest.ParseFrom(input, registry), global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder());
+          case "RefineSearch": return implementation.CallMethod(methodName, global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.ParseFrom(input, registry), global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder());
+          default: throw new global::System.MissingMethodException(typeof(ISearchService).FullName, methodName);
+        }
+      }
+    }
+  }
+  #endregion
+  
+}

+ 153 - 0
src/ProtocolBuffers.Test/TestRpcGenerator.cs

@@ -0,0 +1,153 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// http://github.com/jskeet/dotnet-protobufs/
+// Original C++/Java/Python code:
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using Google.ProtocolBuffers;
+using Google.ProtocolBuffers.TestProtos;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers
+{
+    /// <summary>
+    /// This class verifies the correct code is generated from unittest_rpc_interop.proto and provides a small demonstration
+    /// of using the new IRpcDispatch to write a client/server
+    /// </summary>
+    [TestFixture]
+    public class TestRpcGenerator
+    {
+      /// <summary>
+      /// A sample implementation of the ISearchService for testing
+      /// </summary>
+      class ExampleSearchImpl : ISearchService {
+        SearchResponse ISearchService.Search(SearchRequest searchRequest) {
+            if (searchRequest.CriteriaCount == 0) {
+              throw new ArgumentException("No criteria specified.", new InvalidOperationException());
+            }
+            SearchResponse.Builder resp = SearchResponse.CreateBuilder();
+            foreach (string criteria in searchRequest.CriteriaList) {
+              resp.AddResults(SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://search.com").Build());
+            }
+            return resp.Build();
+        }
+
+        SearchResponse ISearchService.RefineSearch(RefineSearchRequest refineSearchRequest) {
+            SearchResponse.Builder resp = refineSearchRequest.PreviousResults.ToBuilder();
+            foreach (string criteria in refineSearchRequest.CriteriaList) {
+              resp.AddResults(SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://refine.com").Build());
+            }
+            return resp.Build();
+        }
+      }
+
+      /// <summary>
+      /// An example extraction of the wire protocol
+      /// </summary>
+      interface IWireTransfer 
+      {
+          byte[] Execute(string method, byte[] message);
+      }
+
+      /// <summary>
+      /// An example of a server responding to a wire request
+      /// </summary>
+      class ExampleServerHost : IWireTransfer
+      {
+          readonly IRpcServerStub _stub;
+          public ExampleServerHost(ISearchService implementation)
+          {
+              //on the server, we create a dispatch to call the appropriate method by name
+              IRpcDispatch dispatch = new SearchService.Dispatch(implementation);
+              //we then wrap that dispatch in a server stub which will deserialize the wire bytes to the message
+              //type appropriate for the method name being invoked.
+              _stub = new SearchService.ServerStub(dispatch);
+          }
+
+          byte[] IWireTransfer.Execute(string method, byte[] message)
+          {
+              //now when we recieve a wire transmission to invoke a method by name with a byte[] or stream payload
+              //we just simply call the sub:
+              IMessageLite response = _stub.CallMethod(method, CodedInputStream.CreateInstance(message), ExtensionRegistry.Empty);
+              //now we return the expected response message:
+              return response.ToByteArray();
+          }
+      }
+
+      /// <summary>
+      /// An example of a client sending a wire request
+      /// </summary>
+      class ExampleClient : IRpcDispatch
+      {
+          readonly IWireTransfer _wire;
+          public ExampleClient(IWireTransfer wire)
+          {
+              _wire = wire;
+          }
+
+          TMessage IRpcDispatch.CallMethod<TMessage, TBuilder>(string method, IMessageLite request, IBuilderLite<TMessage, TBuilder> response)
+          {
+              byte[] rawResponse = _wire.Execute(method, request.ToByteArray());
+              response.MergeFrom(rawResponse);
+              return response.Build();
+          }
+      }
+
+        /// <summary>
+        /// Put it all together to create one seamless client/server experience full of rich-type goodness ;)
+        /// All you need to do is send/recieve the method name and message bytes across the wire.
+        /// </summary>
+        [Test]
+        public void TestClientServerDispatch()
+        {
+            ExampleServerHost server = new ExampleServerHost(new ExampleSearchImpl());
+            //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting
+            IWireTransfer wire = server;
+
+            ISearchService client = new SearchService(new ExampleClient(wire));
+            //now the client has a real, typed, interface to work with:
+            SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build());
+            Assert.AreEqual(1, result.ResultsCount);
+            Assert.AreEqual("Test", result.ResultsList[0].Name);
+            Assert.AreEqual("http://search.com", result.ResultsList[0].Url);
+
+            //The test part of this, call the only other method
+            result = client.RefineSearch(RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build());
+            Assert.AreEqual(2, result.ResultsCount);
+            Assert.AreEqual("Test", result.ResultsList[0].Name);
+            Assert.AreEqual("http://search.com", result.ResultsList[0].Url);
+
+            Assert.AreEqual("Refine", result.ResultsList[1].Name);
+            Assert.AreEqual("http://refine.com", result.ResultsList[1].Url);
+        }
+    }
+}

+ 527 - 8
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs

@@ -12,6 +12,8 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
     public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
       registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFileOptions);
       registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFieldOptions);
+      registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpServiceOptions);
+      registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpMethodOptions);
     }
     #endregion
     #region Extensions
@@ -19,6 +21,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
     public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions> CSharpFileOptions;
     public const int CSharpFieldOptionsFieldNumber = 1000;
     public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions> CSharpFieldOptions;
+    public const int CsharpServiceOptionsFieldNumber = 1000;
+    public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions> CsharpServiceOptions;
+    public const int CsharpMethodOptionsFieldNumber = 1000;
+    public static pb::GeneratedExtensionBase<global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions> CsharpMethodOptions;
     #endregion
     
     #region Static variables
@@ -26,6 +32,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
     internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.Builder> internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable;
     internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpFieldOptions__Descriptor;
     internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.Builder> internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable;
+    internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpServiceOptions__Descriptor;
+    internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.Builder> internal__static_google_protobuf_CSharpServiceOptions__FieldAccessorTable;
+    internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpMethodOptions__Descriptor;
+    internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.Builder> internal__static_google_protobuf_CSharpMethodOptions__FieldAccessorTable;
     #endregion
     #region Descriptor
     public static pbd::FileDescriptor Descriptor {
@@ -37,7 +47,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
       byte[] descriptorData = global::System.Convert.FromBase64String(
           "CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" + 
           "ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i" + 
-          "6wIKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" + 
+          "uQMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" + 
           "bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB" + 
           "KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz" + 
           "c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u" + 
@@ -45,24 +55,44 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
           "CCABKAg6BHRydWUSHAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoS" + 
           "dW1icmVsbGFfbmFtZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5" + 
           "GN8BIAEoCToBLhImChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoF" + 
-          "ZmFsc2UiKwoSQ1NoYXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUY" + 
-          "ASABKAk6XgoTY3NoYXJwX2ZpbGVfb3B0aW9ucxIcLmdvb2dsZS5wcm90b2J1" + 
-          "Zi5GaWxlT3B0aW9ucxjoByABKAsyIi5nb29nbGUucHJvdG9idWYuQ1NoYXJw" + 
-          "RmlsZU9wdGlvbnM6YQoUY3NoYXJwX2ZpZWxkX29wdGlvbnMSHS5nb29nbGUu" + 
-          "cHJvdG9idWYuRmllbGRPcHRpb25zGOgHIAEoCzIjLmdvb2dsZS5wcm90b2J1" + 
-          "Zi5DU2hhcnBGaWVsZE9wdGlvbnM=");
+          "ZmFsc2USTAoWc2VydmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29n" + 
+          "bGUucHJvdG9idWYuQ1NoYXJwU2VydmljZVR5cGU6B0dFTkVSSUMiKwoSQ1No" + 
+          "YXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1No" + 
+          "YXJwU2VydmljZU9wdGlvbnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NT" + 
+          "aGFycE1ldGhvZE9wdGlvbnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqQQoRQ1No" + 
+          "YXJwU2VydmljZVR5cGUSCwoHR0VORVJJQxABEg0KCUlOVEVSRkFDRRACEhAK" + 
+          "DElSUENESVNQQVRDSBADOl4KE2NzaGFycF9maWxlX29wdGlvbnMSHC5nb29n" + 
+          "bGUucHJvdG9idWYuRmlsZU9wdGlvbnMY6AcgASgLMiIuZ29vZ2xlLnByb3Rv" + 
+          "YnVmLkNTaGFycEZpbGVPcHRpb25zOmEKFGNzaGFycF9maWVsZF9vcHRpb25z" + 
+          "Eh0uZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucxjoByABKAsyIy5nb29n" + 
+          "bGUucHJvdG9idWYuQ1NoYXJwRmllbGRPcHRpb25zOmcKFmNzaGFycF9zZXJ2" + 
+          "aWNlX29wdGlvbnMSHy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMY" + 
+          "6AcgASgLMiUuZ29vZ2xlLnByb3RvYnVmLkNTaGFycFNlcnZpY2VPcHRpb25z" + 
+          "OmQKFWNzaGFycF9tZXRob2Rfb3B0aW9ucxIeLmdvb2dsZS5wcm90b2J1Zi5N" + 
+          "ZXRob2RPcHRpb25zGOgHIAEoCzIkLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBN" + 
+          "ZXRob2RPcHRpb25z");
       pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
         descriptor = root;
         internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0];
         internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable = 
             new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.Builder>(internal__static_google_protobuf_CSharpFileOptions__Descriptor,
-                new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", "FileExtension", "UmbrellaNamespace", "OutputDirectory", "IgnoreGoogleProtobuf", });
+                new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", "FileExtension", "UmbrellaNamespace", "OutputDirectory", "IgnoreGoogleProtobuf", "ServiceGeneratorType", });
         internal__static_google_protobuf_CSharpFieldOptions__Descriptor = Descriptor.MessageTypes[1];
         internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable = 
             new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.Builder>(internal__static_google_protobuf_CSharpFieldOptions__Descriptor,
                 new string[] { "PropertyName", });
+        internal__static_google_protobuf_CSharpServiceOptions__Descriptor = Descriptor.MessageTypes[2];
+        internal__static_google_protobuf_CSharpServiceOptions__FieldAccessorTable = 
+            new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.Builder>(internal__static_google_protobuf_CSharpServiceOptions__Descriptor,
+                new string[] { "InterfaceId", });
+        internal__static_google_protobuf_CSharpMethodOptions__Descriptor = Descriptor.MessageTypes[3];
+        internal__static_google_protobuf_CSharpMethodOptions__FieldAccessorTable = 
+            new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.Builder>(internal__static_google_protobuf_CSharpMethodOptions__Descriptor,
+                new string[] { "DispatchId", });
         global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFileOptions = pb::GeneratedSingleExtension<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions>.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[0]);
         global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFieldOptions = pb::GeneratedSingleExtension<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions>.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[1]);
+        global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpServiceOptions = pb::GeneratedSingleExtension<global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions>.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[2]);
+        global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpMethodOptions = pb::GeneratedSingleExtension<global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions>.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[3]);
         return null;
       };
       pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
@@ -73,6 +103,15 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
     #endregion
     
   }
+  #region Enums
+  public enum CSharpServiceType {
+    GENERIC = 1,
+    INTERFACE = 2,
+    IRPCDISPATCH = 3,
+  }
+  
+  #endregion
+  
   #region Messages
   public sealed partial class CSharpFileOptions : pb::GeneratedMessage<CSharpFileOptions, CSharpFileOptions.Builder> {
     private static readonly CSharpFileOptions defaultInstance = new Builder().BuildPartial();
@@ -216,6 +255,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
       get { return ignoreGoogleProtobuf_; }
     }
     
+    public const int ServiceGeneratorTypeFieldNumber = 225;
+    private bool hasServiceGeneratorType;
+    private global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.GENERIC;
+    public bool HasServiceGeneratorType {
+      get { return hasServiceGeneratorType; }
+    }
+    public global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType ServiceGeneratorType {
+      get { return serviceGeneratorType_; }
+    }
+    
     public override bool IsInitialized {
       get {
         return true;
@@ -260,6 +309,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
       if (HasIgnoreGoogleProtobuf) {
         output.WriteBool(224, IgnoreGoogleProtobuf);
       }
+      if (HasServiceGeneratorType) {
+        output.WriteEnum(225, (int) ServiceGeneratorType);
+      }
       UnknownFields.WriteTo(output);
     }
     
@@ -306,6 +358,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
         if (HasIgnoreGoogleProtobuf) {
           size += pb::CodedOutputStream.ComputeBoolSize(224, IgnoreGoogleProtobuf);
         }
+        if (HasServiceGeneratorType) {
+          size += pb::CodedOutputStream.ComputeEnumSize(225, (int) ServiceGeneratorType);
+        }
         size += UnknownFields.SerializedSize;
         memoizedSerializedSize = size;
         return size;
@@ -434,6 +489,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
         if (other.HasIgnoreGoogleProtobuf) {
           IgnoreGoogleProtobuf = other.IgnoreGoogleProtobuf;
         }
+        if (other.HasServiceGeneratorType) {
+          ServiceGeneratorType = other.ServiceGeneratorType;
+        }
         this.MergeUnknownFields(other.UnknownFields);
         return this;
       }
@@ -514,6 +572,18 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
               IgnoreGoogleProtobuf = input.ReadBool();
               break;
             }
+            case 1800: {
+              int rawValue = input.ReadEnum();
+              if (!global::System.Enum.IsDefined(typeof(global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType), rawValue)) {
+                if (unknownFields == null) {
+                  unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+                }
+                unknownFields.MergeVarintField(225, (ulong) rawValue);
+              } else {
+                ServiceGeneratorType = (global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType) rawValue;
+              }
+              break;
+            }
           }
         }
       }
@@ -739,6 +809,24 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
         result.ignoreGoogleProtobuf_ = false;
         return this;
       }
+      
+      public bool HasServiceGeneratorType {
+       get { return result.HasServiceGeneratorType; }
+      }
+      public global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType ServiceGeneratorType {
+        get { return result.ServiceGeneratorType; }
+        set { SetServiceGeneratorType(value); }
+      }
+      public Builder SetServiceGeneratorType(global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType value) {
+        result.hasServiceGeneratorType = true;
+        result.serviceGeneratorType_ = value;
+        return this;
+      }
+      public Builder ClearServiceGeneratorType() {
+        result.hasServiceGeneratorType = false;
+        result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.GENERIC;
+        return this;
+      }
     }
     static CSharpFileOptions() {
       object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null);
@@ -961,6 +1049,437 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
     }
   }
   
+  public sealed partial class CSharpServiceOptions : pb::GeneratedMessage<CSharpServiceOptions, CSharpServiceOptions.Builder> {
+    private static readonly CSharpServiceOptions defaultInstance = new Builder().BuildPartial();
+    public static CSharpServiceOptions DefaultInstance {
+      get { return defaultInstance; }
+    }
+    
+    public override CSharpServiceOptions DefaultInstanceForType {
+      get { return defaultInstance; }
+    }
+    
+    protected override CSharpServiceOptions ThisMessage {
+      get { return this; }
+    }
+    
+    public static pbd::MessageDescriptor Descriptor {
+      get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpServiceOptions__Descriptor; }
+    }
+    
+    protected override pb::FieldAccess.FieldAccessorTable<CSharpServiceOptions, CSharpServiceOptions.Builder> InternalFieldAccessors {
+      get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpServiceOptions__FieldAccessorTable; }
+    }
+    
+    public const int InterfaceIdFieldNumber = 1;
+    private bool hasInterfaceId;
+    private string interfaceId_ = "";
+    public bool HasInterfaceId {
+      get { return hasInterfaceId; }
+    }
+    public string InterfaceId {
+      get { return interfaceId_; }
+    }
+    
+    public override bool IsInitialized {
+      get {
+        return true;
+      }
+    }
+    
+    public override void WriteTo(pb::CodedOutputStream output) {
+      int size = SerializedSize;
+      if (HasInterfaceId) {
+        output.WriteString(1, InterfaceId);
+      }
+      UnknownFields.WriteTo(output);
+    }
+    
+    private int memoizedSerializedSize = -1;
+    public override int SerializedSize {
+      get {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+        
+        size = 0;
+        if (HasInterfaceId) {
+          size += pb::CodedOutputStream.ComputeStringSize(1, InterfaceId);
+        }
+        size += UnknownFields.SerializedSize;
+        memoizedSerializedSize = size;
+        return size;
+      }
+    }
+    
+    public static CSharpServiceOptions ParseFrom(pb::ByteString data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(byte[] data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(global::System.IO.Stream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseDelimitedFrom(global::System.IO.Stream input) {
+      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(pb::CodedInputStream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static CSharpServiceOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static Builder CreateBuilder() { return new Builder(); }
+    public override Builder ToBuilder() { return CreateBuilder(this); }
+    public override Builder CreateBuilderForType() { return new Builder(); }
+    public static Builder CreateBuilder(CSharpServiceOptions prototype) {
+      return (Builder) new Builder().MergeFrom(prototype);
+    }
+    
+    public sealed partial class Builder : pb::GeneratedBuilder<CSharpServiceOptions, Builder> {
+      protected override Builder ThisBuilder {
+        get { return this; }
+      }
+      public Builder() {}
+      
+      CSharpServiceOptions result = new CSharpServiceOptions();
+      
+      protected override CSharpServiceOptions MessageBeingBuilt {
+        get { return result; }
+      }
+      
+      public override Builder Clear() {
+        result = new CSharpServiceOptions();
+        return this;
+      }
+      
+      public override Builder Clone() {
+        return new Builder().MergeFrom(result);
+      }
+      
+      public override pbd::MessageDescriptor DescriptorForType {
+        get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.Descriptor; }
+      }
+      
+      public override CSharpServiceOptions DefaultInstanceForType {
+        get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.DefaultInstance; }
+      }
+      
+      public override CSharpServiceOptions BuildPartial() {
+        if (result == null) {
+          throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+        }
+        CSharpServiceOptions returnMe = result;
+        result = null;
+        return returnMe;
+      }
+      
+      public override Builder MergeFrom(pb::IMessage other) {
+        if (other is CSharpServiceOptions) {
+          return MergeFrom((CSharpServiceOptions) other);
+        } else {
+          base.MergeFrom(other);
+          return this;
+        }
+      }
+      
+      public override Builder MergeFrom(CSharpServiceOptions other) {
+        if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.DefaultInstance) return this;
+        if (other.HasInterfaceId) {
+          InterfaceId = other.InterfaceId;
+        }
+        this.MergeUnknownFields(other.UnknownFields);
+        return this;
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input) {
+        return MergeFrom(input, pb::ExtensionRegistry.Empty);
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+        pb::UnknownFieldSet.Builder unknownFields = null;
+        while (true) {
+          uint tag = input.ReadTag();
+          switch (tag) {
+            case 0: {
+              if (unknownFields != null) {
+                this.UnknownFields = unknownFields.Build();
+              }
+              return this;
+            }
+            default: {
+              if (pb::WireFormat.IsEndGroupTag(tag)) {
+                if (unknownFields != null) {
+                  this.UnknownFields = unknownFields.Build();
+                }
+                return this;
+              }
+              if (unknownFields == null) {
+                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+              }
+              ParseUnknownField(input, unknownFields, extensionRegistry, tag);
+              break;
+            }
+            case 10: {
+              InterfaceId = input.ReadString();
+              break;
+            }
+          }
+        }
+      }
+      
+      
+      public bool HasInterfaceId {
+        get { return result.HasInterfaceId; }
+      }
+      public string InterfaceId {
+        get { return result.InterfaceId; }
+        set { SetInterfaceId(value); }
+      }
+      public Builder SetInterfaceId(string value) {
+        pb::ThrowHelper.ThrowIfNull(value, "value");
+        result.hasInterfaceId = true;
+        result.interfaceId_ = value;
+        return this;
+      }
+      public Builder ClearInterfaceId() {
+        result.hasInterfaceId = false;
+        result.interfaceId_ = "";
+        return this;
+      }
+    }
+    static CSharpServiceOptions() {
+      object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null);
+    }
+  }
+  
+  public sealed partial class CSharpMethodOptions : pb::GeneratedMessage<CSharpMethodOptions, CSharpMethodOptions.Builder> {
+    private static readonly CSharpMethodOptions defaultInstance = new Builder().BuildPartial();
+    public static CSharpMethodOptions DefaultInstance {
+      get { return defaultInstance; }
+    }
+    
+    public override CSharpMethodOptions DefaultInstanceForType {
+      get { return defaultInstance; }
+    }
+    
+    protected override CSharpMethodOptions ThisMessage {
+      get { return this; }
+    }
+    
+    public static pbd::MessageDescriptor Descriptor {
+      get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpMethodOptions__Descriptor; }
+    }
+    
+    protected override pb::FieldAccess.FieldAccessorTable<CSharpMethodOptions, CSharpMethodOptions.Builder> InternalFieldAccessors {
+      get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpMethodOptions__FieldAccessorTable; }
+    }
+    
+    public const int DispatchIdFieldNumber = 1;
+    private bool hasDispatchId;
+    private int dispatchId_ = 0;
+    public bool HasDispatchId {
+      get { return hasDispatchId; }
+    }
+    public int DispatchId {
+      get { return dispatchId_; }
+    }
+    
+    public override bool IsInitialized {
+      get {
+        return true;
+      }
+    }
+    
+    public override void WriteTo(pb::CodedOutputStream output) {
+      int size = SerializedSize;
+      if (HasDispatchId) {
+        output.WriteInt32(1, DispatchId);
+      }
+      UnknownFields.WriteTo(output);
+    }
+    
+    private int memoizedSerializedSize = -1;
+    public override int SerializedSize {
+      get {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+        
+        size = 0;
+        if (HasDispatchId) {
+          size += pb::CodedOutputStream.ComputeInt32Size(1, DispatchId);
+        }
+        size += UnknownFields.SerializedSize;
+        memoizedSerializedSize = size;
+        return size;
+      }
+    }
+    
+    public static CSharpMethodOptions ParseFrom(pb::ByteString data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(byte[] data) {
+      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(global::System.IO.Stream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseDelimitedFrom(global::System.IO.Stream input) {
+      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
+      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(pb::CodedInputStream input) {
+      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
+    }
+    public static CSharpMethodOptions ParseFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
+    }
+    public static Builder CreateBuilder() { return new Builder(); }
+    public override Builder ToBuilder() { return CreateBuilder(this); }
+    public override Builder CreateBuilderForType() { return new Builder(); }
+    public static Builder CreateBuilder(CSharpMethodOptions prototype) {
+      return (Builder) new Builder().MergeFrom(prototype);
+    }
+    
+    public sealed partial class Builder : pb::GeneratedBuilder<CSharpMethodOptions, Builder> {
+      protected override Builder ThisBuilder {
+        get { return this; }
+      }
+      public Builder() {}
+      
+      CSharpMethodOptions result = new CSharpMethodOptions();
+      
+      protected override CSharpMethodOptions MessageBeingBuilt {
+        get { return result; }
+      }
+      
+      public override Builder Clear() {
+        result = new CSharpMethodOptions();
+        return this;
+      }
+      
+      public override Builder Clone() {
+        return new Builder().MergeFrom(result);
+      }
+      
+      public override pbd::MessageDescriptor DescriptorForType {
+        get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.Descriptor; }
+      }
+      
+      public override CSharpMethodOptions DefaultInstanceForType {
+        get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.DefaultInstance; }
+      }
+      
+      public override CSharpMethodOptions BuildPartial() {
+        if (result == null) {
+          throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+        }
+        CSharpMethodOptions returnMe = result;
+        result = null;
+        return returnMe;
+      }
+      
+      public override Builder MergeFrom(pb::IMessage other) {
+        if (other is CSharpMethodOptions) {
+          return MergeFrom((CSharpMethodOptions) other);
+        } else {
+          base.MergeFrom(other);
+          return this;
+        }
+      }
+      
+      public override Builder MergeFrom(CSharpMethodOptions other) {
+        if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.DefaultInstance) return this;
+        if (other.HasDispatchId) {
+          DispatchId = other.DispatchId;
+        }
+        this.MergeUnknownFields(other.UnknownFields);
+        return this;
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input) {
+        return MergeFrom(input, pb::ExtensionRegistry.Empty);
+      }
+      
+      public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+        pb::UnknownFieldSet.Builder unknownFields = null;
+        while (true) {
+          uint tag = input.ReadTag();
+          switch (tag) {
+            case 0: {
+              if (unknownFields != null) {
+                this.UnknownFields = unknownFields.Build();
+              }
+              return this;
+            }
+            default: {
+              if (pb::WireFormat.IsEndGroupTag(tag)) {
+                if (unknownFields != null) {
+                  this.UnknownFields = unknownFields.Build();
+                }
+                return this;
+              }
+              if (unknownFields == null) {
+                unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
+              }
+              ParseUnknownField(input, unknownFields, extensionRegistry, tag);
+              break;
+            }
+            case 8: {
+              DispatchId = input.ReadInt32();
+              break;
+            }
+          }
+        }
+      }
+      
+      
+      public bool HasDispatchId {
+        get { return result.HasDispatchId; }
+      }
+      public int DispatchId {
+        get { return result.DispatchId; }
+        set { SetDispatchId(value); }
+      }
+      public Builder SetDispatchId(int value) {
+        result.hasDispatchId = true;
+        result.dispatchId_ = value;
+        return this;
+      }
+      public Builder ClearDispatchId() {
+        result.hasDispatchId = false;
+        result.dispatchId_ = 0;
+        return this;
+      }
+    }
+    static CSharpMethodOptions() {
+      object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null);
+    }
+  }
+  
   #endregion
   
 }

+ 53 - 0
src/ProtocolBuffers/IRpcDispatch.cs

@@ -0,0 +1,53 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// http://github.com/jskeet/dotnet-protobufs/
+// Original C++/Java/Python code:
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+
+namespace Google.ProtocolBuffers
+{
+  /// <summary>
+  /// 
+  /// </summary>
+  public interface IRpcServerStub
+  {
+    IMessageLite CallMethod(string methodName, CodedInputStream input, ExtensionRegistry registry);
+  }
+
+  public interface IRpcDispatch
+  {
+    TMessage CallMethod<TMessage, TBuilder>(string method, IMessageLite request, IBuilderLite<TMessage, TBuilder> response)
+      where TMessage : IMessageLite<TMessage, TBuilder>
+      where TBuilder : IBuilderLite<TMessage, TBuilder>;
+  }
+}

+ 206 - 205
src/ProtocolBuffers/ProtocolBuffers.csproj

@@ -1,212 +1,213 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Google.ProtocolBuffers</RootNamespace>
-    <AssemblyName>Google.ProtocolBuffers</AssemblyName>
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.snk</AssemblyOriginatorKeyFile>
-    <FileUpgradeFlags>
-    </FileUpgradeFlags>
-    <UpgradeBackupLocation>
-    </UpgradeBackupLocation>
-    <OldToolsVersion>3.5</OldToolsVersion>
-    <PublishUrl>publish\</PublishUrl>
-    <Install>true</Install>
-    <InstallFrom>Disk</InstallFrom>
-    <UpdateEnabled>false</UpdateEnabled>
-    <UpdateMode>Foreground</UpdateMode>
-    <UpdateInterval>7</UpdateInterval>
-    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
-    <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
-    <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>0</ApplicationRevision>
-    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
-    <UseApplicationTrust>false</UseApplicationTrust>
-    <BootstrapperEnabled>true</BootstrapperEnabled>
-  </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>
-    <NoStdLib>true</NoStdLib>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </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>
-    <NoStdLib>true</NoStdLib>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_Silverlight2|AnyCPU'">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug_Silverlight2\</OutputPath>
-    <DefineConstants>DEBUG;TRACE;SILVERLIGHT2</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <NoStdLib>true</NoStdLib>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_Silverlight2|AnyCPU'">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release_Silverlight2\</OutputPath>
-    <DefineConstants>TRACE;SILVERLIGHT2</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <NoStdLib>true</NoStdLib>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="mscorlib" />
-    <Reference Include="System" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AbstractBuilder.cs" />
-    <Compile Include="AbstractBuilderLite.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="AbstractMessage.cs" />
-    <Compile Include="AbstractMessageLite.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="ByteString.cs" />
-    <Compile Include="Collections\Enumerables.cs" />
-    <Compile Include="Collections\IPopsicleList.cs" />
-    <Compile Include="Collections\PopsicleList.cs" />
-    <Compile Include="Delegates.cs" />
-    <Compile Include="CodedInputStream.cs" />
-    <Compile Include="CodedOutputStream.cs" />
-    <Compile Include="Collections\Dictionaries.cs" />
-    <Compile Include="Collections\Lists.cs" />
-    <Compile Include="Collections\ReadOnlyDictionary.cs" />
-    <Compile Include="DescriptorProtos\CSharpOptions.cs" />
-    <Compile Include="DescriptorProtos\DescriptorProtoFile.cs" />
-    <Compile Include="DescriptorProtos\IDescriptorProto.cs" />
-    <Compile Include="DescriptorProtos\PartialClasses.cs" />
-    <Compile Include="Descriptors\DescriptorBase.cs" />
-    <Compile Include="Descriptors\DescriptorPool.cs" />
-    <Compile Include="Descriptors\DescriptorUtil.cs" />
-    <Compile Include="Descriptors\DescriptorValidationException.cs" />
-    <Compile Include="Descriptors\EnumDescriptor.cs" />
-    <Compile Include="Descriptors\EnumValueDescriptor.cs" />
-    <Compile Include="Descriptors\FieldDescriptor.cs" />
-    <Compile Include="Descriptors\FieldMappingAttribute.cs" />
-    <Compile Include="Descriptors\FieldType.cs" />
-    <Compile Include="Descriptors\FileDescriptor.cs" />
-    <Compile Include="Descriptors\IDescriptor.cs" />
-    <Compile Include="Descriptors\IndexedDescriptorBase.cs" />
-    <Compile Include="Descriptors\MappedType.cs" />
-    <Compile Include="Descriptors\MessageDescriptor.cs" />
-    <Compile Include="Descriptors\MethodDescriptor.cs" />
-    <Compile Include="Descriptors\PackageDescriptor.cs" />
-    <Compile Include="Descriptors\ServiceDescriptor.cs" />
-    <Compile Include="DynamicMessage.cs" />
-    <Compile Include="EnumLite.cs" />
-    <Compile Include="ExtendableBuilder.cs" />
-    <Compile Include="ExtendableBuilderLite.cs" />
-    <Compile Include="ExtendableMessage.cs" />
-    <Compile Include="ExtendableMessageLite.cs" />
-    <Compile Include="ExtensionInfo.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="ExtensionRegistry.cs" />
-    <Compile Include="ExtensionRegistryLite.cs" />
-    <Compile Include="FieldAccess\ReflectionUtil.cs" />
-    <Compile Include="FieldAccess\SingleEnumAccessor.cs" />
-    <Compile Include="FieldAccess\SingleMessageAccessor.cs" />
-    <Compile Include="FieldAccess\SinglePrimitiveAccessor.cs" />
-    <Compile Include="FieldAccess\RepeatedPrimitiveAccessor.cs" />
-    <Compile Include="FieldAccess\RepeatedEnumAccessor.cs" />
-    <Compile Include="FieldAccess\IFieldAccessor.cs" />
-    <Compile Include="FieldAccess\FieldAccessorTable.cs" />
-    <Compile Include="FieldAccess\RepeatedMessageAccessor.cs" />
-    <Compile Include="FieldSet.cs" />
-    <Compile Include="GeneratedBuilder.cs" />
-    <Compile Include="GeneratedBuilderLite.cs" />
-    <Compile Include="GeneratedExtensionLite.cs" />
-    <Compile Include="GeneratedMessageLite.cs" />
-    <Compile Include="GeneratedRepeatExtension.cs" />
-    <Compile Include="GeneratedSingleExtension.cs" />
-    <Compile Include="GeneratedMessage.cs" />
-    <Compile Include="IBuilder.cs" />
-    <Compile Include="GeneratedExtensionBase.cs" />
-    <Compile Include="IBuilderLite.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="IMessage.cs" />
-    <Compile Include="IMessageLite.cs" />
-    <Compile Include="InvalidProtocolBufferException.cs" />
-    <Compile Include="IRpcChannel.cs" />
-    <Compile Include="IRpcController.cs" />
-    <Compile Include="IService.cs" />
-    <Compile Include="MessageStreamIterator.cs" />
-    <Compile Include="MessageStreamWriter.cs" />
-    <Compile Include="MessageUtil.cs" />
-    <Compile Include="NameHelpers.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="RpcUtil.cs" />
-    <Compile Include="SilverlightCompatibility.cs" />
-    <Compile Include="SortedList.cs" />
-    <Compile Include="TextFormat.cs" />
-    <Compile Include="TextGenerator.cs" />
-    <Compile Include="TextTokenizer.cs" />
-    <Compile Include="ThrowHelper.cs" />
-    <Compile Include="UninitializedMessageException.cs" />
-    <Compile Include="UnknownField.cs" />
-    <Compile Include="UnknownFieldSet.cs" />
-    <Compile Include="WireFormat.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="Properties\Google.ProtocolBuffers.snk" />
-  </ItemGroup>
-  <ItemGroup>
-    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
-      <Install>false</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
-      <Visible>False</Visible>
-      <ProductName>Windows Installer 3.1</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Debug' " />
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Release' " />
-  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" Condition=" '$(Configuration)' == 'Debug_Silverlight2' " />
-  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" Condition=" '$(Configuration)' == 'Release_Silverlight2' " />
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Google.ProtocolBuffers</RootNamespace>
+    <AssemblyName>Google.ProtocolBuffers</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.snk</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </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>
+    <NoStdLib>true</NoStdLib>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </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>
+    <NoStdLib>true</NoStdLib>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_Silverlight2|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug_Silverlight2\</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT2</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoStdLib>true</NoStdLib>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_Silverlight2|AnyCPU'">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release_Silverlight2\</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT2</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <NoStdLib>true</NoStdLib>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AbstractBuilder.cs" />
+    <Compile Include="AbstractBuilderLite.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="AbstractMessage.cs" />
+    <Compile Include="AbstractMessageLite.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ByteString.cs" />
+    <Compile Include="Collections\Enumerables.cs" />
+    <Compile Include="Collections\IPopsicleList.cs" />
+    <Compile Include="Collections\PopsicleList.cs" />
+    <Compile Include="Delegates.cs" />
+    <Compile Include="CodedInputStream.cs" />
+    <Compile Include="CodedOutputStream.cs" />
+    <Compile Include="Collections\Dictionaries.cs" />
+    <Compile Include="Collections\Lists.cs" />
+    <Compile Include="Collections\ReadOnlyDictionary.cs" />
+    <Compile Include="DescriptorProtos\CSharpOptions.cs" />
+    <Compile Include="DescriptorProtos\DescriptorProtoFile.cs" />
+    <Compile Include="DescriptorProtos\IDescriptorProto.cs" />
+    <Compile Include="DescriptorProtos\PartialClasses.cs" />
+    <Compile Include="Descriptors\DescriptorBase.cs" />
+    <Compile Include="Descriptors\DescriptorPool.cs" />
+    <Compile Include="Descriptors\DescriptorUtil.cs" />
+    <Compile Include="Descriptors\DescriptorValidationException.cs" />
+    <Compile Include="Descriptors\EnumDescriptor.cs" />
+    <Compile Include="Descriptors\EnumValueDescriptor.cs" />
+    <Compile Include="Descriptors\FieldDescriptor.cs" />
+    <Compile Include="Descriptors\FieldMappingAttribute.cs" />
+    <Compile Include="Descriptors\FieldType.cs" />
+    <Compile Include="Descriptors\FileDescriptor.cs" />
+    <Compile Include="Descriptors\IDescriptor.cs" />
+    <Compile Include="Descriptors\IndexedDescriptorBase.cs" />
+    <Compile Include="Descriptors\MappedType.cs" />
+    <Compile Include="Descriptors\MessageDescriptor.cs" />
+    <Compile Include="Descriptors\MethodDescriptor.cs" />
+    <Compile Include="Descriptors\PackageDescriptor.cs" />
+    <Compile Include="Descriptors\ServiceDescriptor.cs" />
+    <Compile Include="DynamicMessage.cs" />
+    <Compile Include="EnumLite.cs" />
+    <Compile Include="ExtendableBuilder.cs" />
+    <Compile Include="ExtendableBuilderLite.cs" />
+    <Compile Include="ExtendableMessage.cs" />
+    <Compile Include="ExtendableMessageLite.cs" />
+    <Compile Include="ExtensionInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ExtensionRegistry.cs" />
+    <Compile Include="ExtensionRegistryLite.cs" />
+    <Compile Include="FieldAccess\ReflectionUtil.cs" />
+    <Compile Include="FieldAccess\SingleEnumAccessor.cs" />
+    <Compile Include="FieldAccess\SingleMessageAccessor.cs" />
+    <Compile Include="FieldAccess\SinglePrimitiveAccessor.cs" />
+    <Compile Include="FieldAccess\RepeatedPrimitiveAccessor.cs" />
+    <Compile Include="FieldAccess\RepeatedEnumAccessor.cs" />
+    <Compile Include="FieldAccess\IFieldAccessor.cs" />
+    <Compile Include="FieldAccess\FieldAccessorTable.cs" />
+    <Compile Include="FieldAccess\RepeatedMessageAccessor.cs" />
+    <Compile Include="FieldSet.cs" />
+    <Compile Include="GeneratedBuilder.cs" />
+    <Compile Include="GeneratedBuilderLite.cs" />
+    <Compile Include="GeneratedExtensionLite.cs" />
+    <Compile Include="GeneratedMessageLite.cs" />
+    <Compile Include="GeneratedRepeatExtension.cs" />
+    <Compile Include="GeneratedSingleExtension.cs" />
+    <Compile Include="GeneratedMessage.cs" />
+    <Compile Include="IBuilder.cs" />
+    <Compile Include="GeneratedExtensionBase.cs" />
+    <Compile Include="IBuilderLite.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="IMessage.cs" />
+    <Compile Include="IMessageLite.cs" />
+    <Compile Include="InvalidProtocolBufferException.cs" />
+    <Compile Include="IRpcChannel.cs" />
+    <Compile Include="IRpcController.cs" />
+    <Compile Include="IRpcDispatch.cs" />
+    <Compile Include="IService.cs" />
+    <Compile Include="MessageStreamIterator.cs" />
+    <Compile Include="MessageStreamWriter.cs" />
+    <Compile Include="MessageUtil.cs" />
+    <Compile Include="NameHelpers.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="RpcUtil.cs" />
+    <Compile Include="SilverlightCompatibility.cs" />
+    <Compile Include="SortedList.cs" />
+    <Compile Include="TextFormat.cs" />
+    <Compile Include="TextGenerator.cs" />
+    <Compile Include="TextTokenizer.cs" />
+    <Compile Include="ThrowHelper.cs" />
+    <Compile Include="UninitializedMessageException.cs" />
+    <Compile Include="UnknownField.cs" />
+    <Compile Include="UnknownFieldSet.cs" />
+    <Compile Include="WireFormat.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Properties\Google.ProtocolBuffers.snk" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Debug' " />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition=" '$(Configuration)' == 'Release' " />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" Condition=" '$(Configuration)' == 'Debug_Silverlight2' " />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" Condition=" '$(Configuration)' == 'Release_Silverlight2' " />
   <!-- 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>

+ 168 - 167
src/ProtocolBuffers2008.sln

@@ -1,167 +1,168 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "proto", "proto", "{1F896D5C-5FC2-4671-9216-781CB8187EC7}"
-	ProjectSection(SolutionItems) = preProject
-		..\protos\tutorial\addressbook.proto = ..\protos\tutorial\addressbook.proto
-		..\protos\google\protobuf\csharp_options.proto = ..\protos\google\protobuf\csharp_options.proto
-		..\protos\google\protobuf\descriptor.proto = ..\protos\google\protobuf\descriptor.proto
-	EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8D3015A-EA39-4F03-AEEC-3FF1F2087A12}"
-	ProjectSection(SolutionItems) = preProject
-		..\protos\google\protobuf\unittest.proto = ..\protos\google\protobuf\unittest.proto
-		..\protos\google\protobuf\unittest_csharp_options.proto = ..\protos\google\protobuf\unittest_csharp_options.proto
-		..\protos\google\protobuf\unittest_custom_options.proto = ..\protos\google\protobuf\unittest_custom_options.proto
-		..\protos\google\protobuf\unittest_embed_optimize_for.proto = ..\protos\google\protobuf\unittest_embed_optimize_for.proto
-		..\protos\google\protobuf\unittest_empty.proto = ..\protos\google\protobuf\unittest_empty.proto
-		..\protos\google\protobuf\unittest_enormous_descriptor.proto = ..\protos\google\protobuf\unittest_enormous_descriptor.proto
-		..\protos\extest\unittest_extras_lite.proto = ..\protos\extest\unittest_extras_lite.proto
-		..\protos\google\protobuf\unittest_import.proto = ..\protos\google\protobuf\unittest_import.proto
-		..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.proto
-		..\protos\google\protobuf\unittest_lite.proto = ..\protos\google\protobuf\unittest_lite.proto
-		..\protos\google\protobuf\unittest_lite_imports_nonlite.proto = ..\protos\google\protobuf\unittest_lite_imports_nonlite.proto
-		..\protos\google\protobuf\unittest_mset.proto = ..\protos\google\protobuf\unittest_mset.proto
-		..\protos\google\protobuf\unittest_no_generic_services.proto = ..\protos\google\protobuf\unittest_no_generic_services.proto
-		..\protos\google\protobuf\unittest_optimize_for.proto = ..\protos\google\protobuf\unittest_optimize_for.proto
-	EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoGen", "ProtoGen\ProtoGen.csproj", "{250ADE34-82FD-4BAE-86D5-985FBE589C4A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoGen.Test", "ProtoGen.Test\ProtoGen.Test.csproj", "{C268DA4C-4004-47DA-AF23-44C983281A68}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddressBook", "AddressBook\AddressBook.csproj", "{A31F5FB2-4FF3-432A-B35B-5CD203606311}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoMunge", "ProtoMunge\ProtoMunge.csproj", "{8F09AF72-3327-4FA7-BC09-070B80221AB9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoBench", "ProtoBench\ProtoBench.csproj", "{C7A4A435-2813-41C8-AA87-BD914BA5223D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoDump", "ProtoDump\ProtoDump.csproj", "{D7282E99-2DC3-405B-946F-177DB2FD2AE2}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{66ED1950-AD27-42D7-88F8-94355AEC8225}"
-	ProjectSection(SolutionItems) = preProject
-		..\build\Build.bat = ..\build\Build.bat
-		..\build\build.csproj = ..\build\build.csproj
-		..\build\build35.bat = ..\build\build35.bat
-		..\build\BuildAll.bat = ..\build\BuildAll.bat
-		..\build\BuildSilverlight2.bat = ..\build\BuildSilverlight2.bat
-		..\build\Common.targets = ..\build\Common.targets
-		..\build\GenerateCompletePackage.bat = ..\build\GenerateCompletePackage.bat
-		..\build\GenerateReleasePackage.bat = ..\build\GenerateReleasePackage.bat
-		..\build\RunBenchmarks.bat = ..\build\RunBenchmarks.bat
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug_Silverlight2|Any CPU = Debug_Silverlight2|Any CPU
-		Debug|Any CPU = Debug|Any CPU
-		Release_Silverlight2|Any CPU = Release_Silverlight2|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug_Silverlight2|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.Build.0 = Debug_Silverlight2|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.ActiveCfg = Release_Silverlight2|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.Build.0 = Release_Silverlight2|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release|Any CPU.Build.0 = Release|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.Build.0 = Release|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release|Any CPU.Build.0 = Release|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release|Any CPU.Build.0 = Release|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.Build.0 = Release|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug_Silverlight2|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.Build.0 = Debug_Silverlight2|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.ActiveCfg = Release_Silverlight2|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.Build.0 = Release_Silverlight2|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(NestedProjects) = preSolution
-		{C8D3015A-EA39-4F03-AEEC-3FF1F2087A12} = {1F896D5C-5FC2-4671-9216-781CB8187EC7}
-	EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "proto", "proto", "{1F896D5C-5FC2-4671-9216-781CB8187EC7}"
+	ProjectSection(SolutionItems) = preProject
+		..\protos\tutorial\addressbook.proto = ..\protos\tutorial\addressbook.proto
+		..\protos\google\protobuf\csharp_options.proto = ..\protos\google\protobuf\csharp_options.proto
+		..\protos\google\protobuf\descriptor.proto = ..\protos\google\protobuf\descriptor.proto
+	EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8D3015A-EA39-4F03-AEEC-3FF1F2087A12}"
+	ProjectSection(SolutionItems) = preProject
+		..\protos\google\protobuf\unittest.proto = ..\protos\google\protobuf\unittest.proto
+		..\protos\google\protobuf\unittest_csharp_options.proto = ..\protos\google\protobuf\unittest_csharp_options.proto
+		..\protos\google\protobuf\unittest_custom_options.proto = ..\protos\google\protobuf\unittest_custom_options.proto
+		..\protos\google\protobuf\unittest_embed_optimize_for.proto = ..\protos\google\protobuf\unittest_embed_optimize_for.proto
+		..\protos\google\protobuf\unittest_empty.proto = ..\protos\google\protobuf\unittest_empty.proto
+		..\protos\google\protobuf\unittest_enormous_descriptor.proto = ..\protos\google\protobuf\unittest_enormous_descriptor.proto
+		..\protos\extest\unittest_extras_lite.proto = ..\protos\extest\unittest_extras_lite.proto
+		..\protos\google\protobuf\unittest_import.proto = ..\protos\google\protobuf\unittest_import.proto
+		..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.proto
+		..\protos\google\protobuf\unittest_lite.proto = ..\protos\google\protobuf\unittest_lite.proto
+		..\protos\google\protobuf\unittest_lite_imports_nonlite.proto = ..\protos\google\protobuf\unittest_lite_imports_nonlite.proto
+		..\protos\google\protobuf\unittest_mset.proto = ..\protos\google\protobuf\unittest_mset.proto
+		..\protos\google\protobuf\unittest_no_generic_services.proto = ..\protos\google\protobuf\unittest_no_generic_services.proto
+		..\protos\google\protobuf\unittest_optimize_for.proto = ..\protos\google\protobuf\unittest_optimize_for.proto
+		..\protos\extest\unittest_rpc_interop.proto = ..\protos\extest\unittest_rpc_interop.proto
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoGen", "ProtoGen\ProtoGen.csproj", "{250ADE34-82FD-4BAE-86D5-985FBE589C4A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoGen.Test", "ProtoGen.Test\ProtoGen.Test.csproj", "{C268DA4C-4004-47DA-AF23-44C983281A68}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddressBook", "AddressBook\AddressBook.csproj", "{A31F5FB2-4FF3-432A-B35B-5CD203606311}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoMunge", "ProtoMunge\ProtoMunge.csproj", "{8F09AF72-3327-4FA7-BC09-070B80221AB9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoBench", "ProtoBench\ProtoBench.csproj", "{C7A4A435-2813-41C8-AA87-BD914BA5223D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoDump", "ProtoDump\ProtoDump.csproj", "{D7282E99-2DC3-405B-946F-177DB2FD2AE2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{66ED1950-AD27-42D7-88F8-94355AEC8225}"
+	ProjectSection(SolutionItems) = preProject
+		..\build\Build.bat = ..\build\Build.bat
+		..\build\build.csproj = ..\build\build.csproj
+		..\build\build35.bat = ..\build\build35.bat
+		..\build\BuildAll.bat = ..\build\BuildAll.bat
+		..\build\BuildSilverlight2.bat = ..\build\BuildSilverlight2.bat
+		..\build\Common.targets = ..\build\Common.targets
+		..\build\GenerateCompletePackage.bat = ..\build\GenerateCompletePackage.bat
+		..\build\GenerateReleasePackage.bat = ..\build\GenerateReleasePackage.bat
+		..\build\RunBenchmarks.bat = ..\build\RunBenchmarks.bat
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug_Silverlight2|Any CPU = Debug_Silverlight2|Any CPU
+		Debug|Any CPU = Debug|Any CPU
+		Release_Silverlight2|Any CPU = Release_Silverlight2|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug_Silverlight2|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.Build.0 = Debug_Silverlight2|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.ActiveCfg = Release_Silverlight2|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.Build.0 = Release_Silverlight2|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C268DA4C-4004-47DA-AF23-44C983281A68}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.Build.0 = Release|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug_Silverlight2|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight2|Any CPU.Build.0 = Debug_Silverlight2|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.ActiveCfg = Release_Silverlight2|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight2|Any CPU.Build.0 = Release_Silverlight2|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.ActiveCfg = Debug|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight2|Any CPU.Build.0 = Debug|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.ActiveCfg = Release|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight2|Any CPU.Build.0 = Release|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{C8D3015A-EA39-4F03-AEEC-3FF1F2087A12} = {1F896D5C-5FC2-4671-9216-781CB8187EC7}
+	EndGlobalSection
+EndGlobal