Jelajahi Sumber

Remove languages other than C++, Java and Python.

Change-Id: I348b9796cef6f5f3d3f038ae0de38095cd6c2b7d
Feng Xiao 9 tahun lalu
induk
melakukan
eb0e6e9397
100 mengubah file dengan 0 tambahan dan 38564 penghapusan
  1. 0 40
      Protobuf.podspec
  2. 0 31
      csharp/.gitignore
  3. 0 148
      csharp/CHANGES.txt
  4. 0 37
      csharp/Google.Protobuf.Tools.nuspec
  5. 0 70
      csharp/README.md
  6. 0 10
      csharp/build_packages.bat
  7. 0 16
      csharp/buildall.sh
  8. 0 62
      csharp/generate_protos.sh
  9. TEMPAT SAMPAH
      csharp/keys/Google.Protobuf.public.snk
  10. TEMPAT SAMPAH
      csharp/keys/Google.Protobuf.snk
  11. 0 9
      csharp/keys/README.md
  12. 0 126
      csharp/protos/unittest_issues.proto
  13. 0 132
      csharp/src/AddressBook/AddPerson.cs
  14. 0 19
      csharp/src/AddressBook/AddressBook.xproj
  15. 0 518
      csharp/src/AddressBook/Addressbook.cs
  16. 0 99
      csharp/src/AddressBook/ListPeople.cs
  17. 0 95
      csharp/src/AddressBook/Program.cs
  18. 0 73
      csharp/src/AddressBook/SampleUsage.cs
  19. 0 20
      csharp/src/AddressBook/project.json
  20. 0 190
      csharp/src/Google.Protobuf.Conformance/Conformance.cs
  21. 0 19
      csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj
  22. 0 142
      csharp/src/Google.Protobuf.Conformance/Program.cs
  23. 0 19
      csharp/src/Google.Protobuf.Conformance/project.json
  24. 0 19
      csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj
  25. 0 73
      csharp/src/Google.Protobuf.JsonDump/Program.cs
  26. 0 19
      csharp/src/Google.Protobuf.JsonDump/project.json
  27. 0 171
      csharp/src/Google.Protobuf.Test/ByteStringTest.cs
  28. 0 53
      csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs
  29. 0 598
      csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
  30. 0 419
      csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs
  31. 0 532
      csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
  32. 0 746
      csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
  33. 0 98
      csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs
  34. 0 117
      csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
  35. 0 55
      csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
  36. 0 64
      csharp/src/Google.Protobuf.Test/EqualityTester.cs
  37. 0 196
      csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
  38. 0 723
      csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
  39. 0 19
      csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj
  40. 0 82
      csharp/src/Google.Protobuf.Test/IssuesTest.cs
  41. 0 589
      csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
  42. 0 939
      csharp/src/Google.Protobuf.Test/JsonParserTest.cs
  43. 0 408
      csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
  44. 0 259
      csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
  45. 0 218
      csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
  46. 0 94
      csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs
  47. 0 42
      csharp/src/Google.Protobuf.Test/SampleEnum.cs
  48. 0 99
      csharp/src/Google.Protobuf.Test/SampleMessages.cs
  49. 0 62
      csharp/src/Google.Protobuf.Test/TestCornerCases.cs
  50. 0 45
      csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
  51. 0 1599
      csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
  52. 0 174
      csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
  53. 0 160
      csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
  54. 0 1736
      csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
  55. 0 6646
      csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
  56. 0 2539
      csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
  57. 0 116
      csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs
  58. 0 132
      csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
  59. 0 62
      csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs
  60. 0 115
      csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
  61. 0 421
      csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
  62. 0 44
      csharp/src/Google.Protobuf.Test/project.json
  63. 0 45
      csharp/src/Google.Protobuf.sln
  64. 0 79
      csharp/src/Google.Protobuf/ByteArray.cs
  65. 0 345
      csharp/src/Google.Protobuf/ByteString.cs
  66. 0 1275
      csharp/src/Google.Protobuf/CodedInputStream.cs
  67. 0 304
      csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs
  68. 0 761
      csharp/src/Google.Protobuf/CodedOutputStream.cs
  69. 0 760
      csharp/src/Google.Protobuf/Collections/MapField.cs
  70. 0 147
      csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs
  71. 0 591
      csharp/src/Google.Protobuf/Collections/RepeatedField.cs
  72. 0 72
      csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs
  73. 0 106
      csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
  74. 0 474
      csharp/src/Google.Protobuf/FieldCodec.cs
  75. 0 49
      csharp/src/Google.Protobuf/FrameworkPortability.cs
  76. 0 19
      csharp/src/Google.Protobuf/Google.Protobuf.xproj
  77. 0 69
      csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs
  78. 0 54
      csharp/src/Google.Protobuf/IDeepCloneable.cs
  79. 0 87
      csharp/src/Google.Protobuf/IMessage.cs
  80. 0 53
      csharp/src/Google.Protobuf/InvalidJsonException.cs
  81. 0 129
      csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs
  82. 0 909
      csharp/src/Google.Protobuf/JsonFormatter.cs
  83. 0 1019
      csharp/src/Google.Protobuf/JsonParser.cs
  84. 0 166
      csharp/src/Google.Protobuf/JsonToken.cs
  85. 0 738
      csharp/src/Google.Protobuf/JsonTokenizer.cs
  86. 0 110
      csharp/src/Google.Protobuf/LimitedInputStream.cs
  87. 0 157
      csharp/src/Google.Protobuf/MessageExtensions.cs
  88. 0 267
      csharp/src/Google.Protobuf/MessageParser.cs
  89. 0 49
      csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs
  90. 0 79
      csharp/src/Google.Protobuf/ProtoPreconditions.cs
  91. 0 5991
      csharp/src/Google.Protobuf/Reflection/Descriptor.cs
  92. 0 85
      csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
  93. 0 368
      csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
  94. 0 64
      csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
  95. 0 80
      csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs
  96. 0 116
      csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
  97. 0 70
      csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
  98. 0 63
      csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
  99. 0 343
      csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
  100. 0 113
      csharp/src/Google.Protobuf/Reflection/FieldType.cs

+ 0 - 40
Protobuf.podspec

@@ -1,40 +0,0 @@
-# This file describes to Cocoapods how to integrate the Objective-C runtime into a dependent
-# project.
-# Despite this file being specific to Objective-C, it needs to be on the root of the repository.
-# Otherwise, Cocoapods gives trouble like not picking up the license file correctly, or not letting
-# dependent projects use the :git notation to refer to the library.
-Pod::Spec.new do |s|
-  s.name     = 'Protobuf'
-  s.version  = '3.0.0-beta-4'
-  s.summary  = 'Protocol Buffers v.3 runtime library for Objective-C.'
-  s.homepage = 'https://github.com/google/protobuf'
-  s.license  = 'New BSD'
-  s.authors  = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
-  s.cocoapods_version = '>= 1.0'
-
-  s.source = { :git => 'https://github.com/google/protobuf.git',
-               :tag => "v#{s.version}" }
-
-  s.source_files = 'objectivec/*.{h,m}',
-                   'objectivec/google/protobuf/Any.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Api.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Duration.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Empty.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/FieldMask.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/SourceContext.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Struct.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Timestamp.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Type.pbobjc.{h,m}',
-                   'objectivec/google/protobuf/Wrappers.pbobjc.{h,m}'
-  # The following would cause duplicate symbol definitions. GPBProtocolBuffers is expected to be
-  # left out, as it's an umbrella implementation file.
-  s.exclude_files = 'objectivec/GPBProtocolBuffers.m'
-
-  # Set a CPP symbol so the code knows to use framework imports.
-  s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' }
-  s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' }
-
-  s.ios.deployment_target = '7.1'
-  s.osx.deployment_target = '10.9'
-  s.requires_arc = false
-end

+ 0 - 31
csharp/.gitignore

@@ -1,31 +0,0 @@
-# Output
-bin
-obj
-project.lock.json
-TestResult.xml
-
-# Possibly legacy now?
-mono/bin
-mono/tmp
-mono/protoc
-build_output
-build_temp
-build/msbuild*.log
-lib/Microsoft.Silverlight.Testing
-lib/NUnit
-
-#
-# 	Untracked files
-#
-.vs
-*.user
-*.suo
-*.nupkg
-_ReSharper.*
-*.sln.cache
-mono/TestResult.xml
-mono/.libs
-mono/*.exe
-mono/*.dll
-lib/protoc.exe
-*.ncrunch*

+ 0 - 148
csharp/CHANGES.txt

@@ -1,148 +0,0 @@
-===============================================================================
-Welcome to the C# port of Google Protocol Buffers, written by Jon Skeet
-(skeet@pobox.com) based on the work of many talented people.
-
-===============================================================================
-RELEASE NOTES - Code imported into Google's main protobuf repository
-===============================================================================
-
-Everything below note this represents history of protobuf-csharp-port project
-before the code was merged into csharp/ subtree of GitHub google/protobuf
-repository.
-Frozen legacy version of the original project is available in
-https://github.com/jskeet/protobuf-csharp-port.
-
-===============================================================================
-RELEASE NOTES - Version 2.4.1.555
-===============================================================================
-
-Changes:
-- Upgrade solution format to Visual Studio 2012.
-- Add the ability to print a builder (not just a message)
-- TextGenerator introduces a new overload of PrintTo
-- Munge protoc's error format into a VS-C#-compatible output format.
-- Work to make ProtoGen clone that acts as a protoc.exe plugin.
-- Added the AllowPartiallyTrustedCallers attribute
-- Optimized enum parsing.
-
-Fixes:
-- Fix for bug in limited input stream's Position, Introduced Position on 
-  output stream
-- Fix for writing a character to a JSON output overflows allocated buffer
-- Optimize FromBase64String to return Empty when presented with empty string.
-- Use string.Concat instead of operator to avoid potential import problems
-- Issue 81: quoting for NUnit parameters.
-- Issue 56: NuGet package is noisy
-- Issue 70: Portable library project has some invalid Nunit-based code.
-- Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily
-- Issue 84: warning CS0219: The variable `size' is assigned but never used
-
-===============================================================================
-RELEASE NOTES - Version 2.4.1.521
-===============================================================================
-
-Changes:
-- Add generated_code_attributes option, defaulted to false
-- Added support for Portable library
-- Added 'Unsafe' static type in ByteString to allow direct buffer access
-
-Fixes:
-- Issue 50: The XML serializer will fail to deserialize a message with empty 
-  child message
-- Issue 45: Use of 'item' as a field name causes AmbiguousMatchException
-- Issue 49: Generated nested static Types class should be partial
-- Issue 38: Disable CLSCompliant warnings (3021)
-- Issue 40: proto_path does not work for command-line file names
-- Issue 54: should retire all bytes in buffer (bufferSize)
-- Issue 43: Fix to correct identical 'umbrella_classname' options from trying 
-  to write to the same filename.
-
-===============================================================================
-RELEASE NOTES - Version 2.4.1.473
-===============================================================================
-
-Features:
-- Added option service_generator_type to control service generation with
-  NONE, GENERIC, INTERFACE, or IRPCDISPATCH
-- Added interfaces IRpcDispatch and IRpcServerStub to provide for blocking
-  services and implementations.
-- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the 
-  location of protoc.exe.
-- Extracted interfaces for ICodedInputStream and ICodedOutputStream to allow
-  custom implementation of writers with both speed and size optimizations.
-- Addition of the "Google.ProtoBuffers.Serialization" assembly to support
-  reading and writing messages to/from XML, JSON, IDictionary<,> and others.
-- Several performance related fixes and tweeks
-- Issue 3:	Add option to mark generated code with attribute
-- Issue 20:	Support for decorating classes [Serializable]
-- Issue 21:	Decorate fields with [deprecated=true] as [System.Obsolete]
-- Issue 22:	Reusable Builder classes
-- Issue 24:	Support for using Json/Xml formats with ICodedInputStream
-- Issue 25: Added support for NuGet packages
-- Issue 31: Upgraded protoc.exe and descriptor to 2.4.1
-
-Fixes:
-- Issue 13:	Message with Field same name as message causes uncompilable .cs
-- Issue 16:	Does not integrate well with other tooling
-- Issue 19:	Support for negative enum values
-- Issue 26:	AddRange in GeneratedBuilder iterates twice.
-- Issue 27:	Remove XML documentation output from test projects to clear 
-  warnings/errors.
-- Issue 28: Circular message dependencies result in null default values for 
-  Message fields.
-- Issue 29: Message classes generated have a public default constructor.  You
-  can disable private ctor generation with the option generate_private_ctor.
-- Issue 35: Fixed a bug in ProtoGen handling of arguments with trailing \
-- Big-endian support for float, and double on Silverlight
-- Packed and Unpacked parsing allow for all repeated, as per version 2.3
-- Fix for leaving Builder a public ctor on internal classes for use with
-  generic "where T: new()" constraints.
-
-Other:
-- Changed the code signing key to a privately held key
-- Reformatted all code and line-endings to C# defaults
-- Reworking of performance benchmarks to produce reliable results, option /v2
-- Issue 34: Silverlight assemblies are now unit tested
-
-===============================================================================
-RELEASE NOTES - Version 2.3.0.277
-===============================================================================
-
-Features:
-- Added cls_compliance option to generate attributes indicating 
-  non-CLS-compliance.
-- Added file_extension option to control the generated output file's extension.
-- Added umbrella_namespace option to place the umbrella class into a nested
-  namespace to address issues with proto files having the same name as a 
-  message it contains.
-- Added output_directory option to set the output path for the source file(s).
-- Added ignore_google_protobuf option to avoid generating code for includes 
-  from the google.protobuf package.
-- Added the LITE framework (Google.ProtoBuffersLite.dll) and the ability to
-  generate code with "option optimize_for = LITE_RUNTIME;".
-- Added ability to invoke protoc.exe from within ProtoGen.exe.
-- Upgraded to protoc.exe (2.3) compiler.
-
-Fixes:
-- Issue 9:	Class cannot be static and sealed error
-- Issue 12:	default value for enumerate fields must be filled out
-
-Other:
-- Rewrite of build using MSbuild instead of NAnt
-- Moved to NUnit Version 2.2.8.0
-- Changed to using secure .snk for releases
-
-===============================================================================
-RELEASE NOTES - Version 0.9.1
-===============================================================================
-
-Fixes:
-- issue 10:	Incorrect encoding of packed fields when serialized
-
-===============================================================================
-RELEASE NOTES - Version 0.9.0
-===============================================================================
-
-- Initial release
-
-===============================================================================

+ 0 - 37
csharp/Google.Protobuf.Tools.nuspec

@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<package>
-  <metadata>
-    <id>Google.Protobuf.Tools</id>
-    <title>Google Protocol Buffers tools</title>
-    <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
-    <description>See project site for more info.</description>
-    <version>3.0.0-beta4</version>
-    <authors>Google Inc.</authors>
-    <owners>protobuf-packages</owners>
-    <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
-    <projectUrl>https://github.com/google/protobuf</projectUrl>
-    <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <releaseNotes>Tools for Protocol Buffers</releaseNotes>
-    <copyright>Copyright 2015, Google Inc.</copyright>
-    <tags>Protocol Buffers Binary Serialization Format Google proto proto3</tags>
-  </metadata>
-  <files>
-    <file src="protoc\windows_x86\protoc.exe" target="tools\windows_x86\protoc.exe" />
-    <file src="protoc\windows_x64\protoc.exe" target="tools\windows_x64\protoc.exe" />
-    <file src="protoc\linux_x86\protoc" target="tools\linux_x86\protoc" />
-    <file src="protoc\linux_x64\protoc" target="tools\linux_x64\protoc" />
-    <file src="protoc\macosx_x86\protoc" target="tools\macosx_x86\protoc" />
-    <file src="protoc\macosx_x64\protoc" target="tools\macosx_x64\protoc" />
-    <file src="..\src\google\protobuf\any.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\api.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\descriptor.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\duration.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\empty.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\field_mask.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\source_context.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\struct.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\timestamp.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\type.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\wrappers.proto" target="tools\google\protobuf" />
-  </files>
-</package>

+ 0 - 70
csharp/README.md

@@ -1,70 +0,0 @@
-This directory contains the C# Protocol Buffers runtime library.
-
-Status: Beta - ready for external testing
-=========================================
-
-Usage
-=====
-
-The easiest way how to use C# protobufs is via the `Google.Protobuf`
-NuGet package. Just add the NuGet package to your VS project.
-
-You will also want to install the `Google.Protobuf.Tools` NuGet package, which
-contains precompiled version of `protoc.exe` and a copy of well known `.proto`
-files under the package's `tools` directory.
-
-To generate C# files from your `.proto` files, invoke `protoc` with the 
-`--csharp_out` option.
-
-Supported platforms
-===================
-
-The runtime library is built as a portable class library, supporting:
-
-- .NET 4.5
-- Windows 8
-- Windows Phone Silverlight 8
-- Windows Phone 8.1
-- .NET Core
-
-You should be able to use Protocol Buffers in Visual Studio 2012 and
-all later versions. This includes all code generated by `protoc`,
-which only uses features from C# 3 and earlier.
-
-Building
-========
-
-Open the `src/Google.Protobuf.sln` solution in Visual Studio 2015 or
-later. You should be able to run the NUnit test from Test Explorer
-(you might need to install NUnit Visual Studio add-in).
-
-Although *users* of this project are only expected to have Visual
-Studio 2012 or later, *developers* of the library are required to
-have Visual Studio 2015 or later, as the library uses C# 6 features
-in its implementation. These features have no impact when using the
-compiled code - they're only relevant when building the
-`Google.Protobuf` assembly.
-
-History of C# protobufs
-=======================
-
-This subtree was originally imported from https://github.com/jskeet/protobuf-csharp-port
-and represents the latest development version of C# protobufs, that will now be developed
-and maintained by Google. All the development will be done in open, under this repository
-(https://github.com/google/protobuf).
-
-The previous project differs from this project in a number of ways:
-
-- The old code only supported proto2; the new code only supports
-proto3 (so no unknown fields, no required/optional distinction, no
-extensions)
-- The old code was based on immutable message types and builders for
-them
-- The old code did not support maps or `oneof`
-- The old code had its own JSON representation, whereas the new code
-uses the standard protobuf JSON representation
-- The old code had no notion of the "well-known types" which have
-special support in the new code
-- The old project supported some older platforms (such as older
-versions of Silverlight) which are not currently supported in the
-new project

+ 0 - 10
csharp/build_packages.bat

@@ -1,10 +0,0 @@
-@rem Builds Google.Protobuf NuGet packages
-
-dotnet restore src
-dotnet pack -c Release src\Google.Protobuf || goto :error
-
-goto :EOF
-
-:error
-echo Failed!
-exit /b %errorlevel%

+ 0 - 16
csharp/buildall.sh

@@ -1,16 +0,0 @@
-#!/bin/bash
-
-CONFIG=Release
-SRC=$(dirname $0)/src
-
-set -ex
-
-echo Building relevant projects.
-dotnet build -c $CONFIG $SRC/Google.Protobuf $SRC/Google.Protobuf.Test $SRC/Google.Protobuf.Conformance
-
-echo Running tests.
-# Only test netcoreapp1.0, which uses the .NET Core runtime.
-# If we want to test the .NET 4.5 version separately, we could
-# run Mono explicitly. However, we don't have any differences between
-# the .NET 4.5 and netstandard1.0 assemblies.
-dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test

+ 0 - 62
csharp/generate_protos.sh

@@ -1,62 +0,0 @@
-#!/bin/bash
-# Generates C# source files from .proto files.
-# You first need to make sure protoc has been built (see instructions on
-# building protoc in root of this repository)
-
-set -ex
-
-# cd to repository root
-pushd $(dirname $0)/..
-
-# Protocol buffer compiler to use. If the PROTOC variable is set,
-# use that. Otherwise, probe for expected locations under both
-# Windows and Unix.
-if [ -z "$PROTOC" ]; then
-  # TODO(jonskeet): Use an array and a for loop instead?
-  if [ -x cmake/build/Debug/protoc.exe ]; then
-    PROTOC=cmake/build/Debug/protoc.exe
-  elif [ -x cmake/build/Release/protoc.exe ]; then
-    PROTOC=cmake/build/Release/protoc.exe
-  elif [ -x src/protoc ]; then
-    PROTOC=src/protoc
-  else
-    echo "Unable to find protocol buffer compiler."
-    exit 1
-  fi
-fi
-
-# descriptor.proto and well-known types
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
-    --csharp_opt=base_namespace=Google.Protobuf \
-    src/google/protobuf/descriptor.proto \
-    src/google/protobuf/any.proto \
-    src/google/protobuf/api.proto \
-    src/google/protobuf/duration.proto \
-    src/google/protobuf/empty.proto \
-    src/google/protobuf/field_mask.proto \
-    src/google/protobuf/source_context.proto \
-    src/google/protobuf/struct.proto \
-    src/google/protobuf/timestamp.proto \
-    src/google/protobuf/type.proto \
-    src/google/protobuf/wrappers.proto
-
-# Test protos where the namespace matches the target location
-$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \
-    --csharp_opt=base_namespace=Google.Protobuf \
-    src/google/protobuf/map_unittest_proto3.proto \
-    src/google/protobuf/unittest_proto3.proto \
-    src/google/protobuf/unittest_import_proto3.proto \
-    src/google/protobuf/unittest_import_public_proto3.proto \
-    src/google/protobuf/unittest_well_known_types.proto
-
-# Different base namespace to the protos above
-$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \
-    --csharp_opt=base_namespace=UnitTest.Issues \
-    csharp/protos/unittest_issues.proto
-
-# AddressBook sample protos
-$PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \
-    examples/addressbook.proto
-
-$PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \
-    conformance/conformance.proto

TEMPAT SAMPAH
csharp/keys/Google.Protobuf.public.snk


TEMPAT SAMPAH
csharp/keys/Google.Protobuf.snk


+ 0 - 9
csharp/keys/README.md

@@ -1,9 +0,0 @@
-Contents
---------
-
-- Google.Protobuf.public.snk:
-  Public key to verify strong name of Google.Protobuf assemblies.
-- Google.Protobuf.snk:
-  Signing key to provide strong name of Google.Protobuf assemblies.
-  As per [Microsoft guidance](https://msdn.microsoft.com/en-us/library/wd40t7ad(v=vs.110).aspx)
-  signing key should be checked into the repository.

+ 0 - 126
csharp/protos/unittest_issues.proto

@@ -1,126 +0,0 @@
-syntax = "proto3";
-
-// These proto descriptors have at one time been reported as an issue or defect.
-// They are kept here to replicate the issue, and continue to verify the fix.
-
-// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified
-option csharp_namespace = "UnitTest.Issues.TestProtos";
-
-package unittest_issues;
-option optimize_for = SPEED;
-
-// Issue 307: when generating doubly-nested types, any references
-// should be of the form A.Types.B.Types.C.
-message Issue307 {
-  message NestedOnce {
-    message NestedTwice {
-    }
-  }
-}
-
-// Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
-// New issue 309: https://github.com/google/protobuf/issues/309
- 
-// message A {
-//    optional int32 _A = 1;
-// }
-
-// message B {
-//    optional int32 B_ = 1;
-// }
-
-//message AB {
-//    optional int32 a_b = 1;
-//}
-
-// Similar issue with numeric names
-// Java code failed too, so probably best for this to be a restriction.
-// See https://github.com/google/protobuf/issues/308
-// message NumberField {
-//    optional int32 _01 = 1;
-// }
-
-// issue 19 - negative enum values
-
-enum NegativeEnum {
-    NEGATIVE_ENUM_ZERO = 0;
-    FiveBelow = -5;
-    MinusOne = -1;
-}
-
-message NegativeEnumMessage {
-    NegativeEnum value = 1;
-    repeated NegativeEnum values = 2 [packed = false];
-    repeated NegativeEnum packed_values = 3 [packed=true];
-}
-
-// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21
-// Decorate fields with [deprecated=true] as [System.Obsolete]
-
-message DeprecatedChild {
-}
-
-enum DeprecatedEnum {
-    DEPRECATED_ZERO = 0;
-    one = 1;
-}
-
-message DeprecatedFieldsMessage {
-    int32 PrimitiveValue = 1 [deprecated = true];
-    repeated int32 PrimitiveArray = 2 [deprecated = true];
-
-    DeprecatedChild MessageValue = 3 [deprecated = true];
-    repeated DeprecatedChild MessageArray = 4 [deprecated = true];
-
-    DeprecatedEnum EnumValue = 5 [deprecated = true];
-    repeated DeprecatedEnum EnumArray = 6 [deprecated = true];
-}
-
-// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
-message ItemField {
-  int32 item = 1;
-}
-
-message ReservedNames {
-  // Force a nested type called Types
-  message SomeNestedType {
-  }
-
-  int32 types = 1;
-  int32 descriptor = 2;
-}
-
-message TestJsonFieldOrdering {
-  // These fields are deliberately not declared in numeric
-  // order, and the oneof fields aren't contiguous either.
-  // This allows for reasonably robust tests of JSON output
-  // ordering.
-  // TestFieldOrderings in unittest_proto3.proto is similar,
-  // but doesn't include oneofs.
-  // TODO: Consider adding oneofs to TestFieldOrderings, although
-  // that will require fixing other tests in multiple platforms.
-  // Alternatively, consider just adding this to
-  // unittest_proto3.proto if multiple platforms want it.
-  
-  int32 plain_int32 = 4;
-
-  oneof o1 {
-    string o1_string = 2;
-    int32 o1_int32 = 5;
-  }
-  
-  string plain_string = 1;
-  
-  oneof o2 {
-    int32 o2_int32 = 6;
-    string o2_string = 3;
-  }
-  
-}
-
-message TestJsonName {
-  // Message for testing the effects for of the json_name option
-  string name = 1;
-  string description = 2 [json_name = "desc"];
-  string guid = 3 [json_name = "exid"];
-}

+ 0 - 132
csharp/src/AddressBook/AddPerson.cs

@@ -1,132 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf.Examples.AddressBook
-{
-    internal class AddPerson
-    {
-        /// <summary>
-        /// Builds a person based on user input
-        /// </summary>
-        private static Person PromptForAddress(TextReader input, TextWriter output)
-        {
-            Person person = new Person();
-
-            output.Write("Enter person ID: ");
-            person.Id = int.Parse(input.ReadLine());
-
-            output.Write("Enter name: ");
-            person.Name = input.ReadLine();
-
-            output.Write("Enter email address (blank for none): ");
-            string email = input.ReadLine();
-            if (email.Length > 0)
-            {
-                person.Email = email;
-            }
-
-            while (true)
-            {
-                output.Write("Enter a phone number (or leave blank to finish): ");
-                string number = input.ReadLine();
-                if (number.Length == 0)
-                {
-                    break;
-                }
-
-                Person.Types.PhoneNumber phoneNumber = new Person.Types.PhoneNumber { Number = number };
-
-                output.Write("Is this a mobile, home, or work phone? ");
-                String type = input.ReadLine();
-                switch (type)
-                {
-                    case "mobile":
-                        phoneNumber.Type = Person.Types.PhoneType.Mobile;
-                        break;
-                    case "home":
-                        phoneNumber.Type = Person.Types.PhoneType.Home;
-                        break;
-                    case "work":
-                        phoneNumber.Type = Person.Types.PhoneType.Work;
-                        break;
-                    default:
-                        output.Write("Unknown phone type. Using default.");
-                        break;
-                }
-
-                person.Phones.Add(phoneNumber);
-            }
-            return person;
-        }
-
-        /// <summary>
-        /// Entry point - loads an existing addressbook or creates a new one,
-        /// then writes it back to the file.
-        /// </summary>
-        public static int Main(string[] args)
-        {
-            if (args.Length != 1)
-            {
-                Console.Error.WriteLine("Usage:  AddPerson ADDRESS_BOOK_FILE");
-                return -1;
-            }
-
-            AddressBook addressBook;
-
-            if (File.Exists(args[0]))
-            {
-                using (Stream file = File.OpenRead(args[0]))
-                {
-                    addressBook = AddressBook.Parser.ParseFrom(file);
-                }
-            }
-            else
-            {
-                Console.WriteLine("{0}: File not found. Creating a new file.", args[0]);
-                addressBook = new AddressBook();
-            }
-
-            // Add an address.
-            addressBook.People.Add(PromptForAddress(Console.In, Console.Out));
-
-            // Write the new address book back to disk.
-            using (Stream output = File.OpenWrite(args[0]))
-            {
-                addressBook.WriteTo(output);
-            }
-            return 0;
-        }
-    }
-}

+ 0 - 19
csharp/src/AddressBook/AddressBook.xproj

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>afb63919-1e05-43b4-802a-8fb8c9b2f463</ProjectGuid>
-    <RootNamespace>AddressBook</RootNamespace>
-    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
-    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>

+ 0 - 518
csharp/src/AddressBook/Addressbook.cs

@@ -1,518 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: addressbook.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.Examples.AddressBook {
-
-  /// <summary>Holder for reflection information generated from addressbook.proto</summary>
-  public static partial class AddressbookReflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for addressbook.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static AddressbookReflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu",
-            "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l",
-            "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u",
-            "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y",
-            "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA",
-            "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl",
-            "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uQlAKFGNvbS5leGFtcGxlLnR1dG9y",
-            "aWFsQhFBZGRyZXNzQm9va1Byb3Rvc6oCJEdvb2dsZS5Qcm90b2J1Zi5FeGFt",
-            "cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { },
-          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null)
-          }));
-    }
-    #endregion
-
-  }
-  #region Messages
-  /// <summary>
-  ///  [START messages]
-  /// </summary>
-  public sealed partial class Person : pb::IMessage<Person> {
-    private static readonly pb::MessageParser<Person> _parser = new pb::MessageParser<Person>(() => new Person());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<Person> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Person() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Person(Person other) : this() {
-      name_ = other.name_;
-      id_ = other.id_;
-      email_ = other.email_;
-      phones_ = other.phones_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Person Clone() {
-      return new Person(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "id" field.</summary>
-    public const int IdFieldNumber = 2;
-    private int id_;
-    /// <summary>
-    ///  Unique ID number for this person.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Id {
-      get { return id_; }
-      set {
-        id_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "email" field.</summary>
-    public const int EmailFieldNumber = 3;
-    private string email_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Email {
-      get { return email_; }
-      set {
-        email_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "phones" field.</summary>
-    public const int PhonesFieldNumber = 4;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> _repeated_phones_codec
-        = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> phones_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber> Phones {
-      get { return phones_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as Person);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(Person other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (Id != other.Id) return false;
-      if (Email != other.Email) return false;
-      if(!phones_.Equals(other.phones_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (Id != 0) hash ^= Id.GetHashCode();
-      if (Email.Length != 0) hash ^= Email.GetHashCode();
-      hash ^= phones_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (Id != 0) {
-        output.WriteRawTag(16);
-        output.WriteInt32(Id);
-      }
-      if (Email.Length != 0) {
-        output.WriteRawTag(26);
-        output.WriteString(Email);
-      }
-      phones_.WriteTo(output, _repeated_phones_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (Id != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id);
-      }
-      if (Email.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Email);
-      }
-      size += phones_.CalculateSize(_repeated_phones_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(Person other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.Id != 0) {
-        Id = other.Id;
-      }
-      if (other.Email.Length != 0) {
-        Email = other.Email;
-      }
-      phones_.Add(other.phones_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 16: {
-            Id = input.ReadInt32();
-            break;
-          }
-          case 26: {
-            Email = input.ReadString();
-            break;
-          }
-          case 34: {
-            phones_.AddEntriesFrom(input, _repeated_phones_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the Person message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      public enum PhoneType {
-        [pbr::OriginalName("MOBILE")] Mobile = 0,
-        [pbr::OriginalName("HOME")] Home = 1,
-        [pbr::OriginalName("WORK")] Work = 2,
-      }
-
-      public sealed partial class PhoneNumber : pb::IMessage<PhoneNumber> {
-        private static readonly pb::MessageParser<PhoneNumber> _parser = new pb::MessageParser<PhoneNumber>(() => new PhoneNumber());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<PhoneNumber> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.Examples.AddressBook.Person.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public PhoneNumber() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public PhoneNumber(PhoneNumber other) : this() {
-          number_ = other.number_;
-          type_ = other.type_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public PhoneNumber Clone() {
-          return new PhoneNumber(this);
-        }
-
-        /// <summary>Field number for the "number" field.</summary>
-        public const int NumberFieldNumber = 1;
-        private string number_ = "";
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public string Number {
-          get { return number_; }
-          set {
-            number_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-          }
-        }
-
-        /// <summary>Field number for the "type" field.</summary>
-        public const int TypeFieldNumber = 2;
-        private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = 0;
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type {
-          get { return type_; }
-          set {
-            type_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as PhoneNumber);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(PhoneNumber other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if (Number != other.Number) return false;
-          if (Type != other.Type) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          if (Number.Length != 0) hash ^= Number.GetHashCode();
-          if (Type != 0) hash ^= Type.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          if (Number.Length != 0) {
-            output.WriteRawTag(10);
-            output.WriteString(Number);
-          }
-          if (Type != 0) {
-            output.WriteRawTag(16);
-            output.WriteEnum((int) Type);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          if (Number.Length != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeStringSize(Number);
-          }
-          if (Type != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(PhoneNumber other) {
-          if (other == null) {
-            return;
-          }
-          if (other.Number.Length != 0) {
-            Number = other.Number;
-          }
-          if (other.Type != 0) {
-            Type = other.Type;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 10: {
-                Number = input.ReadString();
-                break;
-              }
-              case 16: {
-                type_ = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  Our address book file is just one of these.
-  /// </summary>
-  public sealed partial class AddressBook : pb::IMessage<AddressBook> {
-    private static readonly pb::MessageParser<AddressBook> _parser = new pb::MessageParser<AddressBook>(() => new AddressBook());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<AddressBook> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[1]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public AddressBook() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public AddressBook(AddressBook other) : this() {
-      people_ = other.people_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public AddressBook Clone() {
-      return new AddressBook(this);
-    }
-
-    /// <summary>Field number for the "people" field.</summary>
-    public const int PeopleFieldNumber = 1;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Examples.AddressBook.Person> _repeated_people_codec
-        = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person> people_ = new pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Examples.AddressBook.Person> People {
-      get { return people_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as AddressBook);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(AddressBook other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!people_.Equals(other.people_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= people_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      people_.WriteTo(output, _repeated_people_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += people_.CalculateSize(_repeated_people_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(AddressBook other) {
-      if (other == null) {
-        return;
-      }
-      people_.Add(other.people_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            people_.AddEntriesFrom(input, _repeated_people_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 99
csharp/src/AddressBook/ListPeople.cs

@@ -1,99 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf.Examples.AddressBook
-{
-    internal class ListPeople
-    {
-        /// <summary>
-        /// Iterates though all people in the AddressBook and prints info about them.
-        /// </summary>
-        private static void Print(AddressBook addressBook)
-        {
-            foreach (Person person in addressBook.People)
-            {
-                Console.WriteLine("Person ID: {0}", person.Id);
-                Console.WriteLine("  Name: {0}", person.Name);
-                if (person.Email != "")
-                {
-                    Console.WriteLine("  E-mail address: {0}", person.Email);
-                }
-
-                foreach (Person.Types.PhoneNumber phoneNumber in person.Phones)
-                {
-                    switch (phoneNumber.Type)
-                    {
-                        case Person.Types.PhoneType.Mobile:
-                            Console.Write("  Mobile phone #: ");
-                            break;
-                        case Person.Types.PhoneType.Home:
-                            Console.Write("  Home phone #: ");
-                            break;
-                        case Person.Types.PhoneType.Work:
-                            Console.Write("  Work phone #: ");
-                            break;
-                    }
-                    Console.WriteLine(phoneNumber.Number);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Entry point - loads the addressbook and then displays it.
-        /// </summary>
-        public static int Main(string[] args)
-        {
-            if (args.Length != 1)
-            {
-                Console.Error.WriteLine("Usage:  ListPeople ADDRESS_BOOK_FILE");
-                return 1;
-            }
-
-            if (!File.Exists(args[0]))
-            {
-                Console.WriteLine("{0} doesn't exist. Add a person to create the file first.", args[0]);
-                return 0;
-            }
-
-            // Read the existing address book.
-            using (Stream stream = File.OpenRead(args[0]))
-            {
-                AddressBook addressBook = AddressBook.Parser.ParseFrom(stream);
-                Print(addressBook);
-            }
-            return 0;
-        }
-    }
-}

+ 0 - 95
csharp/src/AddressBook/Program.cs

@@ -1,95 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.Examples.AddressBook
-{
-    /// <summary>
-    /// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour
-    /// to individual actions. Each action has its own Main method, so that it can be used as an
-    /// invidual complete program.
-    /// </summary>
-    internal class Program
-    {
-        private static int Main(string[] args)
-        {
-            if (args.Length > 1)
-            {
-                Console.Error.WriteLine("Usage: AddressBook [file]");
-                Console.Error.WriteLine("If the filename isn't specified, \"addressbook.data\" is used instead.");
-                return 1;
-            }
-            string addressBookFile = args.Length > 0 ? args[0] : "addressbook.data";
-
-            bool stopping = false;
-            while (!stopping)
-            {
-                Console.WriteLine("Options:");
-                Console.WriteLine("  L: List contents");
-                Console.WriteLine("  A: Add new person");
-                Console.WriteLine("  Q: Quit");
-                Console.Write("Action? ");
-                Console.Out.Flush();
-                char choice = Console.ReadKey().KeyChar;
-                Console.WriteLine();
-                try
-                {
-                    switch (choice)
-                    {
-                        case 'A':
-                        case 'a':
-                            AddPerson.Main(new string[] {addressBookFile});
-                            break;
-                        case 'L':
-                        case 'l':
-                            ListPeople.Main(new string[] {addressBookFile});
-                            break;
-                        case 'Q':
-                        case 'q':
-                            stopping = true;
-                            break;
-                        default:
-                            Console.WriteLine("Unknown option: {0}", choice);
-                            break;
-                    }
-                }
-                catch (Exception e)
-                {
-                    Console.WriteLine("Exception executing action: {0}", e);
-                }
-                Console.WriteLine();
-            }
-            return 0;
-        }
-    }
-}

+ 0 - 73
csharp/src/AddressBook/SampleUsage.cs

@@ -1,73 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf.Examples.AddressBook
-{
-    internal class SampleUsage
-    {
-        private static void Main()
-        {
-            byte[] bytes;
-            // Create a new person
-            Person person = new Person
-            {
-                Id = 1,
-                Name = "Foo",
-                Email = "foo@bar",
-                Phones = { new Person.Types.PhoneNumber { Number = "555-1212" } }
-            };
-            using (MemoryStream stream = new MemoryStream())
-            {
-                // Save the person to a stream
-                person.WriteTo(stream);
-                bytes = stream.ToArray();
-            }
-            Person copy = Person.Parser.ParseFrom(bytes);
-
-            AddressBook book = new AddressBook
-            {
-                People = { copy }
-            };
-            bytes = book.ToByteArray();
-            // And read the address book back again
-            AddressBook restored = AddressBook.Parser.ParseFrom(bytes);
-            // The message performs a deep-comparison on equality:
-            if (restored.People.Count != 1 || !person.Equals(restored.People[0]))
-            {
-                throw new Exception("There is a bad person in here!");
-            }
-        }
-    }
-}

+ 0 - 20
csharp/src/AddressBook/project.json

@@ -1,20 +0,0 @@
-{
-  "buildOptions": {
-    "debugType": "portable",
-    "emitEntryPoint": true,
-    "additionalArguments": [ "/main:Google.Protobuf.Examples.AddressBook.Program" ]
-  },
-  "dependencies": {
-    "Google.Protobuf": { "target": "project" }
-  },
-  "frameworks": {
-    "netcoreapp1.0": {
-      "dependencies": {
-        "Microsoft.NETCore.App": {
-          "type": "platform",
-          "version": "1.0.0"
-        }
-      }
-    }
-  }
-}

File diff ditekan karena terlalu besar
+ 0 - 190
csharp/src/Google.Protobuf.Conformance/Conformance.cs


+ 0 - 19
csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.xproj

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>dddc055b-e185-4181-bab0-072f0f984569</ProjectGuid>
-    <RootNamespace>Google.Protobuf.Conformance</RootNamespace>
-    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
-    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>

+ 0 - 142
csharp/src/Google.Protobuf.Conformance/Program.cs

@@ -1,142 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Conformance;
-using Google.Protobuf.Reflection;
-using System;
-using System.IO;
-
-namespace Google.Protobuf.Conformance
-{
-    /// <summary>
-    /// Conformance tests. The test runner will provide JSON or proto data on stdin,
-    /// and this program will produce its output on stdout.
-    /// </summary>
-    class Program
-    {
-        private static void Main(string[] args)
-        {
-            // This way we get the binary streams instead of readers/writers.
-            var input = new BinaryReader(Console.OpenStandardInput());
-            var output = new BinaryWriter(Console.OpenStandardOutput());
-            var typeRegistry = TypeRegistry.FromMessages(TestAllTypes.Descriptor);
-
-            int count = 0;
-            while (RunTest(input, output, typeRegistry))
-            {
-                count++;
-            }
-            Console.Error.WriteLine("Received EOF after {0} tests", count);
-        }
-
-        private static bool RunTest(BinaryReader input, BinaryWriter output, TypeRegistry typeRegistry)
-        {
-            int? size = ReadInt32(input);
-            if (size == null)
-            {
-                return false;
-            }
-            byte[] inputData = input.ReadBytes(size.Value);
-            if (inputData.Length != size.Value)
-            {
-                throw new EndOfStreamException("Read " + inputData.Length + " bytes of data when expecting " + size);
-            }
-            ConformanceRequest request = ConformanceRequest.Parser.ParseFrom(inputData);
-            ConformanceResponse response = PerformRequest(request, typeRegistry);
-            byte[] outputData = response.ToByteArray();
-            output.Write(outputData.Length);
-            output.Write(outputData);
-            // Ready for another test...
-            return true;
-        }
-
-        private static ConformanceResponse PerformRequest(ConformanceRequest request, TypeRegistry typeRegistry)
-        {
-            TestAllTypes message;
-            try
-            {
-                switch (request.PayloadCase)
-                {
-                    case ConformanceRequest.PayloadOneofCase.JsonPayload:
-                        var parser = new JsonParser(new JsonParser.Settings(20, typeRegistry));
-                        message = parser.Parse<TestAllTypes>(request.JsonPayload);
-                        break;
-                    case ConformanceRequest.PayloadOneofCase.ProtobufPayload:
-                        message = TestAllTypes.Parser.ParseFrom(request.ProtobufPayload);
-                        break;
-                    default:
-                        throw new Exception("Unsupported request payload: " + request.PayloadCase);
-                }
-            }
-            catch (InvalidProtocolBufferException e)
-            {
-                return new ConformanceResponse { ParseError = e.Message };
-            }
-            catch (InvalidJsonException e)
-            {
-                return new ConformanceResponse { ParseError = e.Message };
-            }
-            try
-            {
-                switch (request.RequestedOutputFormat)
-                {
-                    case global::Conformance.WireFormat.Json:
-                        var formatter = new JsonFormatter(new JsonFormatter.Settings(false, typeRegistry));
-                        return new ConformanceResponse { JsonPayload = formatter.Format(message) };
-                    case global::Conformance.WireFormat.Protobuf:
-                        return new ConformanceResponse { ProtobufPayload = message.ToByteString() };
-                    default:
-                        throw new Exception("Unsupported request output format: " + request.PayloadCase);
-                }
-            }
-            catch (InvalidOperationException e)
-            {
-                return new ConformanceResponse { SerializeError = e.Message };
-            }
-        }
-
-        private static int? ReadInt32(BinaryReader input)
-        {
-            byte[] bytes = input.ReadBytes(4);
-            if (bytes.Length == 0)
-            {
-                // Cleanly reached the end of the stream
-                return null;
-            }
-            if (bytes.Length != 4)
-            {
-                throw new EndOfStreamException("Read " + bytes.Length + " bytes of size when expecting 4");
-            }
-            return bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24);
-        }
-    }
-}

+ 0 - 19
csharp/src/Google.Protobuf.Conformance/project.json

@@ -1,19 +0,0 @@
-{
-  "buildOptions": {
-    "debugType": "portable",
-    "emitEntryPoint": true
-  },
-  "dependencies": {
-    "Google.Protobuf": { "target": "project" }
-  },
-  "frameworks": {
-    "netcoreapp1.0": {
-      "dependencies": {
-        "Microsoft.NETCore.App": {
-          "type": "platform",
-          "version": "1.0.0"
-        }
-      }
-    }
-  }
-}

+ 0 - 19
csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.xproj

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>9695e08f-9829-497d-b95c-b38f28d48690</ProjectGuid>
-    <RootNamespace>Google.Protobuf.JsonDump</RootNamespace>
-    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
-    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>

+ 0 - 73
csharp/src/Google.Protobuf.JsonDump/Program.cs

@@ -1,73 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-using System.Reflection;
-
-namespace Google.Protobuf.ProtoDump
-{
-    /// <summary>
-    /// Small utility to load a binary message and dump it in JSON format.
-    /// </summary>
-    internal class Program
-    {
-        private static int Main(string[] args)
-        {
-            if (args.Length != 2)
-            {
-                Console.Error.WriteLine("Usage: Google.Protobuf.JsonDump <descriptor type name> <input data>");
-                Console.Error.WriteLine("The descriptor type name is the fully-qualified message name,");
-                Console.Error.WriteLine("including assembly e.g. ProjectNamespace.Message,Company.Project");
-                return 1;
-            }
-            Type type = Type.GetType(args[0]);
-            if (type == null)
-            {
-                Console.Error.WriteLine("Unable to load type {0}.", args[0]);
-                return 1;
-            }
-            if (!typeof(IMessage).GetTypeInfo().IsAssignableFrom(type))
-            {
-                Console.Error.WriteLine("Type {0} doesn't implement IMessage.", args[0]);
-                return 1;
-            }
-            IMessage message = (IMessage) Activator.CreateInstance(type);
-            using (var input = File.OpenRead(args[1]))
-            {
-                message.MergeFrom(input);
-            }
-            Console.WriteLine(message);
-            return 0;
-        }
-    }
-}

+ 0 - 19
csharp/src/Google.Protobuf.JsonDump/project.json

@@ -1,19 +0,0 @@
-{
-  "buildOptions": {
-    "debugType": "portable",
-    "emitEntryPoint": true
-  },
-  "dependencies": {
-    "Google.Protobuf": { "target": "project" }
-  },
-  "frameworks": {
-    "netcoreapp1.0": {
-      "dependencies": {
-        "Microsoft.NETCore.App": {
-          "type": "platform",
-          "version": "1.0.0"
-        }
-      }
-    }
-  }
-}

+ 0 - 171
csharp/src/Google.Protobuf.Test/ByteStringTest.cs

@@ -1,171 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Text;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    public class ByteStringTest
-    {
-        [Test]
-        public void Equality()
-        {
-            ByteString b1 = ByteString.CopyFrom(1, 2, 3);
-            ByteString b2 = ByteString.CopyFrom(1, 2, 3);
-            ByteString b3 = ByteString.CopyFrom(1, 2, 4);
-            ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4);
-            EqualityTester.AssertEquality(b1, b1);
-            EqualityTester.AssertEquality(b1, b2);
-            EqualityTester.AssertInequality(b1, b3);
-            EqualityTester.AssertInequality(b1, b4);
-            EqualityTester.AssertInequality(b1, null);
-#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1)
-            Assert.IsTrue(b1 == b1);
-            Assert.IsTrue(b1 == b2);
-            Assert.IsFalse(b1 == b3);
-            Assert.IsFalse(b1 == b4);
-            Assert.IsFalse(b1 == null);
-            Assert.IsTrue((ByteString) null == null);
-            Assert.IsFalse(b1 != b1);
-            Assert.IsFalse(b1 != b2);
-#pragma warning disable 1718
-            Assert.IsTrue(b1 != b3);
-            Assert.IsTrue(b1 != b4);
-            Assert.IsTrue(b1 != null);
-            Assert.IsFalse((ByteString) null != null);
-        }
-
-        [Test]
-        public void EmptyByteStringHasZeroSize()
-        {
-            Assert.AreEqual(0, ByteString.Empty.Length);
-        }
-
-        [Test]
-        public void CopyFromStringWithExplicitEncoding()
-        {
-            ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode);
-            Assert.AreEqual(4, bs.Length);
-            Assert.AreEqual(65, bs[0]);
-            Assert.AreEqual(0, bs[1]);
-            Assert.AreEqual(66, bs[2]);
-            Assert.AreEqual(0, bs[3]);
-        }
-
-        [Test]
-        public void IsEmptyWhenEmpty()
-        {
-            Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty);
-        }
-
-        [Test]
-        public void IsEmptyWhenNotEmpty()
-        {
-            Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty);
-        }
-
-        [Test]
-        public void CopyFromByteArrayCopiesContents()
-        {
-            byte[] data = new byte[1];
-            data[0] = 10;
-            ByteString bs = ByteString.CopyFrom(data);
-            Assert.AreEqual(10, bs[0]);
-            data[0] = 5;
-            Assert.AreEqual(10, bs[0]);
-        }
-
-        [Test]
-        public void ToByteArrayCopiesContents()
-        {
-            ByteString bs = ByteString.CopyFromUtf8("Hello");
-            byte[] data = bs.ToByteArray();
-            Assert.AreEqual((byte)'H', data[0]);
-            Assert.AreEqual((byte)'H', bs[0]);
-            data[0] = 0;
-            Assert.AreEqual(0, data[0]);
-            Assert.AreEqual((byte)'H', bs[0]);
-        }
-
-        [Test]
-        public void CopyFromUtf8UsesUtf8()
-        {
-            ByteString bs = ByteString.CopyFromUtf8("\u20ac");
-            Assert.AreEqual(3, bs.Length);
-            Assert.AreEqual(0xe2, bs[0]);
-            Assert.AreEqual(0x82, bs[1]);
-            Assert.AreEqual(0xac, bs[2]);
-        }
-
-        [Test]
-        public void CopyFromPortion()
-        {
-            byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
-            ByteString bs = ByteString.CopyFrom(data, 2, 3);
-            Assert.AreEqual(3, bs.Length);
-            Assert.AreEqual(2, bs[0]);
-            Assert.AreEqual(3, bs[1]);
-        }
-
-        [Test]
-        public void ToStringUtf8()
-        {
-            ByteString bs = ByteString.CopyFromUtf8("\u20ac");
-            Assert.AreEqual("\u20ac", bs.ToStringUtf8());
-        }
-
-        [Test]
-        public void ToStringWithExplicitEncoding()
-        {
-            ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode);
-            Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode));
-        }
-
-        [Test]
-        public void FromBase64_WithText()
-        {
-            byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
-            string base64 = Convert.ToBase64String(data);
-            ByteString bs = ByteString.FromBase64(base64);
-            Assert.AreEqual(data, bs.ToByteArray());
-        }
-
-        [Test]
-        public void FromBase64_Empty()
-        {
-            // Optimization which also fixes issue 61.
-            Assert.AreSame(ByteString.Empty, ByteString.FromBase64(""));
-        }
-    }
-}

+ 0 - 53
csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs

@@ -1,53 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    internal static class CodedInputStreamExtensions
-    {
-        public static void AssertNextTag(this CodedInputStream input, uint expectedTag)
-        {
-            uint tag = input.ReadTag();
-            Assert.AreEqual(expectedTag, tag);
-        }
-
-        public static T ReadMessage<T>(this CodedInputStream stream, MessageParser<T> parser)
-            where T : IMessage<T>
-        {
-            var message = parser.CreateTemplate();
-            stream.ReadMessage(message);
-            return message;
-        }
-    }
-}

+ 0 - 598
csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs

@@ -1,598 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    public class CodedInputStreamTest
-    {
-        /// <summary>
-        /// Helper to construct a byte array from a bunch of bytes.  The inputs are
-        /// actually ints so that I can use hex notation and not get stupid errors
-        /// about precision.
-        /// </summary>
-        private static byte[] Bytes(params int[] bytesAsInts)
-        {
-            byte[] bytes = new byte[bytesAsInts.Length];
-            for (int i = 0; i < bytesAsInts.Length; i++)
-            {
-                bytes[i] = (byte) bytesAsInts[i];
-            }
-            return bytes;
-        }
-
-        /// <summary>
-        /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64()
-        /// </summary>
-        private static void AssertReadVarint(byte[] data, ulong value)
-        {
-            CodedInputStream input = new CodedInputStream(data);
-            Assert.AreEqual((uint) value, input.ReadRawVarint32());
-
-            input = new CodedInputStream(data);
-            Assert.AreEqual(value, input.ReadRawVarint64());
-            Assert.IsTrue(input.IsAtEnd);
-
-            // Try different block sizes.
-            for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
-            {
-                input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize));
-                Assert.AreEqual((uint) value, input.ReadRawVarint32());
-
-                input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize));
-                Assert.AreEqual(value, input.ReadRawVarint64());
-                Assert.IsTrue(input.IsAtEnd);
-            }
-
-            // Try reading directly from a MemoryStream. We want to verify that it
-            // doesn't read past the end of the input, so write an extra byte - this
-            // lets us test the position at the end.
-            MemoryStream memoryStream = new MemoryStream();
-            memoryStream.Write(data, 0, data.Length);
-            memoryStream.WriteByte(0);
-            memoryStream.Position = 0;
-            Assert.AreEqual((uint) value, CodedInputStream.ReadRawVarint32(memoryStream));
-            Assert.AreEqual(data.Length, memoryStream.Position);
-        }
-
-        /// <summary>
-        /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and
-        /// expects them to fail with an InvalidProtocolBufferException whose
-        /// description matches the given one.
-        /// </summary>
-        private static void AssertReadVarintFailure(InvalidProtocolBufferException expected, byte[] data)
-        {
-            CodedInputStream input = new CodedInputStream(data);
-            var exception = Assert.Throws<InvalidProtocolBufferException>(() => input.ReadRawVarint32());
-            Assert.AreEqual(expected.Message, exception.Message);
-
-            input = new CodedInputStream(data);
-            exception = Assert.Throws<InvalidProtocolBufferException>(() => input.ReadRawVarint64());
-            Assert.AreEqual(expected.Message, exception.Message);
-
-            // Make sure we get the same error when reading directly from a Stream.
-            exception = Assert.Throws<InvalidProtocolBufferException>(() => CodedInputStream.ReadRawVarint32(new MemoryStream(data)));
-            Assert.AreEqual(expected.Message, exception.Message);
-        }
-
-        [Test]
-        public void ReadVarint()
-        {
-            AssertReadVarint(Bytes(0x00), 0);
-            AssertReadVarint(Bytes(0x01), 1);
-            AssertReadVarint(Bytes(0x7f), 127);
-            // 14882
-            AssertReadVarint(Bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7));
-            // 2961488830
-            AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b),
-                             (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
-                             (0x0bL << 28));
-
-            // 64-bit
-            // 7256456126
-            AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b),
-                             (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
-                             (0x1bL << 28));
-            // 41256202580718336
-            AssertReadVarint(Bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49),
-                             (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) |
-                             (0x43L << 28) | (0x49L << 35) | (0x24L << 42) | (0x49L << 49));
-            // 11964378330978735131
-            AssertReadVarint(Bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01),
-                             (0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) |
-                             (0x3bUL << 28) | (0x56UL << 35) | (0x00UL << 42) |
-                             (0x05UL << 49) | (0x26UL << 56) | (0x01UL << 63));
-
-            // Failures
-            AssertReadVarintFailure(
-                InvalidProtocolBufferException.MalformedVarint(),
-                Bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
-                      0x00));
-            AssertReadVarintFailure(
-                InvalidProtocolBufferException.TruncatedMessage(),
-                Bytes(0x80));
-        }
-
-        /// <summary>
-        /// Parses the given bytes using ReadRawLittleEndian32() and checks
-        /// that the result matches the given value.
-        /// </summary>
-        private static void AssertReadLittleEndian32(byte[] data, uint value)
-        {
-            CodedInputStream input = new CodedInputStream(data);
-            Assert.AreEqual(value, input.ReadRawLittleEndian32());
-            Assert.IsTrue(input.IsAtEnd);
-
-            // Try different block sizes.
-            for (int blockSize = 1; blockSize <= 16; blockSize *= 2)
-            {
-                input = new CodedInputStream(
-                    new SmallBlockInputStream(data, blockSize));
-                Assert.AreEqual(value, input.ReadRawLittleEndian32());
-                Assert.IsTrue(input.IsAtEnd);
-            }
-        }
-
-        /// <summary>
-        /// Parses the given bytes using ReadRawLittleEndian64() and checks
-        /// that the result matches the given value.
-        /// </summary>
-        private static void AssertReadLittleEndian64(byte[] data, ulong value)
-        {
-            CodedInputStream input = new CodedInputStream(data);
-            Assert.AreEqual(value, input.ReadRawLittleEndian64());
-            Assert.IsTrue(input.IsAtEnd);
-
-            // Try different block sizes.
-            for (int blockSize = 1; blockSize <= 16; blockSize *= 2)
-            {
-                input = new CodedInputStream(
-                    new SmallBlockInputStream(data, blockSize));
-                Assert.AreEqual(value, input.ReadRawLittleEndian64());
-                Assert.IsTrue(input.IsAtEnd);
-            }
-        }
-
-        [Test]
-        public void ReadLittleEndian()
-        {
-            AssertReadLittleEndian32(Bytes(0x78, 0x56, 0x34, 0x12), 0x12345678);
-            AssertReadLittleEndian32(Bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0);
-
-            AssertReadLittleEndian64(Bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12),
-                                     0x123456789abcdef0L);
-            AssertReadLittleEndian64(
-                Bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678UL);
-        }
-
-        [Test]
-        public void DecodeZigZag32()
-        {
-            Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(0));
-            Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(1));
-            Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(2));
-            Assert.AreEqual(-2, CodedInputStream.DecodeZigZag32(3));
-            Assert.AreEqual(0x3FFFFFFF, CodedInputStream.DecodeZigZag32(0x7FFFFFFE));
-            Assert.AreEqual(unchecked((int) 0xC0000000), CodedInputStream.DecodeZigZag32(0x7FFFFFFF));
-            Assert.AreEqual(0x7FFFFFFF, CodedInputStream.DecodeZigZag32(0xFFFFFFFE));
-            Assert.AreEqual(unchecked((int) 0x80000000), CodedInputStream.DecodeZigZag32(0xFFFFFFFF));
-        }
-
-        [Test]
-        public void DecodeZigZag64()
-        {
-            Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0));
-            Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1));
-            Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2));
-            Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3));
-            Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL));
-            Assert.AreEqual(unchecked((long) 0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL));
-            Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL));
-            Assert.AreEqual(unchecked((long) 0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL));
-            Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL));
-            Assert.AreEqual(unchecked((long) 0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL));
-        }
-        
-        [Test]
-        public void ReadWholeMessage_VaryingBlockSizes()
-        {
-            TestAllTypes message = SampleMessages.CreateFullTestAllTypes();
-
-            byte[] rawBytes = message.ToByteArray();
-            Assert.AreEqual(rawBytes.Length, message.CalculateSize());
-            TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(rawBytes);
-            Assert.AreEqual(message, message2);
-
-            // Try different block sizes.
-            for (int blockSize = 1; blockSize < 256; blockSize *= 2)
-            {
-                message2 = TestAllTypes.Parser.ParseFrom(new SmallBlockInputStream(rawBytes, blockSize));
-                Assert.AreEqual(message, message2);
-            }
-        }
-                
-        [Test]
-        public void ReadHugeBlob()
-        {
-            // Allocate and initialize a 1MB blob.
-            byte[] blob = new byte[1 << 20];
-            for (int i = 0; i < blob.Length; i++)
-            {
-                blob[i] = (byte) i;
-            }
-
-            // Make a message containing it.
-            var message = new TestAllTypes { SingleBytes = ByteString.CopyFrom(blob) };
-
-            // Serialize and parse it.  Make sure to parse from an InputStream, not
-            // directly from a ByteString, so that CodedInputStream uses buffered
-            // reading.
-            TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(message.ToByteString());
-
-            Assert.AreEqual(message, message2);
-        }
-
-        [Test]
-        public void ReadMaliciouslyLargeBlob()
-        {
-            MemoryStream ms = new MemoryStream();
-            CodedOutputStream output = new CodedOutputStream(ms);
-
-            uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);
-            output.WriteRawVarint32(tag);
-            output.WriteRawVarint32(0x7FFFFFFF);
-            output.WriteRawBytes(new byte[32]); // Pad with a few random bytes.
-            output.Flush();
-            ms.Position = 0;
-
-            CodedInputStream input = new CodedInputStream(ms);
-            Assert.AreEqual(tag, input.ReadTag());
-
-            Assert.Throws<InvalidProtocolBufferException>(() => input.ReadBytes());
-        }
-
-        internal static TestRecursiveMessage MakeRecursiveMessage(int depth)
-        {
-            if (depth == 0)
-            {
-                return new TestRecursiveMessage { I = 5 };
-            }
-            else
-            {
-                return new TestRecursiveMessage { A = MakeRecursiveMessage(depth - 1) };
-            }
-        }
-
-        internal static void AssertMessageDepth(TestRecursiveMessage message, int depth)
-        {
-            if (depth == 0)
-            {
-                Assert.IsNull(message.A);
-                Assert.AreEqual(5, message.I);
-            }
-            else
-            {
-                Assert.IsNotNull(message.A);
-                AssertMessageDepth(message.A, depth - 1);
-            }
-        }
-
-        [Test]
-        public void MaliciousRecursion()
-        {
-            ByteString data64 = MakeRecursiveMessage(64).ToByteString();
-            ByteString data65 = MakeRecursiveMessage(65).ToByteString();
-
-            AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64);
-
-            Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(data65));
-
-            CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63);
-            Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(input));
-        }
-
-        [Test]
-        public void SizeLimit()
-        {
-            // Have to use a Stream rather than ByteString.CreateCodedInput as SizeLimit doesn't
-            // apply to the latter case.
-            MemoryStream ms = new MemoryStream(SampleMessages.CreateFullTestAllTypes().ToByteArray());
-            CodedInputStream input = CodedInputStream.CreateWithLimits(ms, 16, 100);
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(input));
-        }
-
-        /// <summary>
-        /// Tests that if we read an string that contains invalid UTF-8, no exception
-        /// is thrown.  Instead, the invalid bytes are replaced with the Unicode
-        /// "replacement character" U+FFFD.
-        /// </summary>
-        [Test]
-        public void ReadInvalidUtf8()
-        {
-            MemoryStream ms = new MemoryStream();
-            CodedOutputStream output = new CodedOutputStream(ms);
-
-            uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);
-            output.WriteRawVarint32(tag);
-            output.WriteRawVarint32(1);
-            output.WriteRawBytes(new byte[] {0x80});
-            output.Flush();
-            ms.Position = 0;
-
-            CodedInputStream input = new CodedInputStream(ms);
-
-            Assert.AreEqual(tag, input.ReadTag());
-            string text = input.ReadString();
-            Assert.AreEqual('\ufffd', text[0]);
-        }
-
-        /// <summary>
-        /// A stream which limits the number of bytes it reads at a time.
-        /// We use this to make sure that CodedInputStream doesn't screw up when
-        /// reading in small blocks.
-        /// </summary>
-        private sealed class SmallBlockInputStream : MemoryStream
-        {
-            private readonly int blockSize;
-
-            public SmallBlockInputStream(byte[] data, int blockSize)
-                : base(data)
-            {
-                this.blockSize = blockSize;
-            }
-
-            public override int Read(byte[] buffer, int offset, int count)
-            {
-                return base.Read(buffer, offset, Math.Min(count, blockSize));
-            }
-        }
-
-        [Test]
-        public void TestNegativeEnum()
-        {
-            byte[] bytes = { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 };
-            CodedInputStream input = new CodedInputStream(bytes);
-            Assert.AreEqual((int)SampleEnum.NegativeValue, input.ReadEnum());
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        //Issue 71:	CodedInputStream.ReadBytes go to slow path unnecessarily
-        [Test]
-        public void TestSlowPathAvoidance()
-        {
-            using (var ms = new MemoryStream())
-            {
-                CodedOutputStream output = new CodedOutputStream(ms);
-                output.WriteTag(1, WireFormat.WireType.LengthDelimited);
-                output.WriteBytes(ByteString.CopyFrom(new byte[100]));
-                output.WriteTag(2, WireFormat.WireType.LengthDelimited);
-                output.WriteBytes(ByteString.CopyFrom(new byte[100]));
-                output.Flush();
-
-                ms.Position = 0;
-                CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0);
-
-                uint tag = input.ReadTag();
-                Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag));
-                Assert.AreEqual(100, input.ReadBytes().Length);
-
-                tag = input.ReadTag();
-                Assert.AreEqual(2, WireFormat.GetTagFieldNumber(tag));
-                Assert.AreEqual(100, input.ReadBytes().Length);
-            }
-        }
-
-        [Test]
-        public void Tag0Throws()
-        {
-            var input = new CodedInputStream(new byte[] { 0 });
-            Assert.Throws<InvalidProtocolBufferException>(() => input.ReadTag());
-        }
-
-        [Test]
-        public void SkipGroup()
-        {
-            // Create an output stream with a group in:
-            // Field 1: string "field 1"
-            // Field 2: group containing:
-            //   Field 1: fixed int32 value 100
-            //   Field 2: string "ignore me"
-            //   Field 3: nested group containing
-            //      Field 1: fixed int64 value 1000
-            // Field 3: string "field 3"
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(1, WireFormat.WireType.LengthDelimited);
-            output.WriteString("field 1");
-            
-            // The outer group...
-            output.WriteTag(2, WireFormat.WireType.StartGroup);
-            output.WriteTag(1, WireFormat.WireType.Fixed32);
-            output.WriteFixed32(100);
-            output.WriteTag(2, WireFormat.WireType.LengthDelimited);
-            output.WriteString("ignore me");
-            // The nested group...
-            output.WriteTag(3, WireFormat.WireType.StartGroup);
-            output.WriteTag(1, WireFormat.WireType.Fixed64);
-            output.WriteFixed64(1000);
-            // Note: Not sure the field number is relevant for end group...
-            output.WriteTag(3, WireFormat.WireType.EndGroup);
-
-            // End the outer group
-            output.WriteTag(2, WireFormat.WireType.EndGroup);
-
-            output.WriteTag(3, WireFormat.WireType.LengthDelimited);
-            output.WriteString("field 3");
-            output.Flush();
-            stream.Position = 0;
-
-            // Now act like a generated client
-            var input = new CodedInputStream(stream);
-            Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag());
-            Assert.AreEqual("field 1", input.ReadString());
-            Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag());
-            input.SkipLastField(); // Should consume the whole group, including the nested one.
-            Assert.AreEqual(WireFormat.MakeTag(3, WireFormat.WireType.LengthDelimited), input.ReadTag());
-            Assert.AreEqual("field 3", input.ReadString());
-        }
-
-        [Test]
-        public void SkipGroup_WrongEndGroupTag()
-        {
-            // Create an output stream with:
-            // Field 1: string "field 1"
-            // Start group 2
-            //   Field 3: fixed int32
-            // End group 4 (should give an error)
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(1, WireFormat.WireType.LengthDelimited);
-            output.WriteString("field 1");
-
-            // The outer group...
-            output.WriteTag(2, WireFormat.WireType.StartGroup);
-            output.WriteTag(3, WireFormat.WireType.Fixed32);
-            output.WriteFixed32(100);
-            output.WriteTag(4, WireFormat.WireType.EndGroup);
-            output.Flush();
-            stream.Position = 0;
-
-            // Now act like a generated client
-            var input = new CodedInputStream(stream);
-            Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag());
-            Assert.AreEqual("field 1", input.ReadString());
-            Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag());
-            Assert.Throws<InvalidProtocolBufferException>(input.SkipLastField);
-        }
-
-        [Test]
-        public void RogueEndGroupTag()
-        {
-            // If we have an end-group tag without a leading start-group tag, generated
-            // code will just call SkipLastField... so that should fail.
-
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(1, WireFormat.WireType.EndGroup);
-            output.Flush();
-            stream.Position = 0;
-
-            var input = new CodedInputStream(stream);
-            Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.EndGroup), input.ReadTag());
-            Assert.Throws<InvalidProtocolBufferException>(input.SkipLastField);
-        }
-
-        [Test]
-        public void EndOfStreamReachedWhileSkippingGroup()
-        {
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(1, WireFormat.WireType.StartGroup);
-            output.WriteTag(2, WireFormat.WireType.StartGroup);
-            output.WriteTag(2, WireFormat.WireType.EndGroup);
-
-            output.Flush();
-            stream.Position = 0;
-
-            // Now act like a generated client
-            var input = new CodedInputStream(stream);
-            input.ReadTag();
-            Assert.Throws<InvalidProtocolBufferException>(input.SkipLastField);
-        }
-
-        [Test]
-        public void RecursionLimitAppliedWhileSkippingGroup()
-        {
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++)
-            {
-                output.WriteTag(1, WireFormat.WireType.StartGroup);
-            }
-            for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++)
-            {
-                output.WriteTag(1, WireFormat.WireType.EndGroup);
-            }
-            output.Flush();
-            stream.Position = 0;
-
-            // Now act like a generated client
-            var input = new CodedInputStream(stream);
-            Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.StartGroup), input.ReadTag());
-            Assert.Throws<InvalidProtocolBufferException>(input.SkipLastField);
-        }
-
-        [Test]
-        public void Construction_Invalid()
-        {
-            Assert.Throws<ArgumentNullException>(() => new CodedInputStream((byte[]) null));
-            Assert.Throws<ArgumentNullException>(() => new CodedInputStream(null, 0, 0));
-            Assert.Throws<ArgumentNullException>(() => new CodedInputStream((Stream) null));
-            Assert.Throws<ArgumentOutOfRangeException>(() => new CodedInputStream(new byte[10], 100, 0));
-            Assert.Throws<ArgumentOutOfRangeException>(() => new CodedInputStream(new byte[10], 5, 10));
-        }
-
-        [Test]
-        public void CreateWithLimits_InvalidLimits()
-        {
-            var stream = new MemoryStream();
-            Assert.Throws<ArgumentOutOfRangeException>(() => CodedInputStream.CreateWithLimits(stream, 0, 1));
-            Assert.Throws<ArgumentOutOfRangeException>(() => CodedInputStream.CreateWithLimits(stream, 1, 0));
-        }
-
-        [Test]
-        public void Dispose_DisposesUnderlyingStream()
-        {
-            var memoryStream = new MemoryStream();
-            Assert.IsTrue(memoryStream.CanRead);
-            using (var cis = new CodedInputStream(memoryStream))
-            {
-            }
-            Assert.IsFalse(memoryStream.CanRead); // Disposed
-        }
-
-        [Test]
-        public void Dispose_WithLeaveOpen()
-        {
-            var memoryStream = new MemoryStream();
-            Assert.IsTrue(memoryStream.CanRead);
-            using (var cis = new CodedInputStream(memoryStream, true))
-            {
-            }
-            Assert.IsTrue(memoryStream.CanRead); // We left the stream open
-        }
-    }
-}

+ 0 - 419
csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs

@@ -1,419 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    public class CodedOutputStreamTest
-    {
-        /// <summary>
-        /// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and
-        /// checks that the result matches the given bytes
-        /// </summary>
-        private static void AssertWriteVarint(byte[] data, ulong value)
-        {
-            // Only do 32-bit write if the value fits in 32 bits.
-            if ((value >> 32) == 0)
-            {
-                MemoryStream rawOutput = new MemoryStream();
-                CodedOutputStream output = new CodedOutputStream(rawOutput);
-                output.WriteRawVarint32((uint) value);
-                output.Flush();
-                Assert.AreEqual(data, rawOutput.ToArray());
-                // Also try computing size.
-                Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value));
-            }
-
-            {
-                MemoryStream rawOutput = new MemoryStream();
-                CodedOutputStream output = new CodedOutputStream(rawOutput);
-                output.WriteRawVarint64(value);
-                output.Flush();
-                Assert.AreEqual(data, rawOutput.ToArray());
-
-                // Also try computing size.
-                Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value));
-            }
-
-            // Try different buffer sizes.
-            for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
-            {
-                // Only do 32-bit write if the value fits in 32 bits.
-                if ((value >> 32) == 0)
-                {
-                    MemoryStream rawOutput = new MemoryStream();
-                    CodedOutputStream output =
-                        new CodedOutputStream(rawOutput, bufferSize);
-                    output.WriteRawVarint32((uint) value);
-                    output.Flush();
-                    Assert.AreEqual(data, rawOutput.ToArray());
-                }
-
-                {
-                    MemoryStream rawOutput = new MemoryStream();
-                    CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize);
-                    output.WriteRawVarint64(value);
-                    output.Flush();
-                    Assert.AreEqual(data, rawOutput.ToArray());
-                }
-            }
-        }
-
-        /// <summary>
-        /// Tests WriteRawVarint32() and WriteRawVarint64()
-        /// </summary>
-        [Test]
-        public void WriteVarint()
-        {
-            AssertWriteVarint(new byte[] {0x00}, 0);
-            AssertWriteVarint(new byte[] {0x01}, 1);
-            AssertWriteVarint(new byte[] {0x7f}, 127);
-            // 14882
-            AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7));
-            // 2961488830
-            AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b},
-                              (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
-                              (0x0bL << 28));
-
-            // 64-bit
-            // 7256456126
-            AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b},
-                              (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
-                              (0x1bL << 28));
-            // 41256202580718336
-            AssertWriteVarint(
-                new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49},
-                (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) |
-                (0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49));
-            // 11964378330978735131
-            AssertWriteVarint(
-                new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01},
-                unchecked((ulong)
-                          ((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) |
-                           (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) |
-                           (0x05L << 49) | (0x26L << 56) | (0x01L << 63))));
-        }
-
-        /// <summary>
-        /// Parses the given bytes using WriteRawLittleEndian32() and checks
-        /// that the result matches the given value.
-        /// </summary>
-        private static void AssertWriteLittleEndian32(byte[] data, uint value)
-        {
-            MemoryStream rawOutput = new MemoryStream();
-            CodedOutputStream output = new CodedOutputStream(rawOutput);
-            output.WriteRawLittleEndian32(value);
-            output.Flush();
-            Assert.AreEqual(data, rawOutput.ToArray());
-
-            // Try different buffer sizes.
-            for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2)
-            {
-                rawOutput = new MemoryStream();
-                output = new CodedOutputStream(rawOutput, bufferSize);
-                output.WriteRawLittleEndian32(value);
-                output.Flush();
-                Assert.AreEqual(data, rawOutput.ToArray());
-            }
-        }
-
-        /// <summary>
-        /// Parses the given bytes using WriteRawLittleEndian64() and checks
-        /// that the result matches the given value.
-        /// </summary>
-        private static void AssertWriteLittleEndian64(byte[] data, ulong value)
-        {
-            MemoryStream rawOutput = new MemoryStream();
-            CodedOutputStream output = new CodedOutputStream(rawOutput);
-            output.WriteRawLittleEndian64(value);
-            output.Flush();
-            Assert.AreEqual(data, rawOutput.ToArray());
-
-            // Try different block sizes.
-            for (int blockSize = 1; blockSize <= 16; blockSize *= 2)
-            {
-                rawOutput = new MemoryStream();
-                output = new CodedOutputStream(rawOutput, blockSize);
-                output.WriteRawLittleEndian64(value);
-                output.Flush();
-                Assert.AreEqual(data, rawOutput.ToArray());
-            }
-        }
-
-        /// <summary>
-        /// Tests writeRawLittleEndian32() and writeRawLittleEndian64().
-        /// </summary>
-        [Test]
-        public void WriteLittleEndian()
-        {
-            AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678);
-            AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0);
-
-            AssertWriteLittleEndian64(
-                new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12},
-                0x123456789abcdef0L);
-            AssertWriteLittleEndian64(
-                new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a},
-                0x9abcdef012345678UL);
-        }
-
-        [Test]
-        public void WriteWholeMessage_VaryingBlockSizes()
-        {
-            TestAllTypes message = SampleMessages.CreateFullTestAllTypes();
-
-            byte[] rawBytes = message.ToByteArray();
-
-            // Try different block sizes.
-            for (int blockSize = 1; blockSize < 256; blockSize *= 2)
-            {
-                MemoryStream rawOutput = new MemoryStream();
-                CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize);
-                message.WriteTo(output);
-                output.Flush();
-                Assert.AreEqual(rawBytes, rawOutput.ToArray());
-            }
-        }
-        
-        [Test]
-        public void EncodeZigZag32()
-        {
-            Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag32(0));
-            Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag32(-1));
-            Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag32(1));
-            Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag32(-2));
-            Assert.AreEqual(0x7FFFFFFEu, CodedOutputStream.EncodeZigZag32(0x3FFFFFFF));
-            Assert.AreEqual(0x7FFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0xC0000000)));
-            Assert.AreEqual(0xFFFFFFFEu, CodedOutputStream.EncodeZigZag32(0x7FFFFFFF));
-            Assert.AreEqual(0xFFFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0x80000000)));
-        }
-
-        [Test]
-        public void EncodeZigZag64()
-        {
-            Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag64(0));
-            Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag64(-1));
-            Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag64(1));
-            Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag64(-2));
-            Assert.AreEqual(0x000000007FFFFFFEuL,
-                            CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL)));
-            Assert.AreEqual(0x000000007FFFFFFFuL,
-                            CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL)));
-            Assert.AreEqual(0x00000000FFFFFFFEuL,
-                            CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL)));
-            Assert.AreEqual(0x00000000FFFFFFFFuL,
-                            CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL)));
-            Assert.AreEqual(0xFFFFFFFFFFFFFFFEL,
-                            CodedOutputStream.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL)));
-            Assert.AreEqual(0xFFFFFFFFFFFFFFFFL,
-                            CodedOutputStream.EncodeZigZag64(unchecked((long) 0x8000000000000000UL)));
-        }
-
-        [Test]
-        public void RoundTripZigZag32()
-        {
-            // Some easier-to-verify round-trip tests.  The inputs (other than 0, 1, -1)
-            // were chosen semi-randomly via keyboard bashing.
-            Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(0)));
-            Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(1)));
-            Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-1)));
-            Assert.AreEqual(14927, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(14927)));
-            Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-3612)));
-        }
-
-        [Test]
-        public void RoundTripZigZag64()
-        {
-            Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0)));
-            Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1)));
-            Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1)));
-            Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927)));
-            Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612)));
-
-            Assert.AreEqual(856912304801416L,
-                            CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L)));
-            Assert.AreEqual(-75123905439571256L,
-                            CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L)));
-        }
-
-        [Test]
-        public void TestNegativeEnumNoTag()
-        {
-            Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2));
-            Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue));
-
-            byte[] bytes = new byte[10];
-            CodedOutputStream output = new CodedOutputStream(bytes);
-            output.WriteEnum((int) SampleEnum.NegativeValue);
-
-            Assert.AreEqual(0, output.SpaceLeft);
-            Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes));
-        }
-
-        [Test]
-        public void TestCodedInputOutputPosition()
-        {
-            byte[] content = new byte[110];
-            for (int i = 0; i < content.Length; i++)
-                content[i] = (byte)i;
-
-            byte[] child = new byte[120];
-            {
-                MemoryStream ms = new MemoryStream(child);
-                CodedOutputStream cout = new CodedOutputStream(ms, 20);
-                // Field 11: numeric value: 500
-                cout.WriteTag(11, WireFormat.WireType.Varint);
-                Assert.AreEqual(1, cout.Position);
-                cout.WriteInt32(500);
-                Assert.AreEqual(3, cout.Position);
-                //Field 12: length delimited 120 bytes
-                cout.WriteTag(12, WireFormat.WireType.LengthDelimited);
-                Assert.AreEqual(4, cout.Position);
-                cout.WriteBytes(ByteString.CopyFrom(content));
-                Assert.AreEqual(115, cout.Position);
-                // Field 13: fixed numeric value: 501
-                cout.WriteTag(13, WireFormat.WireType.Fixed32);
-                Assert.AreEqual(116, cout.Position);
-                cout.WriteSFixed32(501);
-                Assert.AreEqual(120, cout.Position);
-                cout.Flush();
-            }
-
-            byte[] bytes = new byte[130];
-            {
-                CodedOutputStream cout = new CodedOutputStream(bytes);
-                // Field 1: numeric value: 500
-                cout.WriteTag(1, WireFormat.WireType.Varint);
-                Assert.AreEqual(1, cout.Position);
-                cout.WriteInt32(500);
-                Assert.AreEqual(3, cout.Position);
-                //Field 2: length delimited 120 bytes
-                cout.WriteTag(2, WireFormat.WireType.LengthDelimited);
-                Assert.AreEqual(4, cout.Position);
-                cout.WriteBytes(ByteString.CopyFrom(child));
-                Assert.AreEqual(125, cout.Position);
-                // Field 3: fixed numeric value: 500
-                cout.WriteTag(3, WireFormat.WireType.Fixed32);
-                Assert.AreEqual(126, cout.Position);
-                cout.WriteSFixed32(501);
-                Assert.AreEqual(130, cout.Position);
-                cout.Flush();
-            }
-            // Now test Input stream:
-            {
-                CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0);
-                Assert.AreEqual(0, cin.Position);
-                // Field 1:
-                uint tag = cin.ReadTag();
-                Assert.AreEqual(1, tag >> 3);
-                Assert.AreEqual(1, cin.Position);
-                Assert.AreEqual(500, cin.ReadInt32());
-                Assert.AreEqual(3, cin.Position);
-                //Field 2:
-                tag = cin.ReadTag();
-                Assert.AreEqual(2, tag >> 3);
-                Assert.AreEqual(4, cin.Position);
-                int childlen = cin.ReadLength();
-                Assert.AreEqual(120, childlen);
-                Assert.AreEqual(5, cin.Position);
-                int oldlimit = cin.PushLimit((int)childlen);
-                Assert.AreEqual(5, cin.Position);
-                // Now we are reading child message
-                {
-                    // Field 11: numeric value: 500
-                    tag = cin.ReadTag();
-                    Assert.AreEqual(11, tag >> 3);
-                    Assert.AreEqual(6, cin.Position);
-                    Assert.AreEqual(500, cin.ReadInt32());
-                    Assert.AreEqual(8, cin.Position);
-                    //Field 12: length delimited 120 bytes
-                    tag = cin.ReadTag();
-                    Assert.AreEqual(12, tag >> 3);
-                    Assert.AreEqual(9, cin.Position);
-                    ByteString bstr = cin.ReadBytes();
-                    Assert.AreEqual(110, bstr.Length);
-                    Assert.AreEqual((byte) 109, bstr[109]);
-                    Assert.AreEqual(120, cin.Position);
-                    // Field 13: fixed numeric value: 501
-                    tag = cin.ReadTag();
-                    Assert.AreEqual(13, tag >> 3);
-                    // ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit
-                    Assert.AreEqual(121, cin.Position);
-                    Assert.AreEqual(501, cin.ReadSFixed32());
-                    Assert.AreEqual(125, cin.Position);
-                    Assert.IsTrue(cin.IsAtEnd);
-                }
-                cin.PopLimit(oldlimit);
-                Assert.AreEqual(125, cin.Position);
-                // Field 3: fixed numeric value: 501
-                tag = cin.ReadTag();
-                Assert.AreEqual(3, tag >> 3);
-                Assert.AreEqual(126, cin.Position);
-                Assert.AreEqual(501, cin.ReadSFixed32());
-                Assert.AreEqual(130, cin.Position);
-                Assert.IsTrue(cin.IsAtEnd);
-            }
-        }
-
-        [Test]
-        public void Dispose_DisposesUnderlyingStream()
-        {
-            var memoryStream = new MemoryStream();
-            Assert.IsTrue(memoryStream.CanWrite);
-            using (var cos = new CodedOutputStream(memoryStream))
-            {
-                cos.WriteRawByte(0);
-                Assert.AreEqual(0, memoryStream.Position); // Not flushed yet
-            }
-            Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream
-            Assert.IsFalse(memoryStream.CanWrite); // Disposed
-        }
-
-        [Test]
-        public void Dispose_WithLeaveOpen()
-        {
-            var memoryStream = new MemoryStream();
-            Assert.IsTrue(memoryStream.CanWrite);
-            using (var cos = new CodedOutputStream(memoryStream, true))
-            {
-                cos.WriteRawByte(0);
-                Assert.AreEqual(0, memoryStream.Position); // Not flushed yet
-            }
-            Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream
-            Assert.IsTrue(memoryStream.CanWrite); // We left the stream open
-        }
-    }
-}

+ 0 - 532
csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs

@@ -1,532 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.TestProtos;
-using NUnit.Framework;
-using System.Collections;
-using System.Linq;
-
-namespace Google.Protobuf.Collections
-{
-    /// <summary>
-    /// Tests for MapField which aren't reliant on the encoded format -
-    /// tests for serialization/deserialization are part of GeneratedMessageTest.
-    /// </summary>
-    public class MapFieldTest
-    {
-        [Test]
-        public void Clone_ClonesMessages()
-        {
-            var message = new ForeignMessage { C = 20 };
-            var map = new MapField<string, ForeignMessage> { { "x", message } };
-            var clone = map.Clone();
-            map["x"].C = 30;
-            Assert.AreEqual(20, clone["x"].C);
-        }
-
-        [Test]
-        public void NullValuesProhibited()
-        {
-            TestNullValues<int?>(0);
-            TestNullValues("");
-            TestNullValues(new TestAllTypes());
-        }
-
-        private void TestNullValues<T>(T nonNullValue)
-        {
-            var map = new MapField<int, T>();
-            var nullValue = (T) (object) null;
-            Assert.Throws<ArgumentNullException>(() => map.Add(0, nullValue));
-            Assert.Throws<ArgumentNullException>(() => map[0] = nullValue);
-            map.Add(1, nonNullValue);
-            map[1] = nonNullValue;
-        }
-
-        [Test]
-        public void Add_ForbidsNullKeys()
-        {
-            var map = new MapField<string, ForeignMessage>();
-            Assert.Throws<ArgumentNullException>(() => map.Add(null, new ForeignMessage()));
-        }
-
-        [Test]
-        public void Indexer_ForbidsNullKeys()
-        {
-            var map = new MapField<string, ForeignMessage>();
-            Assert.Throws<ArgumentNullException>(() => map[null] = new ForeignMessage());
-        }
-        
-        [Test]
-        public void AddPreservesInsertionOrder()
-        {
-            var map = new MapField<string, string>();
-            map.Add("a", "v1");
-            map.Add("b", "v2");
-            map.Add("c", "v3");
-            map.Remove("b");
-            map.Add("d", "v4");
-            CollectionAssert.AreEqual(new[] { "a", "c", "d" }, map.Keys);
-            CollectionAssert.AreEqual(new[] { "v1", "v3", "v4" }, map.Values);
-        }
-
-        [Test]
-        public void EqualityIsOrderInsensitive()
-        {
-            var map1 = new MapField<string, string>();
-            map1.Add("a", "v1");
-            map1.Add("b", "v2");
-
-            var map2 = new MapField<string, string>();
-            map2.Add("b", "v2");
-            map2.Add("a", "v1");
-
-            EqualityTester.AssertEquality(map1, map2);
-        }
-
-        [Test]
-        public void EqualityIsKeySensitive()
-        {
-            var map1 = new MapField<string, string>();
-            map1.Add("first key", "v1");
-            map1.Add("second key", "v2");
-
-            var map2 = new MapField<string, string>();
-            map2.Add("third key", "v1");
-            map2.Add("fourth key", "v2");
-
-            EqualityTester.AssertInequality(map1, map2);
-        }
-
-        [Test]
-        public void Equality_Simple()
-        {
-            var map = new MapField<string, string>();
-            EqualityTester.AssertEquality(map, map);
-            EqualityTester.AssertInequality(map, null);
-            Assert.IsFalse(map.Equals(new object()));
-        }
-
-        [Test]
-        public void EqualityIsValueSensitive()
-        {
-            // Note: Without some care, it's a little easier than one might
-            // hope to see hash collisions, but only in some environments...
-            var map1 = new MapField<string, string>();
-            map1.Add("a", "first value");
-            map1.Add("b", "second value");
-
-            var map2 = new MapField<string, string>();
-            map2.Add("a", "third value");
-            map2.Add("b", "fourth value");
-
-            EqualityTester.AssertInequality(map1, map2);
-        }
-
-        [Test]
-        public void Add_Dictionary()
-        {
-            var map1 = new MapField<string, string>
-            {
-                { "x", "y" },
-                { "a", "b" }
-            };
-            var map2 = new MapField<string, string>
-            {
-                { "before", "" },
-                map1,
-                { "after", "" }
-            };
-            var expected = new MapField<string, string>
-            {
-                { "before", "" },
-                { "x", "y" },
-                { "a", "b" },
-                { "after", "" }
-            };
-            Assert.AreEqual(expected, map2);
-            CollectionAssert.AreEqual(new[] { "before", "x", "a", "after" }, map2.Keys);
-        }
-
-        // General IDictionary<TKey, TValue> behavior tests
-        [Test]
-        public void Add_KeyAlreadyExists()
-        {
-            var map = new MapField<string, string>();
-            map.Add("foo", "bar");
-            Assert.Throws<ArgumentException>(() => map.Add("foo", "baz"));
-        }
-
-        [Test]
-        public void Add_Pair()
-        {
-            var map = new MapField<string, string>();
-            ICollection<KeyValuePair<string, string>> collection = map;
-            collection.Add(NewKeyValuePair("x", "y"));
-            Assert.AreEqual("y", map["x"]);
-            Assert.Throws<ArgumentException>(() => collection.Add(NewKeyValuePair("x", "z")));
-        }
-
-        [Test]
-        public void Contains_Pair()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            ICollection<KeyValuePair<string, string>> collection = map;
-            Assert.IsTrue(collection.Contains(NewKeyValuePair("x", "y")));
-            Assert.IsFalse(collection.Contains(NewKeyValuePair("x", "z")));
-            Assert.IsFalse(collection.Contains(NewKeyValuePair("z", "y")));
-        }
-
-        [Test]
-        public void Remove_Key()
-        {
-            var map = new MapField<string, string>();
-            map.Add("foo", "bar");
-            Assert.AreEqual(1, map.Count);
-            Assert.IsFalse(map.Remove("missing"));
-            Assert.AreEqual(1, map.Count);
-            Assert.IsTrue(map.Remove("foo"));
-            Assert.AreEqual(0, map.Count);
-            Assert.Throws<ArgumentNullException>(() => map.Remove(null));
-        }
-
-        [Test]
-        public void Remove_Pair()
-        {
-            var map = new MapField<string, string>();
-            map.Add("foo", "bar");
-            ICollection<KeyValuePair<string, string>> collection = map;
-            Assert.AreEqual(1, map.Count);
-            Assert.IsFalse(collection.Remove(NewKeyValuePair("wrong key", "bar")));
-            Assert.AreEqual(1, map.Count);
-            Assert.IsFalse(collection.Remove(NewKeyValuePair("foo", "wrong value")));
-            Assert.AreEqual(1, map.Count);
-            Assert.IsTrue(collection.Remove(NewKeyValuePair("foo", "bar")));
-            Assert.AreEqual(0, map.Count);
-            Assert.Throws<ArgumentException>(() => collection.Remove(new KeyValuePair<string, string>(null, "")));
-        }
-
-        [Test]
-        public void CopyTo_Pair()
-        {
-            var map = new MapField<string, string>();
-            map.Add("foo", "bar");
-            ICollection<KeyValuePair<string, string>> collection = map;
-            KeyValuePair<string, string>[] array = new KeyValuePair<string, string>[3];
-            collection.CopyTo(array, 1);
-            Assert.AreEqual(NewKeyValuePair("foo", "bar"), array[1]);
-        }
-
-        [Test]
-        public void Clear()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            Assert.AreEqual(1, map.Count);
-            map.Clear();
-            Assert.AreEqual(0, map.Count);
-            map.Add("x", "y");
-            Assert.AreEqual(1, map.Count);
-        }
-
-        [Test]
-        public void Indexer_Get()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            Assert.AreEqual("y", map["x"]);
-            Assert.Throws<KeyNotFoundException>(() => { var ignored = map["z"]; });
-        }
-
-        [Test]
-        public void Indexer_Set()
-        {
-            var map = new MapField<string, string>();
-            map["x"] = "y";
-            Assert.AreEqual("y", map["x"]);
-            map["x"] = "z"; // This won't throw, unlike Add.
-            Assert.AreEqual("z", map["x"]);
-        }
-
-        [Test]
-        public void GetEnumerator_NonGeneric()
-        {
-            IEnumerable map = new MapField<string, string> { { "x", "y" } };
-            CollectionAssert.AreEqual(new[] { new KeyValuePair<string, string>("x", "y") },
-                map.Cast<object>().ToList());
-        }
-
-        // Test for the explicitly-implemented non-generic IDictionary interface
-        [Test]
-        public void IDictionary_GetEnumerator()
-        {
-            IDictionary map = new MapField<string, string> { { "x", "y" } };
-            var enumerator = map.GetEnumerator();
-
-            // Commented assertions show an ideal situation - it looks like
-            // the LinkedList enumerator doesn't throw when you ask for the current entry
-            // at an inappropriate time; fixing this would be more work than it's worth.
-            // Assert.Throws<InvalidOperationException>(() => enumerator.Current.GetHashCode());
-            Assert.IsTrue(enumerator.MoveNext());
-            Assert.AreEqual("x", enumerator.Key);
-            Assert.AreEqual("y", enumerator.Value);
-            Assert.AreEqual(new DictionaryEntry("x", "y"), enumerator.Current);
-            Assert.AreEqual(new DictionaryEntry("x", "y"), enumerator.Entry);
-            Assert.IsFalse(enumerator.MoveNext());
-            // Assert.Throws<InvalidOperationException>(() => enumerator.Current.GetHashCode());
-            enumerator.Reset();
-            // Assert.Throws<InvalidOperationException>(() => enumerator.Current.GetHashCode());
-            Assert.IsTrue(enumerator.MoveNext());
-            Assert.AreEqual("x", enumerator.Key); // Assume the rest are okay
-        }
-
-        [Test]
-        public void IDictionary_Add()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            IDictionary dictionary = map;
-            dictionary.Add("a", "b");
-            Assert.AreEqual("b", map["a"]);
-            Assert.Throws<ArgumentException>(() => dictionary.Add("a", "duplicate"));
-            Assert.Throws<InvalidCastException>(() => dictionary.Add(new object(), "key is bad"));
-            Assert.Throws<InvalidCastException>(() => dictionary.Add("value is bad", new object()));
-        }
-
-        [Test]
-        public void IDictionary_Contains()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            IDictionary dictionary = map;
-
-            Assert.IsFalse(dictionary.Contains("a"));
-            Assert.IsFalse(dictionary.Contains(5));
-            // Surprising, but IDictionary.Contains is only about keys.
-            Assert.IsFalse(dictionary.Contains(new DictionaryEntry("x", "y")));
-            Assert.IsTrue(dictionary.Contains("x"));
-        }
-
-        [Test]
-        public void IDictionary_Remove()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            IDictionary dictionary = map;
-            dictionary.Remove("a");
-            Assert.AreEqual(1, dictionary.Count);
-            dictionary.Remove(5);
-            Assert.AreEqual(1, dictionary.Count);
-            dictionary.Remove(new DictionaryEntry("x", "y"));
-            Assert.AreEqual(1, dictionary.Count);
-            dictionary.Remove("x");
-            Assert.AreEqual(0, dictionary.Count);
-            Assert.Throws<ArgumentNullException>(() => dictionary.Remove(null));
-        }
-
-        [Test]
-        public void IDictionary_CopyTo()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            IDictionary dictionary = map;
-            var array = new DictionaryEntry[3];
-            dictionary.CopyTo(array, 1);
-            CollectionAssert.AreEqual(new[] { default(DictionaryEntry), new DictionaryEntry("x", "y"), default(DictionaryEntry) },
-                array);
-            var objectArray = new object[3];
-            dictionary.CopyTo(objectArray, 1);
-            CollectionAssert.AreEqual(new object[] { null, new DictionaryEntry("x", "y"), null },
-                objectArray);
-        }
-
-        [Test]
-        public void IDictionary_IsFixedSize()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            IDictionary dictionary = map;
-            Assert.IsFalse(dictionary.IsFixedSize);
-        }
-
-        [Test]
-        public void IDictionary_Keys()
-        {
-            IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
-            CollectionAssert.AreEqual(new[] { "x" }, dictionary.Keys);
-        }
-
-        [Test]
-        public void IDictionary_Values()
-        {
-            IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
-            CollectionAssert.AreEqual(new[] { "y" }, dictionary.Values);
-        }
-
-        [Test]
-        public void IDictionary_IsSynchronized()
-        {
-            IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
-            Assert.IsFalse(dictionary.IsSynchronized);
-        }
-
-        [Test]
-        public void IDictionary_SyncRoot()
-        {
-            IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
-            Assert.AreSame(dictionary, dictionary.SyncRoot);
-        }
-
-        [Test]
-        public void IDictionary_Indexer_Get()
-        {
-            IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
-            Assert.AreEqual("y", dictionary["x"]);
-            Assert.IsNull(dictionary["a"]);
-            Assert.IsNull(dictionary[5]);
-            Assert.Throws<ArgumentNullException>(() => dictionary[null].GetHashCode());
-        }
-
-        [Test]
-        public void IDictionary_Indexer_Set()
-        {
-            var map = new MapField<string, string> { { "x", "y" } };
-            IDictionary dictionary = map;
-            map["a"] = "b";
-            Assert.AreEqual("b", map["a"]);
-            map["a"] = "c";
-            Assert.AreEqual("c", map["a"]);
-            Assert.Throws<InvalidCastException>(() => dictionary[5] = "x");
-            Assert.Throws<InvalidCastException>(() => dictionary["x"] = 5);
-            Assert.Throws<ArgumentNullException>(() => dictionary[null] = "z");
-            Assert.Throws<ArgumentNullException>(() => dictionary["x"] = null);
-        }
-
-        [Test]
-        public void KeysReturnsLiveView()
-        {
-            var map = new MapField<string, string>();
-            var keys = map.Keys;
-            CollectionAssert.AreEqual(new string[0], keys);
-            map["foo"] = "bar";
-            map["x"] = "y";
-            CollectionAssert.AreEqual(new[] { "foo", "x" }, keys);
-        }
-
-        [Test]
-        public void ValuesReturnsLiveView()
-        {
-            var map = new MapField<string, string>();
-            var values = map.Values;
-            CollectionAssert.AreEqual(new string[0], values);
-            map["foo"] = "bar";
-            map["x"] = "y";
-            CollectionAssert.AreEqual(new[] { "bar", "y" }, values);
-        }
-
-        // Just test keys - we know the implementation is the same for values
-        [Test]
-        public void ViewsAreReadOnly()
-        {
-            var map = new MapField<string, string>();
-            var keys = map.Keys;
-            Assert.IsTrue(keys.IsReadOnly);
-            Assert.Throws<NotSupportedException>(() => keys.Clear());
-            Assert.Throws<NotSupportedException>(() => keys.Remove("a"));
-            Assert.Throws<NotSupportedException>(() => keys.Add("a"));
-        }
-
-        // Just test keys - we know the implementation is the same for values
-        [Test]
-        public void ViewCopyTo()
-        {
-            var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } };
-            var keys = map.Keys;
-            var array = new string[4];
-            Assert.Throws<ArgumentException>(() => keys.CopyTo(array, 3));
-            Assert.Throws<ArgumentOutOfRangeException>(() => keys.CopyTo(array, -1));
-            keys.CopyTo(array, 1);
-            CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array);
-        }
-        
-        // Just test keys - we know the implementation is the same for values
-        [Test]
-        public void NonGenericViewCopyTo()
-        {
-            IDictionary map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } };
-            ICollection keys = map.Keys;
-            // Note the use of the Array type here rather than string[]
-            Array array = new string[4];
-            Assert.Throws<ArgumentException>(() => keys.CopyTo(array, 3));
-            Assert.Throws<ArgumentOutOfRangeException>(() => keys.CopyTo(array, -1));
-            keys.CopyTo(array, 1);
-            CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array);
-        }
-
-        [Test]
-        public void KeysContains()
-        {
-            var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } };
-            var keys = map.Keys;
-            Assert.IsTrue(keys.Contains("foo"));
-            Assert.IsFalse(keys.Contains("bar")); // It's a value!
-            Assert.IsFalse(keys.Contains("1"));
-            // Keys can't be null, so we should prevent contains check
-            Assert.Throws<ArgumentNullException>(() => keys.Contains(null));
-        }
-
-        [Test]
-        public void ValuesContains()
-        {
-            var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } };
-            var values = map.Values;
-            Assert.IsTrue(values.Contains("bar"));
-            Assert.IsFalse(values.Contains("foo")); // It's a key!
-            Assert.IsFalse(values.Contains("1"));
-            // Values can be null, so this makes sense
-            Assert.IsFalse(values.Contains(null));
-        }
-
-        [Test]
-        public void ToString_StringToString()
-        {
-            var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } };
-            Assert.AreEqual("{ \"foo\": \"bar\", \"x\": \"y\" }", map.ToString());
-        }
-
-        [Test]
-        public void ToString_UnsupportedKeyType()
-        {
-            var map = new MapField<byte, string> { { 10, "foo" } };
-            Assert.Throws<ArgumentException>(() => map.ToString());
-        }
-
-        private static KeyValuePair<TKey, TValue> NewKeyValuePair<TKey, TValue>(TKey key, TValue value)
-        {
-            return new KeyValuePair<TKey, TValue>(key, value);
-        }
-    }
-}

+ 0 - 746
csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs

@@ -1,746 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using Google.Protobuf.TestProtos;
-using Google.Protobuf.WellKnownTypes;
-using NUnit.Framework;
-
-namespace Google.Protobuf.Collections
-{
-    public class RepeatedFieldTest
-    {
-        [Test]
-        public void NullValuesRejected()
-        {
-            var list = new RepeatedField<string>();
-            Assert.Throws<ArgumentNullException>(() => list.Add((string)null));
-            Assert.Throws<ArgumentNullException>(() => list.Add((IEnumerable<string>)null));
-            Assert.Throws<ArgumentNullException>(() => list.Add((RepeatedField<string>)null));
-            Assert.Throws<ArgumentNullException>(() => list.Contains(null));
-            Assert.Throws<ArgumentNullException>(() => list.IndexOf(null));
-        }
-
-        [Test]
-        public void Add_SingleItem()
-        {
-            var list = new RepeatedField<string>();
-            list.Add("foo");
-            Assert.AreEqual(1, list.Count);
-            Assert.AreEqual("foo", list[0]);
-        }
-
-        [Test]
-        public void Add_Sequence()
-        {
-            var list = new RepeatedField<string>();
-            list.Add(new[] { "foo", "bar" });
-            Assert.AreEqual(2, list.Count);
-            Assert.AreEqual("foo", list[0]);
-            Assert.AreEqual("bar", list[1]);
-        }
-
-        [Test]
-        public void AddRange_SlowPath()
-        {
-            var list = new RepeatedField<string>();
-            list.AddRange(new[] { "foo", "bar" }.Select(x => x));
-            Assert.AreEqual(2, list.Count);
-            Assert.AreEqual("foo", list[0]);
-            Assert.AreEqual("bar", list[1]);
-        }
-
-        [Test]
-        public void AddRange_SlowPath_NullsProhibited_ReferenceType()
-        {
-            var list = new RepeatedField<string>();
-            // It's okay for this to throw ArgumentNullException if necessary.
-            // It's not ideal, but not awful.
-            Assert.Catch<ArgumentException>(() => list.AddRange(new[] { "foo", null }.Select(x => x)));
-        }
-
-        [Test]
-        public void AddRange_SlowPath_NullsProhibited_NullableValueType()
-        {
-            var list = new RepeatedField<int?>();
-            // It's okay for this to throw ArgumentNullException if necessary.
-            // It's not ideal, but not awful.
-            Assert.Catch<ArgumentException>(() => list.AddRange(new[] { 20, (int?)null }.Select(x => x)));
-        }
-
-        [Test]
-        public void AddRange_Optimized_NonNullableValueType()
-        {
-            var list = new RepeatedField<int>();
-            list.AddRange(new List<int> { 20, 30 });
-            Assert.AreEqual(2, list.Count);
-            Assert.AreEqual(20, list[0]);
-            Assert.AreEqual(30, list[1]);
-        }
-
-        [Test]
-        public void AddRange_Optimized_ReferenceType()
-        {
-            var list = new RepeatedField<string>();
-            list.AddRange(new List<string> { "foo", "bar" });
-            Assert.AreEqual(2, list.Count);
-            Assert.AreEqual("foo", list[0]);
-            Assert.AreEqual("bar", list[1]);
-        }
-
-        [Test]
-        public void AddRange_Optimized_NullableValueType()
-        {
-            var list = new RepeatedField<int?>();
-            list.AddRange(new List<int?> { 20, 30 });
-            Assert.AreEqual(2, list.Count);
-            Assert.AreEqual((int?) 20, list[0]);
-            Assert.AreEqual((int?) 30, list[1]);
-        }
-
-        [Test]
-        public void AddRange_Optimized_NullsProhibited_ReferenceType()
-        {
-            // We don't just trust that a collection with a nullable element type doesn't contain nulls
-            var list = new RepeatedField<string>();
-            // It's okay for this to throw ArgumentNullException if necessary.
-            // It's not ideal, but not awful.
-            Assert.Catch<ArgumentException>(() => list.AddRange(new List<string> { "foo", null }));
-        }
-
-        [Test]
-        public void AddRange_Optimized_NullsProhibited_NullableValueType()
-        {
-            // We don't just trust that a collection with a nullable element type doesn't contain nulls
-            var list = new RepeatedField<int?>();
-            // It's okay for this to throw ArgumentNullException if necessary.
-            // It's not ideal, but not awful.
-            Assert.Catch<ArgumentException>(() => list.AddRange(new List<int?> { 20, null }));
-        }
-
-        [Test]
-        public void AddRange_AlreadyNotEmpty()
-        {
-            var list = new RepeatedField<int> { 1, 2, 3 };
-            list.AddRange(new List<int> { 4, 5, 6 });
-            CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list);
-        }
-
-        [Test]
-        public void AddRange_RepeatedField()
-        {
-            var list = new RepeatedField<string> { "original" };
-            list.AddRange(new RepeatedField<string> { "foo", "bar" });
-            Assert.AreEqual(3, list.Count);
-            Assert.AreEqual("original", list[0]);
-            Assert.AreEqual("foo", list[1]);
-            Assert.AreEqual("bar", list[2]);
-        }
-
-        [Test]
-        public void RemoveAt_Valid()
-        {
-            var list = new RepeatedField<string> { "first", "second", "third" };
-            list.RemoveAt(1);
-            CollectionAssert.AreEqual(new[] { "first", "third" }, list);
-            // Just check that these don't throw...
-            list.RemoveAt(list.Count - 1); // Now the count will be 1...
-            list.RemoveAt(0);
-            Assert.AreEqual(0, list.Count);
-        }
-
-        [Test]
-        public void RemoveAt_Invalid()
-        {
-            var list = new RepeatedField<string> { "first", "second", "third" };
-            Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(-1));
-            Assert.Throws<ArgumentOutOfRangeException>(() => list.RemoveAt(3));
-        }
-
-        [Test]
-        public void Insert_Valid()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            list.Insert(1, "middle");
-            CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list);
-            list.Insert(3, "end");
-            CollectionAssert.AreEqual(new[] { "first", "middle", "second", "end" }, list);
-            list.Insert(0, "start");
-            CollectionAssert.AreEqual(new[] { "start", "first", "middle", "second", "end" }, list);
-        }
-
-        [Test]
-        public void Insert_Invalid()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(-1, "foo"));
-            Assert.Throws<ArgumentOutOfRangeException>(() => list.Insert(3, "foo"));
-            Assert.Throws<ArgumentNullException>(() => list.Insert(0, null));
-        }
-
-        [Test]
-        public void Equals_RepeatedField()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            Assert.IsFalse(list.Equals((RepeatedField<string>) null));
-            Assert.IsTrue(list.Equals(list));
-            Assert.IsFalse(list.Equals(new RepeatedField<string> { "first", "third" }));
-            Assert.IsFalse(list.Equals(new RepeatedField<string> { "first" }));
-            Assert.IsTrue(list.Equals(new RepeatedField<string> { "first", "second" }));
-        }
-
-        [Test]
-        public void Equals_Object()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            Assert.IsFalse(list.Equals((object) null));
-            Assert.IsTrue(list.Equals((object) list));
-            Assert.IsFalse(list.Equals((object) new RepeatedField<string> { "first", "third" }));
-            Assert.IsFalse(list.Equals((object) new RepeatedField<string> { "first" }));
-            Assert.IsTrue(list.Equals((object) new RepeatedField<string> { "first", "second" }));
-            Assert.IsFalse(list.Equals(new object()));
-        }
-
-        [Test]
-        public void GetEnumerator_GenericInterface()
-        {
-            IEnumerable<string> list = new RepeatedField<string> { "first", "second" };
-            // Select gets rid of the optimizations in ToList...
-            CollectionAssert.AreEqual(new[] { "first", "second" }, list.Select(x => x).ToList());
-        }
-
-        [Test]
-        public void GetEnumerator_NonGenericInterface()
-        {
-            IEnumerable list = new RepeatedField<string> { "first", "second" };
-            CollectionAssert.AreEqual(new[] { "first", "second" }, list.Cast<object>().ToList());
-        }
-
-        [Test]
-        public void CopyTo()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            string[] stringArray = new string[4];
-            list.CopyTo(stringArray, 1);
-            CollectionAssert.AreEqual(new[] { null, "first", "second", null }, stringArray);
-        }
-
-        [Test]
-        public void Indexer_Get()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            Assert.AreEqual("first", list[0]);
-            Assert.AreEqual("second", list[1]);
-            Assert.Throws<ArgumentOutOfRangeException>(() => list[-1].GetHashCode());
-            Assert.Throws<ArgumentOutOfRangeException>(() => list[2].GetHashCode());
-        }
-
-        [Test]
-        public void Indexer_Set()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            list[0] = "changed";
-            Assert.AreEqual("changed", list[0]);
-            Assert.Throws<ArgumentNullException>(() => list[0] = null);
-            Assert.Throws<ArgumentOutOfRangeException>(() => list[-1] = "bad");
-            Assert.Throws<ArgumentOutOfRangeException>(() => list[2] = "bad");
-        }
-
-        [Test]
-        public void Clone_ReturnsMutable()
-        {
-            var list = new RepeatedField<int> { 0 };
-            var clone = list.Clone();
-            clone[0] = 1;
-        }
-
-        [Test]
-        public void Enumerator()
-        {
-            var list = new RepeatedField<string> { "first", "second" };
-            using (var enumerator = list.GetEnumerator())
-            {
-                Assert.IsTrue(enumerator.MoveNext());
-                Assert.AreEqual("first", enumerator.Current);
-                Assert.IsTrue(enumerator.MoveNext());
-                Assert.AreEqual("second", enumerator.Current);
-                Assert.IsFalse(enumerator.MoveNext());
-                Assert.IsFalse(enumerator.MoveNext());
-            }
-        }
-
-        [Test]
-        public void AddEntriesFrom_PackedInt32()
-        {
-            uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            var length = CodedOutputStream.ComputeInt32Size(10)
-                + CodedOutputStream.ComputeInt32Size(999)
-                + CodedOutputStream.ComputeInt32Size(-1000);
-            output.WriteTag(packedTag);
-            output.WriteRawVarint32((uint) length);
-            output.WriteInt32(10);
-            output.WriteInt32(999);
-            output.WriteInt32(-1000);
-            output.Flush();
-            stream.Position = 0;
-
-            // Deliberately "expecting" a non-packed tag, but we detect that the data is
-            // actually packed.
-            uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var field = new RepeatedField<int>();
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(packedTag);
-            field.AddEntriesFrom(input, FieldCodec.ForInt32(nonPackedTag));
-            CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field);
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void AddEntriesFrom_NonPackedInt32()
-        {
-            uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.Varint);
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(nonPackedTag);
-            output.WriteInt32(10);
-            output.WriteTag(nonPackedTag);
-            output.WriteInt32(999);
-            output.WriteTag(nonPackedTag);
-            output.WriteInt32(-1000); // Just for variety...
-            output.Flush();
-            stream.Position = 0;
-
-            // Deliberately "expecting" a packed tag, but we detect that the data is
-            // actually not packed.
-            uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var field = new RepeatedField<int>();
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(nonPackedTag);
-            field.AddEntriesFrom(input, FieldCodec.ForInt32(packedTag));
-            CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field);
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void AddEntriesFrom_String()
-        {
-            uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(tag);
-            output.WriteString("Foo");
-            output.WriteTag(tag);
-            output.WriteString("");
-            output.WriteTag(tag);
-            output.WriteString("Bar");
-            output.Flush();
-            stream.Position = 0;
-
-            var field = new RepeatedField<string>();
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(tag);
-            field.AddEntriesFrom(input, FieldCodec.ForString(tag));
-            CollectionAssert.AreEqual(new[] { "Foo", "", "Bar" }, field);
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void AddEntriesFrom_Message()
-        {
-            var message1 = new ForeignMessage { C = 2000 };
-            var message2 = new ForeignMessage { C = -250 };
-
-            uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            output.WriteTag(tag);
-            output.WriteMessage(message1);
-            output.WriteTag(tag);
-            output.WriteMessage(message2);
-            output.Flush();
-            stream.Position = 0;
-
-            var field = new RepeatedField<ForeignMessage>();
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(tag);
-            field.AddEntriesFrom(input, FieldCodec.ForMessage(tag, ForeignMessage.Parser));
-            CollectionAssert.AreEqual(new[] { message1, message2}, field);
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void WriteTo_PackedInt32()
-        {
-            uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var field = new RepeatedField<int> { 10, 1000, 1000000 };
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            field.WriteTo(output, FieldCodec.ForInt32(tag));
-            output.Flush();
-            stream.Position = 0;
-
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(tag);
-            var length = input.ReadLength();
-            Assert.AreEqual(10, input.ReadInt32());
-            Assert.AreEqual(1000, input.ReadInt32());
-            Assert.AreEqual(1000000, input.ReadInt32());
-            Assert.IsTrue(input.IsAtEnd);
-            Assert.AreEqual(1 + CodedOutputStream.ComputeLengthSize(length) + length, stream.Length);
-        }
-
-        [Test]
-        public void WriteTo_NonPackedInt32()
-        {
-            uint tag = WireFormat.MakeTag(10, WireFormat.WireType.Varint);
-            var field = new RepeatedField<int> { 10, 1000, 1000000};
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            field.WriteTo(output, FieldCodec.ForInt32(tag));
-            output.Flush();
-            stream.Position = 0;
-
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(tag);
-            Assert.AreEqual(10, input.ReadInt32());
-            input.AssertNextTag(tag);
-            Assert.AreEqual(1000, input.ReadInt32());
-            input.AssertNextTag(tag);
-            Assert.AreEqual(1000000, input.ReadInt32());
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void WriteTo_String()
-        {
-            uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var field = new RepeatedField<string> { "Foo", "", "Bar" };
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            field.WriteTo(output, FieldCodec.ForString(tag));
-            output.Flush();
-            stream.Position = 0;
-
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(tag);
-            Assert.AreEqual("Foo", input.ReadString());
-            input.AssertNextTag(tag);
-            Assert.AreEqual("", input.ReadString());
-            input.AssertNextTag(tag);
-            Assert.AreEqual("Bar", input.ReadString());
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void WriteTo_Message()
-        {
-            var message1 = new ForeignMessage { C = 20 };
-            var message2 = new ForeignMessage { C = 25 };
-            uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
-            var field = new RepeatedField<ForeignMessage> { message1, message2 };
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            field.WriteTo(output, FieldCodec.ForMessage(tag, ForeignMessage.Parser));
-            output.Flush();
-            stream.Position = 0;
-
-            var input = new CodedInputStream(stream);
-            input.AssertNextTag(tag);
-            Assert.AreEqual(message1, input.ReadMessage(ForeignMessage.Parser));
-            input.AssertNextTag(tag);
-            Assert.AreEqual(message2, input.ReadMessage(ForeignMessage.Parser));
-            Assert.IsTrue(input.IsAtEnd);
-        }
-
-        [Test]
-        public void CalculateSize_VariableSizeNonPacked()
-        {
-            var list = new RepeatedField<int> { 1, 500, 1 };
-            var tag = WireFormat.MakeTag(1, WireFormat.WireType.Varint);
-            // 2 bytes for the first entry, 3 bytes for the second, 2 bytes for the third
-            Assert.AreEqual(7, list.CalculateSize(FieldCodec.ForInt32(tag)));
-        }
-
-        [Test]
-        public void CalculateSize_FixedSizeNonPacked()
-        {
-            var list = new RepeatedField<int> { 1, 500, 1 };
-            var tag = WireFormat.MakeTag(1, WireFormat.WireType.Fixed32);
-            // 5 bytes for the each entry
-            Assert.AreEqual(15, list.CalculateSize(FieldCodec.ForSFixed32(tag)));
-        }
-
-        [Test]
-        public void CalculateSize_VariableSizePacked()
-        {
-            var list = new RepeatedField<int> { 1, 500, 1};
-            var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);
-            // 1 byte for the tag, 1 byte for the length,
-            // 1 byte for the first entry, 2 bytes for the second, 1 byte for the third
-            Assert.AreEqual(6, list.CalculateSize(FieldCodec.ForInt32(tag)));
-        }
-
-        [Test]
-        public void CalculateSize_FixedSizePacked()
-        {
-            var list = new RepeatedField<int> { 1, 500, 1 };
-            var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);
-            // 1 byte for the tag, 1 byte for the length, 4 bytes per entry
-            Assert.AreEqual(14, list.CalculateSize(FieldCodec.ForSFixed32(tag)));
-        }
-
-        [Test]
-        public void TestNegativeEnumArray()
-        {
-            int arraySize = 1 + 1 + (11 * 5);
-            int msgSize = arraySize;
-            byte[] bytes = new byte[msgSize];
-            CodedOutputStream output = new CodedOutputStream(bytes);
-            uint tag = WireFormat.MakeTag(8, WireFormat.WireType.Varint);
-            for (int i = 0; i >= -5; i--)
-            {
-                output.WriteTag(tag);
-                output.WriteEnum(i);
-            }
-
-            Assert.AreEqual(0, output.SpaceLeft);
-
-            CodedInputStream input = new CodedInputStream(bytes);
-            tag = input.ReadTag();
-
-            RepeatedField<SampleEnum> values = new RepeatedField<SampleEnum>();
-            values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x));
-
-            Assert.AreEqual(6, values.Count);
-            Assert.AreEqual(SampleEnum.None, values[0]);
-            Assert.AreEqual(((SampleEnum)(-1)), values[1]);
-            Assert.AreEqual(SampleEnum.NegativeValue, values[2]);
-            Assert.AreEqual(((SampleEnum)(-3)), values[3]);
-            Assert.AreEqual(((SampleEnum)(-4)), values[4]);
-            Assert.AreEqual(((SampleEnum)(-5)), values[5]);
-        }
-
-
-        [Test]
-        public void TestNegativeEnumPackedArray()
-        {
-            int arraySize = 1 + (10 * 5);
-            int msgSize = 1 + 1 + arraySize;
-            byte[] bytes = new byte[msgSize];
-            CodedOutputStream output = new CodedOutputStream(bytes);
-            // Length-delimited to show we want the packed representation
-            uint tag = WireFormat.MakeTag(8, WireFormat.WireType.LengthDelimited);
-            output.WriteTag(tag);
-            int size = 0;
-            for (int i = 0; i >= -5; i--)
-            {
-                size += CodedOutputStream.ComputeEnumSize(i);
-            }
-            output.WriteRawVarint32((uint)size);
-            for (int i = 0; i >= -5; i--)
-            {
-                output.WriteEnum(i);
-            }
-            Assert.AreEqual(0, output.SpaceLeft);
-
-            CodedInputStream input = new CodedInputStream(bytes);
-            tag = input.ReadTag();
-
-            RepeatedField<SampleEnum> values = new RepeatedField<SampleEnum>();
-            values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x));
-
-            Assert.AreEqual(6, values.Count);
-            Assert.AreEqual(SampleEnum.None, values[0]);
-            Assert.AreEqual(((SampleEnum)(-1)), values[1]);
-            Assert.AreEqual(SampleEnum.NegativeValue, values[2]);
-            Assert.AreEqual(((SampleEnum)(-3)), values[3]);
-            Assert.AreEqual(((SampleEnum)(-4)), values[4]);
-            Assert.AreEqual(((SampleEnum)(-5)), values[5]);
-        }
-
-        // Fairly perfunctory tests for the non-generic IList implementation
-        [Test]
-        public void IList_Indexer()
-        {
-            var field = new RepeatedField<string> { "first", "second" };
-            IList list = field;
-            Assert.AreEqual("first", list[0]);
-            list[1] = "changed";
-            Assert.AreEqual("changed", field[1]);
-        }
-
-        [Test]
-        public void IList_Contains()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            Assert.IsTrue(list.Contains("second"));
-            Assert.IsFalse(list.Contains("third"));
-            Assert.IsFalse(list.Contains(new object()));
-        }
-
-        [Test]
-        public void IList_Add()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            list.Add("third");
-            CollectionAssert.AreEqual(new[] { "first", "second", "third" }, list);
-        }
-
-        [Test]
-        public void IList_Remove()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            list.Remove("third"); // No-op, no exception
-            list.Remove(new object()); // No-op, no exception
-            list.Remove("first");
-            CollectionAssert.AreEqual(new[] { "second" }, list);
-        }
-
-        [Test]
-        public void IList_IsFixedSize()
-        {
-            var field = new RepeatedField<string> { "first", "second" };
-            IList list = field;
-            Assert.IsFalse(list.IsFixedSize);
-        }
-
-        [Test]
-        public void IList_IndexOf()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            Assert.AreEqual(1, list.IndexOf("second"));
-            Assert.AreEqual(-1, list.IndexOf("third"));
-            Assert.AreEqual(-1, list.IndexOf(new object()));
-        }
-
-        [Test]
-        public void IList_SyncRoot()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            Assert.AreSame(list, list.SyncRoot);
-        }
-
-        [Test]
-        public void IList_CopyTo()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            string[] stringArray = new string[4];
-            list.CopyTo(stringArray, 1);
-            CollectionAssert.AreEqual(new[] { null, "first",  "second", null }, stringArray);
-
-            object[] objectArray = new object[4];
-            list.CopyTo(objectArray, 1);
-            CollectionAssert.AreEqual(new[] { null, "first", "second", null }, objectArray);
-
-            Assert.Throws<ArrayTypeMismatchException>(() => list.CopyTo(new StringBuilder[4], 1));
-            Assert.Throws<ArrayTypeMismatchException>(() => list.CopyTo(new int[4], 1));
-        }
-
-        [Test]
-        public void IList_IsSynchronized()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            Assert.IsFalse(list.IsSynchronized);
-        }
-
-        [Test]
-        public void IList_Insert()
-        {
-            IList list = new RepeatedField<string> { "first", "second" };
-            list.Insert(1, "middle");
-            CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list);
-        }
-
-        [Test]
-        public void ToString_Integers()
-        {
-            var list = new RepeatedField<int> { 5, 10, 20 };
-            var text = list.ToString();
-            Assert.AreEqual("[ 5, 10, 20 ]", text);
-        }
-
-        [Test]
-        public void ToString_Strings()
-        {
-            var list = new RepeatedField<string> { "x", "y", "z" };
-            var text = list.ToString();
-            Assert.AreEqual("[ \"x\", \"y\", \"z\" ]", text);
-        }
-
-        [Test]
-        public void ToString_Messages()
-        {
-            var list = new RepeatedField<TestAllTypes> { new TestAllTypes { SingleDouble = 1.5 }, new TestAllTypes { SingleInt32 = 10 } };
-            var text = list.ToString();
-            Assert.AreEqual("[ { \"singleDouble\": 1.5 }, { \"singleInt32\": 10 } ]", text);
-        }
-
-        [Test]
-        public void ToString_Empty()
-        {
-            var list = new RepeatedField<TestAllTypes> { };
-            var text = list.ToString();
-            Assert.AreEqual("[ ]", text);
-        }
-
-        [Test]
-        public void ToString_InvalidElementType()
-        {
-            var list = new RepeatedField<decimal> { 15m };
-            Assert.Throws<ArgumentException>(() => list.ToString());
-        }
-
-        [Test]
-        public void ToString_Timestamp()
-        {
-            var list = new RepeatedField<Timestamp> { Timestamp.FromDateTime(new DateTime(2015, 10, 1, 12, 34, 56, DateTimeKind.Utc)) };
-            var text = list.ToString();
-            Assert.AreEqual("[ \"2015-10-01T12:34:56Z\" ]", text);
-        }
-
-        [Test]
-        public void ToString_Struct()
-        {
-            var message = new Struct { Fields = { { "foo", new Value { NumberValue = 20 } } } };
-            var list = new RepeatedField<Struct> { message };
-            var text = list.ToString();
-            Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString());
-        }
-    }
-}

+ 0 - 98
csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs

@@ -1,98 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-using System.Reflection;
-
-namespace Google.Protobuf.Compatibility
-{
-    public class PropertyInfoExtensionsTest
-    {
-        public string PublicReadWrite { get; set; }
-        private string PrivateReadWrite { get; set; }
-        public string PublicReadPrivateWrite { get; private set; }
-        public string PrivateReadPublicWrite { private get; set; }
-        public string PublicReadOnly { get { return null; } }
-        private string PrivateReadOnly { get { return null; } }
-        public string PublicWriteOnly { set { } }
-        private string PrivateWriteOnly { set {  } }
-
-        [Test]
-        [TestCase("PublicReadWrite")]
-        [TestCase("PublicReadPrivateWrite")]
-        [TestCase("PublicReadOnly")]
-        public void GetGetMethod_Success(string name)
-        {
-            var propertyInfo = typeof(PropertyInfoExtensionsTest)
-                .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
-            Assert.IsNotNull(PropertyInfoExtensions.GetGetMethod(propertyInfo));
-        }
-
-        [Test]
-        [TestCase("PrivateReadWrite")]
-        [TestCase("PrivateReadPublicWrite")]
-        [TestCase("PrivateReadOnly")]
-        [TestCase("PublicWriteOnly")]
-        [TestCase("PrivateWriteOnly")]
-        public void GetGetMethod_NoAccessibleGetter(string name)
-        {
-            var propertyInfo = typeof(PropertyInfoExtensionsTest)
-                .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
-            Assert.IsNull(PropertyInfoExtensions.GetGetMethod(propertyInfo));
-        }
-
-        [Test]
-        [TestCase("PublicReadWrite")]
-        [TestCase("PrivateReadPublicWrite")]
-        [TestCase("PublicWriteOnly")]
-        public void GetSetMethod_Success(string name)
-        {
-            var propertyInfo = typeof(PropertyInfoExtensionsTest)
-                .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
-            Assert.IsNotNull(PropertyInfoExtensions.GetSetMethod(propertyInfo));
-        }
-
-        [Test]
-        [TestCase("PublicReadPrivateWrite")]
-        [TestCase("PrivateReadWrite")]
-        [TestCase("PrivateReadOnly")]
-        [TestCase("PublicReadOnly")]
-        [TestCase("PrivateWriteOnly")]
-        public void GetSetMethod_NoAccessibleGetter(string name)
-        {
-            var propertyInfo = typeof(PropertyInfoExtensionsTest)
-                .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
-            Assert.IsNull(PropertyInfoExtensions.GetSetMethod(propertyInfo));
-        }
-    }
-
-}

+ 0 - 117
csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs

@@ -1,117 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-#if !DOTNET35
-namespace Google.Protobuf.Compatibility
-{
-    public class TypeExtensionsTest
-    {
-        public class DerivedList : List<string> { }
-        public string PublicProperty { get; set; }
-        private string PrivateProperty { get; set; }
-
-        public void PublicMethod()
-        {
-        }
-
-        private void PrivateMethod()
-        {
-        }
-
-        [Test]
-        [TestCase(typeof(object), typeof(string), true)]
-        [TestCase(typeof(object), typeof(int), true)]
-        [TestCase(typeof(string), typeof(string), true)]
-        [TestCase(typeof(string), typeof(object), false)]
-        [TestCase(typeof(string), typeof(int), false)]
-        [TestCase(typeof(int), typeof(int), true)]
-        [TestCase(typeof(ValueType), typeof(int), true)]
-        [TestCase(typeof(long), typeof(int), false)] // 
-        public void IsAssignableFrom(Type target, Type argument, bool expected)
-        {
-            Assert.AreEqual(expected, TypeExtensions.IsAssignableFrom(target, argument));
-        }
-
-        [Test]
-        [TestCase(typeof(DerivedList), "Count")] // Go up the type hierarchy
-        [TestCase(typeof(List<string>), "Count")]
-        [TestCase(typeof(List<>), "Count")]
-        [TestCase(typeof(TypeExtensionsTest), "PublicProperty")]
-        public void GetProperty_Success(Type type, string name)
-        {
-            var property = TypeExtensions.GetProperty(type, name);
-            Assert.IsNotNull(property);
-            Assert.AreEqual(name, property.Name);
-        }
-
-        [Test]
-        [TestCase(typeof(TypeExtensionsTest), "PrivateProperty")]
-        [TestCase(typeof(TypeExtensionsTest), "Garbage")]
-        public void GetProperty_NoSuchProperty(Type type, string name)
-        {
-            var property = TypeExtensions.GetProperty(type, name);
-            Assert.IsNull(property);
-        }
-
-        [Test]
-        [TestCase(typeof(DerivedList), "RemoveAt")] // Go up the type hierarchy
-        [TestCase(typeof(List<>), "RemoveAt")]
-        [TestCase(typeof(TypeExtensionsTest), "PublicMethod")]
-        public void GetMethod_Success(Type type, string name)
-        {
-            var method = TypeExtensions.GetMethod(type, name);
-            Assert.IsNotNull(method);
-            Assert.AreEqual(name, method.Name);
-        }
-
-        [Test]
-        [TestCase(typeof(TypeExtensionsTest), "PrivateMethod")]
-        [TestCase(typeof(TypeExtensionsTest), "GarbageMethod")]
-        public void GetMethod_NoSuchMethod(Type type, string name)
-        {
-            var method = TypeExtensions.GetMethod(type, name);
-            Assert.IsNull(method);
-        }
-
-        [Test]
-        [TestCase(typeof(List<string>), "IndexOf")]
-        public void GetMethod_Ambiguous(Type type, string name)
-        {
-            Assert.Throws<AmbiguousMatchException>(() => TypeExtensions.GetMethod(type, name));
-        }
-    }
-}
-#endif

+ 0 - 55
csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs

@@ -1,55 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Reflection;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    public class DeprecatedMemberTest
-    {
-        private static void AssertIsDeprecated(MemberInfo member)
-        {
-            Assert.NotNull(member);
-            Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member);
-        }
-
-        [Test]
-        public void TestDepreatedPrimitiveValue()
-        {
-            AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32"));
-        }
-
-    }
-}

+ 0 - 64
csharp/src/Google.Protobuf.Test/EqualityTester.cs

@@ -1,64 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Helper methods when testing equality. NUnit's Assert.AreEqual and
-    /// Assert.AreNotEqual methods try to be clever with collections, which can
-    /// be annoying...
-    /// </summary>
-    internal static class EqualityTester
-    {
-        public static void AssertEquality<T>(T first, T second) where T : IEquatable<T>
-        {
-            Assert.IsTrue(first.Equals(second));
-            Assert.IsTrue(first.Equals((object) second));
-            Assert.AreEqual(first.GetHashCode(), second.GetHashCode());
-        }
-
-        public static void AssertInequality<T>(T first, T second) where T : IEquatable<T>
-        {
-            Assert.IsFalse(first.Equals(second));
-            Assert.IsFalse(first.Equals((object) second));
-            // While this isn't a requirement, the chances of this test failing due to
-            // coincidence rather than a bug are very small.
-            if (first != null && second != null)
-            {
-                Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode());
-            }
-        }
-    }
-}

+ 0 - 196
csharp/src/Google.Protobuf.Test/FieldCodecTest.cs

@@ -1,196 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    public class FieldCodecTest
-    {
-#pragma warning disable 0414 // Used by tests via reflection - do not remove!
-        private static readonly List<ICodecTestData> Codecs = new List<ICodecTestData>
-        {
-            new FieldCodecTestData<bool>(FieldCodec.ForBool(100), true, "Bool"),
-            new FieldCodecTestData<string>(FieldCodec.ForString(100), "sample", "String"),
-            new FieldCodecTestData<ByteString>(FieldCodec.ForBytes(100), ByteString.CopyFrom(1, 2, 3), "Bytes"),
-            new FieldCodecTestData<int>(FieldCodec.ForInt32(100), -1000, "Int32"),
-            new FieldCodecTestData<int>(FieldCodec.ForSInt32(100), -1000, "SInt32"),
-            new FieldCodecTestData<int>(FieldCodec.ForSFixed32(100), -1000, "SFixed32"),
-            new FieldCodecTestData<uint>(FieldCodec.ForUInt32(100), 1234, "UInt32"),
-            new FieldCodecTestData<uint>(FieldCodec.ForFixed32(100), 1234, "Fixed32"),
-            new FieldCodecTestData<long>(FieldCodec.ForInt64(100), -1000, "Int64"),
-            new FieldCodecTestData<long>(FieldCodec.ForSInt64(100), -1000, "SInt64"),
-            new FieldCodecTestData<long>(FieldCodec.ForSFixed64(100), -1000, "SFixed64"),
-            new FieldCodecTestData<ulong>(FieldCodec.ForUInt64(100), 1234, "UInt64"),
-            new FieldCodecTestData<ulong>(FieldCodec.ForFixed64(100), 1234, "Fixed64"),
-            new FieldCodecTestData<float>(FieldCodec.ForFloat(100), 1234.5f, "Float"),
-            new FieldCodecTestData<double>(FieldCodec.ForDouble(100), 1234567890.5d, "Double"),
-            new FieldCodecTestData<ForeignEnum>(
-                FieldCodec.ForEnum(100, t => (int) t, t => (ForeignEnum) t), ForeignEnum.ForeignBaz, "Enum"),
-            new FieldCodecTestData<ForeignMessage>(
-                FieldCodec.ForMessage(100, ForeignMessage.Parser), new ForeignMessage { C = 10 }, "Message"),
-        };
-#pragma warning restore 0414
-
-        [Test, TestCaseSource("Codecs")]
-        public void RoundTripWithTag(ICodecTestData codec)
-        {
-            codec.TestRoundTripWithTag();
-        }
-
-        [Test, TestCaseSource("Codecs")]
-        public void RoundTripRaw(ICodecTestData codec)
-        {
-            codec.TestRoundTripRaw();
-        }
-
-        [Test, TestCaseSource("Codecs")]
-        public void CalculateSize(ICodecTestData codec)
-        {
-            codec.TestCalculateSizeWithTag();
-        }
-
-        [Test, TestCaseSource("Codecs")]
-        public void DefaultValue(ICodecTestData codec)
-        {
-            codec.TestDefaultValue();
-        }
-
-        [Test, TestCaseSource("Codecs")]
-        public void FixedSize(ICodecTestData codec)
-        {
-            codec.TestFixedSize();
-        }
-
-        // This is ugly, but it means we can have a non-generic interface.
-        // It feels like NUnit should support this better, but I don't know
-        // of any better ways right now.
-        public interface ICodecTestData
-        {
-            void TestRoundTripRaw();
-            void TestRoundTripWithTag();
-            void TestCalculateSizeWithTag();
-            void TestDefaultValue();
-            void TestFixedSize();
-        }
-
-        public class FieldCodecTestData<T> : ICodecTestData
-        {
-            private readonly FieldCodec<T> codec;
-            private readonly T sampleValue;
-            private readonly string name;
-
-            public FieldCodecTestData(FieldCodec<T> codec, T sampleValue, string name)
-            {
-                this.codec = codec;
-                this.sampleValue = sampleValue;
-                this.name = name;
-            }
-
-            public void TestRoundTripRaw()
-            {
-                var stream = new MemoryStream();
-                var codedOutput = new CodedOutputStream(stream);
-                codec.ValueWriter(codedOutput, sampleValue);
-                codedOutput.Flush();
-                stream.Position = 0;
-                var codedInput = new CodedInputStream(stream);
-                Assert.AreEqual(sampleValue, codec.ValueReader(codedInput));
-                Assert.IsTrue(codedInput.IsAtEnd);
-            }
-
-            public void TestRoundTripWithTag()
-            {
-                var stream = new MemoryStream();
-                var codedOutput = new CodedOutputStream(stream);
-                codec.WriteTagAndValue(codedOutput, sampleValue);
-                codedOutput.Flush();
-                stream.Position = 0;
-                var codedInput = new CodedInputStream(stream);
-                codedInput.AssertNextTag(codec.Tag);
-                Assert.AreEqual(sampleValue, codec.Read(codedInput));
-                Assert.IsTrue(codedInput.IsAtEnd);
-            }
-
-            public void TestCalculateSizeWithTag()
-            {
-                var stream = new MemoryStream();
-                var codedOutput = new CodedOutputStream(stream);
-                codec.WriteTagAndValue(codedOutput, sampleValue);
-                codedOutput.Flush();
-                Assert.AreEqual(stream.Position, codec.CalculateSizeWithTag(sampleValue));
-            }
-
-            public void TestDefaultValue()
-            {
-                // WriteTagAndValue ignores default values
-                var stream = new MemoryStream();
-                var codedOutput = new CodedOutputStream(stream);
-                codec.WriteTagAndValue(codedOutput, codec.DefaultValue);
-                codedOutput.Flush();
-                Assert.AreEqual(0, stream.Position);
-                Assert.AreEqual(0, codec.CalculateSizeWithTag(codec.DefaultValue));
-                if (typeof(T).GetTypeInfo().IsValueType)
-                {
-                    Assert.AreEqual(default(T), codec.DefaultValue);
-                }
-
-                // The plain ValueWriter/ValueReader delegates don't.
-                if (codec.DefaultValue != null) // This part isn't appropriate for message types.
-                {
-                    codedOutput = new CodedOutputStream(stream);
-                    codec.ValueWriter(codedOutput, codec.DefaultValue);
-                    codedOutput.Flush();
-                    Assert.AreNotEqual(0, stream.Position);
-                    Assert.AreEqual(stream.Position, codec.ValueSizeCalculator(codec.DefaultValue));
-                    stream.Position = 0;
-                    var codedInput = new CodedInputStream(stream);
-                    Assert.AreEqual(codec.DefaultValue, codec.ValueReader(codedInput));
-                }
-            }
-
-            public void TestFixedSize()
-            {
-                Assert.AreEqual(name.Contains("Fixed"), codec.FixedSize != 0);
-            }
-
-            public override string ToString()
-            {
-                return name;
-            }
-        }
-    }
-}

+ 0 - 723
csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs

@@ -1,723 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using Google.Protobuf.WellKnownTypes;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Tests around the generated TestAllTypes message.
-    /// </summary>
-    public class GeneratedMessageTest
-    {
-        [Test]
-        public void EmptyMessageFieldDistinctFromMissingMessageField()
-        {
-            // This demonstrates what we're really interested in...
-            var message1 = new TestAllTypes { SingleForeignMessage = new ForeignMessage() };
-            var message2 = new TestAllTypes(); // SingleForeignMessage is null
-            EqualityTester.AssertInequality(message1, message2);
-        }
-
-        [Test]
-        public void DefaultValues()
-        {
-            // Single fields
-            var message = new TestAllTypes();
-            Assert.AreEqual(false, message.SingleBool);
-            Assert.AreEqual(ByteString.Empty, message.SingleBytes);
-            Assert.AreEqual(0.0, message.SingleDouble);
-            Assert.AreEqual(0, message.SingleFixed32);
-            Assert.AreEqual(0L, message.SingleFixed64);
-            Assert.AreEqual(0.0f, message.SingleFloat);
-            Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum);
-            Assert.IsNull(message.SingleForeignMessage);
-            Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum);
-            Assert.IsNull(message.SingleImportMessage);
-            Assert.AreEqual(0, message.SingleInt32);
-            Assert.AreEqual(0L, message.SingleInt64);
-            Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum);
-            Assert.IsNull(message.SingleNestedMessage);
-            Assert.IsNull(message.SinglePublicImportMessage);
-            Assert.AreEqual(0, message.SingleSfixed32);
-            Assert.AreEqual(0L, message.SingleSfixed64);
-            Assert.AreEqual(0, message.SingleSint32);
-            Assert.AreEqual(0L, message.SingleSint64);
-            Assert.AreEqual("", message.SingleString);
-            Assert.AreEqual(0U, message.SingleUint32);
-            Assert.AreEqual(0UL, message.SingleUint64);
-
-            // Repeated fields
-            Assert.AreEqual(0, message.RepeatedBool.Count);
-            Assert.AreEqual(0, message.RepeatedBytes.Count);
-            Assert.AreEqual(0, message.RepeatedDouble.Count);
-            Assert.AreEqual(0, message.RepeatedFixed32.Count);
-            Assert.AreEqual(0, message.RepeatedFixed64.Count);
-            Assert.AreEqual(0, message.RepeatedFloat.Count);
-            Assert.AreEqual(0, message.RepeatedForeignEnum.Count);
-            Assert.AreEqual(0, message.RepeatedForeignMessage.Count);
-            Assert.AreEqual(0, message.RepeatedImportEnum.Count);
-            Assert.AreEqual(0, message.RepeatedImportMessage.Count);
-            Assert.AreEqual(0, message.RepeatedNestedEnum.Count);
-            Assert.AreEqual(0, message.RepeatedNestedMessage.Count);
-            Assert.AreEqual(0, message.RepeatedPublicImportMessage.Count);
-            Assert.AreEqual(0, message.RepeatedSfixed32.Count);
-            Assert.AreEqual(0, message.RepeatedSfixed64.Count);
-            Assert.AreEqual(0, message.RepeatedSint32.Count);
-            Assert.AreEqual(0, message.RepeatedSint64.Count);
-            Assert.AreEqual(0, message.RepeatedString.Count);
-            Assert.AreEqual(0, message.RepeatedUint32.Count);
-            Assert.AreEqual(0, message.RepeatedUint64.Count);
-
-            // Oneof fields
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
-            Assert.AreEqual(0, message.OneofUint32);
-            Assert.AreEqual("", message.OneofString);
-            Assert.AreEqual(ByteString.Empty, message.OneofBytes);
-            Assert.IsNull(message.OneofNestedMessage);
-        }
-
-        [Test]
-        public void NullStringAndBytesRejected()
-        {
-            var message = new TestAllTypes();
-            Assert.Throws<ArgumentNullException>(() => message.SingleString = null);
-            Assert.Throws<ArgumentNullException>(() => message.OneofString = null);
-            Assert.Throws<ArgumentNullException>(() => message.SingleBytes = null);
-            Assert.Throws<ArgumentNullException>(() => message.OneofBytes = null);
-        }
-
-        [Test]
-        public void RoundTrip_Empty()
-        {
-            var message = new TestAllTypes();
-            // Without setting any values, there's nothing to write.
-            byte[] bytes = message.ToByteArray();
-            Assert.AreEqual(0, bytes.Length);
-            TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, parsed);
-        }
-
-        [Test]
-        public void RoundTrip_SingleValues()
-        {
-            var message = new TestAllTypes
-            {
-                SingleBool = true,
-                SingleBytes = ByteString.CopyFrom(1, 2, 3, 4),
-                SingleDouble = 23.5,
-                SingleFixed32 = 23,
-                SingleFixed64 = 1234567890123,
-                SingleFloat = 12.25f,
-                SingleForeignEnum = ForeignEnum.ForeignBar,
-                SingleForeignMessage = new ForeignMessage { C = 10 },
-                SingleImportEnum = ImportEnum.ImportBaz,
-                SingleImportMessage = new ImportMessage { D = 20 },
-                SingleInt32 = 100,
-                SingleInt64 = 3210987654321,
-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,
-                SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 },
-                SinglePublicImportMessage = new PublicImportMessage { E = 54 },
-                SingleSfixed32 = -123,
-                SingleSfixed64 = -12345678901234,
-                SingleSint32 = -456,
-                SingleSint64 = -12345678901235,
-                SingleString = "test",
-                SingleUint32 = uint.MaxValue,
-                SingleUint64 = ulong.MaxValue
-            };
-
-            byte[] bytes = message.ToByteArray();
-            TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, parsed);
-        }
-
-        [Test]
-        public void RoundTrip_RepeatedValues()
-        {
-            var message = new TestAllTypes
-            {
-                RepeatedBool = { true, false },
-                RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) },
-                RepeatedDouble = { -12.25, 23.5 },
-                RepeatedFixed32 = { uint.MaxValue, 23 },
-                RepeatedFixed64 = { ulong.MaxValue, 1234567890123 },
-                RepeatedFloat = { 100f, 12.25f },
-                RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar },
-                RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } },
-                RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified },
-                RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } },
-                RepeatedInt32 = { 100, 200 },
-                RepeatedInt64 = { 3210987654321, long.MaxValue },
-                RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg },
-                RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } },
-                RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } },
-                RepeatedSfixed32 = { -123, 123 },
-                RepeatedSfixed64 = { -12345678901234, 12345678901234 },
-                RepeatedSint32 = { -456, 100 },
-                RepeatedSint64 = { -12345678901235, 123 },
-                RepeatedString = { "foo", "bar" },
-                RepeatedUint32 = { uint.MaxValue, uint.MinValue },
-                RepeatedUint64 = { ulong.MaxValue, uint.MinValue }
-            };
-
-            byte[] bytes = message.ToByteArray();
-            TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, parsed);
-        }
-
-        // Note that not every map within map_unittest_proto3 is used. They all go through very
-        // similar code paths. The fact that all maps are present is validation that we have codecs
-        // for every type.
-        [Test]
-        public void RoundTrip_Maps()
-        {
-            var message = new TestMap
-            {
-                MapBoolBool = {
-                    { false, true },
-                    { true, false }
-                },
-                MapInt32Bytes = {
-                    { 5, ByteString.CopyFrom(6, 7, 8) },
-                    { 25, ByteString.CopyFrom(1, 2, 3, 4, 5) },
-                    { 10, ByteString.Empty }
-                },
-                MapInt32ForeignMessage = {
-                    { 0, new ForeignMessage { C = 10 } },
-                    { 5, new ForeignMessage() },
-                },
-                MapInt32Enum = {
-                    { 1, MapEnum.Bar },
-                    { 2000, MapEnum.Foo }
-                }
-            };
-
-            byte[] bytes = message.ToByteArray();
-            TestMap parsed = TestMap.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, parsed);
-        }
-
-        [Test]
-        public void MapWithEmptyEntry()
-        {
-            var message = new TestMap
-            {
-                MapInt32Bytes = { { 0, ByteString.Empty } }
-            };
-
-            byte[] bytes = message.ToByteArray();
-            Assert.AreEqual(2, bytes.Length); // Tag for field entry (1 byte), length of entry (0; 1 byte)
-
-            var parsed = TestMap.Parser.ParseFrom(bytes);
-            Assert.AreEqual(1, parsed.MapInt32Bytes.Count);
-            Assert.AreEqual(ByteString.Empty, parsed.MapInt32Bytes[0]);
-        }
-
-        [Test]
-        public void MapWithOnlyValue()
-        {
-            // Hand-craft the stream to contain a single entry with just a value.
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-            output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited);
-            var nestedMessage = new ForeignMessage { C = 20 };
-            // Size of the entry (tag, size written by WriteMessage, data written by WriteMessage)
-            output.WriteLength(2 + nestedMessage.CalculateSize());
-            output.WriteTag(2, WireFormat.WireType.LengthDelimited);
-            output.WriteMessage(nestedMessage);
-            output.Flush();
-
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            Assert.AreEqual(nestedMessage, parsed.MapInt32ForeignMessage[0]);
-        }
-
-        [Test]
-        public void MapWithOnlyKey_PrimitiveValue()
-        {
-            // Hand-craft the stream to contain a single entry with just a key.
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-            output.WriteTag(TestMap.MapInt32DoubleFieldNumber, WireFormat.WireType.LengthDelimited);
-            int key = 10;
-            output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key));
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key);
-            output.Flush();
-
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            Assert.AreEqual(0.0, parsed.MapInt32Double[key]);
-        }
-
-        [Test]
-        public void MapWithOnlyKey_MessageValue()
-        {
-            // Hand-craft the stream to contain a single entry with just a key.
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-            output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited);
-            int key = 10;
-            output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key));
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key);
-            output.Flush();
-
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            Assert.AreEqual(new ForeignMessage(), parsed.MapInt32ForeignMessage[key]);
-        }
-
-        [Test]
-        public void MapIgnoresExtraFieldsWithinEntryMessages()
-        {
-            // Hand-craft the stream to contain a single entry with three fields
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-
-            output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited);
-
-            var key = 10; // Field 1 
-            var value = 20; // Field 2
-            var extra = 30; // Field 3
-
-            // Each field can be represented in a single byte, with a single byte tag.
-            // Total message size: 6 bytes.
-            output.WriteLength(6);
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key);
-            output.WriteTag(2, WireFormat.WireType.Varint);
-            output.WriteInt32(value);
-            output.WriteTag(3, WireFormat.WireType.Varint);
-            output.WriteInt32(extra);
-            output.Flush();
-
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            Assert.AreEqual(value, parsed.MapInt32Int32[key]);
-        }
-
-        [Test]
-        public void MapFieldOrderIsIrrelevant()
-        {
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-
-            output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited);
-
-            var key = 10;
-            var value = 20;
-
-            // Each field can be represented in a single byte, with a single byte tag.
-            // Total message size: 4 bytes.
-            output.WriteLength(4);
-            output.WriteTag(2, WireFormat.WireType.Varint);
-            output.WriteInt32(value);
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key);
-            output.Flush();
-
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            Assert.AreEqual(value, parsed.MapInt32Int32[key]);
-        }
-
-        [Test]
-        public void MapNonContiguousEntries()
-        {
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-
-            // Message structure:
-            // Entry for MapInt32Int32
-            // Entry for MapStringString
-            // Entry for MapInt32Int32
-
-            // First entry
-            var key1 = 10;
-            var value1 = 20;
-            output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(4);
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key1);
-            output.WriteTag(2, WireFormat.WireType.Varint);
-            output.WriteInt32(value1);
-
-            // Second entry
-            var key2 = "a";
-            var value2 = "b";
-            output.WriteTag(TestMap.MapStringStringFieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(6); // 3 bytes per entry: tag, size, character
-            output.WriteTag(1, WireFormat.WireType.LengthDelimited);
-            output.WriteString(key2);
-            output.WriteTag(2, WireFormat.WireType.LengthDelimited);
-            output.WriteString(value2);
-
-            // Third entry
-            var key3 = 15;
-            var value3 = 25;
-            output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(4);
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key3);
-            output.WriteTag(2, WireFormat.WireType.Varint);
-            output.WriteInt32(value3);
-
-            output.Flush();
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            var expected = new TestMap
-            {
-                MapInt32Int32 = { { key1, value1 }, { key3, value3 } },
-                MapStringString = { { key2, value2 } }
-            };
-            Assert.AreEqual(expected, parsed);
-        }
-
-        [Test]
-        public void DuplicateKeys_LastEntryWins()
-        {
-            var memoryStream = new MemoryStream();
-            var output = new CodedOutputStream(memoryStream);
-
-            var key = 10;
-            var value1 = 20;
-            var value2 = 30;
-
-            // First entry
-            output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(4);
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key);
-            output.WriteTag(2, WireFormat.WireType.Varint);
-            output.WriteInt32(value1);
-
-            // Second entry - same key, different value
-            output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(4);
-            output.WriteTag(1, WireFormat.WireType.Varint);
-            output.WriteInt32(key);
-            output.WriteTag(2, WireFormat.WireType.Varint);
-            output.WriteInt32(value2);
-            output.Flush();
-
-            var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray());
-            Assert.AreEqual(value2, parsed.MapInt32Int32[key]);
-        }
-
-        [Test]
-        public void CloneSingleNonMessageValues()
-        {
-            var original = new TestAllTypes
-            {
-                SingleBool = true,
-                SingleBytes = ByteString.CopyFrom(1, 2, 3, 4),
-                SingleDouble = 23.5,
-                SingleFixed32 = 23,
-                SingleFixed64 = 1234567890123,
-                SingleFloat = 12.25f,
-                SingleInt32 = 100,
-                SingleInt64 = 3210987654321,
-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,
-                SingleSfixed32 = -123,
-                SingleSfixed64 = -12345678901234,
-                SingleSint32 = -456,
-                SingleSint64 = -12345678901235,
-                SingleString = "test",
-                SingleUint32 = uint.MaxValue,
-                SingleUint64 = ulong.MaxValue
-            };
-            var clone = original.Clone();
-            Assert.AreNotSame(original, clone);
-            Assert.AreEqual(original, clone);
-            // Just as a single example
-            clone.SingleInt32 = 150;
-            Assert.AreNotEqual(original, clone);
-        }
-
-        [Test]
-        public void CloneRepeatedNonMessageValues()
-        {
-            var original = new TestAllTypes
-            {
-                RepeatedBool = { true, false },
-                RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) },
-                RepeatedDouble = { -12.25, 23.5 },
-                RepeatedFixed32 = { uint.MaxValue, 23 },
-                RepeatedFixed64 = { ulong.MaxValue, 1234567890123 },
-                RepeatedFloat = { 100f, 12.25f },
-                RepeatedInt32 = { 100, 200 },
-                RepeatedInt64 = { 3210987654321, long.MaxValue },
-                RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg },
-                RepeatedSfixed32 = { -123, 123 },
-                RepeatedSfixed64 = { -12345678901234, 12345678901234 },
-                RepeatedSint32 = { -456, 100 },
-                RepeatedSint64 = { -12345678901235, 123 },
-                RepeatedString = { "foo", "bar" },
-                RepeatedUint32 = { uint.MaxValue, uint.MinValue },
-                RepeatedUint64 = { ulong.MaxValue, uint.MinValue }
-            };
-
-            var clone = original.Clone();
-            Assert.AreNotSame(original, clone);
-            Assert.AreEqual(original, clone);
-            // Just as a single example
-            clone.RepeatedDouble.Add(25.5);
-            Assert.AreNotEqual(original, clone);
-        }
-
-        [Test]
-        public void CloneSingleMessageField()
-        {
-            var original = new TestAllTypes
-            {
-                SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 }
-            };
-
-            var clone = original.Clone();
-            Assert.AreNotSame(original, clone);
-            Assert.AreNotSame(original.SingleNestedMessage, clone.SingleNestedMessage);
-            Assert.AreEqual(original, clone);
-
-            clone.SingleNestedMessage.Bb = 30;
-            Assert.AreNotEqual(original, clone);
-        }
-
-        [Test]
-        public void CloneRepeatedMessageField()
-        {
-            var original = new TestAllTypes
-            {
-                RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 20 } }
-            };
-
-            var clone = original.Clone();
-            Assert.AreNotSame(original, clone);
-            Assert.AreNotSame(original.RepeatedNestedMessage, clone.RepeatedNestedMessage);
-            Assert.AreNotSame(original.RepeatedNestedMessage[0], clone.RepeatedNestedMessage[0]);
-            Assert.AreEqual(original, clone);
-
-            clone.RepeatedNestedMessage[0].Bb = 30;
-            Assert.AreNotEqual(original, clone);
-        }
-
-        [Test]
-        public void CloneOneofField()
-        {
-            var original = new TestAllTypes
-            {
-                OneofNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 }
-            };
-
-            var clone = original.Clone();
-            Assert.AreNotSame(original, clone);
-            Assert.AreEqual(original, clone);
-
-            // We should have cloned the message
-            original.OneofNestedMessage.Bb = 30;
-            Assert.AreNotEqual(original, clone);
-        }
-
-        [Test]
-        public void OneofProperties()
-        {
-            // Switch the oneof case between each of the different options, and check everything behaves
-            // as expected in each case.
-            var message = new TestAllTypes();
-            Assert.AreEqual("", message.OneofString);
-            Assert.AreEqual(0, message.OneofUint32);
-            Assert.AreEqual(ByteString.Empty, message.OneofBytes);
-            Assert.IsNull(message.OneofNestedMessage);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
-
-            message.OneofString = "sample";
-            Assert.AreEqual("sample", message.OneofString);
-            Assert.AreEqual(0, message.OneofUint32);
-            Assert.AreEqual(ByteString.Empty, message.OneofBytes);
-            Assert.IsNull(message.OneofNestedMessage);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase);
-
-            var bytes = ByteString.CopyFrom(1, 2, 3);
-            message.OneofBytes = bytes;
-            Assert.AreEqual("", message.OneofString);
-            Assert.AreEqual(0, message.OneofUint32);
-            Assert.AreEqual(bytes, message.OneofBytes);
-            Assert.IsNull(message.OneofNestedMessage);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase);
-
-            message.OneofUint32 = 20;
-            Assert.AreEqual("", message.OneofString);
-            Assert.AreEqual(20, message.OneofUint32);
-            Assert.AreEqual(ByteString.Empty, message.OneofBytes);
-            Assert.IsNull(message.OneofNestedMessage);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase);
-
-            var nestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 25 };
-            message.OneofNestedMessage = nestedMessage;
-            Assert.AreEqual("", message.OneofString);
-            Assert.AreEqual(0, message.OneofUint32);
-            Assert.AreEqual(ByteString.Empty, message.OneofBytes);
-            Assert.AreEqual(nestedMessage, message.OneofNestedMessage);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase);
-
-            message.ClearOneofField();
-            Assert.AreEqual("", message.OneofString);
-            Assert.AreEqual(0, message.OneofUint32);
-            Assert.AreEqual(ByteString.Empty, message.OneofBytes);
-            Assert.IsNull(message.OneofNestedMessage);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
-        }
-
-        [Test]
-        public void Oneof_DefaultValuesNotEqual()
-        {
-            var message1 = new TestAllTypes { OneofString = "" };
-            var message2 = new TestAllTypes { OneofUint32 = 0 };
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message1.OneofFieldCase);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase);
-            Assert.AreNotEqual(message1, message2);
-        }
-
-        [Test]
-        public void OneofSerialization_NonDefaultValue()
-        {
-            var message = new TestAllTypes();
-            message.OneofString = "this would take a bit of space";
-            message.OneofUint32 = 10;
-            var bytes = message.ToByteArray();
-            Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - no string!
-
-            var message2 = TestAllTypes.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, message2);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase);
-        }
-
-        [Test]
-        public void OneofSerialization_DefaultValue()
-        {
-            var message = new TestAllTypes();
-            message.OneofString = "this would take a bit of space";
-            message.OneofUint32 = 0; // This is the default value for UInt32; normally wouldn't be serialized
-            var bytes = message.ToByteArray();
-            Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - it's still serialized
-
-            var message2 = TestAllTypes.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, message2);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase);
-        }
-
-        [Test]
-        public void IgnoreUnknownFields_RealDataStillRead()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            var unusedFieldNumber = 23456;
-            Assert.IsFalse(TestAllTypes.Descriptor.Fields.InDeclarationOrder().Select(x => x.FieldNumber).Contains(unusedFieldNumber));
-            output.WriteTag(unusedFieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteString("ignore me");
-            message.WriteTo(output);
-            output.Flush();
-
-            stream.Position = 0;
-            var parsed = TestAllTypes.Parser.ParseFrom(stream);
-            Assert.AreEqual(message, parsed);
-        }
-
-        [Test]
-        public void IgnoreUnknownFields_AllTypes()
-        {
-            // Simple way of ensuring we can skip all kinds of fields.
-            var data = SampleMessages.CreateFullTestAllTypes().ToByteArray();
-            var empty = Empty.Parser.ParseFrom(data);
-            Assert.AreEqual(new Empty(), empty);
-        }
-
-        // This was originally seen as a conformance test failure.
-        [Test]
-        public void TruncatedMessageFieldThrows()
-        {
-            // 130, 3 is the message tag
-            // 1 is the data length - but there's no data.
-            var data = new byte[] { 130, 3, 1 };
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(data));
-        }
-
-        /// <summary>
-        /// Demonstrates current behaviour with an extraneous end group tag - see issue 688
-        /// for details; we may want to change this.
-        /// </summary>
-        [Test]
-        public void ExtraEndGroupThrows()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-
-            output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32);
-            output.WriteFixed32(123);
-            output.WriteTag(100, WireFormat.WireType.EndGroup);
-
-            output.Flush();
-
-            stream.Position = 0;
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(stream));
-        }
-
-        [Test]
-        public void CustomDiagnosticMessage_DirectToStringCall()
-        {
-            var message = new ForeignMessage { C = 31 };
-            Assert.AreEqual("{ \"c\": 31, \"@cInHex\": \"1f\" }", message.ToString());
-            Assert.AreEqual("{ \"c\": 31 }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void CustomDiagnosticMessage_Nested()
-        {
-            var message = new TestAllTypes { SingleForeignMessage = new ForeignMessage { C = 16 } };
-            Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16, \"@cInHex\": \"10\" } }", message.ToString());
-            Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16 } }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void CustomDiagnosticMessage_DirectToTextWriterCall()
-        {
-            var message = new ForeignMessage { C = 31 };
-            var writer = new StringWriter();
-            JsonFormatter.Default.Format(message, writer);
-            Assert.AreEqual("{ \"c\": 31 }", writer.ToString());
-        }
-    }
-}

+ 0 - 19
csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>580eb013-d3c7-4578-b845-015f4a3b0591</ProjectGuid>
-    <RootNamespace>Google.Protobuf.Test</RootNamespace>
-    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
-    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>

+ 0 - 82
csharp/src/Google.Protobuf.Test/IssuesTest.cs

@@ -1,82 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Reflection;
-using UnitTest.Issues.TestProtos;
-using NUnit.Framework;
-
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Tests for issues which aren't easily compartmentalized into other unit tests.
-    /// </summary>
-    public class IssuesTest
-    {
-        // Issue 45
-        [Test]
-        public void FieldCalledItem()
-        {
-            ItemField message = new ItemField { Item = 3 };
-            FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
-            Assert.NotNull(field);
-            Assert.AreEqual(3, (int)field.Accessor.GetValue(message));
-        }
-
-        [Test]
-        public void ReservedNames()
-        {
-            var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 };
-            // Underscores aren't reflected in the JSON.
-            Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString());
-        }
-
-        [Test]
-        public void JsonNameParseTest()
-        {
-            var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor));
-            var parser = new JsonParser(settings);
-
-            // It is safe to use either original field name or explicitly specified json_name
-            Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" },
-                parser.Parse<TestJsonName>("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }"));
-        }
-
-        [Test]
-        public void JsonNameFormatTest()
-        {
-            var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" };
-            Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }",
-                JsonFormatter.Default.Format(message));
-        }
-    }
-}

+ 0 - 589
csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs

@@ -1,589 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.TestProtos;
-using NUnit.Framework;
-using UnitTest.Issues.TestProtos;
-using Google.Protobuf.WellKnownTypes;
-using Google.Protobuf.Reflection;
-
-using static Google.Protobuf.JsonParserTest; // For WrapInQuotes
-using System.IO;
-using Google.Protobuf.Collections;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Tests for the JSON formatter. Note that in these tests, double quotes are replaced with apostrophes
-    /// for the sake of readability (embedding \" everywhere is painful). See the AssertJson method for details.
-    /// </summary>
-    public class JsonFormatterTest
-    {
-        [Test]
-        public void DefaultValues_WhenOmitted()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(formatDefaultValues: false));
-
-            AssertJson("{ }", formatter.Format(new ForeignMessage()));
-            AssertJson("{ }", formatter.Format(new TestAllTypes()));
-            AssertJson("{ }", formatter.Format(new TestMap()));
-        }
-
-        [Test]
-        public void DefaultValues_WhenIncluded()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(formatDefaultValues: true));
-            AssertJson("{ 'c': 0 }", formatter.Format(new ForeignMessage()));
-        }
-
-        [Test]
-        public void AllSingleFields()
-        {
-            var message = new TestAllTypes
-            {
-                SingleBool = true,
-                SingleBytes = ByteString.CopyFrom(1, 2, 3, 4),
-                SingleDouble = 23.5,
-                SingleFixed32 = 23,
-                SingleFixed64 = 1234567890123,
-                SingleFloat = 12.25f,
-                SingleForeignEnum = ForeignEnum.ForeignBar,
-                SingleForeignMessage = new ForeignMessage { C = 10 },
-                SingleImportEnum = ImportEnum.ImportBaz,
-                SingleImportMessage = new ImportMessage { D = 20 },
-                SingleInt32 = 100,
-                SingleInt64 = 3210987654321,
-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,
-                SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 },
-                SinglePublicImportMessage = new PublicImportMessage { E = 54 },
-                SingleSfixed32 = -123,
-                SingleSfixed64 = -12345678901234,
-                SingleSint32 = -456,
-                SingleSint64 = -12345678901235,
-                SingleString = "test\twith\ttabs",
-                SingleUint32 = uint.MaxValue,
-                SingleUint64 = ulong.MaxValue,
-            };
-            var actualText = JsonFormatter.Default.Format(message);
-
-            // Fields in numeric order
-            var expectedText = "{ " +
-                "'singleInt32': 100, " +
-                "'singleInt64': '3210987654321', " +
-                "'singleUint32': 4294967295, " +
-                "'singleUint64': '18446744073709551615', " +
-                "'singleSint32': -456, " +
-                "'singleSint64': '-12345678901235', " +
-                "'singleFixed32': 23, " +
-                "'singleFixed64': '1234567890123', " +
-                "'singleSfixed32': -123, " +
-                "'singleSfixed64': '-12345678901234', " +
-                "'singleFloat': 12.25, " +
-                "'singleDouble': 23.5, " +
-                "'singleBool': true, " +
-                "'singleString': 'test\\twith\\ttabs', " +
-                "'singleBytes': 'AQIDBA==', " +
-                "'singleNestedMessage': { 'bb': 35 }, " +
-                "'singleForeignMessage': { 'c': 10 }, " +
-                "'singleImportMessage': { 'd': 20 }, " +
-                "'singleNestedEnum': 'FOO', " +
-                "'singleForeignEnum': 'FOREIGN_BAR', " +
-                "'singleImportEnum': 'IMPORT_BAZ', " +
-                "'singlePublicImportMessage': { 'e': 54 }" +
-                " }";
-            AssertJson(expectedText, actualText);
-        }
-
-        [Test]
-        public void RepeatedField()
-        {
-            AssertJson("{ 'repeatedInt32': [ 1, 2, 3, 4, 5 ] }",
-                JsonFormatter.Default.Format(new TestAllTypes { RepeatedInt32 = { 1, 2, 3, 4, 5 } }));
-        }
-
-        [Test]
-        public void MapField_StringString()
-        {
-            AssertJson("{ 'mapStringString': { 'with spaces': 'bar', 'a': 'b' } }",
-                JsonFormatter.Default.Format(new TestMap { MapStringString = { { "with spaces", "bar" }, { "a", "b" } } }));
-        }
-
-        [Test]
-        public void MapField_Int32Int32()
-        {
-            // The keys are quoted, but the values aren't.
-            AssertJson("{ 'mapInt32Int32': { '0': 1, '2': 3 } }",
-                JsonFormatter.Default.Format(new TestMap { MapInt32Int32 = { { 0, 1 }, { 2, 3 } } }));
-        }
-
-        [Test]
-        public void MapField_BoolBool()
-        {
-            // The keys are quoted, but the values aren't.
-            AssertJson("{ 'mapBoolBool': { 'false': true, 'true': false } }",
-                JsonFormatter.Default.Format(new TestMap { MapBoolBool = { { false, true }, { true, false } } }));
-        }
-
-        [TestCase(1.0, "1")]
-        [TestCase(double.NaN, "'NaN'")]
-        [TestCase(double.PositiveInfinity, "'Infinity'")]
-        [TestCase(double.NegativeInfinity, "'-Infinity'")]
-        public void DoubleRepresentations(double value, string expectedValueText)
-        {
-            var message = new TestAllTypes { SingleDouble = value };
-            string actualText = JsonFormatter.Default.Format(message);
-            string expectedText = "{ 'singleDouble': " + expectedValueText + " }";
-            AssertJson(expectedText, actualText);
-        }
-
-        [Test]
-        public void UnknownEnumValueNumeric_SingleField()
-        {
-            var message = new TestAllTypes { SingleForeignEnum = (ForeignEnum) 100 };
-            AssertJson("{ 'singleForeignEnum': 100 }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void UnknownEnumValueNumeric_RepeatedField()
-        {
-            var message = new TestAllTypes { RepeatedForeignEnum = { ForeignEnum.ForeignBaz, (ForeignEnum) 100, ForeignEnum.ForeignFoo } };
-            AssertJson("{ 'repeatedForeignEnum': [ 'FOREIGN_BAZ', 100, 'FOREIGN_FOO' ] }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void UnknownEnumValueNumeric_MapField()
-        {
-            var message = new TestMap { MapInt32Enum = { { 1, MapEnum.Foo }, { 2, (MapEnum) 100 }, { 3, MapEnum.Bar } } };
-            AssertJson("{ 'mapInt32Enum': { '1': 'MAP_ENUM_FOO', '2': 100, '3': 'MAP_ENUM_BAR' } }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void UnknownEnumValue_RepeatedField_AllEntriesUnknown()
-        {
-            var message = new TestAllTypes { RepeatedForeignEnum = { (ForeignEnum) 200, (ForeignEnum) 100 } };
-            AssertJson("{ 'repeatedForeignEnum': [ 200, 100 ] }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        [TestCase("a\u17b4b", "a\\u17b4b")] // Explicit
-        [TestCase("a\u0601b", "a\\u0601b")] // Ranged
-        [TestCase("a\u0605b", "a\u0605b")] // Passthrough (note lack of double backslash...)
-        public void SimpleNonAscii(string text, string encoded)
-        {
-            var message = new TestAllTypes { SingleString = text };
-            AssertJson("{ 'singleString': '" + encoded + "' }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void SurrogatePairEscaping()
-        {
-            var message = new TestAllTypes { SingleString = "a\uD801\uDC01b" };
-            AssertJson("{ 'singleString': 'a\\ud801\\udc01b' }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void InvalidSurrogatePairsFail()
-        {
-            // Note: don't use TestCase for these, as the strings can't be reliably represented 
-            // See http://codeblog.jonskeet.uk/2014/11/07/when-is-a-string-not-a-string/
-
-            // Lone low surrogate
-            var message = new TestAllTypes { SingleString = "a\uDC01b" };
-            Assert.Throws<ArgumentException>(() => JsonFormatter.Default.Format(message));
-
-            // Lone high surrogate
-            message = new TestAllTypes { SingleString = "a\uD801b" };
-            Assert.Throws<ArgumentException>(() => JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        [TestCase("foo_bar", "fooBar")]
-        [TestCase("bananaBanana", "bananaBanana")]
-        [TestCase("BANANABanana", "bananaBanana")]
-        public void ToCamelCase(string original, string expected)
-        {
-            Assert.AreEqual(expected, JsonFormatter.ToCamelCase(original));
-        }
-
-        [Test]
-        [TestCase(null, "{ }")]
-        [TestCase("x", "{ 'fooString': 'x' }")]
-        [TestCase("", "{ 'fooString': '' }")]
-        public void Oneof(string fooStringValue, string expectedJson)
-        {
-            var message = new TestOneof();
-            if (fooStringValue != null)
-            {
-                message.FooString = fooStringValue;
-            }
-
-            // We should get the same result both with and without "format default values".
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false));
-            AssertJson(expectedJson, formatter.Format(message));
-            formatter = new JsonFormatter(new JsonFormatter.Settings(true));
-            AssertJson(expectedJson, formatter.Format(message));
-        }
-
-        [Test]
-        public void WrapperFormatting_Single()
-        {
-            // Just a few examples, handling both classes and value types, and
-            // default vs non-default values
-            var message = new TestWellKnownTypes
-            {
-                Int64Field = 10,
-                Int32Field = 0,
-                BytesField = ByteString.FromBase64("ABCD"),
-                StringField = ""
-            };
-            var expectedJson = "{ 'int64Field': '10', 'int32Field': 0, 'stringField': '', 'bytesField': 'ABCD' }";
-            AssertJson(expectedJson, JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void WrapperFormatting_Message()
-        {
-            Assert.AreEqual("\"\"", JsonFormatter.Default.Format(new StringValue()));
-            Assert.AreEqual("0", JsonFormatter.Default.Format(new Int32Value()));
-        }
-
-        [Test]
-        public void WrapperFormatting_IncludeNull()
-        {
-            // The actual JSON here is very large because there are lots of fields. Just test a couple of them.
-            var message = new TestWellKnownTypes { Int32Field = 10 };
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(true));
-            var actualJson = formatter.Format(message);
-            Assert.IsTrue(actualJson.Contains("\"int64Field\": null"));
-            Assert.IsFalse(actualJson.Contains("\"int32Field\": null"));
-        }
-
-        [Test]
-        public void OutputIsInNumericFieldOrder_NoDefaults()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false));
-            var message = new TestJsonFieldOrdering { PlainString = "p1", PlainInt32 = 2 };
-            AssertJson("{ 'plainString': 'p1', 'plainInt32': 2 }", formatter.Format(message));
-            message = new TestJsonFieldOrdering { O1Int32 = 5, O2String = "o2", PlainInt32 = 10, PlainString = "plain" };
-            AssertJson("{ 'plainString': 'plain', 'o2String': 'o2', 'plainInt32': 10, 'o1Int32': 5 }", formatter.Format(message));
-            message = new TestJsonFieldOrdering { O1String = "", O2Int32 = 0, PlainInt32 = 10, PlainString = "plain" };
-            AssertJson("{ 'plainString': 'plain', 'o1String': '', 'plainInt32': 10, 'o2Int32': 0 }", formatter.Format(message));
-        }
-
-        [Test]
-        public void OutputIsInNumericFieldOrder_WithDefaults()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(true));
-            var message = new TestJsonFieldOrdering();
-            AssertJson("{ 'plainString': '', 'plainInt32': 0 }", formatter.Format(message));
-            message = new TestJsonFieldOrdering { O1Int32 = 5, O2String = "o2", PlainInt32 = 10, PlainString = "plain" };
-            AssertJson("{ 'plainString': 'plain', 'o2String': 'o2', 'plainInt32': 10, 'o1Int32': 5 }", formatter.Format(message));
-            message = new TestJsonFieldOrdering { O1String = "", O2Int32 = 0, PlainInt32 = 10, PlainString = "plain" };
-            AssertJson("{ 'plainString': 'plain', 'o1String': '', 'plainInt32': 10, 'o2Int32': 0 }", formatter.Format(message));
-        }
-
-        [Test]
-        [TestCase("1970-01-01T00:00:00Z", 0)]
-        [TestCase("1970-01-01T00:00:00.000000001Z", 1)]
-        [TestCase("1970-01-01T00:00:00.000000010Z", 10)]
-        [TestCase("1970-01-01T00:00:00.000000100Z", 100)]
-        [TestCase("1970-01-01T00:00:00.000001Z", 1000)]
-        [TestCase("1970-01-01T00:00:00.000010Z", 10000)]
-        [TestCase("1970-01-01T00:00:00.000100Z", 100000)]
-        [TestCase("1970-01-01T00:00:00.001Z", 1000000)]
-        [TestCase("1970-01-01T00:00:00.010Z", 10000000)]
-        [TestCase("1970-01-01T00:00:00.100Z", 100000000)]
-        [TestCase("1970-01-01T00:00:00.120Z", 120000000)]
-        [TestCase("1970-01-01T00:00:00.123Z", 123000000)]
-        [TestCase("1970-01-01T00:00:00.123400Z", 123400000)]
-        [TestCase("1970-01-01T00:00:00.123450Z", 123450000)]
-        [TestCase("1970-01-01T00:00:00.123456Z", 123456000)]
-        [TestCase("1970-01-01T00:00:00.123456700Z", 123456700)]
-        [TestCase("1970-01-01T00:00:00.123456780Z", 123456780)]
-        [TestCase("1970-01-01T00:00:00.123456789Z", 123456789)]
-        public void TimestampStandalone(string expected, int nanos)
-        {
-            Assert.AreEqual(WrapInQuotes(expected), new Timestamp { Nanos = nanos }.ToString());
-        }
-
-        [Test]
-        public void TimestampStandalone_FromDateTime()
-        {
-            // One before and one after the Unix epoch, more easily represented via DateTime.
-            Assert.AreEqual("\"1673-06-19T12:34:56Z\"",
-                new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp().ToString());
-            Assert.AreEqual("\"2015-07-31T10:29:34Z\"",
-                new DateTime(2015, 7, 31, 10, 29, 34, DateTimeKind.Utc).ToTimestamp().ToString());
-        }
-
-        [Test]
-        [TestCase(-1, -1)] // Would be valid as duration
-        [TestCase(1, Timestamp.MaxNanos + 1)]
-        [TestCase(Timestamp.UnixSecondsAtBclMaxValue + 1, 0)]
-        [TestCase(Timestamp.UnixSecondsAtBclMinValue - 1, 0)]
-        public void TimestampStandalone_NonNormalized(long seconds, int nanoseconds)
-        {
-            var timestamp = new Timestamp { Seconds = seconds, Nanos = nanoseconds };
-            Assert.Throws<InvalidOperationException>(() => JsonFormatter.Default.Format(timestamp));
-        }
-
-        [Test]
-        public void TimestampField()
-        {
-            var message = new TestWellKnownTypes { TimestampField = new Timestamp() };
-            AssertJson("{ 'timestampField': '1970-01-01T00:00:00Z' }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        [TestCase(0, 0, "0s")]
-        [TestCase(1, 0, "1s")]
-        [TestCase(-1, 0, "-1s")]
-        [TestCase(0, 1, "0.000000001s")]
-        [TestCase(0, 10, "0.000000010s")]
-        [TestCase(0, 100, "0.000000100s")]
-        [TestCase(0, 1000, "0.000001s")]
-        [TestCase(0, 10000, "0.000010s")]
-        [TestCase(0, 100000, "0.000100s")]
-        [TestCase(0, 1000000, "0.001s")]
-        [TestCase(0, 10000000, "0.010s")]
-        [TestCase(0, 100000000, "0.100s")]
-        [TestCase(0, 120000000, "0.120s")]
-        [TestCase(0, 123000000, "0.123s")]
-        [TestCase(0, 123400000, "0.123400s")]
-        [TestCase(0, 123450000, "0.123450s")]
-        [TestCase(0, 123456000, "0.123456s")]
-        [TestCase(0, 123456700, "0.123456700s")]
-        [TestCase(0, 123456780, "0.123456780s")]
-        [TestCase(0, 123456789, "0.123456789s")]
-        [TestCase(0, -100000000, "-0.100s")]
-        [TestCase(1, 100000000, "1.100s")]
-        [TestCase(-1, -100000000, "-1.100s")]
-        public void DurationStandalone(long seconds, int nanoseconds, string expected)
-        {
-            var json = JsonFormatter.Default.Format(new Duration { Seconds = seconds, Nanos = nanoseconds });
-            Assert.AreEqual(WrapInQuotes(expected), json);
-        }
-
-        [Test]
-        [TestCase(1, 2123456789)]
-        [TestCase(1, -100000000)]
-        public void DurationStandalone_NonNormalized(long seconds, int nanoseconds)
-        {
-            var duration = new Duration { Seconds = seconds, Nanos = nanoseconds };
-            Assert.Throws<InvalidOperationException>(() => JsonFormatter.Default.Format(duration));
-        }
-
-        [Test]
-        public void DurationField()
-        {
-            var message = new TestWellKnownTypes { DurationField = new Duration() };
-            AssertJson("{ 'durationField': '0s' }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void StructSample()
-        {
-            var message = new Struct
-            {
-                Fields =
-                {
-                    { "a", Value.ForNull() },
-                    { "b", Value.ForBool(false) },
-                    { "c", Value.ForNumber(10.5) },
-                    { "d", Value.ForString("text") },
-                    { "e", Value.ForList(Value.ForString("t1"), Value.ForNumber(5)) },
-                    { "f", Value.ForStruct(new Struct { Fields = { { "nested", Value.ForString("value") } } }) }
-                }
-            };
-            AssertJson("{ 'a': null, 'b': false, 'c': 10.5, 'd': 'text', 'e': [ 't1', 5 ], 'f': { 'nested': 'value' } }", message.ToString());
-        }
-
-        [Test]
-        [TestCase("foo__bar")]
-        [TestCase("foo_3_ar")]
-        [TestCase("fooBar")]
-        public void FieldMaskInvalid(string input)
-        {
-            var mask = new FieldMask { Paths = { input } };
-            Assert.Throws<InvalidOperationException>(() => JsonFormatter.Default.Format(mask));
-        }
-
-        [Test]
-        public void FieldMaskStandalone()
-        {
-            var fieldMask = new FieldMask { Paths = { "", "single", "with_underscore", "nested.field.name", "nested..double_dot" } };
-            Assert.AreEqual("\",single,withUnderscore,nested.field.name,nested..doubleDot\"", fieldMask.ToString());
-
-            // Invalid, but we shouldn't create broken JSON...
-            fieldMask = new FieldMask { Paths = { "x\\y" } };
-            Assert.AreEqual(@"""x\\y""", fieldMask.ToString());
-        }
-
-        [Test]
-        public void FieldMaskField()
-        {
-            var message = new TestWellKnownTypes { FieldMaskField = new FieldMask { Paths = { "user.display_name", "photo" } } };
-            AssertJson("{ 'fieldMaskField': 'user.displayName,photo' }", JsonFormatter.Default.Format(message));
-        }
-
-        // SourceContext is an example of a well-known type with no special JSON handling
-        [Test]
-        public void SourceContextStandalone()
-        {
-            var message = new SourceContext { FileName = "foo.proto" };
-            AssertJson("{ 'fileName': 'foo.proto' }", JsonFormatter.Default.Format(message));
-        }
-
-        [Test]
-        public void AnyWellKnownType()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(Timestamp.Descriptor)));
-            var timestamp = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp();
-            var any = Any.Pack(timestamp);
-            AssertJson("{ '@type': 'type.googleapis.com/google.protobuf.Timestamp', 'value': '1673-06-19T12:34:56Z' }", formatter.Format(any));
-        }
-
-        [Test]
-        public void AnyMessageType()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor)));
-            var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } };
-            var any = Any.Pack(message);
-            AssertJson("{ '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 10, 'singleNestedMessage': { 'bb': 20 } }", formatter.Format(any));
-        }
-
-        [Test]
-        public void AnyMessageType_CustomPrefix()
-        {
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor)));
-            var message = new TestAllTypes { SingleInt32 = 10 };
-            var any = Any.Pack(message, "foo.bar/baz");
-            AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any));
-        }
-
-        [Test]
-        public void AnyNested()
-        {
-            var registry = TypeRegistry.FromMessages(TestWellKnownTypes.Descriptor, TestAllTypes.Descriptor);
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry));
-
-            // Nest an Any as the value of an Any.
-            var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 };
-            var nestedMessage = Any.Pack(doubleNestedMessage);
-            var message = new TestWellKnownTypes { AnyField = Any.Pack(nestedMessage) };
-            AssertJson("{ 'anyField': { '@type': 'type.googleapis.com/google.protobuf.Any', 'value': { '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 20 } } }",
-                formatter.Format(message));
-        }
-
-        [Test]
-        public void AnyUnknownType()
-        {
-            // The default type registry doesn't have any types in it.
-            var message = new TestAllTypes();
-            var any = Any.Pack(message);
-            Assert.Throws<InvalidOperationException>(() => JsonFormatter.Default.Format(any));
-        }
-
-        [Test]
-        [TestCase(typeof(BoolValue), true, "true")]
-        [TestCase(typeof(Int32Value), 32, "32")]
-        [TestCase(typeof(Int64Value), 32L, "\"32\"")]
-        [TestCase(typeof(UInt32Value), 32U, "32")]
-        [TestCase(typeof(UInt64Value), 32UL, "\"32\"")]
-        [TestCase(typeof(StringValue), "foo", "\"foo\"")]
-        [TestCase(typeof(FloatValue), 1.5f, "1.5")]
-        [TestCase(typeof(DoubleValue), 1.5d, "1.5")]
-        public void Wrappers_Standalone(System.Type wrapperType, object value, string expectedJson)
-        {
-            IMessage populated = (IMessage)Activator.CreateInstance(wrapperType);
-            populated.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber].Accessor.SetValue(populated, value);
-            Assert.AreEqual(expectedJson, JsonFormatter.Default.Format(populated));
-        }
-
-        // Sanity tests for WriteValue. Not particularly comprehensive, as it's all covered above already,
-        // as FormatMessage uses WriteValue.
-
-        [TestCase(null, "null")]
-        [TestCase(1, "1")]
-        [TestCase(1L, "'1'")]
-        [TestCase(0.5f, "0.5")]
-        [TestCase(0.5d, "0.5")]
-        [TestCase("text", "'text'")]
-        [TestCase("x\ny", @"'x\ny'")]
-        [TestCase(ForeignEnum.ForeignBar, "'FOREIGN_BAR'")]
-        public void WriteValue_Constant(object value, string expectedJson)
-        {
-            AssertWriteValue(value, expectedJson);
-        }
-
-        [Test]
-        public void WriteValue_Timestamp()
-        {
-            var value = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp();
-            AssertWriteValue(value, "'1673-06-19T12:34:56Z'");
-        }
-
-        [Test]
-        public void WriteValue_Message()
-        {
-            var value = new TestAllTypes { SingleInt32 = 100, SingleInt64 = 3210987654321L };
-            AssertWriteValue(value, "{ 'singleInt32': 100, 'singleInt64': '3210987654321' }");
-        }
-
-        [Test]
-        public void WriteValue_List()
-        {
-            var value = new RepeatedField<int> { 1, 2, 3 };
-            AssertWriteValue(value, "[ 1, 2, 3 ]");
-        }
-
-        private static void AssertWriteValue(object value, string expectedJson)
-        {
-            var writer = new StringWriter();
-            JsonFormatter.Default.WriteValue(writer, value);
-            string actual = writer.ToString();
-            AssertJson(expectedJson, actual);
-        }
-
-        /// <summary>
-        /// Checks that the actual JSON is the same as the expected JSON - but after replacing
-        /// all apostrophes in the expected JSON with double quotes. This basically makes the tests easier
-        /// to read.
-        /// </summary>
-        private static void AssertJson(string expectedJsonWithApostrophes, string actualJson)
-        {
-            var expectedJson = expectedJsonWithApostrophes.Replace("'", "\"");
-            Assert.AreEqual(expectedJson, actualJson);
-        }
-    }
-}

+ 0 - 939
csharp/src/Google.Protobuf.Test/JsonParserTest.cs

@@ -1,939 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Reflection;
-using Google.Protobuf.TestProtos;
-using Google.Protobuf.WellKnownTypes;
-using NUnit.Framework;
-using System;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Unit tests for JSON parsing.
-    /// </summary>
-    public class JsonParserTest
-    {
-        // Sanity smoke test
-        [Test]
-        public void AllTypesRoundtrip()
-        {
-            AssertRoundtrip(SampleMessages.CreateFullTestAllTypes());
-        }
-
-        [Test]
-        public void Maps()
-        {
-            AssertRoundtrip(new TestMap { MapStringString = { { "with spaces", "bar" }, { "a", "b" } } });
-            AssertRoundtrip(new TestMap { MapInt32Int32 = { { 0, 1 }, { 2, 3 } } });
-            AssertRoundtrip(new TestMap { MapBoolBool = { { false, true }, { true, false } } });
-        }
-
-        [Test]
-        [TestCase(" 1 ")]
-        [TestCase("+1")]
-        [TestCase("1,000")]
-        [TestCase("1.5")]
-        public void IntegerMapKeysAreStrict(string keyText)
-        {
-            // Test that integer parsing is strict. We assume that if this is correct for int32,
-            // it's correct for other numeric key types.
-            var json = "{ \"mapInt32Int32\": { \"" + keyText + "\" : \"1\" } }";
-            Assert.Throws<InvalidProtocolBufferException>(() => JsonParser.Default.Parse<TestMap>(json));
-        }
-
-        [Test]
-        public void OriginalFieldNameAccepted()
-        {
-            var json = "{ \"single_int32\": 10 }";
-            var expected = new TestAllTypes { SingleInt32 = 10 };
-            Assert.AreEqual(expected, TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void SourceContextRoundtrip()
-        {
-            AssertRoundtrip(new SourceContext { FileName = "foo.proto" });
-        }
-
-        [Test]
-        public void SingularWrappers_DefaultNonNullValues()
-        {
-            var message = new TestWellKnownTypes
-            {
-                StringField = "",
-                BytesField = ByteString.Empty,
-                BoolField = false,
-                FloatField = 0f,
-                DoubleField = 0d,
-                Int32Field = 0,
-                Int64Field = 0,
-                Uint32Field = 0,
-                Uint64Field = 0
-            };
-            AssertRoundtrip(message);
-        }
-
-        [Test]
-        public void SingularWrappers_NonDefaultValues()
-        {
-            var message = new TestWellKnownTypes
-            {
-                StringField = "x",
-                BytesField = ByteString.CopyFrom(1, 2, 3),
-                BoolField = true,
-                FloatField = 12.5f,
-                DoubleField = 12.25d,
-                Int32Field = 1,
-                Int64Field = 2,
-                Uint32Field = 3,
-                Uint64Field = 4
-            };
-            AssertRoundtrip(message);
-        }
-
-        [Test]
-        public void SingularWrappers_ExplicitNulls()
-        {
-            // When we parse the "valueField": null part, we remember it... basically, it's one case
-            // where explicit default values don't fully roundtrip.
-            var message = new TestWellKnownTypes { ValueField = Value.ForNull() };
-            var json = new JsonFormatter(new JsonFormatter.Settings(true)).Format(message);
-            var parsed = JsonParser.Default.Parse<TestWellKnownTypes>(json);
-            Assert.AreEqual(message, parsed);
-        }
-
-        [Test]
-        [TestCase(typeof(BoolValue), "true", true)]
-        [TestCase(typeof(Int32Value), "32", 32)]
-        [TestCase(typeof(Int64Value), "32", 32L)]
-        [TestCase(typeof(Int64Value), "\"32\"", 32L)]
-        [TestCase(typeof(UInt32Value), "32", 32U)]
-        [TestCase(typeof(UInt64Value), "\"32\"", 32UL)]
-        [TestCase(typeof(UInt64Value), "32", 32UL)]
-        [TestCase(typeof(StringValue), "\"foo\"", "foo")]
-        [TestCase(typeof(FloatValue), "1.5", 1.5f)]
-        [TestCase(typeof(DoubleValue), "1.5", 1.5d)]
-        public void Wrappers_Standalone(System.Type wrapperType, string json, object expectedValue)
-        {
-            IMessage parsed = (IMessage)Activator.CreateInstance(wrapperType);
-            IMessage expected = (IMessage)Activator.CreateInstance(wrapperType);
-            JsonParser.Default.Merge(parsed, "null");
-            Assert.AreEqual(expected, parsed);
-
-            JsonParser.Default.Merge(parsed, json);
-            expected.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber].Accessor.SetValue(expected, expectedValue);
-            Assert.AreEqual(expected, parsed);
-        }
-
-        [Test]
-        public void ExplicitNullValue()
-        {
-            string json = "{\"valueField\": null}";
-            var message = JsonParser.Default.Parse<TestWellKnownTypes>(json);
-            Assert.AreEqual(new TestWellKnownTypes { ValueField = Value.ForNull() }, message);
-        }
-
-        [Test]
-        public void BytesWrapper_Standalone()
-        {
-            ByteString data = ByteString.CopyFrom(1, 2, 3);
-            // Can't do this with attributes...
-            var parsed = JsonParser.Default.Parse<BytesValue>(WrapInQuotes(data.ToBase64()));
-            var expected = new BytesValue { Value = data };
-            Assert.AreEqual(expected, parsed);
-        }
-
-        [Test]
-        public void RepeatedWrappers()
-        {
-            var message = new RepeatedWellKnownTypes
-            {
-                BoolField = { true, false },
-                BytesField = { ByteString.CopyFrom(1, 2, 3), ByteString.CopyFrom(4, 5, 6), ByteString.Empty },
-                DoubleField = { 12.5, -1.5, 0d },
-                FloatField = { 123.25f, -20f, 0f },
-                Int32Field = { int.MaxValue, int.MinValue, 0 },
-                Int64Field = { long.MaxValue, long.MinValue, 0L },
-                StringField = { "First", "Second", "" },
-                Uint32Field = { uint.MaxValue, uint.MinValue, 0U },
-                Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL },
-            };
-            AssertRoundtrip(message);
-        }
-
-        [Test]
-        public void RepeatedField_NullElementProhibited()
-        {
-            string json = "{ \"repeated_foreign_message\": [null] }";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void RepeatedField_NullOverallValueAllowed()
-        {
-            string json = "{ \"repeated_foreign_message\": null }";
-            Assert.AreEqual(new TestAllTypes(), TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("{ \"mapInt32Int32\": { \"10\": null }")]
-        [TestCase("{ \"mapStringString\": { \"abc\": null }")]
-        [TestCase("{ \"mapInt32ForeignMessage\": { \"10\": null }")]
-        public void MapField_NullValueProhibited(string json)
-        {
-            Assert.Throws<InvalidProtocolBufferException>(() => TestMap.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void MapField_NullOverallValueAllowed()
-        {
-            string json = "{ \"mapInt32Int32\": null }";
-            Assert.AreEqual(new TestMap(), TestMap.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void IndividualWrapperTypes()
-        {
-            Assert.AreEqual(new StringValue { Value = "foo" }, StringValue.Parser.ParseJson("\"foo\""));
-            Assert.AreEqual(new Int32Value { Value = 1 }, Int32Value.Parser.ParseJson("1"));
-            // Can parse strings directly too
-            Assert.AreEqual(new Int32Value { Value = 1 }, Int32Value.Parser.ParseJson("\"1\""));
-        }
-
-        private static void AssertRoundtrip<T>(T message) where T : IMessage<T>, new()
-        {
-            var clone = message.Clone();
-            var json = JsonFormatter.Default.Format(message);
-            var parsed = JsonParser.Default.Parse<T>(json);
-            Assert.AreEqual(clone, parsed);
-        }
-
-        [Test]
-        [TestCase("0", 0)]
-        [TestCase("-0", 0)] // Not entirely clear whether we intend to allow this...
-        [TestCase("1", 1)]
-        [TestCase("-1", -1)]
-        [TestCase("2147483647", 2147483647)]
-        [TestCase("-2147483648", -2147483648)]
-        public void StringToInt32_Valid(string jsonValue, int expectedParsedValue)
-        {
-            string json = "{ \"singleInt32\": \"" + jsonValue + "\"}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleInt32);
-        }
-
-        [Test]
-        [TestCase("+0")]
-        [TestCase(" 1")]
-        [TestCase("1 ")]
-        [TestCase("00")]
-        [TestCase("-00")]
-        [TestCase("--1")]
-        [TestCase("+1")]
-        [TestCase("1.5")]
-        [TestCase("1e10")]
-        [TestCase("2147483648")]
-        [TestCase("-2147483649")]
-        public void StringToInt32_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleInt32\": \"" + jsonValue + "\"}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0U)]
-        [TestCase("1", 1U)]
-        [TestCase("4294967295", 4294967295U)]
-        public void StringToUInt32_Valid(string jsonValue, uint expectedParsedValue)
-        {
-            string json = "{ \"singleUint32\": \"" + jsonValue + "\"}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleUint32);
-        }
-
-        // Assume that anything non-bounds-related is covered in the Int32 case
-        [Test]
-        [TestCase("-1")]
-        [TestCase("4294967296")]
-        public void StringToUInt32_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleUint32\": \"" + jsonValue + "\"}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0L)]
-        [TestCase("1", 1L)]
-        [TestCase("-1", -1L)]
-        [TestCase("9223372036854775807", 9223372036854775807)]
-        [TestCase("-9223372036854775808", -9223372036854775808)]
-        public void StringToInt64_Valid(string jsonValue, long expectedParsedValue)
-        {
-            string json = "{ \"singleInt64\": \"" + jsonValue + "\"}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleInt64);
-        }
-
-        // Assume that anything non-bounds-related is covered in the Int32 case
-        [Test]
-        [TestCase("-9223372036854775809")]
-        [TestCase("9223372036854775808")]
-        public void StringToInt64_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleInt64\": \"" + jsonValue + "\"}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0UL)]
-        [TestCase("1", 1UL)]
-        [TestCase("18446744073709551615", 18446744073709551615)]
-        public void StringToUInt64_Valid(string jsonValue, ulong expectedParsedValue)
-        {
-            string json = "{ \"singleUint64\": \"" + jsonValue + "\"}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleUint64);
-        }
-
-        // Assume that anything non-bounds-related is covered in the Int32 case
-        [Test]
-        [TestCase("-1")]
-        [TestCase("18446744073709551616")]
-        public void StringToUInt64_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleUint64\": \"" + jsonValue + "\"}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0d)]
-        [TestCase("1", 1d)]
-        [TestCase("1.000000", 1d)]
-        [TestCase("1.0000000000000000000000001", 1d)] // We don't notice that we haven't preserved the exact value
-        [TestCase("-1", -1d)]
-        [TestCase("1e1", 10d)]
-        [TestCase("1e01", 10d)] // Leading decimals are allowed in exponents
-        [TestCase("1E1", 10d)] // Either case is fine
-        [TestCase("-1e1", -10d)]
-        [TestCase("1.5e1", 15d)]
-        [TestCase("-1.5e1", -15d)]
-        [TestCase("15e-1", 1.5d)]
-        [TestCase("-15e-1", -1.5d)]
-        [TestCase("1.79769e308", 1.79769e308)]
-        [TestCase("-1.79769e308", -1.79769e308)]
-        [TestCase("Infinity", double.PositiveInfinity)]
-        [TestCase("-Infinity", double.NegativeInfinity)]
-        [TestCase("NaN", double.NaN)]
-        public void StringToDouble_Valid(string jsonValue, double expectedParsedValue)
-        {
-            string json = "{ \"singleDouble\": \"" + jsonValue + "\"}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleDouble);
-        }
-
-        [Test]
-        [TestCase("1.7977e308")]
-        [TestCase("-1.7977e308")]
-        [TestCase("1e309")]
-        [TestCase("1,0")]
-        [TestCase("1.0.0")]
-        [TestCase("+1")]
-        [TestCase("00")]
-        [TestCase("01")]
-        [TestCase("-00")]
-        [TestCase("-01")]
-        [TestCase("--1")]
-        [TestCase(" Infinity")]
-        [TestCase(" -Infinity")]
-        [TestCase("NaN ")]
-        [TestCase("Infinity ")]
-        [TestCase("-Infinity ")]
-        [TestCase(" NaN")]
-        [TestCase("INFINITY")]
-        [TestCase("nan")]
-        [TestCase("\u00BD")] // 1/2 as a single Unicode character. Just sanity checking...
-        public void StringToDouble_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleDouble\": \"" + jsonValue + "\"}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0f)]
-        [TestCase("1", 1f)]
-        [TestCase("1.000000", 1f)]
-        [TestCase("-1", -1f)]
-        [TestCase("3.402823e38", 3.402823e38f)]
-        [TestCase("-3.402823e38", -3.402823e38f)]
-        [TestCase("1.5e1", 15f)]
-        [TestCase("15e-1", 1.5f)]
-        public void StringToFloat_Valid(string jsonValue, float expectedParsedValue)
-        {
-            string json = "{ \"singleFloat\": \"" + jsonValue + "\"}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleFloat);
-        }
-
-        [Test]
-        [TestCase("3.402824e38")]
-        [TestCase("-3.402824e38")]
-        [TestCase("1,0")]
-        [TestCase("1.0.0")]
-        [TestCase("+1")]
-        [TestCase("00")]
-        [TestCase("--1")]
-        public void StringToFloat_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleFloat\": \"" + jsonValue + "\"}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0)]
-        [TestCase("-0", 0)] // Not entirely clear whether we intend to allow this...
-        [TestCase("1", 1)]
-        [TestCase("-1", -1)]
-        [TestCase("2147483647", 2147483647)]
-        [TestCase("-2147483648", -2147483648)]
-        [TestCase("1e1", 10)]
-        [TestCase("-1e1", -10)]
-        [TestCase("10.00", 10)]
-        [TestCase("-10.00", -10)]
-        public void NumberToInt32_Valid(string jsonValue, int expectedParsedValue)
-        {
-            string json = "{ \"singleInt32\": " + jsonValue + "}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleInt32);
-        }
-
-        [Test]
-        [TestCase("+0", typeof(InvalidJsonException))]
-        [TestCase("00", typeof(InvalidJsonException))]
-        [TestCase("-00", typeof(InvalidJsonException))]
-        [TestCase("--1", typeof(InvalidJsonException))]
-        [TestCase("+1", typeof(InvalidJsonException))]
-        [TestCase("1.5", typeof(InvalidProtocolBufferException))]
-        // Value is out of range
-        [TestCase("1e10", typeof(InvalidProtocolBufferException))]
-        [TestCase("2147483648", typeof(InvalidProtocolBufferException))]
-        [TestCase("-2147483649", typeof(InvalidProtocolBufferException))]
-        public void NumberToInt32_Invalid(string jsonValue, System.Type expectedExceptionType)
-        {
-            string json = "{ \"singleInt32\": " + jsonValue + "}";
-            Assert.Throws(expectedExceptionType, () => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0U)]
-        [TestCase("1", 1U)]
-        [TestCase("4294967295", 4294967295U)]
-        public void NumberToUInt32_Valid(string jsonValue, uint expectedParsedValue)
-        {
-            string json = "{ \"singleUint32\": " + jsonValue + "}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleUint32);
-        }
-
-        // Assume that anything non-bounds-related is covered in the Int32 case
-        [Test]
-        [TestCase("-1")]
-        [TestCase("4294967296")]
-        public void NumberToUInt32_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleUint32\": " + jsonValue + "}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0L)]
-        [TestCase("1", 1L)]
-        [TestCase("-1", -1L)]
-        // long.MaxValue isn't actually representable as a double. This string value is the highest
-        // representable value which isn't greater than long.MaxValue.
-        [TestCase("9223372036854774784", 9223372036854774784)]
-        [TestCase("-9223372036854775808", -9223372036854775808)]
-        public void NumberToInt64_Valid(string jsonValue, long expectedParsedValue)
-        {
-            string json = "{ \"singleInt64\": " + jsonValue + "}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleInt64);
-        }
-
-        // Assume that anything non-bounds-related is covered in the Int32 case
-        [Test]
-        [TestCase("9223372036854775808")]
-        // Theoretical bound would be -9223372036854775809, but when that is parsed to a double
-        // we end up with the exact value of long.MinValue due to lack of precision. The value here
-        // is the "next double down".
-        [TestCase("-9223372036854780000")]
-        public void NumberToInt64_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleInt64\": " + jsonValue + "}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0UL)]
-        [TestCase("1", 1UL)]
-        // ulong.MaxValue isn't representable as a double. This value is the largest double within
-        // the range of ulong.
-        [TestCase("18446744073709549568", 18446744073709549568UL)]
-        public void NumberToUInt64_Valid(string jsonValue, ulong expectedParsedValue)
-        {
-            string json = "{ \"singleUint64\": " + jsonValue + "}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleUint64);
-        }
-
-        // Assume that anything non-bounds-related is covered in the Int32 case
-        [Test]
-        [TestCase("-1")]
-        [TestCase("18446744073709551616")]
-        public void NumberToUInt64_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleUint64\": " + jsonValue + "}";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0d)]
-        [TestCase("1", 1d)]
-        [TestCase("1.000000", 1d)]
-        [TestCase("1.0000000000000000000000001", 1d)] // We don't notice that we haven't preserved the exact value
-        [TestCase("-1", -1d)]
-        [TestCase("1e1", 10d)]
-        [TestCase("1e01", 10d)] // Leading decimals are allowed in exponents
-        [TestCase("1E1", 10d)] // Either case is fine
-        [TestCase("-1e1", -10d)]
-        [TestCase("1.5e1", 15d)]
-        [TestCase("-1.5e1", -15d)]
-        [TestCase("15e-1", 1.5d)]
-        [TestCase("-15e-1", -1.5d)]
-        [TestCase("1.79769e308", 1.79769e308)]
-        [TestCase("-1.79769e308", -1.79769e308)]
-        public void NumberToDouble_Valid(string jsonValue, double expectedParsedValue)
-        {
-            string json = "{ \"singleDouble\": " + jsonValue + "}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleDouble);
-        }
-
-        [Test]
-        [TestCase("1.7977e308")]
-        [TestCase("-1.7977e308")]
-        [TestCase("1e309")]
-        [TestCase("1,0")]
-        [TestCase("1.0.0")]
-        [TestCase("+1")]
-        [TestCase("00")]
-        [TestCase("--1")]
-        [TestCase("\u00BD")] // 1/2 as a single Unicode character. Just sanity checking...
-        public void NumberToDouble_Invalid(string jsonValue)
-        {
-            string json = "{ \"singleDouble\": " + jsonValue + "}";
-            Assert.Throws<InvalidJsonException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("0", 0f)]
-        [TestCase("1", 1f)]
-        [TestCase("1.000000", 1f)]
-        [TestCase("-1", -1f)]
-        [TestCase("3.402823e38", 3.402823e38f)]
-        [TestCase("-3.402823e38", -3.402823e38f)]
-        [TestCase("1.5e1", 15f)]
-        [TestCase("15e-1", 1.5f)]
-        public void NumberToFloat_Valid(string jsonValue, float expectedParsedValue)
-        {
-            string json = "{ \"singleFloat\": " + jsonValue + "}";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(expectedParsedValue, parsed.SingleFloat);
-        }
-
-        [Test]
-        [TestCase("3.402824e38", typeof(InvalidProtocolBufferException))]
-        [TestCase("-3.402824e38", typeof(InvalidProtocolBufferException))]
-        [TestCase("1,0", typeof(InvalidJsonException))]
-        [TestCase("1.0.0", typeof(InvalidJsonException))]
-        [TestCase("+1", typeof(InvalidJsonException))]
-        [TestCase("00", typeof(InvalidJsonException))]
-        [TestCase("--1", typeof(InvalidJsonException))]
-        public void NumberToFloat_Invalid(string jsonValue, System.Type expectedExceptionType)
-        {
-            string json = "{ \"singleFloat\": " + jsonValue + "}";
-            Assert.Throws(expectedExceptionType, () => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        // The simplest way of testing that the value has parsed correctly is to reformat it,
-        // as we trust the formatting. In many cases that will give the same result as the input,
-        // so in those cases we accept an expectedFormatted value of null. Sometimes the results
-        // will be different though, due to a different number of digits being provided.
-        [Test]
-        // Z offset
-        [TestCase("2015-10-09T14:46:23.123456789Z", null)]
-        [TestCase("2015-10-09T14:46:23.123456Z", null)]
-        [TestCase("2015-10-09T14:46:23.123Z", null)]
-        [TestCase("2015-10-09T14:46:23Z", null)]
-        [TestCase("2015-10-09T14:46:23.123456000Z", "2015-10-09T14:46:23.123456Z")]
-        [TestCase("2015-10-09T14:46:23.1234560Z", "2015-10-09T14:46:23.123456Z")]
-        [TestCase("2015-10-09T14:46:23.123000000Z", "2015-10-09T14:46:23.123Z")]
-        [TestCase("2015-10-09T14:46:23.1230Z", "2015-10-09T14:46:23.123Z")]
-        [TestCase("2015-10-09T14:46:23.00Z", "2015-10-09T14:46:23Z")]
-
-        // +00:00 offset
-        [TestCase("2015-10-09T14:46:23.123456789+00:00", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-09T14:46:23.123456+00:00", "2015-10-09T14:46:23.123456Z")]
-        [TestCase("2015-10-09T14:46:23.123+00:00", "2015-10-09T14:46:23.123Z")]
-        [TestCase("2015-10-09T14:46:23+00:00", "2015-10-09T14:46:23Z")]
-        [TestCase("2015-10-09T14:46:23.123456000+00:00", "2015-10-09T14:46:23.123456Z")]
-        [TestCase("2015-10-09T14:46:23.1234560+00:00", "2015-10-09T14:46:23.123456Z")]
-        [TestCase("2015-10-09T14:46:23.123000000+00:00", "2015-10-09T14:46:23.123Z")]
-        [TestCase("2015-10-09T14:46:23.1230+00:00", "2015-10-09T14:46:23.123Z")]
-        [TestCase("2015-10-09T14:46:23.00+00:00", "2015-10-09T14:46:23Z")]
-
-        // Other offsets (assume by now that the subsecond handling is okay)
-        [TestCase("2015-10-09T15:46:23.123456789+01:00", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-09T13:46:23.123456789-01:00", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-09T15:16:23.123456789+00:30", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-09T14:16:23.123456789-00:30", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-09T16:31:23.123456789+01:45", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-09T13:01:23.123456789-01:45", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-10T08:46:23.123456789+18:00", "2015-10-09T14:46:23.123456789Z")]
-        [TestCase("2015-10-08T20:46:23.123456789-18:00", "2015-10-09T14:46:23.123456789Z")]
-
-        // Leap years and min/max
-        [TestCase("2016-02-29T14:46:23.123456789Z", null)]
-        [TestCase("2000-02-29T14:46:23.123456789Z", null)]
-        [TestCase("0001-01-01T00:00:00Z", null)]
-        [TestCase("9999-12-31T23:59:59.999999999Z", null)]
-        public void Timestamp_Valid(string jsonValue, string expectedFormatted)
-        {
-            expectedFormatted = expectedFormatted ?? jsonValue;
-            string json = WrapInQuotes(jsonValue);
-            var parsed = Timestamp.Parser.ParseJson(json);
-            Assert.AreEqual(WrapInQuotes(expectedFormatted), parsed.ToString());
-        }
-
-        [Test]
-        [TestCase("2015-10-09 14:46:23.123456789Z", Description = "No T between date and time")]
-        [TestCase("2015/10/09T14:46:23.123456789Z", Description = "Wrong date separators")]
-        [TestCase("2015-10-09T14.46.23.123456789Z", Description = "Wrong time separators")]
-        [TestCase("2015-10-09T14:46:23,123456789Z", Description = "Wrong fractional second separators (valid ISO-8601 though)")]
-        [TestCase(" 2015-10-09T14:46:23.123456789Z", Description = "Whitespace at start")]
-        [TestCase("2015-10-09T14:46:23.123456789Z ", Description = "Whitespace at end")]
-        [TestCase("2015-10-09T14:46:23.1234567890", Description = "Too many digits")]
-        [TestCase("2015-10-09T14:46:23.123456789", Description = "No offset")]
-        [TestCase("2015-13-09T14:46:23.123456789Z", Description = "Invalid month")]
-        [TestCase("2015-10-32T14:46:23.123456789Z", Description = "Invalid day")]
-        [TestCase("2015-10-09T24:00:00.000000000Z", Description = "Invalid hour (valid ISO-8601 though)")]
-        [TestCase("2015-10-09T14:60:23.123456789Z", Description = "Invalid minutes")]
-        [TestCase("2015-10-09T14:46:60.123456789Z", Description = "Invalid seconds")]
-        [TestCase("2015-10-09T14:46:23.123456789+18:01", Description = "Offset too large (positive)")]
-        [TestCase("2015-10-09T14:46:23.123456789-18:01", Description = "Offset too large (negative)")]
-        [TestCase("2015-10-09T14:46:23.123456789-00:00", Description = "Local offset (-00:00) makes no sense here")]
-        [TestCase("0001-01-01T00:00:00+00:01", Description = "Value before earliest when offset applied")]
-        [TestCase("9999-12-31T23:59:59.999999999-00:01", Description = "Value after latest when offset applied")]
-        [TestCase("2100-02-29T14:46:23.123456789Z", Description = "Feb 29th on a non-leap-year")]
-        public void Timestamp_Invalid(string jsonValue)
-        {
-            string json = WrapInQuotes(jsonValue);
-            Assert.Throws<InvalidProtocolBufferException>(() => Timestamp.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void StructValue_Null()
-        {
-            Assert.AreEqual(new Value { NullValue = 0 }, Value.Parser.ParseJson("null"));
-        }
-
-        [Test]
-        public void StructValue_String()
-        {
-            Assert.AreEqual(new Value { StringValue = "hi" }, Value.Parser.ParseJson("\"hi\""));
-        }
-
-        [Test]
-        public void StructValue_Bool()
-        {
-            Assert.AreEqual(new Value { BoolValue = true }, Value.Parser.ParseJson("true"));
-            Assert.AreEqual(new Value { BoolValue = false }, Value.Parser.ParseJson("false"));
-        }
-
-        [Test]
-        public void StructValue_List()
-        {
-            Assert.AreEqual(Value.ForList(Value.ForNumber(1), Value.ForString("x")), Value.Parser.ParseJson("[1, \"x\"]"));
-        }
-
-        [Test]
-        public void ParseListValue()
-        {
-            Assert.AreEqual(new ListValue { Values = { Value.ForNumber(1), Value.ForString("x") } }, ListValue.Parser.ParseJson("[1, \"x\"]"));
-        }
-
-        [Test]
-        public void StructValue_Struct()
-        {
-            Assert.AreEqual(
-                Value.ForStruct(new Struct { Fields = { { "x", Value.ForNumber(1) }, { "y", Value.ForString("z") } } }),
-                Value.Parser.ParseJson("{ \"x\": 1, \"y\": \"z\" }"));
-        }
-
-        [Test]
-        public void ParseStruct()
-        {
-            Assert.AreEqual(new Struct { Fields = { { "x", Value.ForNumber(1) }, { "y", Value.ForString("z") } } },
-                Struct.Parser.ParseJson("{ \"x\": 1, \"y\": \"z\" }"));
-        }
-
-        // TODO for duration parsing: upper and lower bounds.
-        // +/- 315576000000 seconds
-
-        [Test]
-        [TestCase("1.123456789s", null)]
-        [TestCase("1.123456s", null)]
-        [TestCase("1.123s", null)]
-        [TestCase("1.12300s", "1.123s")]
-        [TestCase("1.12345s", "1.123450s")]
-        [TestCase("1s", null)]
-        [TestCase("-1.123456789s", null)]
-        [TestCase("-1.123456s", null)]
-        [TestCase("-1.123s", null)]
-        [TestCase("-1s", null)]
-        [TestCase("0.123s", null)]
-        [TestCase("-0.123s", null)]
-        [TestCase("123456.123s", null)]
-        [TestCase("-123456.123s", null)]
-        // Upper and lower bounds
-        [TestCase("315576000000s", null)]
-        [TestCase("-315576000000s", null)]
-        public void Duration_Valid(string jsonValue, string expectedFormatted)
-        {
-            expectedFormatted = expectedFormatted ?? jsonValue;
-            string json = WrapInQuotes(jsonValue);
-            var parsed = Duration.Parser.ParseJson(json);
-            Assert.AreEqual(WrapInQuotes(expectedFormatted), parsed.ToString());
-        }
-
-        // The simplest way of testing that the value has parsed correctly is to reformat it,
-        // as we trust the formatting. In many cases that will give the same result as the input,
-        // so in those cases we accept an expectedFormatted value of null. Sometimes the results
-        // will be different though, due to a different number of digits being provided.
-        [Test]
-        [TestCase("1.1234567890s", Description = "Too many digits")]
-        [TestCase("1.123456789", Description = "No suffix")]
-        [TestCase("1.123456789ss", Description = "Too much suffix")]
-        [TestCase("1.123456789S", Description = "Upper case suffix")]
-        [TestCase("+1.123456789s", Description = "Leading +")]
-        [TestCase(".123456789s", Description = "No integer before the fraction")]
-        [TestCase("1,123456789s", Description = "Comma as decimal separator")]
-        [TestCase("1x1.123456789s", Description = "Non-digit in integer part")]
-        [TestCase("1.1x3456789s", Description = "Non-digit in fractional part")]
-        [TestCase(" 1.123456789s", Description = "Whitespace before fraction")]
-        [TestCase("1.123456789s ", Description = "Whitespace after value")]
-        [TestCase("01.123456789s", Description = "Leading zero (positive)")]
-        [TestCase("-01.123456789s", Description = "Leading zero (negative)")]
-        [TestCase("--0.123456789s", Description = "Double minus sign")]
-        // Violate upper/lower bounds in various ways
-        [TestCase("315576000001s", Description = "Integer part too large")]
-        [TestCase("3155760000000s", Description = "Integer part too long (positive)")]
-        [TestCase("-3155760000000s", Description = "Integer part too long (negative)")]
-        public void Duration_Invalid(string jsonValue)
-        {
-            string json = WrapInQuotes(jsonValue);
-            Assert.Throws<InvalidProtocolBufferException>(() => Duration.Parser.ParseJson(json));
-        }
-
-        // Not as many tests for field masks as I'd like; more to be added when we have more
-        // detailed specifications.
-
-        [Test]
-        [TestCase("")]
-        [TestCase("foo", "foo")]
-        [TestCase("foo,bar", "foo", "bar")]
-        [TestCase("foo.bar", "foo.bar")]
-        [TestCase("fooBar", "foo_bar")]
-        [TestCase("fooBar.bazQux", "foo_bar.baz_qux")]
-        public void FieldMask_Valid(string jsonValue, params string[] expectedPaths)
-        {
-            string json = WrapInQuotes(jsonValue);
-            var parsed = FieldMask.Parser.ParseJson(json);
-            CollectionAssert.AreEqual(expectedPaths, parsed.Paths);
-        }
-
-        [Test]
-        [TestCase("foo_bar")]
-        public void FieldMask_Invalid(string jsonValue)
-        {
-            string json = WrapInQuotes(jsonValue);
-            Assert.Throws<InvalidProtocolBufferException>(() => FieldMask.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void Any_RegularMessage()
-        {
-            var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor);
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor)));
-            var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } };
-            var original = Any.Pack(message);
-            var json = formatter.Format(original); // This is tested in JsonFormatterTest
-            var parser = new JsonParser(new JsonParser.Settings(10, registry));
-            Assert.AreEqual(original, parser.Parse<Any>(json));
-            string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest.TestAllTypes\" }";
-            Assert.AreEqual(original, parser.Parse<Any>(valueFirstJson));
-        }
-
-        [Test]
-        public void Any_CustomPrefix()
-        {
-            var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor);
-            var message = new TestAllTypes { SingleInt32 = 10 };
-            var original = Any.Pack(message, "custom.prefix/middle-part");
-            var parser = new JsonParser(new JsonParser.Settings(10, registry));
-            string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest.TestAllTypes\", \"singleInt32\": 10 }";
-            Assert.AreEqual(original, parser.Parse<Any>(json));
-        }
-
-        [Test]
-        public void Any_UnknownType()
-        {
-            string json = "{ \"@type\": \"type.googleapis.com/bogus\" }";
-            Assert.Throws<InvalidOperationException>(() => Any.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void Any_NoTypeUrl()
-        {
-            string json = "{ \"foo\": \"bar\" }";
-            Assert.Throws<InvalidProtocolBufferException>(() => Any.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void Any_WellKnownType()
-        {
-            var registry = TypeRegistry.FromMessages(Timestamp.Descriptor);
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry));
-            var timestamp = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp();
-            var original = Any.Pack(timestamp);
-            var json = formatter.Format(original); // This is tested in JsonFormatterTest
-            var parser = new JsonParser(new JsonParser.Settings(10, registry));
-            Assert.AreEqual(original, parser.Parse<Any>(json));
-            string valueFirstJson = "{ \"value\": \"1673-06-19T12:34:56Z\", \"@type\": \"type.googleapis.com/google.protobuf.Timestamp\" }";
-            Assert.AreEqual(original, parser.Parse<Any>(valueFirstJson));
-        }
-
-        [Test]
-        public void Any_Nested()
-        {
-            var registry = TypeRegistry.FromMessages(TestWellKnownTypes.Descriptor, TestAllTypes.Descriptor);
-            var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry));
-            var parser = new JsonParser(new JsonParser.Settings(10, registry));
-            var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 };
-            var nestedMessage = Any.Pack(doubleNestedMessage);
-            var message = new TestWellKnownTypes { AnyField = Any.Pack(nestedMessage) };
-            var json = formatter.Format(message);
-            // Use the descriptor-based parser just for a change.
-            Assert.AreEqual(message, parser.Parse(json, TestWellKnownTypes.Descriptor));
-        }
-
-        [Test]
-        public void DataAfterObject()
-        {
-            string json = "{} 10";
-            Assert.Throws<InvalidJsonException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        /// <summary>
-        /// JSON equivalent to <see cref="CodedInputStreamTest.MaliciousRecursion"/>
-        /// </summary>
-        [Test]
-        public void MaliciousRecursion()
-        {
-            string data64 = CodedInputStreamTest.MakeRecursiveMessage(64).ToString();
-            string data65 = CodedInputStreamTest.MakeRecursiveMessage(65).ToString();
-
-            var parser64 = new JsonParser(new JsonParser.Settings(64));
-            CodedInputStreamTest.AssertMessageDepth(parser64.Parse<TestRecursiveMessage>(data64), 64);
-            Assert.Throws<InvalidProtocolBufferException>(() => parser64.Parse<TestRecursiveMessage>(data65));
-
-            var parser63 = new JsonParser(new JsonParser.Settings(63));
-            Assert.Throws<InvalidProtocolBufferException>(() => parser63.Parse<TestRecursiveMessage>(data64));
-        }
-
-        [Test]
-        [TestCase("AQI")]
-        [TestCase("_-==")]
-        public void Bytes_InvalidBase64(string badBase64)
-        {
-            string json = "{ \"singleBytes\": \"" + badBase64 + "\" }";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        [TestCase("\"FOREIGN_BAR\"", ForeignEnum.ForeignBar)]
-        [TestCase("5", ForeignEnum.ForeignBar)]
-        [TestCase("100", (ForeignEnum)100)]
-        public void EnumValid(string value, ForeignEnum expectedValue)
-        {
-            string json = "{ \"singleForeignEnum\": " + value + " }";
-            var parsed = TestAllTypes.Parser.ParseJson(json);
-            Assert.AreEqual(new TestAllTypes { SingleForeignEnum = expectedValue }, parsed);
-        }
-
-        [Test]
-        [TestCase("\"NOT_A_VALID_VALUE\"")]
-        [TestCase("5.5")]
-        public void Enum_Invalid(string value)
-        {
-            string json = "{ \"singleForeignEnum\": " + value + " }";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        [Test]
-        public void OneofDuplicate_Invalid()
-        {
-            string json = "{ \"oneofString\": \"x\", \"oneofUint32\": 10 }";
-            Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseJson(json));
-        }
-
-        /// <summary>
-        /// Various tests use strings which have quotes round them for parsing or as the result
-        /// of formatting, but without those quotes being specified in the tests (for the sake of readability).
-        /// This method simply returns the input, wrapped in double quotes.
-        /// </summary>
-        internal static string WrapInQuotes(string text)
-        {
-            return '"' + text + '"';
-        }
-    }
-}

+ 0 - 408
csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs

@@ -1,408 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-using System;
-using System.IO;
-
-namespace Google.Protobuf
-{
-    public class JsonTokenizerTest
-    {
-        [Test]
-        public void EmptyObjectValue()
-        {
-            AssertTokens("{}", JsonToken.StartObject, JsonToken.EndObject);
-        }
-
-        [Test]
-        public void EmptyArrayValue()
-        {
-            AssertTokens("[]", JsonToken.StartArray, JsonToken.EndArray);
-        }
-
-        [Test]
-        [TestCase("foo", "foo")]
-        [TestCase("tab\\t", "tab\t")]
-        [TestCase("line\\nfeed", "line\nfeed")]
-        [TestCase("carriage\\rreturn", "carriage\rreturn")]
-        [TestCase("back\\bspace", "back\bspace")]
-        [TestCase("form\\ffeed", "form\ffeed")]
-        [TestCase("escaped\\/slash", "escaped/slash")]
-        [TestCase("escaped\\\\backslash", "escaped\\backslash")]
-        [TestCase("escaped\\\"quote", "escaped\"quote")]
-        [TestCase("foo {}[] bar", "foo {}[] bar")]
-        [TestCase("foo\\u09aFbar", "foo\u09afbar")] // Digits, upper hex, lower hex
-        [TestCase("ab\ud800\udc00cd", "ab\ud800\udc00cd")]
-        [TestCase("ab\\ud800\\udc00cd", "ab\ud800\udc00cd")]
-        public void StringValue(string json, string expectedValue)
-        {
-            AssertTokensNoReplacement("\"" + json + "\"", JsonToken.Value(expectedValue));
-        }
-
-        // Valid surrogate pairs, with mixed escaping. These test cases can't be expressed
-        // using TestCase as they have no valid UTF-8 representation.
-        // It's unclear exactly how we should handle a mixture of escaped or not: that can't
-        // come from UTF-8 text, but could come from a .NET string. For the moment,
-        // treat it as valid in the obvious way.
-        [Test]
-        public void MixedSurrogatePairs()
-        {
-            string expected = "\ud800\udc00";
-            AssertTokens("'\\ud800\udc00'", JsonToken.Value(expected));
-            AssertTokens("'\ud800\\udc00'", JsonToken.Value(expected));
-        }
-
-        [Test]
-        public void ObjectDepth()
-        {
-            string json = "{ \"foo\": { \"x\": 1, \"y\": [ 0 ] } }";
-            var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json));
-            // If we had more tests like this, I'd introduce a helper method... but for one test, it's not worth it.
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.StartObject, tokenizer.Next());
-            Assert.AreEqual(1, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.Name("foo"), tokenizer.Next());
-            Assert.AreEqual(1, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.StartObject, tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.Name("x"), tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.Value(1), tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.Name("y"), tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.StartArray, tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth); // Depth hasn't changed in array
-            Assert.AreEqual(JsonToken.Value(0), tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.EndArray, tokenizer.Next());
-            Assert.AreEqual(2, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.EndObject, tokenizer.Next());
-            Assert.AreEqual(1, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.EndObject, tokenizer.Next());
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-            Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next());
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-        }
-
-        [Test]
-        public void ObjectDepth_WithPushBack()
-        {
-            string json = "{}";
-            var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json));
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-            var token = tokenizer.Next();
-            Assert.AreEqual(1, tokenizer.ObjectDepth);
-            // When we push back a "start object", we should effectively be back to the previous depth.
-            tokenizer.PushBack(token);
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-            // Read the same token again, and get back to depth 1
-            token = tokenizer.Next();
-            Assert.AreEqual(1, tokenizer.ObjectDepth);
-
-            // Now the same in reverse, with EndObject
-            token = tokenizer.Next();
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-            tokenizer.PushBack(token);
-            Assert.AreEqual(1, tokenizer.ObjectDepth);
-            tokenizer.Next();
-            Assert.AreEqual(0, tokenizer.ObjectDepth);
-        }
-
-        [Test]
-        [TestCase("embedded tab\t")]
-        [TestCase("embedded CR\r")]
-        [TestCase("embedded LF\n")]
-        [TestCase("embedded bell\u0007")]
-        [TestCase("bad escape\\a")]
-        [TestCase("incomplete escape\\")]
-        [TestCase("incomplete Unicode escape\\u000")]
-        [TestCase("invalid Unicode escape\\u000H")]
-        // Surrogate pair handling, both in raw .NET strings and escaped. We only need
-        // to detect this in strings, as non-ASCII characters anywhere other than in strings
-        // will already lead to parsing errors.
-        [TestCase("\\ud800")]
-        [TestCase("\\udc00")]
-        [TestCase("\\ud800x")]
-        [TestCase("\\udc00x")]
-        [TestCase("\\udc00\\ud800y")]
-        public void InvalidStringValue(string json)
-        {
-            AssertThrowsAfter("\"" + json + "\"");
-        }
-
-        // Tests for invalid strings that can't be expressed in attributes,
-        // as the constants can't be expressed as UTF-8 strings.
-        [Test]
-        public void InvalidSurrogatePairs()
-        {
-            AssertThrowsAfter("\"\ud800x\"");
-            AssertThrowsAfter("\"\udc00y\"");
-            AssertThrowsAfter("\"\udc00\ud800y\"");
-        }
-
-        [Test]
-        [TestCase("0", 0)]
-        [TestCase("-0", 0)] // We don't distinguish between positive and negative 0
-        [TestCase("1", 1)]
-        [TestCase("-1", -1)]
-        // From here on, assume leading sign is okay...
-        [TestCase("1.125", 1.125)]
-        [TestCase("1.0", 1)]
-        [TestCase("1e5", 100000)]
-        [TestCase("1e000000", 1)] // Weird, but not prohibited by the spec
-        [TestCase("1E5", 100000)]
-        [TestCase("1e+5", 100000)]
-        [TestCase("1E-5", 0.00001)]
-        [TestCase("123E-2", 1.23)]
-        [TestCase("123.45E3", 123450)]
-        [TestCase("   1   ", 1)]
-        public void NumberValue(string json, double expectedValue)
-        {
-            AssertTokens(json, JsonToken.Value(expectedValue));
-        }
-
-        [Test]
-        [TestCase("00")]
-        [TestCase(".5")]
-        [TestCase("1.")]
-        [TestCase("1e")]
-        [TestCase("1e-")]
-        [TestCase("--")]
-        [TestCase("--1")]
-        [TestCase("-1.7977e308")]
-        [TestCase("1.7977e308")]
-        public void InvalidNumberValue(string json)
-        {
-            AssertThrowsAfter(json);
-        }
-
-        [Test]
-        [TestCase("nul")]
-        [TestCase("nothing")]
-        [TestCase("truth")]
-        [TestCase("fALSEhood")]
-        public void InvalidLiterals(string json)
-        {
-            AssertThrowsAfter(json);
-        }
-
-        [Test]
-        public void NullValue()
-        {
-            AssertTokens("null", JsonToken.Null);
-        }
-
-        [Test]
-        public void TrueValue()
-        {
-            AssertTokens("true", JsonToken.True);
-        }
-
-        [Test]
-        public void FalseValue()
-        {
-            AssertTokens("false", JsonToken.False);
-        }
-
-        [Test]
-        public void SimpleObject()
-        {
-            AssertTokens("{'x': 'y'}",
-                JsonToken.StartObject, JsonToken.Name("x"), JsonToken.Value("y"), JsonToken.EndObject);
-        }
-        
-        [Test]
-        [TestCase("[10, 20", 3)]
-        [TestCase("[10,", 2)]
-        [TestCase("[10:20]", 2)]
-        [TestCase("[", 1)]
-        [TestCase("[,", 1)]
-        [TestCase("{", 1)]
-        [TestCase("{,", 1)]
-        [TestCase("{[", 1)]
-        [TestCase("{{", 1)]
-        [TestCase("{0", 1)]
-        [TestCase("{null", 1)]
-        [TestCase("{false", 1)]
-        [TestCase("{true", 1)]
-        [TestCase("}", 0)]
-        [TestCase("]", 0)]
-        [TestCase(",", 0)]
-        [TestCase("'foo' 'bar'", 1)]
-        [TestCase(":", 0)]
-        [TestCase("'foo", 0)] // Incomplete string
-        [TestCase("{ 'foo' }", 2)]
-        [TestCase("{ x:1", 1)] // Property names must be quoted
-        [TestCase("{]", 1)]
-        [TestCase("[}", 1)]
-        [TestCase("[1,", 2)]
-        [TestCase("{'x':0]", 3)]
-        [TestCase("{ 'foo': }", 2)]
-        [TestCase("{ 'foo':'bar', }", 3)]
-        public void InvalidStructure(string json, int expectedValidTokens)
-        {
-            // Note: we don't test that the earlier tokens are exactly as expected,
-            // partly because that's hard to parameterize.
-            var reader = new StringReader(json.Replace('\'', '"'));
-            var tokenizer = JsonTokenizer.FromTextReader(reader);
-            for (int i = 0; i < expectedValidTokens; i++)
-            {
-                Assert.IsNotNull(tokenizer.Next());
-            }
-            Assert.Throws<InvalidJsonException>(() => tokenizer.Next());
-        }
-
-        [Test]
-        public void ArrayMixedType()
-        {
-            AssertTokens("[1, 'foo', null, false, true, [2], {'x':'y' }]",
-                JsonToken.StartArray,
-                JsonToken.Value(1),
-                JsonToken.Value("foo"),
-                JsonToken.Null,
-                JsonToken.False,
-                JsonToken.True,
-                JsonToken.StartArray,
-                JsonToken.Value(2),
-                JsonToken.EndArray,
-                JsonToken.StartObject,
-                JsonToken.Name("x"),
-                JsonToken.Value("y"),
-                JsonToken.EndObject,
-                JsonToken.EndArray);
-        }
-
-        [Test]
-        public void ObjectMixedType()
-        {
-            AssertTokens(@"{'a': 1, 'b': 'bar', 'c': null, 'd': false, 'e': true, 
-                           'f': [2], 'g': {'x':'y' }}",
-                JsonToken.StartObject,
-                JsonToken.Name("a"),
-                JsonToken.Value(1),
-                JsonToken.Name("b"),
-                JsonToken.Value("bar"),
-                JsonToken.Name("c"),
-                JsonToken.Null,
-                JsonToken.Name("d"),
-                JsonToken.False,
-                JsonToken.Name("e"),
-                JsonToken.True,
-                JsonToken.Name("f"),
-                JsonToken.StartArray,
-                JsonToken.Value(2),
-                JsonToken.EndArray,
-                JsonToken.Name("g"),
-                JsonToken.StartObject,
-                JsonToken.Name("x"),
-                JsonToken.Value("y"),
-                JsonToken.EndObject,
-                JsonToken.EndObject);
-        }
-
-        [Test]
-        public void NextAfterEndDocumentThrows()
-        {
-            var tokenizer = JsonTokenizer.FromTextReader(new StringReader("null"));
-            Assert.AreEqual(JsonToken.Null, tokenizer.Next());
-            Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next());
-            Assert.Throws<InvalidOperationException>(() => tokenizer.Next());
-        }
-
-        [Test]
-        public void CanPushBackEndDocument()
-        {
-            var tokenizer = JsonTokenizer.FromTextReader(new StringReader("null"));
-            Assert.AreEqual(JsonToken.Null, tokenizer.Next());
-            Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next());
-            tokenizer.PushBack(JsonToken.EndDocument);
-            Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next());
-            Assert.Throws<InvalidOperationException>(() => tokenizer.Next());
-        }
-       
-        /// <summary>
-        /// Asserts that the specified JSON is tokenized into the given sequence of tokens.
-        /// All apostrophes are first converted to double quotes, allowing any tests
-        /// that don't need to check actual apostrophe handling to use apostrophes in the JSON, avoiding
-        /// messy string literal escaping. The "end document" token is not specified in the list of 
-        /// expected tokens, but is implicit.
-        /// </summary>
-        private static void AssertTokens(string json, params JsonToken[] expectedTokens)
-        {
-            AssertTokensNoReplacement(json.Replace('\'', '"'), expectedTokens);
-        }
-
-        /// <summary>
-        /// Asserts that the specified JSON is tokenized into the given sequence of tokens.
-        /// Unlike <see cref="AssertTokens(string, JsonToken[])"/>, this does not perform any character
-        /// replacement on the specified JSON, and should be used when the text contains apostrophes which
-        /// are expected to be used *as* apostrophes. The "end document" token is not specified in the list of 
-        /// expected tokens, but is implicit.
-        /// </summary>
-        private static void AssertTokensNoReplacement(string json, params JsonToken[] expectedTokens)
-        {
-            var reader = new StringReader(json);
-            var tokenizer = JsonTokenizer.FromTextReader(reader);
-            for (int i = 0; i < expectedTokens.Length; i++)
-            {
-                var actualToken = tokenizer.Next();
-                if (actualToken == JsonToken.EndDocument)
-                {
-                    Assert.Fail("Expected {0} but reached end of token stream", expectedTokens[i]);
-                }
-                Assert.AreEqual(expectedTokens[i], actualToken);
-            }
-            var finalToken = tokenizer.Next();
-            if (finalToken != JsonToken.EndDocument)
-            {
-                Assert.Fail("Expected token stream to be exhausted; received {0}", finalToken);
-            }
-        }
-
-        private static void AssertThrowsAfter(string json, params JsonToken[] expectedTokens)
-        {
-            var reader = new StringReader(json);
-            var tokenizer = JsonTokenizer.FromTextReader(reader);
-            for (int i = 0; i < expectedTokens.Length; i++)
-            {
-                var actualToken = tokenizer.Next();
-                if (actualToken == JsonToken.EndDocument)
-                {
-                    Assert.Fail("Expected {0} but reached end of document", expectedTokens[i]);
-                }
-                Assert.AreEqual(expectedTokens[i], actualToken);
-            }
-            Assert.Throws<InvalidJsonException>(() => tokenizer.Next());
-        }
-    }
-}

+ 0 - 259
csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs

@@ -1,259 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Linq;
-using Google.Protobuf.TestProtos;
-using NUnit.Framework;
-using UnitTest.Issues.TestProtos;
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the
-    /// size doesn't warrant it. On the other hand, this makes me feel a bit dirty...)
-    /// </summary>
-    public class DescriptorsTest
-    {
-        [Test]
-        public void FileDescriptor()
-        {
-            FileDescriptor file = UnittestProto3Reflection.Descriptor;
-
-            Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name);
-            Assert.AreEqual("protobuf_unittest", file.Package);
-
-            Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname);
-            Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name);
-
-            // unittest.proto doesn't have any public imports, but unittest_import.proto does.
-            Assert.AreEqual(0, file.PublicDependencies.Count);
-            Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.PublicDependencies.Count);
-            Assert.AreEqual(UnittestImportPublicProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor.PublicDependencies[0]);
-
-            Assert.AreEqual(1, file.Dependencies.Count);
-            Assert.AreEqual(UnittestImportProto3Reflection.Descriptor, file.Dependencies[0]);
-
-            MessageDescriptor messageType = TestAllTypes.Descriptor;
-            Assert.AreSame(typeof(TestAllTypes), messageType.ClrType);
-            Assert.AreSame(TestAllTypes.Parser, messageType.Parser);
-            Assert.AreEqual(messageType, file.MessageTypes[0]);
-            Assert.AreEqual(messageType, file.FindTypeByName<MessageDescriptor>("TestAllTypes"));
-            Assert.Null(file.FindTypeByName<MessageDescriptor>("NoSuchType"));
-            Assert.Null(file.FindTypeByName<MessageDescriptor>("protobuf_unittest.TestAllTypes"));
-            for (int i = 0; i < file.MessageTypes.Count; i++)
-            {
-                Assert.AreEqual(i, file.MessageTypes[i].Index);
-            }
-
-            Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName<EnumDescriptor>("ForeignEnum"));
-            Assert.Null(file.FindTypeByName<EnumDescriptor>("NoSuchType"));
-            Assert.Null(file.FindTypeByName<EnumDescriptor>("protobuf_unittest.ForeignEnum"));
-            Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.EnumTypes.Count);
-            Assert.AreEqual("ImportEnum", UnittestImportProto3Reflection.Descriptor.EnumTypes[0].Name);
-            for (int i = 0; i < file.EnumTypes.Count; i++)
-            {
-                Assert.AreEqual(i, file.EnumTypes[i].Index);
-            }
-
-            Assert.AreEqual(10, file.SerializedData[0]);
-        }
-
-        [Test]
-        public void MessageDescriptor()
-        {
-            MessageDescriptor messageType = TestAllTypes.Descriptor;
-            MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor;
-
-            Assert.AreEqual("TestAllTypes", messageType.Name);
-            Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName);
-            Assert.AreEqual(UnittestProto3Reflection.Descriptor, messageType.File);
-            Assert.IsNull(messageType.ContainingType);
-            Assert.IsNull(messageType.Proto.Options);
-
-            Assert.AreEqual("TestAllTypes", messageType.Name);
-
-            Assert.AreEqual("NestedMessage", nestedType.Name);
-            Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName);
-            Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File);
-            Assert.AreEqual(messageType, nestedType.ContainingType);
-
-            FieldDescriptor field = messageType.Fields.InDeclarationOrder()[0];
-            Assert.AreEqual("single_int32", field.Name);
-            Assert.AreEqual(field, messageType.FindDescriptor<FieldDescriptor>("single_int32"));
-            Assert.Null(messageType.FindDescriptor<FieldDescriptor>("no_such_field"));
-            Assert.AreEqual(field, messageType.FindFieldByNumber(1));
-            Assert.Null(messageType.FindFieldByNumber(571283));
-            var fieldsInDeclarationOrder = messageType.Fields.InDeclarationOrder();
-            for (int i = 0; i < fieldsInDeclarationOrder.Count; i++)
-            {
-                Assert.AreEqual(i, fieldsInDeclarationOrder[i].Index);
-            }
-
-            Assert.AreEqual(nestedType, messageType.NestedTypes[0]);
-            Assert.AreEqual(nestedType, messageType.FindDescriptor<MessageDescriptor>("NestedMessage"));
-            Assert.Null(messageType.FindDescriptor<MessageDescriptor>("NoSuchType"));
-            for (int i = 0; i < messageType.NestedTypes.Count; i++)
-            {
-                Assert.AreEqual(i, messageType.NestedTypes[i].Index);
-            }
-
-            Assert.AreEqual(messageType.EnumTypes[0], messageType.FindDescriptor<EnumDescriptor>("NestedEnum"));
-            Assert.Null(messageType.FindDescriptor<EnumDescriptor>("NoSuchType"));
-            for (int i = 0; i < messageType.EnumTypes.Count; i++)
-            {
-                Assert.AreEqual(i, messageType.EnumTypes[i].Index);
-            }
-        }
-
-        [Test]
-        public void FieldDescriptor()
-        {
-            MessageDescriptor messageType = TestAllTypes.Descriptor;
-            FieldDescriptor primitiveField = messageType.FindDescriptor<FieldDescriptor>("single_int32");
-            FieldDescriptor enumField = messageType.FindDescriptor<FieldDescriptor>("single_nested_enum");
-            FieldDescriptor messageField = messageType.FindDescriptor<FieldDescriptor>("single_foreign_message");
-
-            Assert.AreEqual("single_int32", primitiveField.Name);
-            Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32",
-                            primitiveField.FullName);
-            Assert.AreEqual(1, primitiveField.FieldNumber);
-            Assert.AreEqual(messageType, primitiveField.ContainingType);
-            Assert.AreEqual(UnittestProto3Reflection.Descriptor, primitiveField.File);
-            Assert.AreEqual(FieldType.Int32, primitiveField.FieldType);
-            Assert.IsNull(primitiveField.Proto.Options);
-            
-            Assert.AreEqual("single_nested_enum", enumField.Name);
-            Assert.AreEqual(FieldType.Enum, enumField.FieldType);
-            // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType);
-
-            Assert.AreEqual("single_foreign_message", messageField.Name);
-            Assert.AreEqual(FieldType.Message, messageField.FieldType);
-            Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType);
-        }
-
-        [Test]
-        public void FieldDescriptorLabel()
-        {
-            FieldDescriptor singleField =
-                TestAllTypes.Descriptor.FindDescriptor<FieldDescriptor>("single_int32");
-            FieldDescriptor repeatedField =
-                TestAllTypes.Descriptor.FindDescriptor<FieldDescriptor>("repeated_int32");
-
-            Assert.IsFalse(singleField.IsRepeated);
-            Assert.IsTrue(repeatedField.IsRepeated);
-        }
-
-        [Test]
-        public void EnumDescriptor()
-        {
-            // Note: this test is a bit different to the Java version because there's no static way of getting to the descriptor
-            EnumDescriptor enumType = UnittestProto3Reflection.Descriptor.FindTypeByName<EnumDescriptor>("ForeignEnum");
-            EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor<EnumDescriptor>("NestedEnum");
-
-            Assert.AreEqual("ForeignEnum", enumType.Name);
-            Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName);
-            Assert.AreEqual(UnittestProto3Reflection.Descriptor, enumType.File);
-            Assert.Null(enumType.ContainingType);
-            Assert.Null(enumType.Proto.Options);
-
-            Assert.AreEqual("NestedEnum", nestedType.Name);
-            Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum",
-                            nestedType.FullName);
-            Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File);
-            Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType);
-
-            EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO");
-            Assert.AreEqual(value, enumType.Values[1]);
-            Assert.AreEqual("FOREIGN_FOO", value.Name);
-            Assert.AreEqual(4, value.Number);
-            Assert.AreEqual((int) ForeignEnum.ForeignFoo, value.Number);
-            Assert.AreEqual(value, enumType.FindValueByNumber(4));
-            Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE"));
-            for (int i = 0; i < enumType.Values.Count; i++)
-            {
-                Assert.AreEqual(i, enumType.Values[i].Index);
-            }
-        }
-
-        [Test]
-        public void OneofDescriptor()
-        {
-            OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor<OneofDescriptor>("oneof_field");
-            Assert.AreEqual("oneof_field", descriptor.Name);
-            Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName);
-
-            var expectedFields = new[] {
-                TestAllTypes.OneofBytesFieldNumber,
-                TestAllTypes.OneofNestedMessageFieldNumber,
-                TestAllTypes.OneofStringFieldNumber,
-                TestAllTypes.OneofUint32FieldNumber }
-                .Select(fieldNumber => TestAllTypes.Descriptor.FindFieldByNumber(fieldNumber))
-                .ToList();
-            foreach (var field in expectedFields)
-            {
-                Assert.AreSame(descriptor, field.ContainingOneof);
-            }
-
-            CollectionAssert.AreEquivalent(expectedFields, descriptor.Fields);
-        }
-
-        [Test]
-        public void MapEntryMessageDescriptor()
-        {
-            var descriptor = MapWellKnownTypes.Descriptor.NestedTypes[0];
-            Assert.IsNull(descriptor.Parser);
-            Assert.IsNull(descriptor.ClrType);
-            Assert.IsNull(descriptor.Fields[1].Accessor);
-        }
-
-        // From TestFieldOrdering:
-        // string my_string = 11;
-        // int64 my_int = 1;
-        // float my_float = 101;
-        // NestedMessage single_nested_message = 200;
-        [Test]
-        public void FieldListOrderings()
-        { 
-            var fields = TestFieldOrderings.Descriptor.Fields;
-            Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber));
-            Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber));
-        }
-
-
-        [Test]
-        public void DescriptorProtoFileDescriptor()
-        {
-            var descriptor = Google.Protobuf.Reflection.FileDescriptor.DescriptorProtoFileDescriptor;
-            Assert.AreEqual("google/protobuf/descriptor.proto", descriptor.Name);
-        }
-    }
-}

+ 0 - 218
csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs

@@ -1,218 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.TestProtos;
-using NUnit.Framework;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Google.Protobuf.Reflection
-{
-    public class FieldAccessTest
-    {
-        [Test]
-        public void GetValue()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var fields = TestAllTypes.Descriptor.Fields;
-            Assert.AreEqual(message.SingleBool, fields[TestAllTypes.SingleBoolFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleBytes, fields[TestAllTypes.SingleBytesFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleDouble, fields[TestAllTypes.SingleDoubleFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleFixed32, fields[TestAllTypes.SingleFixed32FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleFixed64, fields[TestAllTypes.SingleFixed64FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleFloat, fields[TestAllTypes.SingleFloatFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleForeignEnum, fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleForeignMessage, fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleImportEnum, fields[TestAllTypes.SingleImportEnumFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleImportMessage, fields[TestAllTypes.SingleImportMessageFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleInt32, fields[TestAllTypes.SingleInt32FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleInt64, fields[TestAllTypes.SingleInt64FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleNestedEnum, fields[TestAllTypes.SingleNestedEnumFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleNestedMessage, fields[TestAllTypes.SingleNestedMessageFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SinglePublicImportMessage, fields[TestAllTypes.SinglePublicImportMessageFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleSint32, fields[TestAllTypes.SingleSint32FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleSint64, fields[TestAllTypes.SingleSint64FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleString, fields[TestAllTypes.SingleStringFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleSfixed32, fields[TestAllTypes.SingleSfixed32FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleSfixed64, fields[TestAllTypes.SingleSfixed64FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleUint32, fields[TestAllTypes.SingleUint32FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.SingleUint64, fields[TestAllTypes.SingleUint64FieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.OneofBytes, fields[TestAllTypes.OneofBytesFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.OneofString, fields[TestAllTypes.OneofStringFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.OneofNestedMessage, fields[TestAllTypes.OneofNestedMessageFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(message.OneofUint32, fields[TestAllTypes.OneofUint32FieldNumber].Accessor.GetValue(message));
-
-            // Just one example for repeated fields - they're all just returning the list
-            var list = (IList) fields[TestAllTypes.RepeatedInt32FieldNumber].Accessor.GetValue(message);
-            Assert.AreEqual(message.RepeatedInt32, list);
-            Assert.AreEqual(message.RepeatedInt32[0], list[0]); // Just in case there was any doubt...
-
-            // Just a single map field, for the same reason
-            var mapMessage = new TestMap { MapStringString = { { "key1", "value1" }, { "key2", "value2" } } };
-            fields = TestMap.Descriptor.Fields;
-            var dictionary = (IDictionary) fields[TestMap.MapStringStringFieldNumber].Accessor.GetValue(mapMessage);
-            Assert.AreEqual(mapMessage.MapStringString, dictionary);
-            Assert.AreEqual("value1", dictionary["key1"]);
-        }
-
-        [Test]
-        public void Clear()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var fields = TestAllTypes.Descriptor.Fields;
-            fields[TestAllTypes.SingleBoolFieldNumber].Accessor.Clear(message);
-            fields[TestAllTypes.SingleInt32FieldNumber].Accessor.Clear(message);
-            fields[TestAllTypes.SingleStringFieldNumber].Accessor.Clear(message);
-            fields[TestAllTypes.SingleBytesFieldNumber].Accessor.Clear(message);
-            fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.Clear(message);
-            fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.Clear(message);
-            fields[TestAllTypes.RepeatedDoubleFieldNumber].Accessor.Clear(message);
-
-            var expected = new TestAllTypes(SampleMessages.CreateFullTestAllTypes())
-            {
-                SingleBool = false,
-                SingleInt32 = 0,
-                SingleString = "",
-                SingleBytes = ByteString.Empty,
-                SingleForeignEnum = 0,
-                SingleForeignMessage = null,
-            };
-            expected.RepeatedDouble.Clear();
-
-            Assert.AreEqual(expected, message);
-
-            // Separately, maps.
-            var mapMessage = new TestMap { MapStringString = { { "key1", "value1" }, { "key2", "value2" } } };
-            fields = TestMap.Descriptor.Fields;
-            fields[TestMap.MapStringStringFieldNumber].Accessor.Clear(mapMessage);
-            Assert.AreEqual(0, mapMessage.MapStringString.Count);
-        }
-
-        [Test]
-        public void SetValue_SingleFields()
-        {
-            // Just a sample (primitives, messages, enums, strings, byte strings)
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var fields = TestAllTypes.Descriptor.Fields;
-            fields[TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, false);
-            fields[TestAllTypes.SingleInt32FieldNumber].Accessor.SetValue(message, 500);
-            fields[TestAllTypes.SingleStringFieldNumber].Accessor.SetValue(message, "It's a string");
-            fields[TestAllTypes.SingleBytesFieldNumber].Accessor.SetValue(message, ByteString.CopyFrom(99, 98, 97));
-            fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.SetValue(message, ForeignEnum.ForeignFoo);
-            fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.SetValue(message, new ForeignMessage { C = 12345 });
-            fields[TestAllTypes.SingleDoubleFieldNumber].Accessor.SetValue(message, 20150701.5);
-
-            var expected = new TestAllTypes(SampleMessages.CreateFullTestAllTypes())
-            {
-                SingleBool = false,
-                SingleInt32 = 500,
-                SingleString = "It's a string",
-                SingleBytes = ByteString.CopyFrom(99, 98, 97),
-                SingleForeignEnum = ForeignEnum.ForeignFoo,
-                SingleForeignMessage = new ForeignMessage { C = 12345 },
-                SingleDouble = 20150701.5
-            };
-
-            Assert.AreEqual(expected, message);
-        }
-
-        [Test]
-        public void SetValue_SingleFields_WrongType()
-        {
-            IMessage message = SampleMessages.CreateFullTestAllTypes();
-            var fields = message.Descriptor.Fields;
-            Assert.Throws<InvalidCastException>(() => fields[TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, "This isn't a bool"));
-        }
-
-        [Test]
-        public void SetValue_MapFields()
-        {
-            IMessage message = new TestMap();
-            var fields = message.Descriptor.Fields;
-            Assert.Throws<InvalidOperationException>(() => fields[TestMap.MapStringStringFieldNumber].Accessor.SetValue(message, new Dictionary<string, string>()));
-        }
-
-        [Test]
-        public void SetValue_RepeatedFields()
-        {
-            IMessage message = SampleMessages.CreateFullTestAllTypes();
-            var fields = message.Descriptor.Fields;
-            Assert.Throws<InvalidOperationException>(() => fields[TestAllTypes.RepeatedDoubleFieldNumber].Accessor.SetValue(message, new double[10]));
-        }
-
-        [Test]
-        public void GetValue_IncorrectType()
-        {
-            IMessage message = SampleMessages.CreateFullTestAllTypes();
-            var fields = message.Descriptor.Fields;
-            Assert.Throws<InvalidCastException>(() => fields[TestAllTypes.SingleBoolFieldNumber].Accessor.GetValue(new TestMap()));
-        }
-
-        [Test]
-        public void Oneof()
-        {
-            var message = new TestAllTypes();
-            var descriptor = TestAllTypes.Descriptor;
-            Assert.AreEqual(1, descriptor.Oneofs.Count);
-            var oneof = descriptor.Oneofs[0];
-            Assert.AreEqual("oneof_field", oneof.Name);
-            Assert.IsNull(oneof.Accessor.GetCaseFieldDescriptor(message));
-
-            message.OneofString = "foo";
-            Assert.AreSame(descriptor.Fields[TestAllTypes.OneofStringFieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message));
-
-            message.OneofUint32 = 10;
-            Assert.AreSame(descriptor.Fields[TestAllTypes.OneofUint32FieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message));
-
-            oneof.Accessor.Clear(message);
-            Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
-        }
-
-        [Test]
-        public void FieldDescriptor_ByName()
-        {
-            var descriptor = TestAllTypes.Descriptor;
-            Assert.AreSame(
-                descriptor.Fields[TestAllTypes.SingleBoolFieldNumber],
-                descriptor.Fields["single_bool"]);
-        }
-
-        [Test]
-        public void FieldDescriptor_NotFound()
-        {
-            var descriptor = TestAllTypes.Descriptor;
-            Assert.Throws<KeyNotFoundException>(() => descriptor.Fields[999999].ToString());
-            Assert.Throws<KeyNotFoundException>(() => descriptor.Fields["not found"].ToString());
-        }        
-    }
-}

+ 0 - 94
csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs

@@ -1,94 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.TestProtos;
-using Google.Protobuf.WellKnownTypes;
-using NUnit.Framework;
-
-namespace Google.Protobuf.Reflection
-{
-    public class TypeRegistryTest
-    {
-        // Most of our tests use messages. Simple test that we really can use files...
-        [Test]
-        public void CreateWithFileDescriptor()
-        {
-            var registry = TypeRegistry.FromFiles(DurationReflection.Descriptor, StructReflection.Descriptor);
-            AssertDescriptorPresent(registry, Duration.Descriptor);
-            AssertDescriptorPresent(registry, ListValue.Descriptor);
-            AssertDescriptorAbsent(registry, Timestamp.Descriptor);
-        }
-
-        [Test]
-        public void TypesFromSameFile()
-        {
-            // Just for kicks, let's start with a nested type
-            var registry = TypeRegistry.FromMessages(TestAllTypes.Types.NestedMessage.Descriptor);
-            // Top-level...
-            AssertDescriptorPresent(registry, TestFieldOrderings.Descriptor);
-            // ... and nested (not the same as the original NestedMessage!)
-            AssertDescriptorPresent(registry, TestFieldOrderings.Types.NestedMessage.Descriptor);
-        }
-
-        [Test]
-        public void DependenciesAreIncluded()
-        {
-            var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor);
-            // Direct dependencies
-            AssertDescriptorPresent(registry, ImportMessage.Descriptor);
-            // Public dependencies
-            AssertDescriptorPresent(registry, PublicImportMessage.Descriptor);
-        }
-
-        [Test]
-        public void DuplicateFiles()
-        {
-            // Duplicates via dependencies and simply via repetition
-            var registry = TypeRegistry.FromFiles(
-                UnittestProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor,
-                TimestampReflection.Descriptor, TimestampReflection.Descriptor);
-            AssertDescriptorPresent(registry, TestAllTypes.Descriptor);
-            AssertDescriptorPresent(registry, ImportMessage.Descriptor);
-            AssertDescriptorPresent(registry, Timestamp.Descriptor);
-        }
-
-        private static void AssertDescriptorPresent(TypeRegistry registry, MessageDescriptor descriptor)
-        {
-            Assert.AreSame(descriptor, registry.Find(descriptor.FullName));
-        }
-
-        private static void AssertDescriptorAbsent(TypeRegistry registry, MessageDescriptor descriptor)
-        {
-            Assert.IsNull(registry.Find(descriptor.FullName));
-        }
-    }
-}

+ 0 - 42
csharp/src/Google.Protobuf.Test/SampleEnum.cs

@@ -1,42 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-    
-namespace Google.Protobuf
-{
-    // Just a sample enum with positive and negative values to be used in tests.
-    internal enum SampleEnum
-    {
-        NegativeValue = -2,
-        None = 0,
-        PositiveValue = 3
-    }
-}

+ 0 - 99
csharp/src/Google.Protobuf.Test/SampleMessages.cs

@@ -1,99 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.TestProtos;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Helper methods to create sample instances of types generated from unit test messages.
-    /// </summary>
-    public class SampleMessages
-    {
-        /// <summary>
-        /// Creates a new sample TestAllTypes message with all fields populated.
-        /// The "oneof" field is populated with the string property (OneofString).
-        /// </summary>
-        public static TestAllTypes CreateFullTestAllTypes()
-        {
-            return new TestAllTypes
-            {
-                SingleBool = true,
-                SingleBytes = ByteString.CopyFrom(1, 2, 3, 4),
-                SingleDouble = 23.5,
-                SingleFixed32 = 23,
-                SingleFixed64 = 1234567890123,
-                SingleFloat = 12.25f,
-                SingleForeignEnum = ForeignEnum.ForeignBar,
-                SingleForeignMessage = new ForeignMessage { C = 10 },
-                SingleImportEnum = ImportEnum.ImportBaz,
-                SingleImportMessage = new ImportMessage { D = 20 },
-                SingleInt32 = 100,
-                SingleInt64 = 3210987654321,
-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,
-                SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 },
-                SinglePublicImportMessage = new PublicImportMessage { E = 54 },
-                SingleSfixed32 = -123,
-                SingleSfixed64 = -12345678901234,
-                SingleSint32 = -456,
-                SingleSint64 = -12345678901235,
-                SingleString = "test",
-                SingleUint32 = UInt32.MaxValue,
-                SingleUint64 = UInt64.MaxValue,
-                RepeatedBool = { true, false },
-                RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6), ByteString.CopyFrom(new byte[1000]) },
-                RepeatedDouble = { -12.25, 23.5 },
-                RepeatedFixed32 = { UInt32.MaxValue, 23 },
-                RepeatedFixed64 = { UInt64.MaxValue, 1234567890123 },
-                RepeatedFloat = { 100f, 12.25f },
-                RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar },
-                RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } },
-                RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified },
-                RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } },
-                RepeatedInt32 = { 100, 200 },
-                RepeatedInt64 = { 3210987654321, Int64.MaxValue },
-                RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg },
-                RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } },
-                RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } },
-                RepeatedSfixed32 = { -123, 123 },
-                RepeatedSfixed64 = { -12345678901234, 12345678901234 },
-                RepeatedSint32 = { -456, 100 },
-                RepeatedSint64 = { -12345678901235, 123 },
-                RepeatedString = { "foo", "bar" },
-                RepeatedUint32 = { UInt32.MaxValue, UInt32.MinValue },
-                RepeatedUint64 = { UInt64.MaxValue, UInt32.MinValue },
-                OneofString = "Oneof string"
-            };
-        }
-    }
-}

+ 0 - 62
csharp/src/Google.Protobuf.Test/TestCornerCases.cs

@@ -1,62 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 UnitTest.Issues.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf
-{
-    public class TestCornerCases
-    {
-        [Test]
-        public void TestRoundTripNegativeEnums()
-        {
-            NegativeEnumMessage msg = new NegativeEnumMessage
-            {
-                Value = NegativeEnum.MinusOne,
-                Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },
-                PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }
-            };
-
-            Assert.AreEqual(58, msg.CalculateSize());
-
-            byte[] bytes = new byte[58];
-            CodedOutputStream output = new CodedOutputStream(bytes);
-
-            msg.WriteTo(output);
-            Assert.AreEqual(0, output.SpaceLeft);
-
-            NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes);
-            Assert.AreEqual(msg, copy);
-        }
-    }
-}

+ 0 - 45
csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs

@@ -1,45 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2016 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-
-namespace Google.Protobuf.TestProtos
-{
-    /// <summary>
-    /// A message with custom diagnostics (to test that they work).
-    /// </summary>
-    public partial class ForeignMessage : ICustomDiagnosticMessage
-    {
-        public string ToDiagnosticString()
-        {
-            return $"{{ \"c\": {C}, \"@cInHex\": \"{C:x}\" }}";
-        }
-    }
-}

+ 0 - 1599
csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs

@@ -1,1599 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: google/protobuf/map_unittest_proto3.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos {
-
-  /// <summary>Holder for reflection information generated from google/protobuf/map_unittest_proto3.proto</summary>
-  public static partial class MapUnittestProto3Reflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for google/protobuf/map_unittest_proto3.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static MapUnittestProto3Reflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "Cilnb29nbGUvcHJvdG9idWYvbWFwX3VuaXR0ZXN0X3Byb3RvMy5wcm90bxIR",
-            "cHJvdG9idWZfdW5pdHRlc3QaJWdvb2dsZS9wcm90b2J1Zi91bml0dGVzdF9w",
-            "cm90bzMucHJvdG8ilhIKB1Rlc3RNYXASRgoPbWFwX2ludDMyX2ludDMyGAEg",
-            "AygLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkludDMy",
-            "RW50cnkSRgoPbWFwX2ludDY0X2ludDY0GAIgAygLMi0ucHJvdG9idWZfdW5p",
-            "dHRlc3QuVGVzdE1hcC5NYXBJbnQ2NEludDY0RW50cnkSSgoRbWFwX3VpbnQz",
-            "Ml91aW50MzIYAyADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1h",
-            "cFVpbnQzMlVpbnQzMkVudHJ5EkoKEW1hcF91aW50NjRfdWludDY0GAQgAygL",
-            "Mi8ucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBVaW50NjRVaW50NjRF",
-            "bnRyeRJKChFtYXBfc2ludDMyX3NpbnQzMhgFIAMoCzIvLnByb3RvYnVmX3Vu",
-            "aXR0ZXN0LlRlc3RNYXAuTWFwU2ludDMyU2ludDMyRW50cnkSSgoRbWFwX3Np",
-            "bnQ2NF9zaW50NjQYBiADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFw",
-            "Lk1hcFNpbnQ2NFNpbnQ2NEVudHJ5Ek4KE21hcF9maXhlZDMyX2ZpeGVkMzIY",
-            "ByADKAsyMS5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1hcEZpeGVkMzJG",
-            "aXhlZDMyRW50cnkSTgoTbWFwX2ZpeGVkNjRfZml4ZWQ2NBgIIAMoCzIxLnBy",
-            "b3RvYnVmX3VuaXR0ZXN0LlRlc3RNYXAuTWFwRml4ZWQ2NEZpeGVkNjRFbnRy",
-            "eRJSChVtYXBfc2ZpeGVkMzJfc2ZpeGVkMzIYCSADKAsyMy5wcm90b2J1Zl91",
-            "bml0dGVzdC5UZXN0TWFwLk1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRJSChVt",
-            "YXBfc2ZpeGVkNjRfc2ZpeGVkNjQYCiADKAsyMy5wcm90b2J1Zl91bml0dGVz",
-            "dC5UZXN0TWFwLk1hcFNmaXhlZDY0U2ZpeGVkNjRFbnRyeRJGCg9tYXBfaW50",
-            "MzJfZmxvYXQYCyADKAsyLS5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1h",
-            "cEludDMyRmxvYXRFbnRyeRJIChBtYXBfaW50MzJfZG91YmxlGAwgAygLMi4u",
-            "cHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkRvdWJsZUVudHJ5",
-            "EkIKDW1hcF9ib29sX2Jvb2wYDSADKAsyKy5wcm90b2J1Zl91bml0dGVzdC5U",
-            "ZXN0TWFwLk1hcEJvb2xCb29sRW50cnkSSgoRbWFwX3N0cmluZ19zdHJpbmcY",
-            "DiADKAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWFwLk1hcFN0cmluZ1N0",
-            "cmluZ0VudHJ5EkYKD21hcF9pbnQzMl9ieXRlcxgPIAMoCzItLnByb3RvYnVm",
-            "X3VuaXR0ZXN0LlRlc3RNYXAuTWFwSW50MzJCeXRlc0VudHJ5EkQKDm1hcF9p",
-            "bnQzMl9lbnVtGBAgAygLMiwucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5N",
-            "YXBJbnQzMkVudW1FbnRyeRJZChltYXBfaW50MzJfZm9yZWlnbl9tZXNzYWdl",
-            "GBEgAygLMjYucHJvdG9idWZfdW5pdHRlc3QuVGVzdE1hcC5NYXBJbnQzMkZv",
-            "cmVpZ25NZXNzYWdlRW50cnkaNAoSTWFwSW50MzJJbnQzMkVudHJ5EgsKA2tl",
-            "eRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFwSW50NjRJbnQ2NEVu",
-            "dHJ5EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoCOAEaNgoUTWFwVWlu",
-            "dDMyVWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZhbHVlGAIgASgNOgI4",
-            "ARo2ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkYASABKAQSDQoFdmFs",
-            "dWUYAiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVudHJ5EgsKA2tleRgB",
-            "IAEoERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2ludDY0U2ludDY0RW50",
-            "cnkSCwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4ARo4ChZNYXBGaXhl",
-            "ZDMyRml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2YWx1ZRgCIAEoBzoC",
-            "OAEaOAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNrZXkYASABKAYSDQoF",
-            "dmFsdWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRIL",
-            "CgNrZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoKGE1hcFNmaXhlZDY0",
-            "U2ZpeGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFsdWUYAiABKBA6AjgB",
-            "GjQKEk1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASABKAUSDQoFdmFsdWUY",
-            "AiABKAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkSCwoDa2V5GAEgASgF",
-            "Eg0KBXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9vbEVudHJ5EgsKA2tl",
-            "eRgBIAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaNgoUTWFwU3RyaW5nU3RyaW5n",
-            "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARo0ChJNYXBJ",
-            "bnQzMkJ5dGVzRW50cnkSCwoDa2V5GAEgASgFEg0KBXZhbHVlGAIgASgMOgI4",
-            "ARpPChFNYXBJbnQzMkVudW1FbnRyeRILCgNrZXkYASABKAUSKQoFdmFsdWUY",
-            "AiABKA4yGi5wcm90b2J1Zl91bml0dGVzdC5NYXBFbnVtOgI4ARpgChtNYXBJ",
-            "bnQzMkZvcmVpZ25NZXNzYWdlRW50cnkSCwoDa2V5GAEgASgFEjAKBXZhbHVl",
-            "GAIgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2U6AjgB",
-            "IkEKEVRlc3RNYXBTdWJtZXNzYWdlEiwKCHRlc3RfbWFwGAEgASgLMhoucHJv",
-            "dG9idWZfdW5pdHRlc3QuVGVzdE1hcCK8AQoOVGVzdE1lc3NhZ2VNYXASUQoR",
-            "bWFwX2ludDMyX21lc3NhZ2UYASADKAsyNi5wcm90b2J1Zl91bml0dGVzdC5U",
-            "ZXN0TWVzc2FnZU1hcC5NYXBJbnQzMk1lc3NhZ2VFbnRyeRpXChRNYXBJbnQz",
-            "Mk1lc3NhZ2VFbnRyeRILCgNrZXkYASABKAUSLgoFdmFsdWUYAiABKAsyHy5w",
-            "cm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXM6AjgBIuMBCg9UZXN0U2Ft",
-            "ZVR5cGVNYXASOgoEbWFwMRgBIAMoCzIsLnByb3RvYnVmX3VuaXR0ZXN0LlRl",
-            "c3RTYW1lVHlwZU1hcC5NYXAxRW50cnkSOgoEbWFwMhgCIAMoCzIsLnByb3Rv",
-            "YnVmX3VuaXR0ZXN0LlRlc3RTYW1lVHlwZU1hcC5NYXAyRW50cnkaKwoJTWFw",
-            "MUVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaKwoJTWFw",
-            "MkVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEi5BAKDFRl",
-            "c3RBcmVuYU1hcBJLCg9tYXBfaW50MzJfaW50MzIYASADKAsyMi5wcm90b2J1",
-            "Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwSW50MzJJbnQzMkVudHJ5EksK",
-            "D21hcF9pbnQ2NF9pbnQ2NBgCIAMoCzIyLnByb3RvYnVmX3VuaXR0ZXN0LlRl",
-            "c3RBcmVuYU1hcC5NYXBJbnQ2NEludDY0RW50cnkSTwoRbWFwX3VpbnQzMl91",
-            "aW50MzIYAyADKAsyNC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAu",
-            "TWFwVWludDMyVWludDMyRW50cnkSTwoRbWFwX3VpbnQ2NF91aW50NjQYBCAD",
-            "KAsyNC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwVWludDY0",
-            "VWludDY0RW50cnkSTwoRbWFwX3NpbnQzMl9zaW50MzIYBSADKAsyNC5wcm90",
-            "b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwU2ludDMyU2ludDMyRW50",
-            "cnkSTwoRbWFwX3NpbnQ2NF9zaW50NjQYBiADKAsyNC5wcm90b2J1Zl91bml0",
-            "dGVzdC5UZXN0QXJlbmFNYXAuTWFwU2ludDY0U2ludDY0RW50cnkSUwoTbWFw",
-            "X2ZpeGVkMzJfZml4ZWQzMhgHIAMoCzI2LnByb3RvYnVmX3VuaXR0ZXN0LlRl",
-            "c3RBcmVuYU1hcC5NYXBGaXhlZDMyRml4ZWQzMkVudHJ5ElMKE21hcF9maXhl",
-            "ZDY0X2ZpeGVkNjQYCCADKAsyNi5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJl",
-            "bmFNYXAuTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRJXChVtYXBfc2ZpeGVkMzJf",
-            "c2ZpeGVkMzIYCSADKAsyOC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFN",
-            "YXAuTWFwU2ZpeGVkMzJTZml4ZWQzMkVudHJ5ElcKFW1hcF9zZml4ZWQ2NF9z",
-            "Zml4ZWQ2NBgKIAMoCzI4LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBcmVuYU1h",
-            "cC5NYXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkSSwoPbWFwX2ludDMyX2Zsb2F0",
-            "GAsgAygLMjIucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1hcElu",
-            "dDMyRmxvYXRFbnRyeRJNChBtYXBfaW50MzJfZG91YmxlGAwgAygLMjMucHJv",
-            "dG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1hcEludDMyRG91YmxlRW50",
-            "cnkSRwoNbWFwX2Jvb2xfYm9vbBgNIAMoCzIwLnByb3RvYnVmX3VuaXR0ZXN0",
-            "LlRlc3RBcmVuYU1hcC5NYXBCb29sQm9vbEVudHJ5EkkKDm1hcF9pbnQzMl9l",
-            "bnVtGA4gAygLMjEucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFyZW5hTWFwLk1h",
-            "cEludDMyRW51bUVudHJ5El4KGW1hcF9pbnQzMl9mb3JlaWduX21lc3NhZ2UY",
-            "DyADKAsyOy5wcm90b2J1Zl91bml0dGVzdC5UZXN0QXJlbmFNYXAuTWFwSW50",
-            "MzJGb3JlaWduTWVzc2FnZUVudHJ5GjQKEk1hcEludDMySW50MzJFbnRyeRIL",
-            "CgNrZXkYASABKAUSDQoFdmFsdWUYAiABKAU6AjgBGjQKEk1hcEludDY0SW50",
-            "NjRFbnRyeRILCgNrZXkYASABKAMSDQoFdmFsdWUYAiABKAM6AjgBGjYKFE1h",
-            "cFVpbnQzMlVpbnQzMkVudHJ5EgsKA2tleRgBIAEoDRINCgV2YWx1ZRgCIAEo",
-            "DToCOAEaNgoUTWFwVWludDY0VWludDY0RW50cnkSCwoDa2V5GAEgASgEEg0K",
-            "BXZhbHVlGAIgASgEOgI4ARo2ChRNYXBTaW50MzJTaW50MzJFbnRyeRILCgNr",
-            "ZXkYASABKBESDQoFdmFsdWUYAiABKBE6AjgBGjYKFE1hcFNpbnQ2NFNpbnQ2",
-            "NEVudHJ5EgsKA2tleRgBIAEoEhINCgV2YWx1ZRgCIAEoEjoCOAEaOAoWTWFw",
-            "Rml4ZWQzMkZpeGVkMzJFbnRyeRILCgNrZXkYASABKAcSDQoFdmFsdWUYAiAB",
-            "KAc6AjgBGjgKFk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSCwoDa2V5GAEgASgG",
-            "Eg0KBXZhbHVlGAIgASgGOgI4ARo6ChhNYXBTZml4ZWQzMlNmaXhlZDMyRW50",
-            "cnkSCwoDa2V5GAEgASgPEg0KBXZhbHVlGAIgASgPOgI4ARo6ChhNYXBTZml4",
-            "ZWQ2NFNmaXhlZDY0RW50cnkSCwoDa2V5GAEgASgQEg0KBXZhbHVlGAIgASgQ",
-            "OgI4ARo0ChJNYXBJbnQzMkZsb2F0RW50cnkSCwoDa2V5GAEgASgFEg0KBXZh",
-            "bHVlGAIgASgCOgI4ARo1ChNNYXBJbnQzMkRvdWJsZUVudHJ5EgsKA2tleRgB",
-            "IAEoBRINCgV2YWx1ZRgCIAEoAToCOAEaMgoQTWFwQm9vbEJvb2xFbnRyeRIL",
-            "CgNrZXkYASABKAgSDQoFdmFsdWUYAiABKAg6AjgBGk8KEU1hcEludDMyRW51",
-            "bUVudHJ5EgsKA2tleRgBIAEoBRIpCgV2YWx1ZRgCIAEoDjIaLnByb3RvYnVm",
-            "X3VuaXR0ZXN0Lk1hcEVudW06AjgBGmAKG01hcEludDMyRm9yZWlnbk1lc3Nh",
-            "Z2VFbnRyeRILCgNrZXkYASABKAUSMAoFdmFsdWUYAiABKAsyIS5wcm90b2J1",
-            "Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZToCOAEi5AEKH01lc3NhZ2VDb250",
-            "YWluaW5nRW51bUNhbGxlZFR5cGUSSgoEdHlwZRgBIAMoCzI8LnByb3RvYnVm",
-            "X3VuaXR0ZXN0Lk1lc3NhZ2VDb250YWluaW5nRW51bUNhbGxlZFR5cGUuVHlw",
-            "ZUVudHJ5Gl8KCVR5cGVFbnRyeRILCgNrZXkYASABKAUSQQoFdmFsdWUYAiAB",
-            "KAsyMi5wcm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ0VudW1D",
-            "YWxsZWRUeXBlOgI4ASIUCgRUeXBlEgwKCFRZUEVfRk9PEAAinQEKH01lc3Nh",
-            "Z2VDb250YWluaW5nTWFwQ2FsbGVkRW50cnkSTAoFZW50cnkYASADKAsyPS5w",
-            "cm90b2J1Zl91bml0dGVzdC5NZXNzYWdlQ29udGFpbmluZ01hcENhbGxlZEVu",
-            "dHJ5LkVudHJ5RW50cnkaLAoKRW50cnlFbnRyeRILCgNrZXkYASABKAUSDQoF",
-            "dmFsdWUYAiABKAU6AjgBKj8KB01hcEVudW0SEAoMTUFQX0VOVU1fRk9PEAAS",
-            "EAoMTUFQX0VOVU1fQkFSEAESEAoMTUFQX0VOVU1fQkFaEAJCIPgBAaoCGkdv",
-            "b2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zYgZwcm90bzM="));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor, },
-          new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.MapEnum), }, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMap), global::Google.Protobuf.TestProtos.TestMap.Parser, new[]{ "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapInt32Bytes", "MapInt32Enum", "MapInt32ForeignMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMapSubmessage), global::Google.Protobuf.TestProtos.TestMapSubmessage.Parser, new[]{ "TestMap" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMessageMap), global::Google.Protobuf.TestProtos.TestMessageMap.Parser, new[]{ "MapInt32Message" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap), global::Google.Protobuf.TestProtos.TestSameTypeMap.Parser, new[]{ "Map1", "Map2" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestArenaMap), global::Google.Protobuf.TestProtos.TestArenaMap.Parser, new[]{ "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapInt32Enum", "MapInt32ForeignMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType), global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser, new[]{ "Type" }, null, new[]{ typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Types.Type) }, new pbr::GeneratedClrTypeInfo[] { null, }),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry), global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Parser, new[]{ "Entry" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, })
-          }));
-    }
-    #endregion
-
-  }
-  #region Enums
-  public enum MapEnum {
-    [pbr::OriginalName("MAP_ENUM_FOO")] Foo = 0,
-    [pbr::OriginalName("MAP_ENUM_BAR")] Bar = 1,
-    [pbr::OriginalName("MAP_ENUM_BAZ")] Baz = 2,
-  }
-
-  #endregion
-
-  #region Messages
-  /// <summary>
-  ///  Tests maps.
-  /// </summary>
-  public sealed partial class TestMap : pb::IMessage<TestMap> {
-    private static readonly pb::MessageParser<TestMap> _parser = new pb::MessageParser<TestMap>(() => new TestMap());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestMap> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMap() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMap(TestMap other) : this() {
-      mapInt32Int32_ = other.mapInt32Int32_.Clone();
-      mapInt64Int64_ = other.mapInt64Int64_.Clone();
-      mapUint32Uint32_ = other.mapUint32Uint32_.Clone();
-      mapUint64Uint64_ = other.mapUint64Uint64_.Clone();
-      mapSint32Sint32_ = other.mapSint32Sint32_.Clone();
-      mapSint64Sint64_ = other.mapSint64Sint64_.Clone();
-      mapFixed32Fixed32_ = other.mapFixed32Fixed32_.Clone();
-      mapFixed64Fixed64_ = other.mapFixed64Fixed64_.Clone();
-      mapSfixed32Sfixed32_ = other.mapSfixed32Sfixed32_.Clone();
-      mapSfixed64Sfixed64_ = other.mapSfixed64Sfixed64_.Clone();
-      mapInt32Float_ = other.mapInt32Float_.Clone();
-      mapInt32Double_ = other.mapInt32Double_.Clone();
-      mapBoolBool_ = other.mapBoolBool_.Clone();
-      mapStringString_ = other.mapStringString_.Clone();
-      mapInt32Bytes_ = other.mapInt32Bytes_.Clone();
-      mapInt32Enum_ = other.mapInt32Enum_.Clone();
-      mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMap Clone() {
-      return new TestMap(this);
-    }
-
-    /// <summary>Field number for the "map_int32_int32" field.</summary>
-    public const int MapInt32Int32FieldNumber = 1;
-    private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
-    private readonly pbc::MapField<int, int> mapInt32Int32_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> MapInt32Int32 {
-      get { return mapInt32Int32_; }
-    }
-
-    /// <summary>Field number for the "map_int64_int64" field.</summary>
-    public const int MapInt64Int64FieldNumber = 2;
-    private static readonly pbc::MapField<long, long>.Codec _map_mapInt64Int64_codec
-        = new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18);
-    private readonly pbc::MapField<long, long> mapInt64Int64_ = new pbc::MapField<long, long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<long, long> MapInt64Int64 {
-      get { return mapInt64Int64_; }
-    }
-
-    /// <summary>Field number for the "map_uint32_uint32" field.</summary>
-    public const int MapUint32Uint32FieldNumber = 3;
-    private static readonly pbc::MapField<uint, uint>.Codec _map_mapUint32Uint32_codec
-        = new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26);
-    private readonly pbc::MapField<uint, uint> mapUint32Uint32_ = new pbc::MapField<uint, uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<uint, uint> MapUint32Uint32 {
-      get { return mapUint32Uint32_; }
-    }
-
-    /// <summary>Field number for the "map_uint64_uint64" field.</summary>
-    public const int MapUint64Uint64FieldNumber = 4;
-    private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapUint64Uint64_codec
-        = new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34);
-    private readonly pbc::MapField<ulong, ulong> mapUint64Uint64_ = new pbc::MapField<ulong, ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<ulong, ulong> MapUint64Uint64 {
-      get { return mapUint64Uint64_; }
-    }
-
-    /// <summary>Field number for the "map_sint32_sint32" field.</summary>
-    public const int MapSint32Sint32FieldNumber = 5;
-    private static readonly pbc::MapField<int, int>.Codec _map_mapSint32Sint32_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42);
-    private readonly pbc::MapField<int, int> mapSint32Sint32_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> MapSint32Sint32 {
-      get { return mapSint32Sint32_; }
-    }
-
-    /// <summary>Field number for the "map_sint64_sint64" field.</summary>
-    public const int MapSint64Sint64FieldNumber = 6;
-    private static readonly pbc::MapField<long, long>.Codec _map_mapSint64Sint64_codec
-        = new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50);
-    private readonly pbc::MapField<long, long> mapSint64Sint64_ = new pbc::MapField<long, long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<long, long> MapSint64Sint64 {
-      get { return mapSint64Sint64_; }
-    }
-
-    /// <summary>Field number for the "map_fixed32_fixed32" field.</summary>
-    public const int MapFixed32Fixed32FieldNumber = 7;
-    private static readonly pbc::MapField<uint, uint>.Codec _map_mapFixed32Fixed32_codec
-        = new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58);
-    private readonly pbc::MapField<uint, uint> mapFixed32Fixed32_ = new pbc::MapField<uint, uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<uint, uint> MapFixed32Fixed32 {
-      get { return mapFixed32Fixed32_; }
-    }
-
-    /// <summary>Field number for the "map_fixed64_fixed64" field.</summary>
-    public const int MapFixed64Fixed64FieldNumber = 8;
-    private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapFixed64Fixed64_codec
-        = new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66);
-    private readonly pbc::MapField<ulong, ulong> mapFixed64Fixed64_ = new pbc::MapField<ulong, ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<ulong, ulong> MapFixed64Fixed64 {
-      get { return mapFixed64Fixed64_; }
-    }
-
-    /// <summary>Field number for the "map_sfixed32_sfixed32" field.</summary>
-    public const int MapSfixed32Sfixed32FieldNumber = 9;
-    private static readonly pbc::MapField<int, int>.Codec _map_mapSfixed32Sfixed32_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74);
-    private readonly pbc::MapField<int, int> mapSfixed32Sfixed32_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> MapSfixed32Sfixed32 {
-      get { return mapSfixed32Sfixed32_; }
-    }
-
-    /// <summary>Field number for the "map_sfixed64_sfixed64" field.</summary>
-    public const int MapSfixed64Sfixed64FieldNumber = 10;
-    private static readonly pbc::MapField<long, long>.Codec _map_mapSfixed64Sfixed64_codec
-        = new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82);
-    private readonly pbc::MapField<long, long> mapSfixed64Sfixed64_ = new pbc::MapField<long, long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<long, long> MapSfixed64Sfixed64 {
-      get { return mapSfixed64Sfixed64_; }
-    }
-
-    /// <summary>Field number for the "map_int32_float" field.</summary>
-    public const int MapInt32FloatFieldNumber = 11;
-    private static readonly pbc::MapField<int, float>.Codec _map_mapInt32Float_codec
-        = new pbc::MapField<int, float>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90);
-    private readonly pbc::MapField<int, float> mapInt32Float_ = new pbc::MapField<int, float>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, float> MapInt32Float {
-      get { return mapInt32Float_; }
-    }
-
-    /// <summary>Field number for the "map_int32_double" field.</summary>
-    public const int MapInt32DoubleFieldNumber = 12;
-    private static readonly pbc::MapField<int, double>.Codec _map_mapInt32Double_codec
-        = new pbc::MapField<int, double>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98);
-    private readonly pbc::MapField<int, double> mapInt32Double_ = new pbc::MapField<int, double>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, double> MapInt32Double {
-      get { return mapInt32Double_; }
-    }
-
-    /// <summary>Field number for the "map_bool_bool" field.</summary>
-    public const int MapBoolBoolFieldNumber = 13;
-    private static readonly pbc::MapField<bool, bool>.Codec _map_mapBoolBool_codec
-        = new pbc::MapField<bool, bool>.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106);
-    private readonly pbc::MapField<bool, bool> mapBoolBool_ = new pbc::MapField<bool, bool>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<bool, bool> MapBoolBool {
-      get { return mapBoolBool_; }
-    }
-
-    /// <summary>Field number for the "map_string_string" field.</summary>
-    public const int MapStringStringFieldNumber = 14;
-    private static readonly pbc::MapField<string, string>.Codec _map_mapStringString_codec
-        = new pbc::MapField<string, string>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 114);
-    private readonly pbc::MapField<string, string> mapStringString_ = new pbc::MapField<string, string>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<string, string> MapStringString {
-      get { return mapStringString_; }
-    }
-
-    /// <summary>Field number for the "map_int32_bytes" field.</summary>
-    public const int MapInt32BytesFieldNumber = 15;
-    private static readonly pbc::MapField<int, pb::ByteString>.Codec _map_mapInt32Bytes_codec
-        = new pbc::MapField<int, pb::ByteString>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForBytes(18), 122);
-    private readonly pbc::MapField<int, pb::ByteString> mapInt32Bytes_ = new pbc::MapField<int, pb::ByteString>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, pb::ByteString> MapInt32Bytes {
-      get { return mapInt32Bytes_; }
-    }
-
-    /// <summary>Field number for the "map_int32_enum" field.</summary>
-    public const int MapInt32EnumFieldNumber = 16;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec _map_mapInt32Enum_codec
-        = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 130);
-    private readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum> mapInt32Enum_ = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum> MapInt32Enum {
-      get { return mapInt32Enum_; }
-    }
-
-    /// <summary>Field number for the "map_int32_foreign_message" field.</summary>
-    public const int MapInt32ForeignMessageFieldNumber = 17;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec _map_mapInt32ForeignMessage_codec
-        = new pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 138);
-    private readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage> mapInt32ForeignMessage_ = new pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage> MapInt32ForeignMessage {
-      get { return mapInt32ForeignMessage_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestMap);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestMap other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!MapInt32Int32.Equals(other.MapInt32Int32)) return false;
-      if (!MapInt64Int64.Equals(other.MapInt64Int64)) return false;
-      if (!MapUint32Uint32.Equals(other.MapUint32Uint32)) return false;
-      if (!MapUint64Uint64.Equals(other.MapUint64Uint64)) return false;
-      if (!MapSint32Sint32.Equals(other.MapSint32Sint32)) return false;
-      if (!MapSint64Sint64.Equals(other.MapSint64Sint64)) return false;
-      if (!MapFixed32Fixed32.Equals(other.MapFixed32Fixed32)) return false;
-      if (!MapFixed64Fixed64.Equals(other.MapFixed64Fixed64)) return false;
-      if (!MapSfixed32Sfixed32.Equals(other.MapSfixed32Sfixed32)) return false;
-      if (!MapSfixed64Sfixed64.Equals(other.MapSfixed64Sfixed64)) return false;
-      if (!MapInt32Float.Equals(other.MapInt32Float)) return false;
-      if (!MapInt32Double.Equals(other.MapInt32Double)) return false;
-      if (!MapBoolBool.Equals(other.MapBoolBool)) return false;
-      if (!MapStringString.Equals(other.MapStringString)) return false;
-      if (!MapInt32Bytes.Equals(other.MapInt32Bytes)) return false;
-      if (!MapInt32Enum.Equals(other.MapInt32Enum)) return false;
-      if (!MapInt32ForeignMessage.Equals(other.MapInt32ForeignMessage)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= MapInt32Int32.GetHashCode();
-      hash ^= MapInt64Int64.GetHashCode();
-      hash ^= MapUint32Uint32.GetHashCode();
-      hash ^= MapUint64Uint64.GetHashCode();
-      hash ^= MapSint32Sint32.GetHashCode();
-      hash ^= MapSint64Sint64.GetHashCode();
-      hash ^= MapFixed32Fixed32.GetHashCode();
-      hash ^= MapFixed64Fixed64.GetHashCode();
-      hash ^= MapSfixed32Sfixed32.GetHashCode();
-      hash ^= MapSfixed64Sfixed64.GetHashCode();
-      hash ^= MapInt32Float.GetHashCode();
-      hash ^= MapInt32Double.GetHashCode();
-      hash ^= MapBoolBool.GetHashCode();
-      hash ^= MapStringString.GetHashCode();
-      hash ^= MapInt32Bytes.GetHashCode();
-      hash ^= MapInt32Enum.GetHashCode();
-      hash ^= MapInt32ForeignMessage.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec);
-      mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec);
-      mapUint32Uint32_.WriteTo(output, _map_mapUint32Uint32_codec);
-      mapUint64Uint64_.WriteTo(output, _map_mapUint64Uint64_codec);
-      mapSint32Sint32_.WriteTo(output, _map_mapSint32Sint32_codec);
-      mapSint64Sint64_.WriteTo(output, _map_mapSint64Sint64_codec);
-      mapFixed32Fixed32_.WriteTo(output, _map_mapFixed32Fixed32_codec);
-      mapFixed64Fixed64_.WriteTo(output, _map_mapFixed64Fixed64_codec);
-      mapSfixed32Sfixed32_.WriteTo(output, _map_mapSfixed32Sfixed32_codec);
-      mapSfixed64Sfixed64_.WriteTo(output, _map_mapSfixed64Sfixed64_codec);
-      mapInt32Float_.WriteTo(output, _map_mapInt32Float_codec);
-      mapInt32Double_.WriteTo(output, _map_mapInt32Double_codec);
-      mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec);
-      mapStringString_.WriteTo(output, _map_mapStringString_codec);
-      mapInt32Bytes_.WriteTo(output, _map_mapInt32Bytes_codec);
-      mapInt32Enum_.WriteTo(output, _map_mapInt32Enum_codec);
-      mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec);
-      size += mapInt64Int64_.CalculateSize(_map_mapInt64Int64_codec);
-      size += mapUint32Uint32_.CalculateSize(_map_mapUint32Uint32_codec);
-      size += mapUint64Uint64_.CalculateSize(_map_mapUint64Uint64_codec);
-      size += mapSint32Sint32_.CalculateSize(_map_mapSint32Sint32_codec);
-      size += mapSint64Sint64_.CalculateSize(_map_mapSint64Sint64_codec);
-      size += mapFixed32Fixed32_.CalculateSize(_map_mapFixed32Fixed32_codec);
-      size += mapFixed64Fixed64_.CalculateSize(_map_mapFixed64Fixed64_codec);
-      size += mapSfixed32Sfixed32_.CalculateSize(_map_mapSfixed32Sfixed32_codec);
-      size += mapSfixed64Sfixed64_.CalculateSize(_map_mapSfixed64Sfixed64_codec);
-      size += mapInt32Float_.CalculateSize(_map_mapInt32Float_codec);
-      size += mapInt32Double_.CalculateSize(_map_mapInt32Double_codec);
-      size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec);
-      size += mapStringString_.CalculateSize(_map_mapStringString_codec);
-      size += mapInt32Bytes_.CalculateSize(_map_mapInt32Bytes_codec);
-      size += mapInt32Enum_.CalculateSize(_map_mapInt32Enum_codec);
-      size += mapInt32ForeignMessage_.CalculateSize(_map_mapInt32ForeignMessage_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestMap other) {
-      if (other == null) {
-        return;
-      }
-      mapInt32Int32_.Add(other.mapInt32Int32_);
-      mapInt64Int64_.Add(other.mapInt64Int64_);
-      mapUint32Uint32_.Add(other.mapUint32Uint32_);
-      mapUint64Uint64_.Add(other.mapUint64Uint64_);
-      mapSint32Sint32_.Add(other.mapSint32Sint32_);
-      mapSint64Sint64_.Add(other.mapSint64Sint64_);
-      mapFixed32Fixed32_.Add(other.mapFixed32Fixed32_);
-      mapFixed64Fixed64_.Add(other.mapFixed64Fixed64_);
-      mapSfixed32Sfixed32_.Add(other.mapSfixed32Sfixed32_);
-      mapSfixed64Sfixed64_.Add(other.mapSfixed64Sfixed64_);
-      mapInt32Float_.Add(other.mapInt32Float_);
-      mapInt32Double_.Add(other.mapInt32Double_);
-      mapBoolBool_.Add(other.mapBoolBool_);
-      mapStringString_.Add(other.mapStringString_);
-      mapInt32Bytes_.Add(other.mapInt32Bytes_);
-      mapInt32Enum_.Add(other.mapInt32Enum_);
-      mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
-            break;
-          }
-          case 18: {
-            mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec);
-            break;
-          }
-          case 26: {
-            mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec);
-            break;
-          }
-          case 34: {
-            mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec);
-            break;
-          }
-          case 42: {
-            mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec);
-            break;
-          }
-          case 50: {
-            mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec);
-            break;
-          }
-          case 58: {
-            mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec);
-            break;
-          }
-          case 66: {
-            mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec);
-            break;
-          }
-          case 74: {
-            mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec);
-            break;
-          }
-          case 82: {
-            mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec);
-            break;
-          }
-          case 90: {
-            mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec);
-            break;
-          }
-          case 98: {
-            mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec);
-            break;
-          }
-          case 106: {
-            mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec);
-            break;
-          }
-          case 114: {
-            mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec);
-            break;
-          }
-          case 122: {
-            mapInt32Bytes_.AddEntriesFrom(input, _map_mapInt32Bytes_codec);
-            break;
-          }
-          case 130: {
-            mapInt32Enum_.AddEntriesFrom(input, _map_mapInt32Enum_codec);
-            break;
-          }
-          case 138: {
-            mapInt32ForeignMessage_.AddEntriesFrom(input, _map_mapInt32ForeignMessage_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestMapSubmessage : pb::IMessage<TestMapSubmessage> {
-    private static readonly pb::MessageParser<TestMapSubmessage> _parser = new pb::MessageParser<TestMapSubmessage>(() => new TestMapSubmessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestMapSubmessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[1]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMapSubmessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMapSubmessage(TestMapSubmessage other) : this() {
-      TestMap = other.testMap_ != null ? other.TestMap.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMapSubmessage Clone() {
-      return new TestMapSubmessage(this);
-    }
-
-    /// <summary>Field number for the "test_map" field.</summary>
-    public const int TestMapFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestMap testMap_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestMap TestMap {
-      get { return testMap_; }
-      set {
-        testMap_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestMapSubmessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestMapSubmessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(TestMap, other.TestMap)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (testMap_ != null) hash ^= TestMap.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (testMap_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(TestMap);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (testMap_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(TestMap);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestMapSubmessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.testMap_ != null) {
-        if (testMap_ == null) {
-          testMap_ = new global::Google.Protobuf.TestProtos.TestMap();
-        }
-        TestMap.MergeFrom(other.TestMap);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (testMap_ == null) {
-              testMap_ = new global::Google.Protobuf.TestProtos.TestMap();
-            }
-            input.ReadMessage(testMap_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestMessageMap : pb::IMessage<TestMessageMap> {
-    private static readonly pb::MessageParser<TestMessageMap> _parser = new pb::MessageParser<TestMessageMap>(() => new TestMessageMap());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestMessageMap> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[2]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMessageMap() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMessageMap(TestMessageMap other) : this() {
-      mapInt32Message_ = other.mapInt32Message_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMessageMap Clone() {
-      return new TestMessageMap(this);
-    }
-
-    /// <summary>Field number for the "map_int32_message" field.</summary>
-    public const int MapInt32MessageFieldNumber = 1;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec _map_mapInt32Message_codec
-        = new pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10);
-    private readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes> mapInt32Message_ = new pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.TestProtos.TestAllTypes> MapInt32Message {
-      get { return mapInt32Message_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestMessageMap);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestMessageMap other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!MapInt32Message.Equals(other.MapInt32Message)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= MapInt32Message.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      mapInt32Message_.WriteTo(output, _map_mapInt32Message_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += mapInt32Message_.CalculateSize(_map_mapInt32Message_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestMessageMap other) {
-      if (other == null) {
-        return;
-      }
-      mapInt32Message_.Add(other.mapInt32Message_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            mapInt32Message_.AddEntriesFrom(input, _map_mapInt32Message_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Two map fields share the same entry default instance.
-  /// </summary>
-  public sealed partial class TestSameTypeMap : pb::IMessage<TestSameTypeMap> {
-    private static readonly pb::MessageParser<TestSameTypeMap> _parser = new pb::MessageParser<TestSameTypeMap>(() => new TestSameTypeMap());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestSameTypeMap> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[3]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestSameTypeMap() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestSameTypeMap(TestSameTypeMap other) : this() {
-      map1_ = other.map1_.Clone();
-      map2_ = other.map2_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestSameTypeMap Clone() {
-      return new TestSameTypeMap(this);
-    }
-
-    /// <summary>Field number for the "map1" field.</summary>
-    public const int Map1FieldNumber = 1;
-    private static readonly pbc::MapField<int, int>.Codec _map_map1_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
-    private readonly pbc::MapField<int, int> map1_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> Map1 {
-      get { return map1_; }
-    }
-
-    /// <summary>Field number for the "map2" field.</summary>
-    public const int Map2FieldNumber = 2;
-    private static readonly pbc::MapField<int, int>.Codec _map_map2_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 18);
-    private readonly pbc::MapField<int, int> map2_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> Map2 {
-      get { return map2_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestSameTypeMap);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestSameTypeMap other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!Map1.Equals(other.Map1)) return false;
-      if (!Map2.Equals(other.Map2)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= Map1.GetHashCode();
-      hash ^= Map2.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      map1_.WriteTo(output, _map_map1_codec);
-      map2_.WriteTo(output, _map_map2_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += map1_.CalculateSize(_map_map1_codec);
-      size += map2_.CalculateSize(_map_map2_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestSameTypeMap other) {
-      if (other == null) {
-        return;
-      }
-      map1_.Add(other.map1_);
-      map2_.Add(other.map2_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            map1_.AddEntriesFrom(input, _map_map1_codec);
-            break;
-          }
-          case 18: {
-            map2_.AddEntriesFrom(input, _map_map2_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestArenaMap : pb::IMessage<TestArenaMap> {
-    private static readonly pb::MessageParser<TestArenaMap> _parser = new pb::MessageParser<TestArenaMap>(() => new TestArenaMap());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestArenaMap> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[4]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestArenaMap() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestArenaMap(TestArenaMap other) : this() {
-      mapInt32Int32_ = other.mapInt32Int32_.Clone();
-      mapInt64Int64_ = other.mapInt64Int64_.Clone();
-      mapUint32Uint32_ = other.mapUint32Uint32_.Clone();
-      mapUint64Uint64_ = other.mapUint64Uint64_.Clone();
-      mapSint32Sint32_ = other.mapSint32Sint32_.Clone();
-      mapSint64Sint64_ = other.mapSint64Sint64_.Clone();
-      mapFixed32Fixed32_ = other.mapFixed32Fixed32_.Clone();
-      mapFixed64Fixed64_ = other.mapFixed64Fixed64_.Clone();
-      mapSfixed32Sfixed32_ = other.mapSfixed32Sfixed32_.Clone();
-      mapSfixed64Sfixed64_ = other.mapSfixed64Sfixed64_.Clone();
-      mapInt32Float_ = other.mapInt32Float_.Clone();
-      mapInt32Double_ = other.mapInt32Double_.Clone();
-      mapBoolBool_ = other.mapBoolBool_.Clone();
-      mapInt32Enum_ = other.mapInt32Enum_.Clone();
-      mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestArenaMap Clone() {
-      return new TestArenaMap(this);
-    }
-
-    /// <summary>Field number for the "map_int32_int32" field.</summary>
-    public const int MapInt32Int32FieldNumber = 1;
-    private static readonly pbc::MapField<int, int>.Codec _map_mapInt32Int32_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
-    private readonly pbc::MapField<int, int> mapInt32Int32_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> MapInt32Int32 {
-      get { return mapInt32Int32_; }
-    }
-
-    /// <summary>Field number for the "map_int64_int64" field.</summary>
-    public const int MapInt64Int64FieldNumber = 2;
-    private static readonly pbc::MapField<long, long>.Codec _map_mapInt64Int64_codec
-        = new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18);
-    private readonly pbc::MapField<long, long> mapInt64Int64_ = new pbc::MapField<long, long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<long, long> MapInt64Int64 {
-      get { return mapInt64Int64_; }
-    }
-
-    /// <summary>Field number for the "map_uint32_uint32" field.</summary>
-    public const int MapUint32Uint32FieldNumber = 3;
-    private static readonly pbc::MapField<uint, uint>.Codec _map_mapUint32Uint32_codec
-        = new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26);
-    private readonly pbc::MapField<uint, uint> mapUint32Uint32_ = new pbc::MapField<uint, uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<uint, uint> MapUint32Uint32 {
-      get { return mapUint32Uint32_; }
-    }
-
-    /// <summary>Field number for the "map_uint64_uint64" field.</summary>
-    public const int MapUint64Uint64FieldNumber = 4;
-    private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapUint64Uint64_codec
-        = new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34);
-    private readonly pbc::MapField<ulong, ulong> mapUint64Uint64_ = new pbc::MapField<ulong, ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<ulong, ulong> MapUint64Uint64 {
-      get { return mapUint64Uint64_; }
-    }
-
-    /// <summary>Field number for the "map_sint32_sint32" field.</summary>
-    public const int MapSint32Sint32FieldNumber = 5;
-    private static readonly pbc::MapField<int, int>.Codec _map_mapSint32Sint32_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42);
-    private readonly pbc::MapField<int, int> mapSint32Sint32_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> MapSint32Sint32 {
-      get { return mapSint32Sint32_; }
-    }
-
-    /// <summary>Field number for the "map_sint64_sint64" field.</summary>
-    public const int MapSint64Sint64FieldNumber = 6;
-    private static readonly pbc::MapField<long, long>.Codec _map_mapSint64Sint64_codec
-        = new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50);
-    private readonly pbc::MapField<long, long> mapSint64Sint64_ = new pbc::MapField<long, long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<long, long> MapSint64Sint64 {
-      get { return mapSint64Sint64_; }
-    }
-
-    /// <summary>Field number for the "map_fixed32_fixed32" field.</summary>
-    public const int MapFixed32Fixed32FieldNumber = 7;
-    private static readonly pbc::MapField<uint, uint>.Codec _map_mapFixed32Fixed32_codec
-        = new pbc::MapField<uint, uint>.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58);
-    private readonly pbc::MapField<uint, uint> mapFixed32Fixed32_ = new pbc::MapField<uint, uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<uint, uint> MapFixed32Fixed32 {
-      get { return mapFixed32Fixed32_; }
-    }
-
-    /// <summary>Field number for the "map_fixed64_fixed64" field.</summary>
-    public const int MapFixed64Fixed64FieldNumber = 8;
-    private static readonly pbc::MapField<ulong, ulong>.Codec _map_mapFixed64Fixed64_codec
-        = new pbc::MapField<ulong, ulong>.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66);
-    private readonly pbc::MapField<ulong, ulong> mapFixed64Fixed64_ = new pbc::MapField<ulong, ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<ulong, ulong> MapFixed64Fixed64 {
-      get { return mapFixed64Fixed64_; }
-    }
-
-    /// <summary>Field number for the "map_sfixed32_sfixed32" field.</summary>
-    public const int MapSfixed32Sfixed32FieldNumber = 9;
-    private static readonly pbc::MapField<int, int>.Codec _map_mapSfixed32Sfixed32_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74);
-    private readonly pbc::MapField<int, int> mapSfixed32Sfixed32_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> MapSfixed32Sfixed32 {
-      get { return mapSfixed32Sfixed32_; }
-    }
-
-    /// <summary>Field number for the "map_sfixed64_sfixed64" field.</summary>
-    public const int MapSfixed64Sfixed64FieldNumber = 10;
-    private static readonly pbc::MapField<long, long>.Codec _map_mapSfixed64Sfixed64_codec
-        = new pbc::MapField<long, long>.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82);
-    private readonly pbc::MapField<long, long> mapSfixed64Sfixed64_ = new pbc::MapField<long, long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<long, long> MapSfixed64Sfixed64 {
-      get { return mapSfixed64Sfixed64_; }
-    }
-
-    /// <summary>Field number for the "map_int32_float" field.</summary>
-    public const int MapInt32FloatFieldNumber = 11;
-    private static readonly pbc::MapField<int, float>.Codec _map_mapInt32Float_codec
-        = new pbc::MapField<int, float>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90);
-    private readonly pbc::MapField<int, float> mapInt32Float_ = new pbc::MapField<int, float>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, float> MapInt32Float {
-      get { return mapInt32Float_; }
-    }
-
-    /// <summary>Field number for the "map_int32_double" field.</summary>
-    public const int MapInt32DoubleFieldNumber = 12;
-    private static readonly pbc::MapField<int, double>.Codec _map_mapInt32Double_codec
-        = new pbc::MapField<int, double>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98);
-    private readonly pbc::MapField<int, double> mapInt32Double_ = new pbc::MapField<int, double>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, double> MapInt32Double {
-      get { return mapInt32Double_; }
-    }
-
-    /// <summary>Field number for the "map_bool_bool" field.</summary>
-    public const int MapBoolBoolFieldNumber = 13;
-    private static readonly pbc::MapField<bool, bool>.Codec _map_mapBoolBool_codec
-        = new pbc::MapField<bool, bool>.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106);
-    private readonly pbc::MapField<bool, bool> mapBoolBool_ = new pbc::MapField<bool, bool>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<bool, bool> MapBoolBool {
-      get { return mapBoolBool_; }
-    }
-
-    /// <summary>Field number for the "map_int32_enum" field.</summary>
-    public const int MapInt32EnumFieldNumber = 14;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec _map_mapInt32Enum_codec
-        = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 114);
-    private readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum> mapInt32Enum_ = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.TestProtos.MapEnum> MapInt32Enum {
-      get { return mapInt32Enum_; }
-    }
-
-    /// <summary>Field number for the "map_int32_foreign_message" field.</summary>
-    public const int MapInt32ForeignMessageFieldNumber = 15;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec _map_mapInt32ForeignMessage_codec
-        = new pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 122);
-    private readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage> mapInt32ForeignMessage_ = new pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.TestProtos.ForeignMessage> MapInt32ForeignMessage {
-      get { return mapInt32ForeignMessage_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestArenaMap);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestArenaMap other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!MapInt32Int32.Equals(other.MapInt32Int32)) return false;
-      if (!MapInt64Int64.Equals(other.MapInt64Int64)) return false;
-      if (!MapUint32Uint32.Equals(other.MapUint32Uint32)) return false;
-      if (!MapUint64Uint64.Equals(other.MapUint64Uint64)) return false;
-      if (!MapSint32Sint32.Equals(other.MapSint32Sint32)) return false;
-      if (!MapSint64Sint64.Equals(other.MapSint64Sint64)) return false;
-      if (!MapFixed32Fixed32.Equals(other.MapFixed32Fixed32)) return false;
-      if (!MapFixed64Fixed64.Equals(other.MapFixed64Fixed64)) return false;
-      if (!MapSfixed32Sfixed32.Equals(other.MapSfixed32Sfixed32)) return false;
-      if (!MapSfixed64Sfixed64.Equals(other.MapSfixed64Sfixed64)) return false;
-      if (!MapInt32Float.Equals(other.MapInt32Float)) return false;
-      if (!MapInt32Double.Equals(other.MapInt32Double)) return false;
-      if (!MapBoolBool.Equals(other.MapBoolBool)) return false;
-      if (!MapInt32Enum.Equals(other.MapInt32Enum)) return false;
-      if (!MapInt32ForeignMessage.Equals(other.MapInt32ForeignMessage)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= MapInt32Int32.GetHashCode();
-      hash ^= MapInt64Int64.GetHashCode();
-      hash ^= MapUint32Uint32.GetHashCode();
-      hash ^= MapUint64Uint64.GetHashCode();
-      hash ^= MapSint32Sint32.GetHashCode();
-      hash ^= MapSint64Sint64.GetHashCode();
-      hash ^= MapFixed32Fixed32.GetHashCode();
-      hash ^= MapFixed64Fixed64.GetHashCode();
-      hash ^= MapSfixed32Sfixed32.GetHashCode();
-      hash ^= MapSfixed64Sfixed64.GetHashCode();
-      hash ^= MapInt32Float.GetHashCode();
-      hash ^= MapInt32Double.GetHashCode();
-      hash ^= MapBoolBool.GetHashCode();
-      hash ^= MapInt32Enum.GetHashCode();
-      hash ^= MapInt32ForeignMessage.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec);
-      mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec);
-      mapUint32Uint32_.WriteTo(output, _map_mapUint32Uint32_codec);
-      mapUint64Uint64_.WriteTo(output, _map_mapUint64Uint64_codec);
-      mapSint32Sint32_.WriteTo(output, _map_mapSint32Sint32_codec);
-      mapSint64Sint64_.WriteTo(output, _map_mapSint64Sint64_codec);
-      mapFixed32Fixed32_.WriteTo(output, _map_mapFixed32Fixed32_codec);
-      mapFixed64Fixed64_.WriteTo(output, _map_mapFixed64Fixed64_codec);
-      mapSfixed32Sfixed32_.WriteTo(output, _map_mapSfixed32Sfixed32_codec);
-      mapSfixed64Sfixed64_.WriteTo(output, _map_mapSfixed64Sfixed64_codec);
-      mapInt32Float_.WriteTo(output, _map_mapInt32Float_codec);
-      mapInt32Double_.WriteTo(output, _map_mapInt32Double_codec);
-      mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec);
-      mapInt32Enum_.WriteTo(output, _map_mapInt32Enum_codec);
-      mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec);
-      size += mapInt64Int64_.CalculateSize(_map_mapInt64Int64_codec);
-      size += mapUint32Uint32_.CalculateSize(_map_mapUint32Uint32_codec);
-      size += mapUint64Uint64_.CalculateSize(_map_mapUint64Uint64_codec);
-      size += mapSint32Sint32_.CalculateSize(_map_mapSint32Sint32_codec);
-      size += mapSint64Sint64_.CalculateSize(_map_mapSint64Sint64_codec);
-      size += mapFixed32Fixed32_.CalculateSize(_map_mapFixed32Fixed32_codec);
-      size += mapFixed64Fixed64_.CalculateSize(_map_mapFixed64Fixed64_codec);
-      size += mapSfixed32Sfixed32_.CalculateSize(_map_mapSfixed32Sfixed32_codec);
-      size += mapSfixed64Sfixed64_.CalculateSize(_map_mapSfixed64Sfixed64_codec);
-      size += mapInt32Float_.CalculateSize(_map_mapInt32Float_codec);
-      size += mapInt32Double_.CalculateSize(_map_mapInt32Double_codec);
-      size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec);
-      size += mapInt32Enum_.CalculateSize(_map_mapInt32Enum_codec);
-      size += mapInt32ForeignMessage_.CalculateSize(_map_mapInt32ForeignMessage_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestArenaMap other) {
-      if (other == null) {
-        return;
-      }
-      mapInt32Int32_.Add(other.mapInt32Int32_);
-      mapInt64Int64_.Add(other.mapInt64Int64_);
-      mapUint32Uint32_.Add(other.mapUint32Uint32_);
-      mapUint64Uint64_.Add(other.mapUint64Uint64_);
-      mapSint32Sint32_.Add(other.mapSint32Sint32_);
-      mapSint64Sint64_.Add(other.mapSint64Sint64_);
-      mapFixed32Fixed32_.Add(other.mapFixed32Fixed32_);
-      mapFixed64Fixed64_.Add(other.mapFixed64Fixed64_);
-      mapSfixed32Sfixed32_.Add(other.mapSfixed32Sfixed32_);
-      mapSfixed64Sfixed64_.Add(other.mapSfixed64Sfixed64_);
-      mapInt32Float_.Add(other.mapInt32Float_);
-      mapInt32Double_.Add(other.mapInt32Double_);
-      mapBoolBool_.Add(other.mapBoolBool_);
-      mapInt32Enum_.Add(other.mapInt32Enum_);
-      mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
-            break;
-          }
-          case 18: {
-            mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec);
-            break;
-          }
-          case 26: {
-            mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec);
-            break;
-          }
-          case 34: {
-            mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec);
-            break;
-          }
-          case 42: {
-            mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec);
-            break;
-          }
-          case 50: {
-            mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec);
-            break;
-          }
-          case 58: {
-            mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec);
-            break;
-          }
-          case 66: {
-            mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec);
-            break;
-          }
-          case 74: {
-            mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec);
-            break;
-          }
-          case 82: {
-            mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec);
-            break;
-          }
-          case 90: {
-            mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec);
-            break;
-          }
-          case 98: {
-            mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec);
-            break;
-          }
-          case 106: {
-            mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec);
-            break;
-          }
-          case 114: {
-            mapInt32Enum_.AddEntriesFrom(input, _map_mapInt32Enum_codec);
-            break;
-          }
-          case 122: {
-            mapInt32ForeignMessage_.AddEntriesFrom(input, _map_mapInt32ForeignMessage_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Previously, message containing enum called Type cannot be used as value of
-  ///  map field.
-  /// </summary>
-  public sealed partial class MessageContainingEnumCalledType : pb::IMessage<MessageContainingEnumCalledType> {
-    private static readonly pb::MessageParser<MessageContainingEnumCalledType> _parser = new pb::MessageParser<MessageContainingEnumCalledType>(() => new MessageContainingEnumCalledType());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MessageContainingEnumCalledType> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[5]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageContainingEnumCalledType() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageContainingEnumCalledType(MessageContainingEnumCalledType other) : this() {
-      type_ = other.type_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageContainingEnumCalledType Clone() {
-      return new MessageContainingEnumCalledType(this);
-    }
-
-    /// <summary>Field number for the "type" field.</summary>
-    public const int TypeFieldNumber = 1;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec _map_type_codec
-        = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10);
-    private readonly pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType> type_ = new pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType> Type {
-      get { return type_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MessageContainingEnumCalledType);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MessageContainingEnumCalledType other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!Type.Equals(other.Type)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= Type.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      type_.WriteTo(output, _map_type_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += type_.CalculateSize(_map_type_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MessageContainingEnumCalledType other) {
-      if (other == null) {
-        return;
-      }
-      type_.Add(other.type_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            type_.AddEntriesFrom(input, _map_type_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the MessageContainingEnumCalledType message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      public enum Type {
-        [pbr::OriginalName("TYPE_FOO")] Foo = 0,
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  Previously, message cannot contain map field called "entry".
-  /// </summary>
-  public sealed partial class MessageContainingMapCalledEntry : pb::IMessage<MessageContainingMapCalledEntry> {
-    private static readonly pb::MessageParser<MessageContainingMapCalledEntry> _parser = new pb::MessageParser<MessageContainingMapCalledEntry>(() => new MessageContainingMapCalledEntry());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MessageContainingMapCalledEntry> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[6]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageContainingMapCalledEntry() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageContainingMapCalledEntry(MessageContainingMapCalledEntry other) : this() {
-      entry_ = other.entry_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageContainingMapCalledEntry Clone() {
-      return new MessageContainingMapCalledEntry(this);
-    }
-
-    /// <summary>Field number for the "entry" field.</summary>
-    public const int EntryFieldNumber = 1;
-    private static readonly pbc::MapField<int, int>.Codec _map_entry_codec
-        = new pbc::MapField<int, int>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10);
-    private readonly pbc::MapField<int, int> entry_ = new pbc::MapField<int, int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int> Entry {
-      get { return entry_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MessageContainingMapCalledEntry);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MessageContainingMapCalledEntry other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!Entry.Equals(other.Entry)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= Entry.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      entry_.WriteTo(output, _map_entry_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += entry_.CalculateSize(_map_entry_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MessageContainingMapCalledEntry other) {
-      if (other == null) {
-        return;
-      }
-      entry_.Add(other.entry_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            entry_.AddEntriesFrom(input, _map_entry_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 174
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs

@@ -1,174 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: google/protobuf/unittest_import_proto3.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos {
-
-  /// <summary>Holder for reflection information generated from google/protobuf/unittest_import_proto3.proto</summary>
-  public static partial class UnittestImportProto3Reflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for google/protobuf/unittest_import_proto3.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static UnittestImportProto3Reflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "Cixnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3Byb3RvMy5wcm90",
-            "bxIYcHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0GjNnb29nbGUvcHJvdG9idWYv",
-            "dW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90bzMucHJvdG8iGgoNSW1wb3J0",
-            "TWVzc2FnZRIJCgFkGAEgASgFKlkKCkltcG9ydEVudW0SGwoXSU1QT1JUX0VO",
-            "VU1fVU5TUEVDSUZJRUQQABIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JB",
-            "UhAIEg4KCklNUE9SVF9CQVoQCUI8Chhjb20uZ29vZ2xlLnByb3RvYnVmLnRl",
-            "c3RIAfgBAaoCGkdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3Rv",
-            "Mw=="));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor, },
-          new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ImportEnum), }, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.ImportMessage), global::Google.Protobuf.TestProtos.ImportMessage.Parser, new[]{ "D" }, null, null, null)
-          }));
-    }
-    #endregion
-
-  }
-  #region Enums
-  public enum ImportEnum {
-    [pbr::OriginalName("IMPORT_ENUM_UNSPECIFIED")] Unspecified = 0,
-    [pbr::OriginalName("IMPORT_FOO")] ImportFoo = 7,
-    [pbr::OriginalName("IMPORT_BAR")] ImportBar = 8,
-    [pbr::OriginalName("IMPORT_BAZ")] ImportBaz = 9,
-  }
-
-  #endregion
-
-  #region Messages
-  public sealed partial class ImportMessage : pb::IMessage<ImportMessage> {
-    private static readonly pb::MessageParser<ImportMessage> _parser = new pb::MessageParser<ImportMessage>(() => new ImportMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<ImportMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ImportMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ImportMessage(ImportMessage other) : this() {
-      d_ = other.d_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ImportMessage Clone() {
-      return new ImportMessage(this);
-    }
-
-    /// <summary>Field number for the "d" field.</summary>
-    public const int DFieldNumber = 1;
-    private int d_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int D {
-      get { return d_; }
-      set {
-        d_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as ImportMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(ImportMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (D != other.D) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (D != 0) hash ^= D.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (D != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(D);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (D != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(D);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(ImportMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.D != 0) {
-        D = other.D;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            D = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 160
csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs

@@ -1,160 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: google/protobuf/unittest_import_public_proto3.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos {
-
-  /// <summary>Holder for reflection information generated from google/protobuf/unittest_import_public_proto3.proto</summary>
-  public static partial class UnittestImportPublicProto3Reflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for google/protobuf/unittest_import_public_proto3.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static UnittestImportPublicProto3Reflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "CjNnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0X3B1YmxpY19wcm90",
-            "bzMucHJvdG8SGHByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydCIgChNQdWJsaWNJ",
-            "bXBvcnRNZXNzYWdlEgkKAWUYASABKAVCNwoYY29tLmdvb2dsZS5wcm90b2J1",
-            "Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { },
-          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.PublicImportMessage), global::Google.Protobuf.TestProtos.PublicImportMessage.Parser, new[]{ "E" }, null, null, null)
-          }));
-    }
-    #endregion
-
-  }
-  #region Messages
-  public sealed partial class PublicImportMessage : pb::IMessage<PublicImportMessage> {
-    private static readonly pb::MessageParser<PublicImportMessage> _parser = new pb::MessageParser<PublicImportMessage>(() => new PublicImportMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<PublicImportMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public PublicImportMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public PublicImportMessage(PublicImportMessage other) : this() {
-      e_ = other.e_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public PublicImportMessage Clone() {
-      return new PublicImportMessage(this);
-    }
-
-    /// <summary>Field number for the "e" field.</summary>
-    public const int EFieldNumber = 1;
-    private int e_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int E {
-      get { return e_; }
-      set {
-        e_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as PublicImportMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(PublicImportMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (E != other.E) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (E != 0) hash ^= E.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (E != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(E);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (E != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(E);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(PublicImportMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.E != 0) {
-        E = other.E;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            E = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 1736
csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs

@@ -1,1736 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: unittest_issues.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace UnitTest.Issues.TestProtos {
-
-  /// <summary>Holder for reflection information generated from unittest_issues.proto</summary>
-  public static partial class UnittestIssuesReflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for unittest_issues.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static UnittestIssuesReflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "ChV1bml0dGVzdF9pc3N1ZXMucHJvdG8SD3VuaXR0ZXN0X2lzc3VlcyInCghJ",
-            "c3N1ZTMwNxobCgpOZXN0ZWRPbmNlGg0KC05lc3RlZFR3aWNlIrABChNOZWdh",
-            "dGl2ZUVudW1NZXNzYWdlEiwKBXZhbHVlGAEgASgOMh0udW5pdHRlc3RfaXNz",
-            "dWVzLk5lZ2F0aXZlRW51bRIxCgZ2YWx1ZXMYAiADKA4yHS51bml0dGVzdF9p",
-            "c3N1ZXMuTmVnYXRpdmVFbnVtQgIQABI4Cg1wYWNrZWRfdmFsdWVzGAMgAygO",
-            "Mh0udW5pdHRlc3RfaXNzdWVzLk5lZ2F0aXZlRW51bUICEAEiEQoPRGVwcmVj",
-            "YXRlZENoaWxkIrkCChdEZXByZWNhdGVkRmllbGRzTWVzc2FnZRIaCg5Qcmlt",
-            "aXRpdmVWYWx1ZRgBIAEoBUICGAESGgoOUHJpbWl0aXZlQXJyYXkYAiADKAVC",
-            "AhgBEjoKDE1lc3NhZ2VWYWx1ZRgDIAEoCzIgLnVuaXR0ZXN0X2lzc3Vlcy5E",
-            "ZXByZWNhdGVkQ2hpbGRCAhgBEjoKDE1lc3NhZ2VBcnJheRgEIAMoCzIgLnVu",
-            "aXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgBEjYKCUVudW1WYWx1",
-            "ZRgFIAEoDjIfLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkRW51bUICGAES",
-            "NgoJRW51bUFycmF5GAYgAygOMh8udW5pdHRlc3RfaXNzdWVzLkRlcHJlY2F0",
-            "ZWRFbnVtQgIYASIZCglJdGVtRmllbGQSDAoEaXRlbRgBIAEoBSJECg1SZXNl",
-            "cnZlZE5hbWVzEg0KBXR5cGVzGAEgASgFEhIKCmRlc2NyaXB0b3IYAiABKAUa",
-            "EAoOU29tZU5lc3RlZFR5cGUioAEKFVRlc3RKc29uRmllbGRPcmRlcmluZxIT",
-            "CgtwbGFpbl9pbnQzMhgEIAEoBRITCglvMV9zdHJpbmcYAiABKAlIABISCghv",
-            "MV9pbnQzMhgFIAEoBUgAEhQKDHBsYWluX3N0cmluZxgBIAEoCRISCghvMl9p",
-            "bnQzMhgGIAEoBUgBEhMKCW8yX3N0cmluZxgDIAEoCUgBQgQKAm8xQgQKAm8y",
-            "IksKDFRlc3RKc29uTmFtZRIMCgRuYW1lGAEgASgJEhkKC2Rlc2NyaXB0aW9u",
-            "GAIgASgJUgRkZXNjEhIKBGd1aWQYAyABKAlSBGV4aWQqVQoMTmVnYXRpdmVF",
-            "bnVtEhYKEk5FR0FUSVZFX0VOVU1fWkVSTxAAEhYKCUZpdmVCZWxvdxD7////",
-            "//////8BEhUKCE1pbnVzT25lEP///////////wEqLgoORGVwcmVjYXRlZEVu",
-            "dW0SEwoPREVQUkVDQVRFRF9aRVJPEAASBwoDb25lEAFCH0gBqgIaVW5pdFRl",
-            "c3QuSXNzdWVzLlRlc3RQcm90b3NiBnByb3RvMw=="));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { },
-          new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.NegativeEnum), typeof(global::UnitTest.Issues.TestProtos.DeprecatedEnum), }, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307), global::UnitTest.Issues.TestProtos.Issue307.Parser, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Parser, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice.Parser, null, null, null, null)})}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NegativeEnumMessage), global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Parser, new[]{ "Value", "Values", "PackedValues" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedChild), global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage), global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Parser, new[]{ "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ItemField), global::UnitTest.Issues.TestProtos.ItemField.Parser, new[]{ "Item" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames), global::UnitTest.Issues.TestProtos.ReservedNames.Parser, new[]{ "Types_", "Descriptor_" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType), global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType.Parser, null, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering), global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering.Parser, new[]{ "PlainInt32", "O1String", "O1Int32", "PlainString", "O2Int32", "O2String" }, new[]{ "O1", "O2" }, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonName), global::UnitTest.Issues.TestProtos.TestJsonName.Parser, new[]{ "Name", "Description", "Guid" }, null, null, null)
-          }));
-    }
-    #endregion
-
-  }
-  #region Enums
-  public enum NegativeEnum {
-    [pbr::OriginalName("NEGATIVE_ENUM_ZERO")] Zero = 0,
-    [pbr::OriginalName("FiveBelow")] FiveBelow = -5,
-    [pbr::OriginalName("MinusOne")] MinusOne = -1,
-  }
-
-  public enum DeprecatedEnum {
-    [pbr::OriginalName("DEPRECATED_ZERO")] DeprecatedZero = 0,
-    [pbr::OriginalName("one")] One = 1,
-  }
-
-  #endregion
-
-  #region Messages
-  /// <summary>
-  ///  Issue 307: when generating doubly-nested types, any references
-  ///  should be of the form A.Types.B.Types.C.
-  /// </summary>
-  public sealed partial class Issue307 : pb::IMessage<Issue307> {
-    private static readonly pb::MessageParser<Issue307> _parser = new pb::MessageParser<Issue307>(() => new Issue307());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<Issue307> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Issue307() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Issue307(Issue307 other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Issue307 Clone() {
-      return new Issue307(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as Issue307);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(Issue307 other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(Issue307 other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the Issue307 message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      public sealed partial class NestedOnce : pb::IMessage<NestedOnce> {
-        private static readonly pb::MessageParser<NestedOnce> _parser = new pb::MessageParser<NestedOnce>(() => new NestedOnce());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<NestedOnce> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::UnitTest.Issues.TestProtos.Issue307.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedOnce() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedOnce(NestedOnce other) : this() {
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedOnce Clone() {
-          return new NestedOnce(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as NestedOnce);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(NestedOnce other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(NestedOnce other) {
-          if (other == null) {
-            return;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-            }
-          }
-        }
-
-        #region Nested types
-        /// <summary>Container for nested types declared in the NestedOnce message type.</summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static partial class Types {
-          public sealed partial class NestedTwice : pb::IMessage<NestedTwice> {
-            private static readonly pb::MessageParser<NestedTwice> _parser = new pb::MessageParser<NestedTwice>(() => new NestedTwice());
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public static pb::MessageParser<NestedTwice> Parser { get { return _parser; } }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public static pbr::MessageDescriptor Descriptor {
-              get { return global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Descriptor.NestedTypes[0]; }
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            pbr::MessageDescriptor pb::IMessage.Descriptor {
-              get { return Descriptor; }
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public NestedTwice() {
-              OnConstruction();
-            }
-
-            partial void OnConstruction();
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public NestedTwice(NestedTwice other) : this() {
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public NestedTwice Clone() {
-              return new NestedTwice(this);
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public override bool Equals(object other) {
-              return Equals(other as NestedTwice);
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public bool Equals(NestedTwice other) {
-              if (ReferenceEquals(other, null)) {
-                return false;
-              }
-              if (ReferenceEquals(other, this)) {
-                return true;
-              }
-              return true;
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public override int GetHashCode() {
-              int hash = 1;
-              return hash;
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public override string ToString() {
-              return pb::JsonFormatter.ToDiagnosticString(this);
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public void WriteTo(pb::CodedOutputStream output) {
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public int CalculateSize() {
-              int size = 0;
-              return size;
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public void MergeFrom(NestedTwice other) {
-              if (other == null) {
-                return;
-              }
-            }
-
-            [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-            public void MergeFrom(pb::CodedInputStream input) {
-              uint tag;
-              while ((tag = input.ReadTag()) != 0) {
-                switch(tag) {
-                  default:
-                    input.SkipLastField();
-                    break;
-                }
-              }
-            }
-
-          }
-
-        }
-        #endregion
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  public sealed partial class NegativeEnumMessage : pb::IMessage<NegativeEnumMessage> {
-    private static readonly pb::MessageParser<NegativeEnumMessage> _parser = new pb::MessageParser<NegativeEnumMessage>(() => new NegativeEnumMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<NegativeEnumMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[1]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public NegativeEnumMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public NegativeEnumMessage(NegativeEnumMessage other) : this() {
-      value_ = other.value_;
-      values_ = other.values_.Clone();
-      packedValues_ = other.packedValues_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public NegativeEnumMessage Clone() {
-      return new NegativeEnumMessage(this);
-    }
-
-    /// <summary>Field number for the "value" field.</summary>
-    public const int ValueFieldNumber = 1;
-    private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::UnitTest.Issues.TestProtos.NegativeEnum Value {
-      get { return value_; }
-      set {
-        value_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "values" field.</summary>
-    public const int ValuesFieldNumber = 2;
-    private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.NegativeEnum> _repeated_values_codec
-        = pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::UnitTest.Issues.TestProtos.NegativeEnum) x);
-    private readonly pbc::RepeatedField<global::UnitTest.Issues.TestProtos.NegativeEnum> values_ = new pbc::RepeatedField<global::UnitTest.Issues.TestProtos.NegativeEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::UnitTest.Issues.TestProtos.NegativeEnum> Values {
-      get { return values_; }
-    }
-
-    /// <summary>Field number for the "packed_values" field.</summary>
-    public const int PackedValuesFieldNumber = 3;
-    private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.NegativeEnum> _repeated_packedValues_codec
-        = pb::FieldCodec.ForEnum(26, x => (int) x, x => (global::UnitTest.Issues.TestProtos.NegativeEnum) x);
-    private readonly pbc::RepeatedField<global::UnitTest.Issues.TestProtos.NegativeEnum> packedValues_ = new pbc::RepeatedField<global::UnitTest.Issues.TestProtos.NegativeEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::UnitTest.Issues.TestProtos.NegativeEnum> PackedValues {
-      get { return packedValues_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as NegativeEnumMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(NegativeEnumMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Value != other.Value) return false;
-      if(!values_.Equals(other.values_)) return false;
-      if(!packedValues_.Equals(other.packedValues_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Value != 0) hash ^= Value.GetHashCode();
-      hash ^= values_.GetHashCode();
-      hash ^= packedValues_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Value != 0) {
-        output.WriteRawTag(8);
-        output.WriteEnum((int) Value);
-      }
-      values_.WriteTo(output, _repeated_values_codec);
-      packedValues_.WriteTo(output, _repeated_packedValues_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Value != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Value);
-      }
-      size += values_.CalculateSize(_repeated_values_codec);
-      size += packedValues_.CalculateSize(_repeated_packedValues_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(NegativeEnumMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Value != 0) {
-        Value = other.Value;
-      }
-      values_.Add(other.values_);
-      packedValues_.Add(other.packedValues_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            value_ = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum();
-            break;
-          }
-          case 18:
-          case 16: {
-            values_.AddEntriesFrom(input, _repeated_values_codec);
-            break;
-          }
-          case 26:
-          case 24: {
-            packedValues_.AddEntriesFrom(input, _repeated_packedValues_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class DeprecatedChild : pb::IMessage<DeprecatedChild> {
-    private static readonly pb::MessageParser<DeprecatedChild> _parser = new pb::MessageParser<DeprecatedChild>(() => new DeprecatedChild());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<DeprecatedChild> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[2]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DeprecatedChild() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DeprecatedChild(DeprecatedChild other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DeprecatedChild Clone() {
-      return new DeprecatedChild(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as DeprecatedChild);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(DeprecatedChild other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(DeprecatedChild other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class DeprecatedFieldsMessage : pb::IMessage<DeprecatedFieldsMessage> {
-    private static readonly pb::MessageParser<DeprecatedFieldsMessage> _parser = new pb::MessageParser<DeprecatedFieldsMessage>(() => new DeprecatedFieldsMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<DeprecatedFieldsMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[3]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DeprecatedFieldsMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DeprecatedFieldsMessage(DeprecatedFieldsMessage other) : this() {
-      primitiveValue_ = other.primitiveValue_;
-      primitiveArray_ = other.primitiveArray_.Clone();
-      MessageValue = other.messageValue_ != null ? other.MessageValue.Clone() : null;
-      messageArray_ = other.messageArray_.Clone();
-      enumValue_ = other.enumValue_;
-      enumArray_ = other.enumArray_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DeprecatedFieldsMessage Clone() {
-      return new DeprecatedFieldsMessage(this);
-    }
-
-    /// <summary>Field number for the "PrimitiveValue" field.</summary>
-    public const int PrimitiveValueFieldNumber = 1;
-    private int primitiveValue_;
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int PrimitiveValue {
-      get { return primitiveValue_; }
-      set {
-        primitiveValue_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "PrimitiveArray" field.</summary>
-    public const int PrimitiveArrayFieldNumber = 2;
-    private static readonly pb::FieldCodec<int> _repeated_primitiveArray_codec
-        = pb::FieldCodec.ForInt32(18);
-    private readonly pbc::RepeatedField<int> primitiveArray_ = new pbc::RepeatedField<int>();
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> PrimitiveArray {
-      get { return primitiveArray_; }
-    }
-
-    /// <summary>Field number for the "MessageValue" field.</summary>
-    public const int MessageValueFieldNumber = 3;
-    private global::UnitTest.Issues.TestProtos.DeprecatedChild messageValue_;
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue {
-      get { return messageValue_; }
-      set {
-        messageValue_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "MessageArray" field.</summary>
-    public const int MessageArrayFieldNumber = 4;
-    private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.DeprecatedChild> _repeated_messageArray_codec
-        = pb::FieldCodec.ForMessage(34, global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser);
-    private readonly pbc::RepeatedField<global::UnitTest.Issues.TestProtos.DeprecatedChild> messageArray_ = new pbc::RepeatedField<global::UnitTest.Issues.TestProtos.DeprecatedChild>();
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::UnitTest.Issues.TestProtos.DeprecatedChild> MessageArray {
-      get { return messageArray_; }
-    }
-
-    /// <summary>Field number for the "EnumValue" field.</summary>
-    public const int EnumValueFieldNumber = 5;
-    private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = 0;
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue {
-      get { return enumValue_; }
-      set {
-        enumValue_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "EnumArray" field.</summary>
-    public const int EnumArrayFieldNumber = 6;
-    private static readonly pb::FieldCodec<global::UnitTest.Issues.TestProtos.DeprecatedEnum> _repeated_enumArray_codec
-        = pb::FieldCodec.ForEnum(50, x => (int) x, x => (global::UnitTest.Issues.TestProtos.DeprecatedEnum) x);
-    private readonly pbc::RepeatedField<global::UnitTest.Issues.TestProtos.DeprecatedEnum> enumArray_ = new pbc::RepeatedField<global::UnitTest.Issues.TestProtos.DeprecatedEnum>();
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::UnitTest.Issues.TestProtos.DeprecatedEnum> EnumArray {
-      get { return enumArray_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as DeprecatedFieldsMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(DeprecatedFieldsMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (PrimitiveValue != other.PrimitiveValue) return false;
-      if(!primitiveArray_.Equals(other.primitiveArray_)) return false;
-      if (!object.Equals(MessageValue, other.MessageValue)) return false;
-      if(!messageArray_.Equals(other.messageArray_)) return false;
-      if (EnumValue != other.EnumValue) return false;
-      if(!enumArray_.Equals(other.enumArray_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (PrimitiveValue != 0) hash ^= PrimitiveValue.GetHashCode();
-      hash ^= primitiveArray_.GetHashCode();
-      if (messageValue_ != null) hash ^= MessageValue.GetHashCode();
-      hash ^= messageArray_.GetHashCode();
-      if (EnumValue != 0) hash ^= EnumValue.GetHashCode();
-      hash ^= enumArray_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (PrimitiveValue != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(PrimitiveValue);
-      }
-      primitiveArray_.WriteTo(output, _repeated_primitiveArray_codec);
-      if (messageValue_ != null) {
-        output.WriteRawTag(26);
-        output.WriteMessage(MessageValue);
-      }
-      messageArray_.WriteTo(output, _repeated_messageArray_codec);
-      if (EnumValue != 0) {
-        output.WriteRawTag(40);
-        output.WriteEnum((int) EnumValue);
-      }
-      enumArray_.WriteTo(output, _repeated_enumArray_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (PrimitiveValue != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(PrimitiveValue);
-      }
-      size += primitiveArray_.CalculateSize(_repeated_primitiveArray_codec);
-      if (messageValue_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(MessageValue);
-      }
-      size += messageArray_.CalculateSize(_repeated_messageArray_codec);
-      if (EnumValue != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnumValue);
-      }
-      size += enumArray_.CalculateSize(_repeated_enumArray_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(DeprecatedFieldsMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.PrimitiveValue != 0) {
-        PrimitiveValue = other.PrimitiveValue;
-      }
-      primitiveArray_.Add(other.primitiveArray_);
-      if (other.messageValue_ != null) {
-        if (messageValue_ == null) {
-          messageValue_ = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
-        }
-        MessageValue.MergeFrom(other.MessageValue);
-      }
-      messageArray_.Add(other.messageArray_);
-      if (other.EnumValue != 0) {
-        EnumValue = other.EnumValue;
-      }
-      enumArray_.Add(other.enumArray_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            PrimitiveValue = input.ReadInt32();
-            break;
-          }
-          case 18:
-          case 16: {
-            primitiveArray_.AddEntriesFrom(input, _repeated_primitiveArray_codec);
-            break;
-          }
-          case 26: {
-            if (messageValue_ == null) {
-              messageValue_ = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
-            }
-            input.ReadMessage(messageValue_);
-            break;
-          }
-          case 34: {
-            messageArray_.AddEntriesFrom(input, _repeated_messageArray_codec);
-            break;
-          }
-          case 40: {
-            enumValue_ = (global::UnitTest.Issues.TestProtos.DeprecatedEnum) input.ReadEnum();
-            break;
-          }
-          case 50:
-          case 48: {
-            enumArray_.AddEntriesFrom(input, _repeated_enumArray_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
-  /// </summary>
-  public sealed partial class ItemField : pb::IMessage<ItemField> {
-    private static readonly pb::MessageParser<ItemField> _parser = new pb::MessageParser<ItemField>(() => new ItemField());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<ItemField> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[4]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ItemField() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ItemField(ItemField other) : this() {
-      item_ = other.item_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ItemField Clone() {
-      return new ItemField(this);
-    }
-
-    /// <summary>Field number for the "item" field.</summary>
-    public const int ItemFieldNumber = 1;
-    private int item_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Item {
-      get { return item_; }
-      set {
-        item_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as ItemField);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(ItemField other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Item != other.Item) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Item != 0) hash ^= Item.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Item != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(Item);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Item != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Item);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(ItemField other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Item != 0) {
-        Item = other.Item;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Item = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class ReservedNames : pb::IMessage<ReservedNames> {
-    private static readonly pb::MessageParser<ReservedNames> _parser = new pb::MessageParser<ReservedNames>(() => new ReservedNames());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<ReservedNames> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[5]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ReservedNames() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ReservedNames(ReservedNames other) : this() {
-      types_ = other.types_;
-      descriptor_ = other.descriptor_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ReservedNames Clone() {
-      return new ReservedNames(this);
-    }
-
-    /// <summary>Field number for the "types" field.</summary>
-    public const int Types_FieldNumber = 1;
-    private int types_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Types_ {
-      get { return types_; }
-      set {
-        types_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "descriptor" field.</summary>
-    public const int Descriptor_FieldNumber = 2;
-    private int descriptor_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Descriptor_ {
-      get { return descriptor_; }
-      set {
-        descriptor_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as ReservedNames);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(ReservedNames other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Types_ != other.Types_) return false;
-      if (Descriptor_ != other.Descriptor_) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Types_ != 0) hash ^= Types_.GetHashCode();
-      if (Descriptor_ != 0) hash ^= Descriptor_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Types_ != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(Types_);
-      }
-      if (Descriptor_ != 0) {
-        output.WriteRawTag(16);
-        output.WriteInt32(Descriptor_);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Types_ != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Types_);
-      }
-      if (Descriptor_ != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Descriptor_);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(ReservedNames other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Types_ != 0) {
-        Types_ = other.Types_;
-      }
-      if (other.Descriptor_ != 0) {
-        Descriptor_ = other.Descriptor_;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Types_ = input.ReadInt32();
-            break;
-          }
-          case 16: {
-            Descriptor_ = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the ReservedNames message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      /// <summary>
-      ///  Force a nested type called Types
-      /// </summary>
-      public sealed partial class SomeNestedType : pb::IMessage<SomeNestedType> {
-        private static readonly pb::MessageParser<SomeNestedType> _parser = new pb::MessageParser<SomeNestedType>(() => new SomeNestedType());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<SomeNestedType> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::UnitTest.Issues.TestProtos.ReservedNames.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public SomeNestedType() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public SomeNestedType(SomeNestedType other) : this() {
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public SomeNestedType Clone() {
-          return new SomeNestedType(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as SomeNestedType);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(SomeNestedType other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(SomeNestedType other) {
-          if (other == null) {
-            return;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  These fields are deliberately not declared in numeric
-  ///  order, and the oneof fields aren't contiguous either.
-  ///  This allows for reasonably robust tests of JSON output
-  ///  ordering.
-  ///  TestFieldOrderings in unittest_proto3.proto is similar,
-  ///  but doesn't include oneofs.
-  ///  TODO: Consider adding oneofs to TestFieldOrderings, although
-  ///  that will require fixing other tests in multiple platforms.
-  ///  Alternatively, consider just adding this to
-  ///  unittest_proto3.proto if multiple platforms want it.
-  /// </summary>
-  public sealed partial class TestJsonFieldOrdering : pb::IMessage<TestJsonFieldOrdering> {
-    private static readonly pb::MessageParser<TestJsonFieldOrdering> _parser = new pb::MessageParser<TestJsonFieldOrdering>(() => new TestJsonFieldOrdering());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestJsonFieldOrdering> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[6]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestJsonFieldOrdering() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestJsonFieldOrdering(TestJsonFieldOrdering other) : this() {
-      plainInt32_ = other.plainInt32_;
-      plainString_ = other.plainString_;
-      switch (other.O1Case) {
-        case O1OneofCase.O1String:
-          O1String = other.O1String;
-          break;
-        case O1OneofCase.O1Int32:
-          O1Int32 = other.O1Int32;
-          break;
-      }
-
-      switch (other.O2Case) {
-        case O2OneofCase.O2Int32:
-          O2Int32 = other.O2Int32;
-          break;
-        case O2OneofCase.O2String:
-          O2String = other.O2String;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestJsonFieldOrdering Clone() {
-      return new TestJsonFieldOrdering(this);
-    }
-
-    /// <summary>Field number for the "plain_int32" field.</summary>
-    public const int PlainInt32FieldNumber = 4;
-    private int plainInt32_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int PlainInt32 {
-      get { return plainInt32_; }
-      set {
-        plainInt32_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "o1_string" field.</summary>
-    public const int O1StringFieldNumber = 2;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string O1String {
-      get { return o1Case_ == O1OneofCase.O1String ? (string) o1_ : ""; }
-      set {
-        o1_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-        o1Case_ = O1OneofCase.O1String;
-      }
-    }
-
-    /// <summary>Field number for the "o1_int32" field.</summary>
-    public const int O1Int32FieldNumber = 5;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int O1Int32 {
-      get { return o1Case_ == O1OneofCase.O1Int32 ? (int) o1_ : 0; }
-      set {
-        o1_ = value;
-        o1Case_ = O1OneofCase.O1Int32;
-      }
-    }
-
-    /// <summary>Field number for the "plain_string" field.</summary>
-    public const int PlainStringFieldNumber = 1;
-    private string plainString_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string PlainString {
-      get { return plainString_; }
-      set {
-        plainString_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "o2_int32" field.</summary>
-    public const int O2Int32FieldNumber = 6;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int O2Int32 {
-      get { return o2Case_ == O2OneofCase.O2Int32 ? (int) o2_ : 0; }
-      set {
-        o2_ = value;
-        o2Case_ = O2OneofCase.O2Int32;
-      }
-    }
-
-    /// <summary>Field number for the "o2_string" field.</summary>
-    public const int O2StringFieldNumber = 3;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string O2String {
-      get { return o2Case_ == O2OneofCase.O2String ? (string) o2_ : ""; }
-      set {
-        o2_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-        o2Case_ = O2OneofCase.O2String;
-      }
-    }
-
-    private object o1_;
-    /// <summary>Enum of possible cases for the "o1" oneof.</summary>
-    public enum O1OneofCase {
-      None = 0,
-      O1String = 2,
-      O1Int32 = 5,
-    }
-    private O1OneofCase o1Case_ = O1OneofCase.None;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public O1OneofCase O1Case {
-      get { return o1Case_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void ClearO1() {
-      o1Case_ = O1OneofCase.None;
-      o1_ = null;
-    }
-
-    private object o2_;
-    /// <summary>Enum of possible cases for the "o2" oneof.</summary>
-    public enum O2OneofCase {
-      None = 0,
-      O2Int32 = 6,
-      O2String = 3,
-    }
-    private O2OneofCase o2Case_ = O2OneofCase.None;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public O2OneofCase O2Case {
-      get { return o2Case_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void ClearO2() {
-      o2Case_ = O2OneofCase.None;
-      o2_ = null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestJsonFieldOrdering);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestJsonFieldOrdering other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (PlainInt32 != other.PlainInt32) return false;
-      if (O1String != other.O1String) return false;
-      if (O1Int32 != other.O1Int32) return false;
-      if (PlainString != other.PlainString) return false;
-      if (O2Int32 != other.O2Int32) return false;
-      if (O2String != other.O2String) return false;
-      if (O1Case != other.O1Case) return false;
-      if (O2Case != other.O2Case) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (PlainInt32 != 0) hash ^= PlainInt32.GetHashCode();
-      if (o1Case_ == O1OneofCase.O1String) hash ^= O1String.GetHashCode();
-      if (o1Case_ == O1OneofCase.O1Int32) hash ^= O1Int32.GetHashCode();
-      if (PlainString.Length != 0) hash ^= PlainString.GetHashCode();
-      if (o2Case_ == O2OneofCase.O2Int32) hash ^= O2Int32.GetHashCode();
-      if (o2Case_ == O2OneofCase.O2String) hash ^= O2String.GetHashCode();
-      hash ^= (int) o1Case_;
-      hash ^= (int) o2Case_;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (PlainString.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(PlainString);
-      }
-      if (o1Case_ == O1OneofCase.O1String) {
-        output.WriteRawTag(18);
-        output.WriteString(O1String);
-      }
-      if (o2Case_ == O2OneofCase.O2String) {
-        output.WriteRawTag(26);
-        output.WriteString(O2String);
-      }
-      if (PlainInt32 != 0) {
-        output.WriteRawTag(32);
-        output.WriteInt32(PlainInt32);
-      }
-      if (o1Case_ == O1OneofCase.O1Int32) {
-        output.WriteRawTag(40);
-        output.WriteInt32(O1Int32);
-      }
-      if (o2Case_ == O2OneofCase.O2Int32) {
-        output.WriteRawTag(48);
-        output.WriteInt32(O2Int32);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (PlainInt32 != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(PlainInt32);
-      }
-      if (o1Case_ == O1OneofCase.O1String) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(O1String);
-      }
-      if (o1Case_ == O1OneofCase.O1Int32) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(O1Int32);
-      }
-      if (PlainString.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(PlainString);
-      }
-      if (o2Case_ == O2OneofCase.O2Int32) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(O2Int32);
-      }
-      if (o2Case_ == O2OneofCase.O2String) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(O2String);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestJsonFieldOrdering other) {
-      if (other == null) {
-        return;
-      }
-      if (other.PlainInt32 != 0) {
-        PlainInt32 = other.PlainInt32;
-      }
-      if (other.PlainString.Length != 0) {
-        PlainString = other.PlainString;
-      }
-      switch (other.O1Case) {
-        case O1OneofCase.O1String:
-          O1String = other.O1String;
-          break;
-        case O1OneofCase.O1Int32:
-          O1Int32 = other.O1Int32;
-          break;
-      }
-
-      switch (other.O2Case) {
-        case O2OneofCase.O2Int32:
-          O2Int32 = other.O2Int32;
-          break;
-        case O2OneofCase.O2String:
-          O2String = other.O2String;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            PlainString = input.ReadString();
-            break;
-          }
-          case 18: {
-            O1String = input.ReadString();
-            break;
-          }
-          case 26: {
-            O2String = input.ReadString();
-            break;
-          }
-          case 32: {
-            PlainInt32 = input.ReadInt32();
-            break;
-          }
-          case 40: {
-            O1Int32 = input.ReadInt32();
-            break;
-          }
-          case 48: {
-            O2Int32 = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestJsonName : pb::IMessage<TestJsonName> {
-    private static readonly pb::MessageParser<TestJsonName> _parser = new pb::MessageParser<TestJsonName>(() => new TestJsonName());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestJsonName> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[7]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestJsonName() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestJsonName(TestJsonName other) : this() {
-      name_ = other.name_;
-      description_ = other.description_;
-      guid_ = other.guid_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestJsonName Clone() {
-      return new TestJsonName(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    /// <summary>
-    ///  Message for testing the effects for of the json_name option
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "description" field.</summary>
-    public const int DescriptionFieldNumber = 2;
-    private string description_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Description {
-      get { return description_; }
-      set {
-        description_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "guid" field.</summary>
-    public const int GuidFieldNumber = 3;
-    private string guid_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Guid {
-      get { return guid_; }
-      set {
-        guid_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestJsonName);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestJsonName other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (Description != other.Description) return false;
-      if (Guid != other.Guid) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (Description.Length != 0) hash ^= Description.GetHashCode();
-      if (Guid.Length != 0) hash ^= Guid.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (Description.Length != 0) {
-        output.WriteRawTag(18);
-        output.WriteString(Description);
-      }
-      if (Guid.Length != 0) {
-        output.WriteRawTag(26);
-        output.WriteString(Guid);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (Description.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Description);
-      }
-      if (Guid.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Guid);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestJsonName other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.Description.Length != 0) {
-        Description = other.Description;
-      }
-      if (other.Guid.Length != 0) {
-        Guid = other.Guid;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            Description = input.ReadString();
-            break;
-          }
-          case 26: {
-            Guid = input.ReadString();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 6646
csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs

@@ -1,6646 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: google/protobuf/unittest_proto3.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos {
-
-  /// <summary>Holder for reflection information generated from google/protobuf/unittest_proto3.proto</summary>
-  public static partial class UnittestProto3Reflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for google/protobuf/unittest_proto3.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static UnittestProto3Reflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJvdG8zLnByb3RvEhFwcm90",
-            "b2J1Zl91bml0dGVzdBosZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0X2ltcG9y",
-            "dF9wcm90bzMucHJvdG8i8A8KDFRlc3RBbGxUeXBlcxIUCgxzaW5nbGVfaW50",
-            "MzIYASABKAUSFAoMc2luZ2xlX2ludDY0GAIgASgDEhUKDXNpbmdsZV91aW50",
-            "MzIYAyABKA0SFQoNc2luZ2xlX3VpbnQ2NBgEIAEoBBIVCg1zaW5nbGVfc2lu",
-            "dDMyGAUgASgREhUKDXNpbmdsZV9zaW50NjQYBiABKBISFgoOc2luZ2xlX2Zp",
-            "eGVkMzIYByABKAcSFgoOc2luZ2xlX2ZpeGVkNjQYCCABKAYSFwoPc2luZ2xl",
-            "X3NmaXhlZDMyGAkgASgPEhcKD3NpbmdsZV9zZml4ZWQ2NBgKIAEoEBIUCgxz",
-            "aW5nbGVfZmxvYXQYCyABKAISFQoNc2luZ2xlX2RvdWJsZRgMIAEoARITCgtz",
-            "aW5nbGVfYm9vbBgNIAEoCBIVCg1zaW5nbGVfc3RyaW5nGA4gASgJEhQKDHNp",
-            "bmdsZV9ieXRlcxgPIAEoDBJMChVzaW5nbGVfbmVzdGVkX21lc3NhZ2UYEiAB",
-            "KAsyLS5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVz",
-            "c2FnZRJBChZzaW5nbGVfZm9yZWlnbl9tZXNzYWdlGBMgASgLMiEucHJvdG9i",
-            "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USRgoVc2luZ2xlX2ltcG9ydF9t",
-            "ZXNzYWdlGBQgASgLMicucHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9y",
-            "dE1lc3NhZ2USRgoSc2luZ2xlX25lc3RlZF9lbnVtGBUgASgOMioucHJvdG9i",
-            "dWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SOwoTc2luZ2xl",
-            "X2ZvcmVpZ25fZW51bRgWIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp",
-            "Z25FbnVtEkAKEnNpbmdsZV9pbXBvcnRfZW51bRgXIAEoDjIkLnByb3RvYnVm",
-            "X3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRFbnVtElMKHHNpbmdsZV9wdWJsaWNf",
-            "aW1wb3J0X21lc3NhZ2UYGiABKAsyLS5wcm90b2J1Zl91bml0dGVzdF9pbXBv",
-            "cnQuUHVibGljSW1wb3J0TWVzc2FnZRIWCg5yZXBlYXRlZF9pbnQzMhgfIAMo",
-            "BRIWCg5yZXBlYXRlZF9pbnQ2NBggIAMoAxIXCg9yZXBlYXRlZF91aW50MzIY",
-            "ISADKA0SFwoPcmVwZWF0ZWRfdWludDY0GCIgAygEEhcKD3JlcGVhdGVkX3Np",
-            "bnQzMhgjIAMoERIXCg9yZXBlYXRlZF9zaW50NjQYJCADKBISGAoQcmVwZWF0",
-            "ZWRfZml4ZWQzMhglIAMoBxIYChByZXBlYXRlZF9maXhlZDY0GCYgAygGEhkK",
-            "EXJlcGVhdGVkX3NmaXhlZDMyGCcgAygPEhkKEXJlcGVhdGVkX3NmaXhlZDY0",
-            "GCggAygQEhYKDnJlcGVhdGVkX2Zsb2F0GCkgAygCEhcKD3JlcGVhdGVkX2Rv",
-            "dWJsZRgqIAMoARIVCg1yZXBlYXRlZF9ib29sGCsgAygIEhcKD3JlcGVhdGVk",
-            "X3N0cmluZxgsIAMoCRIWCg5yZXBlYXRlZF9ieXRlcxgtIAMoDBJOChdyZXBl",
-            "YXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0",
-            "LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEkMKGHJlcGVhdGVkX2ZvcmVp",
-            "Z25fbWVzc2FnZRgxIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25N",
-            "ZXNzYWdlEkgKF3JlcGVhdGVkX2ltcG9ydF9tZXNzYWdlGDIgAygLMicucHJv",
-            "dG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9ydE1lc3NhZ2USSAoUcmVwZWF0",
-            "ZWRfbmVzdGVkX2VudW0YMyADKA4yKi5wcm90b2J1Zl91bml0dGVzdC5UZXN0",
-            "QWxsVHlwZXMuTmVzdGVkRW51bRI9ChVyZXBlYXRlZF9mb3JlaWduX2VudW0Y",
-            "NCADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bRJCChRyZXBl",
-            "YXRlZF9pbXBvcnRfZW51bRg1IAMoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2lt",
-            "cG9ydC5JbXBvcnRFbnVtElUKHnJlcGVhdGVkX3B1YmxpY19pbXBvcnRfbWVz",
-            "c2FnZRg2IAMoCzItLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5QdWJsaWNJ",
-            "bXBvcnRNZXNzYWdlEhYKDG9uZW9mX3VpbnQzMhhvIAEoDUgAEk0KFG9uZW9m",
-            "X25lc3RlZF9tZXNzYWdlGHAgASgLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVz",
-            "dEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2VIABIWCgxvbmVvZl9zdHJpbmcYcSAB",
-            "KAlIABIVCgtvbmVvZl9ieXRlcxhyIAEoDEgAGhsKDU5lc3RlZE1lc3NhZ2US",
-            "CgoCYmIYASABKAUiVgoKTmVzdGVkRW51bRIbChdORVNURURfRU5VTV9VTlNQ",
-            "RUNJRklFRBAAEgcKA0ZPTxABEgcKA0JBUhACEgcKA0JBWhADEhAKA05FRxD/",
-            "//////////8BQg0KC29uZW9mX2ZpZWxkIrsBChJOZXN0ZWRUZXN0QWxsVHlw",
-            "ZXMSNAoFY2hpbGQYASABKAsyJS5wcm90b2J1Zl91bml0dGVzdC5OZXN0ZWRU",
-            "ZXN0QWxsVHlwZXMSMAoHcGF5bG9hZBgCIAEoCzIfLnByb3RvYnVmX3VuaXR0",
-            "ZXN0LlRlc3RBbGxUeXBlcxI9Cg5yZXBlYXRlZF9jaGlsZBgDIAMoCzIlLnBy",
-            "b3RvYnVmX3VuaXR0ZXN0Lk5lc3RlZFRlc3RBbGxUeXBlcyI0ChRUZXN0RGVw",
-            "cmVjYXRlZEZpZWxkcxIcChBkZXByZWNhdGVkX2ludDMyGAEgASgFQgIYASIb",
-            "Cg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFIjAKElRlc3RSZXNlcnZlZEZp",
-            "ZWxkc0oECAIQA0oECA8QEEoECAkQDFIDYmFyUgNiYXoiWgoRVGVzdEZvcmVp",
-            "Z25OZXN0ZWQSRQoOZm9yZWlnbl9uZXN0ZWQYASABKAsyLS5wcm90b2J1Zl91",
-            "bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZSI0ChhUZXN0UmVh",
-            "bGx5TGFyZ2VUYWdOdW1iZXISCQoBYRgBIAEoBRINCgJiYhj///9/IAEoBSJV",
-            "ChRUZXN0UmVjdXJzaXZlTWVzc2FnZRIyCgFhGAEgASgLMicucHJvdG9idWZf",
-            "dW5pdHRlc3QuVGVzdFJlY3Vyc2l2ZU1lc3NhZ2USCQoBaRgCIAEoBSJLChRU",
-            "ZXN0TXV0dWFsUmVjdXJzaW9uQRIzCgJiYhgBIAEoCzInLnByb3RvYnVmX3Vu",
-            "aXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25CImIKFFRlc3RNdXR1YWxSZWN1",
-            "cnNpb25CEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TXV0",
-            "dWFsUmVjdXJzaW9uQRIWCg5vcHRpb25hbF9pbnQzMhgCIAEoBSLrAgoXVGVz",
-            "dENhbWVsQ2FzZUZpZWxkTmFtZXMSFgoOUHJpbWl0aXZlRmllbGQYASABKAUS",
-            "EwoLU3RyaW5nRmllbGQYAiABKAkSMQoJRW51bUZpZWxkGAMgASgOMh4ucHJv",
-            "dG9idWZfdW5pdHRlc3QuRm9yZWlnbkVudW0SNwoMTWVzc2FnZUZpZWxkGAQg",
-            "ASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USHgoWUmVw",
-            "ZWF0ZWRQcmltaXRpdmVGaWVsZBgHIAMoBRIbChNSZXBlYXRlZFN0cmluZ0Zp",
-            "ZWxkGAggAygJEjkKEVJlcGVhdGVkRW51bUZpZWxkGAkgAygOMh4ucHJvdG9i",
-            "dWZfdW5pdHRlc3QuRm9yZWlnbkVudW0SPwoUUmVwZWF0ZWRNZXNzYWdlRmll",
-            "bGQYCiADKAsyIS5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZSLH",
-            "AQoSVGVzdEZpZWxkT3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEoCRIOCgZt",
-            "eV9pbnQYASABKAMSEAoIbXlfZmxvYXQYZSABKAISUwoVc2luZ2xlX25lc3Rl",
-            "ZF9tZXNzYWdlGMgBIAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RGaWVs",
-            "ZE9yZGVyaW5ncy5OZXN0ZWRNZXNzYWdlGicKDU5lc3RlZE1lc3NhZ2USCgoC",
-            "b28YAiABKAMSCgoCYmIYASABKAUiSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoL",
-            "c3BhcnNlX2VudW0YASABKA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3Bh",
-            "cnNlRW51bSIZCglPbmVTdHJpbmcSDAoEZGF0YRgBIAEoCSIaCgpNb3JlU3Ry",
-            "aW5nEgwKBGRhdGEYASADKAkiGAoIT25lQnl0ZXMSDAoEZGF0YRgBIAEoDCIZ",
-            "CglNb3JlQnl0ZXMSDAoEZGF0YRgBIAEoDCIcCgxJbnQzMk1lc3NhZ2USDAoE",
-            "ZGF0YRgBIAEoBSIdCg1VaW50MzJNZXNzYWdlEgwKBGRhdGEYASABKA0iHAoM",
-            "SW50NjRNZXNzYWdlEgwKBGRhdGEYASABKAMiHQoNVWludDY0TWVzc2FnZRIM",
-            "CgRkYXRhGAEgASgEIhsKC0Jvb2xNZXNzYWdlEgwKBGRhdGEYASABKAgicwoJ",
-            "VGVzdE9uZW9mEhEKB2Zvb19pbnQYASABKAVIABIUCgpmb29fc3RyaW5nGAIg",
-            "ASgJSAASNgoLZm9vX21lc3NhZ2UYAyABKAsyHy5wcm90b2J1Zl91bml0dGVz",
-            "dC5UZXN0QWxsVHlwZXNIAEIFCgNmb28iqgMKD1Rlc3RQYWNrZWRUeXBlcxIY",
-            "CgxwYWNrZWRfaW50MzIYWiADKAVCAhABEhgKDHBhY2tlZF9pbnQ2NBhbIAMo",
-            "A0ICEAESGQoNcGFja2VkX3VpbnQzMhhcIAMoDUICEAESGQoNcGFja2VkX3Vp",
-            "bnQ2NBhdIAMoBEICEAESGQoNcGFja2VkX3NpbnQzMhheIAMoEUICEAESGQoN",
-            "cGFja2VkX3NpbnQ2NBhfIAMoEkICEAESGgoOcGFja2VkX2ZpeGVkMzIYYCAD",
-            "KAdCAhABEhoKDnBhY2tlZF9maXhlZDY0GGEgAygGQgIQARIbCg9wYWNrZWRf",
-            "c2ZpeGVkMzIYYiADKA9CAhABEhsKD3BhY2tlZF9zZml4ZWQ2NBhjIAMoEEIC",
-            "EAESGAoMcGFja2VkX2Zsb2F0GGQgAygCQgIQARIZCg1wYWNrZWRfZG91Ymxl",
-            "GGUgAygBQgIQARIXCgtwYWNrZWRfYm9vbBhmIAMoCEICEAESNwoLcGFja2Vk",
-            "X2VudW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUIC",
-            "EAEiyAMKEVRlc3RVbnBhY2tlZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFog",
-            "AygFQgIQABIaCg51bnBhY2tlZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNr",
-            "ZWRfdWludDMyGFwgAygNQgIQABIbCg91bnBhY2tlZF91aW50NjQYXSADKARC",
-            "AhAAEhsKD3VucGFja2VkX3NpbnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRf",
-            "c2ludDY0GF8gAygSQgIQABIcChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQ",
-            "ABIcChB1bnBhY2tlZF9maXhlZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9z",
-            "Zml4ZWQzMhhiIAMoD0ICEAASHQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBC",
-            "AhAAEhoKDnVucGFja2VkX2Zsb2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9k",
-            "b3VibGUYZSADKAFCAhAAEhkKDXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjkK",
-            "DXVucGFja2VkX2VudW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3Jl",
-            "aWduRW51bUICEAAiwAEKI1Rlc3RSZXBlYXRlZFNjYWxhckRpZmZlcmVudFRh",
-            "Z1NpemVzEhgKEHJlcGVhdGVkX2ZpeGVkMzIYDCADKAcSFgoOcmVwZWF0ZWRf",
-            "aW50MzIYDSADKAUSGQoQcmVwZWF0ZWRfZml4ZWQ2NBj+DyADKAYSFwoOcmVw",
-            "ZWF0ZWRfaW50NjQY/w8gAygDEhgKDnJlcGVhdGVkX2Zsb2F0GP7/DyADKAIS",
-            "GQoPcmVwZWF0ZWRfdWludDY0GP//DyADKAQiKAobVGVzdENvbW1lbnRJbmpl",
-            "Y3Rpb25NZXNzYWdlEgkKAWEYASABKAkiDAoKRm9vUmVxdWVzdCINCgtGb29S",
-            "ZXNwb25zZSISChBGb29DbGllbnRNZXNzYWdlIhIKEEZvb1NlcnZlck1lc3Nh",
-            "Z2UiDAoKQmFyUmVxdWVzdCINCgtCYXJSZXNwb25zZSpZCgtGb3JlaWduRW51",
-            "bRIXChNGT1JFSUdOX1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIP",
-            "CgtGT1JFSUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1X",
-            "aXRoRHVwVmFsdWUSKAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BF",
-            "Q0lGSUVEEAASCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08y",
-            "EAESCAoEQkFSMhACGgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9T",
-            "UEFSU0VfRU5VTV9VTlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BB",
-            "UlNFX0IQpucDEg8KCFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////",
-            "////ARIVCghTUEFSU0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIymQEK",
-            "C1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1Jl",
-            "cXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXIS",
-            "HS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5p",
-            "dHRlc3QuQmFyUmVzcG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB",
-            "+AEBqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor, },
-          new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), }, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestAllTypes), global::Google.Protobuf.TestProtos.TestAllTypes.Parser, new[]{ "SingleInt32", "SingleInt64", "SingleUint32", "SingleUint64", "SingleSint32", "SingleSint64", "SingleFixed32", "SingleFixed64", "SingleSfixed32", "SingleSfixed64", "SingleFloat", "SingleDouble", "SingleBool", "SingleString", "SingleBytes", "SingleNestedMessage", "SingleForeignMessage", "SingleImportMessage", "SingleNestedEnum", "SingleForeignEnum", "SingleImportEnum", "SinglePublicImportMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedImportMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedImportEnum", "RepeatedPublicImportMessage", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes" }, new[]{ "OneofField" }, new[]{ typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage.Parser, new[]{ "Bb" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.NestedTestAllTypes), global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser, new[]{ "Child", "Payload", "RepeatedChild" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestDeprecatedFields), global::Google.Protobuf.TestProtos.TestDeprecatedFields.Parser, new[]{ "DeprecatedInt32" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.ForeignMessage), global::Google.Protobuf.TestProtos.ForeignMessage.Parser, new[]{ "C" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestReservedFields), global::Google.Protobuf.TestProtos.TestReservedFields.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestForeignNested), global::Google.Protobuf.TestProtos.TestForeignNested.Parser, new[]{ "ForeignNested" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber), global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber.Parser, new[]{ "A", "Bb" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), global::Google.Protobuf.TestProtos.TestRecursiveMessage.Parser, new[]{ "A", "I" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), global::Google.Protobuf.TestProtos.TestMutualRecursionA.Parser, new[]{ "Bb" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), global::Google.Protobuf.TestProtos.TestMutualRecursionB.Parser, new[]{ "A", "OptionalInt32" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames.Parser, new[]{ "PrimitiveField", "StringField", "EnumField", "MessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), global::Google.Protobuf.TestProtos.TestFieldOrderings.Parser, new[]{ "MyString", "MyInt", "MyFloat", "SingleNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage.Parser, new[]{ "Oo", "Bb" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), global::Google.Protobuf.TestProtos.SparseEnumMessage.Parser, new[]{ "SparseEnum" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneString), global::Google.Protobuf.TestProtos.OneString.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MoreString), global::Google.Protobuf.TestProtos.MoreString.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneBytes), global::Google.Protobuf.TestProtos.OneBytes.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MoreBytes), global::Google.Protobuf.TestProtos.MoreBytes.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Int32Message), global::Google.Protobuf.TestProtos.Int32Message.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Uint32Message), global::Google.Protobuf.TestProtos.Uint32Message.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Int64Message), global::Google.Protobuf.TestProtos.Int64Message.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Uint64Message), global::Google.Protobuf.TestProtos.Uint64Message.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BoolMessage), global::Google.Protobuf.TestProtos.BoolMessage.Parser, new[]{ "Data" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestOneof), global::Google.Protobuf.TestProtos.TestOneof.Parser, new[]{ "FooInt", "FooString", "FooMessage" }, new[]{ "Foo" }, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestPackedTypes), global::Google.Protobuf.TestProtos.TestPackedTypes.Parser, new[]{ "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestUnpackedTypes), global::Google.Protobuf.TestProtos.TestUnpackedTypes.Parser, new[]{ "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes), global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes.Parser, new[]{ "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCommentInjectionMessage), global::Google.Protobuf.TestProtos.TestCommentInjectionMessage.Parser, new[]{ "A" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooRequest), global::Google.Protobuf.TestProtos.FooRequest.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooResponse), global::Google.Protobuf.TestProtos.FooResponse.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), global::Google.Protobuf.TestProtos.FooClientMessage.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), global::Google.Protobuf.TestProtos.FooServerMessage.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarRequest), global::Google.Protobuf.TestProtos.BarRequest.Parser, null, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null)
-          }));
-    }
-    #endregion
-
-  }
-  #region Enums
-  public enum ForeignEnum {
-    [pbr::OriginalName("FOREIGN_UNSPECIFIED")] ForeignUnspecified = 0,
-    [pbr::OriginalName("FOREIGN_FOO")] ForeignFoo = 4,
-    [pbr::OriginalName("FOREIGN_BAR")] ForeignBar = 5,
-    [pbr::OriginalName("FOREIGN_BAZ")] ForeignBaz = 6,
-  }
-
-  /// <summary>
-  ///  Test an enum that has multiple values with the same number.
-  /// </summary>
-  public enum TestEnumWithDupValue {
-    [pbr::OriginalName("TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED")] Unspecified = 0,
-    [pbr::OriginalName("FOO1")] Foo1 = 1,
-    [pbr::OriginalName("BAR1")] Bar1 = 2,
-    [pbr::OriginalName("BAZ")] Baz = 3,
-    [pbr::OriginalName("FOO2")] Foo2 = 1,
-    [pbr::OriginalName("BAR2")] Bar2 = 2,
-  }
-
-  /// <summary>
-  ///  Test an enum with large, unordered values.
-  /// </summary>
-  public enum TestSparseEnum {
-    [pbr::OriginalName("TEST_SPARSE_ENUM_UNSPECIFIED")] Unspecified = 0,
-    [pbr::OriginalName("SPARSE_A")] SparseA = 123,
-    [pbr::OriginalName("SPARSE_B")] SparseB = 62374,
-    [pbr::OriginalName("SPARSE_C")] SparseC = 12589234,
-    [pbr::OriginalName("SPARSE_D")] SparseD = -15,
-    [pbr::OriginalName("SPARSE_E")] SparseE = -53452,
-    /// <summary>
-    ///  In proto3, value 0 must be the first one specified
-    ///  SPARSE_F = 0;
-    /// </summary>
-    [pbr::OriginalName("SPARSE_G")] SparseG = 2,
-  }
-
-  #endregion
-
-  #region Messages
-  /// <summary>
-  ///  This proto includes every type of field in both singular and repeated
-  ///  forms.
-  /// </summary>
-  public sealed partial class TestAllTypes : pb::IMessage<TestAllTypes> {
-    private static readonly pb::MessageParser<TestAllTypes> _parser = new pb::MessageParser<TestAllTypes>(() => new TestAllTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestAllTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestAllTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestAllTypes(TestAllTypes other) : this() {
-      singleInt32_ = other.singleInt32_;
-      singleInt64_ = other.singleInt64_;
-      singleUint32_ = other.singleUint32_;
-      singleUint64_ = other.singleUint64_;
-      singleSint32_ = other.singleSint32_;
-      singleSint64_ = other.singleSint64_;
-      singleFixed32_ = other.singleFixed32_;
-      singleFixed64_ = other.singleFixed64_;
-      singleSfixed32_ = other.singleSfixed32_;
-      singleSfixed64_ = other.singleSfixed64_;
-      singleFloat_ = other.singleFloat_;
-      singleDouble_ = other.singleDouble_;
-      singleBool_ = other.singleBool_;
-      singleString_ = other.singleString_;
-      singleBytes_ = other.singleBytes_;
-      SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null;
-      SingleForeignMessage = other.singleForeignMessage_ != null ? other.SingleForeignMessage.Clone() : null;
-      SingleImportMessage = other.singleImportMessage_ != null ? other.SingleImportMessage.Clone() : null;
-      singleNestedEnum_ = other.singleNestedEnum_;
-      singleForeignEnum_ = other.singleForeignEnum_;
-      singleImportEnum_ = other.singleImportEnum_;
-      SinglePublicImportMessage = other.singlePublicImportMessage_ != null ? other.SinglePublicImportMessage.Clone() : null;
-      repeatedInt32_ = other.repeatedInt32_.Clone();
-      repeatedInt64_ = other.repeatedInt64_.Clone();
-      repeatedUint32_ = other.repeatedUint32_.Clone();
-      repeatedUint64_ = other.repeatedUint64_.Clone();
-      repeatedSint32_ = other.repeatedSint32_.Clone();
-      repeatedSint64_ = other.repeatedSint64_.Clone();
-      repeatedFixed32_ = other.repeatedFixed32_.Clone();
-      repeatedFixed64_ = other.repeatedFixed64_.Clone();
-      repeatedSfixed32_ = other.repeatedSfixed32_.Clone();
-      repeatedSfixed64_ = other.repeatedSfixed64_.Clone();
-      repeatedFloat_ = other.repeatedFloat_.Clone();
-      repeatedDouble_ = other.repeatedDouble_.Clone();
-      repeatedBool_ = other.repeatedBool_.Clone();
-      repeatedString_ = other.repeatedString_.Clone();
-      repeatedBytes_ = other.repeatedBytes_.Clone();
-      repeatedNestedMessage_ = other.repeatedNestedMessage_.Clone();
-      repeatedForeignMessage_ = other.repeatedForeignMessage_.Clone();
-      repeatedImportMessage_ = other.repeatedImportMessage_.Clone();
-      repeatedNestedEnum_ = other.repeatedNestedEnum_.Clone();
-      repeatedForeignEnum_ = other.repeatedForeignEnum_.Clone();
-      repeatedImportEnum_ = other.repeatedImportEnum_.Clone();
-      repeatedPublicImportMessage_ = other.repeatedPublicImportMessage_.Clone();
-      switch (other.OneofFieldCase) {
-        case OneofFieldOneofCase.OneofUint32:
-          OneofUint32 = other.OneofUint32;
-          break;
-        case OneofFieldOneofCase.OneofNestedMessage:
-          OneofNestedMessage = other.OneofNestedMessage.Clone();
-          break;
-        case OneofFieldOneofCase.OneofString:
-          OneofString = other.OneofString;
-          break;
-        case OneofFieldOneofCase.OneofBytes:
-          OneofBytes = other.OneofBytes;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestAllTypes Clone() {
-      return new TestAllTypes(this);
-    }
-
-    /// <summary>Field number for the "single_int32" field.</summary>
-    public const int SingleInt32FieldNumber = 1;
-    private int singleInt32_;
-    /// <summary>
-    ///  Singular
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int SingleInt32 {
-      get { return singleInt32_; }
-      set {
-        singleInt32_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_int64" field.</summary>
-    public const int SingleInt64FieldNumber = 2;
-    private long singleInt64_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long SingleInt64 {
-      get { return singleInt64_; }
-      set {
-        singleInt64_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_uint32" field.</summary>
-    public const int SingleUint32FieldNumber = 3;
-    private uint singleUint32_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public uint SingleUint32 {
-      get { return singleUint32_; }
-      set {
-        singleUint32_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_uint64" field.</summary>
-    public const int SingleUint64FieldNumber = 4;
-    private ulong singleUint64_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ulong SingleUint64 {
-      get { return singleUint64_; }
-      set {
-        singleUint64_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_sint32" field.</summary>
-    public const int SingleSint32FieldNumber = 5;
-    private int singleSint32_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int SingleSint32 {
-      get { return singleSint32_; }
-      set {
-        singleSint32_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_sint64" field.</summary>
-    public const int SingleSint64FieldNumber = 6;
-    private long singleSint64_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long SingleSint64 {
-      get { return singleSint64_; }
-      set {
-        singleSint64_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_fixed32" field.</summary>
-    public const int SingleFixed32FieldNumber = 7;
-    private uint singleFixed32_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public uint SingleFixed32 {
-      get { return singleFixed32_; }
-      set {
-        singleFixed32_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_fixed64" field.</summary>
-    public const int SingleFixed64FieldNumber = 8;
-    private ulong singleFixed64_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ulong SingleFixed64 {
-      get { return singleFixed64_; }
-      set {
-        singleFixed64_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_sfixed32" field.</summary>
-    public const int SingleSfixed32FieldNumber = 9;
-    private int singleSfixed32_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int SingleSfixed32 {
-      get { return singleSfixed32_; }
-      set {
-        singleSfixed32_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_sfixed64" field.</summary>
-    public const int SingleSfixed64FieldNumber = 10;
-    private long singleSfixed64_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long SingleSfixed64 {
-      get { return singleSfixed64_; }
-      set {
-        singleSfixed64_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_float" field.</summary>
-    public const int SingleFloatFieldNumber = 11;
-    private float singleFloat_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public float SingleFloat {
-      get { return singleFloat_; }
-      set {
-        singleFloat_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_double" field.</summary>
-    public const int SingleDoubleFieldNumber = 12;
-    private double singleDouble_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public double SingleDouble {
-      get { return singleDouble_; }
-      set {
-        singleDouble_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_bool" field.</summary>
-    public const int SingleBoolFieldNumber = 13;
-    private bool singleBool_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool SingleBool {
-      get { return singleBool_; }
-      set {
-        singleBool_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_string" field.</summary>
-    public const int SingleStringFieldNumber = 14;
-    private string singleString_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string SingleString {
-      get { return singleString_; }
-      set {
-        singleString_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "single_bytes" field.</summary>
-    public const int SingleBytesFieldNumber = 15;
-    private pb::ByteString singleBytes_ = pb::ByteString.Empty;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString SingleBytes {
-      get { return singleBytes_; }
-      set {
-        singleBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "single_nested_message" field.</summary>
-    public const int SingleNestedMessageFieldNumber = 18;
-    private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage singleNestedMessage_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage SingleNestedMessage {
-      get { return singleNestedMessage_; }
-      set {
-        singleNestedMessage_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_foreign_message" field.</summary>
-    public const int SingleForeignMessageFieldNumber = 19;
-    private global::Google.Protobuf.TestProtos.ForeignMessage singleForeignMessage_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.ForeignMessage SingleForeignMessage {
-      get { return singleForeignMessage_; }
-      set {
-        singleForeignMessage_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_import_message" field.</summary>
-    public const int SingleImportMessageFieldNumber = 20;
-    private global::Google.Protobuf.TestProtos.ImportMessage singleImportMessage_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.ImportMessage SingleImportMessage {
-      get { return singleImportMessage_; }
-      set {
-        singleImportMessage_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_nested_enum" field.</summary>
-    public const int SingleNestedEnumFieldNumber = 21;
-    private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum singleNestedEnum_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum SingleNestedEnum {
-      get { return singleNestedEnum_; }
-      set {
-        singleNestedEnum_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_foreign_enum" field.</summary>
-    public const int SingleForeignEnumFieldNumber = 22;
-    private global::Google.Protobuf.TestProtos.ForeignEnum singleForeignEnum_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.ForeignEnum SingleForeignEnum {
-      get { return singleForeignEnum_; }
-      set {
-        singleForeignEnum_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_import_enum" field.</summary>
-    public const int SingleImportEnumFieldNumber = 23;
-    private global::Google.Protobuf.TestProtos.ImportEnum singleImportEnum_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.ImportEnum SingleImportEnum {
-      get { return singleImportEnum_; }
-      set {
-        singleImportEnum_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_public_import_message" field.</summary>
-    public const int SinglePublicImportMessageFieldNumber = 26;
-    private global::Google.Protobuf.TestProtos.PublicImportMessage singlePublicImportMessage_;
-    /// <summary>
-    ///  Defined in unittest_import_public.proto
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.PublicImportMessage SinglePublicImportMessage {
-      get { return singlePublicImportMessage_; }
-      set {
-        singlePublicImportMessage_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "repeated_int32" field.</summary>
-    public const int RepeatedInt32FieldNumber = 31;
-    private static readonly pb::FieldCodec<int> _repeated_repeatedInt32_codec
-        = pb::FieldCodec.ForInt32(250);
-    private readonly pbc::RepeatedField<int> repeatedInt32_ = new pbc::RepeatedField<int>();
-    /// <summary>
-    ///  Repeated
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> RepeatedInt32 {
-      get { return repeatedInt32_; }
-    }
-
-    /// <summary>Field number for the "repeated_int64" field.</summary>
-    public const int RepeatedInt64FieldNumber = 32;
-    private static readonly pb::FieldCodec<long> _repeated_repeatedInt64_codec
-        = pb::FieldCodec.ForInt64(258);
-    private readonly pbc::RepeatedField<long> repeatedInt64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> RepeatedInt64 {
-      get { return repeatedInt64_; }
-    }
-
-    /// <summary>Field number for the "repeated_uint32" field.</summary>
-    public const int RepeatedUint32FieldNumber = 33;
-    private static readonly pb::FieldCodec<uint> _repeated_repeatedUint32_codec
-        = pb::FieldCodec.ForUInt32(266);
-    private readonly pbc::RepeatedField<uint> repeatedUint32_ = new pbc::RepeatedField<uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> RepeatedUint32 {
-      get { return repeatedUint32_; }
-    }
-
-    /// <summary>Field number for the "repeated_uint64" field.</summary>
-    public const int RepeatedUint64FieldNumber = 34;
-    private static readonly pb::FieldCodec<ulong> _repeated_repeatedUint64_codec
-        = pb::FieldCodec.ForUInt64(274);
-    private readonly pbc::RepeatedField<ulong> repeatedUint64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> RepeatedUint64 {
-      get { return repeatedUint64_; }
-    }
-
-    /// <summary>Field number for the "repeated_sint32" field.</summary>
-    public const int RepeatedSint32FieldNumber = 35;
-    private static readonly pb::FieldCodec<int> _repeated_repeatedSint32_codec
-        = pb::FieldCodec.ForSInt32(282);
-    private readonly pbc::RepeatedField<int> repeatedSint32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> RepeatedSint32 {
-      get { return repeatedSint32_; }
-    }
-
-    /// <summary>Field number for the "repeated_sint64" field.</summary>
-    public const int RepeatedSint64FieldNumber = 36;
-    private static readonly pb::FieldCodec<long> _repeated_repeatedSint64_codec
-        = pb::FieldCodec.ForSInt64(290);
-    private readonly pbc::RepeatedField<long> repeatedSint64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> RepeatedSint64 {
-      get { return repeatedSint64_; }
-    }
-
-    /// <summary>Field number for the "repeated_fixed32" field.</summary>
-    public const int RepeatedFixed32FieldNumber = 37;
-    private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec
-        = pb::FieldCodec.ForFixed32(298);
-    private readonly pbc::RepeatedField<uint> repeatedFixed32_ = new pbc::RepeatedField<uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> RepeatedFixed32 {
-      get { return repeatedFixed32_; }
-    }
-
-    /// <summary>Field number for the "repeated_fixed64" field.</summary>
-    public const int RepeatedFixed64FieldNumber = 38;
-    private static readonly pb::FieldCodec<ulong> _repeated_repeatedFixed64_codec
-        = pb::FieldCodec.ForFixed64(306);
-    private readonly pbc::RepeatedField<ulong> repeatedFixed64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> RepeatedFixed64 {
-      get { return repeatedFixed64_; }
-    }
-
-    /// <summary>Field number for the "repeated_sfixed32" field.</summary>
-    public const int RepeatedSfixed32FieldNumber = 39;
-    private static readonly pb::FieldCodec<int> _repeated_repeatedSfixed32_codec
-        = pb::FieldCodec.ForSFixed32(314);
-    private readonly pbc::RepeatedField<int> repeatedSfixed32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> RepeatedSfixed32 {
-      get { return repeatedSfixed32_; }
-    }
-
-    /// <summary>Field number for the "repeated_sfixed64" field.</summary>
-    public const int RepeatedSfixed64FieldNumber = 40;
-    private static readonly pb::FieldCodec<long> _repeated_repeatedSfixed64_codec
-        = pb::FieldCodec.ForSFixed64(322);
-    private readonly pbc::RepeatedField<long> repeatedSfixed64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> RepeatedSfixed64 {
-      get { return repeatedSfixed64_; }
-    }
-
-    /// <summary>Field number for the "repeated_float" field.</summary>
-    public const int RepeatedFloatFieldNumber = 41;
-    private static readonly pb::FieldCodec<float> _repeated_repeatedFloat_codec
-        = pb::FieldCodec.ForFloat(330);
-    private readonly pbc::RepeatedField<float> repeatedFloat_ = new pbc::RepeatedField<float>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<float> RepeatedFloat {
-      get { return repeatedFloat_; }
-    }
-
-    /// <summary>Field number for the "repeated_double" field.</summary>
-    public const int RepeatedDoubleFieldNumber = 42;
-    private static readonly pb::FieldCodec<double> _repeated_repeatedDouble_codec
-        = pb::FieldCodec.ForDouble(338);
-    private readonly pbc::RepeatedField<double> repeatedDouble_ = new pbc::RepeatedField<double>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<double> RepeatedDouble {
-      get { return repeatedDouble_; }
-    }
-
-    /// <summary>Field number for the "repeated_bool" field.</summary>
-    public const int RepeatedBoolFieldNumber = 43;
-    private static readonly pb::FieldCodec<bool> _repeated_repeatedBool_codec
-        = pb::FieldCodec.ForBool(346);
-    private readonly pbc::RepeatedField<bool> repeatedBool_ = new pbc::RepeatedField<bool>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<bool> RepeatedBool {
-      get { return repeatedBool_; }
-    }
-
-    /// <summary>Field number for the "repeated_string" field.</summary>
-    public const int RepeatedStringFieldNumber = 44;
-    private static readonly pb::FieldCodec<string> _repeated_repeatedString_codec
-        = pb::FieldCodec.ForString(354);
-    private readonly pbc::RepeatedField<string> repeatedString_ = new pbc::RepeatedField<string>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<string> RepeatedString {
-      get { return repeatedString_; }
-    }
-
-    /// <summary>Field number for the "repeated_bytes" field.</summary>
-    public const int RepeatedBytesFieldNumber = 45;
-    private static readonly pb::FieldCodec<pb::ByteString> _repeated_repeatedBytes_codec
-        = pb::FieldCodec.ForBytes(362);
-    private readonly pbc::RepeatedField<pb::ByteString> repeatedBytes_ = new pbc::RepeatedField<pb::ByteString>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<pb::ByteString> RepeatedBytes {
-      get { return repeatedBytes_; }
-    }
-
-    /// <summary>Field number for the "repeated_nested_message" field.</summary>
-    public const int RepeatedNestedMessageFieldNumber = 48;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage> _repeated_repeatedNestedMessage_codec
-        = pb::FieldCodec.ForMessage(386, global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage> repeatedNestedMessage_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage> RepeatedNestedMessage {
-      get { return repeatedNestedMessage_; }
-    }
-
-    /// <summary>Field number for the "repeated_foreign_message" field.</summary>
-    public const int RepeatedForeignMessageFieldNumber = 49;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignMessage> _repeated_repeatedForeignMessage_codec
-        = pb::FieldCodec.ForMessage(394, global::Google.Protobuf.TestProtos.ForeignMessage.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignMessage> repeatedForeignMessage_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignMessage>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignMessage> RepeatedForeignMessage {
-      get { return repeatedForeignMessage_; }
-    }
-
-    /// <summary>Field number for the "repeated_import_message" field.</summary>
-    public const int RepeatedImportMessageFieldNumber = 50;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ImportMessage> _repeated_repeatedImportMessage_codec
-        = pb::FieldCodec.ForMessage(402, global::Google.Protobuf.TestProtos.ImportMessage.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ImportMessage> repeatedImportMessage_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ImportMessage>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ImportMessage> RepeatedImportMessage {
-      get { return repeatedImportMessage_; }
-    }
-
-    /// <summary>Field number for the "repeated_nested_enum" field.</summary>
-    public const int RepeatedNestedEnumFieldNumber = 51;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum> _repeated_repeatedNestedEnum_codec
-        = pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) x);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum> repeatedNestedEnum_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum> RepeatedNestedEnum {
-      get { return repeatedNestedEnum_; }
-    }
-
-    /// <summary>Field number for the "repeated_foreign_enum" field.</summary>
-    public const int RepeatedForeignEnumFieldNumber = 52;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_repeatedForeignEnum_codec
-        = pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> repeatedForeignEnum_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> RepeatedForeignEnum {
-      get { return repeatedForeignEnum_; }
-    }
-
-    /// <summary>Field number for the "repeated_import_enum" field.</summary>
-    public const int RepeatedImportEnumFieldNumber = 53;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ImportEnum> _repeated_repeatedImportEnum_codec
-        = pb::FieldCodec.ForEnum(426, x => (int) x, x => (global::Google.Protobuf.TestProtos.ImportEnum) x);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ImportEnum> repeatedImportEnum_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ImportEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ImportEnum> RepeatedImportEnum {
-      get { return repeatedImportEnum_; }
-    }
-
-    /// <summary>Field number for the "repeated_public_import_message" field.</summary>
-    public const int RepeatedPublicImportMessageFieldNumber = 54;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.PublicImportMessage> _repeated_repeatedPublicImportMessage_codec
-        = pb::FieldCodec.ForMessage(434, global::Google.Protobuf.TestProtos.PublicImportMessage.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.PublicImportMessage> repeatedPublicImportMessage_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.PublicImportMessage>();
-    /// <summary>
-    ///  Defined in unittest_import_public.proto
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.PublicImportMessage> RepeatedPublicImportMessage {
-      get { return repeatedPublicImportMessage_; }
-    }
-
-    /// <summary>Field number for the "oneof_uint32" field.</summary>
-    public const int OneofUint32FieldNumber = 111;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public uint OneofUint32 {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = OneofFieldOneofCase.OneofUint32;
-      }
-    }
-
-    /// <summary>Field number for the "oneof_nested_message" field.</summary>
-    public const int OneofNestedMessageFieldNumber = 112;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage OneofNestedMessage {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage;
-      }
-    }
-
-    /// <summary>Field number for the "oneof_string" field.</summary>
-    public const int OneofStringFieldNumber = 113;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string OneofString {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; }
-      set {
-        oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-        oneofFieldCase_ = OneofFieldOneofCase.OneofString;
-      }
-    }
-
-    /// <summary>Field number for the "oneof_bytes" field.</summary>
-    public const int OneofBytesFieldNumber = 114;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString OneofBytes {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; }
-      set {
-        oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-        oneofFieldCase_ = OneofFieldOneofCase.OneofBytes;
-      }
-    }
-
-    private object oneofField_;
-    /// <summary>Enum of possible cases for the "oneof_field" oneof.</summary>
-    public enum OneofFieldOneofCase {
-      None = 0,
-      OneofUint32 = 111,
-      OneofNestedMessage = 112,
-      OneofString = 113,
-      OneofBytes = 114,
-    }
-    private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofFieldOneofCase OneofFieldCase {
-      get { return oneofFieldCase_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void ClearOneofField() {
-      oneofFieldCase_ = OneofFieldOneofCase.None;
-      oneofField_ = null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestAllTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestAllTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (SingleInt32 != other.SingleInt32) return false;
-      if (SingleInt64 != other.SingleInt64) return false;
-      if (SingleUint32 != other.SingleUint32) return false;
-      if (SingleUint64 != other.SingleUint64) return false;
-      if (SingleSint32 != other.SingleSint32) return false;
-      if (SingleSint64 != other.SingleSint64) return false;
-      if (SingleFixed32 != other.SingleFixed32) return false;
-      if (SingleFixed64 != other.SingleFixed64) return false;
-      if (SingleSfixed32 != other.SingleSfixed32) return false;
-      if (SingleSfixed64 != other.SingleSfixed64) return false;
-      if (SingleFloat != other.SingleFloat) return false;
-      if (SingleDouble != other.SingleDouble) return false;
-      if (SingleBool != other.SingleBool) return false;
-      if (SingleString != other.SingleString) return false;
-      if (SingleBytes != other.SingleBytes) return false;
-      if (!object.Equals(SingleNestedMessage, other.SingleNestedMessage)) return false;
-      if (!object.Equals(SingleForeignMessage, other.SingleForeignMessage)) return false;
-      if (!object.Equals(SingleImportMessage, other.SingleImportMessage)) return false;
-      if (SingleNestedEnum != other.SingleNestedEnum) return false;
-      if (SingleForeignEnum != other.SingleForeignEnum) return false;
-      if (SingleImportEnum != other.SingleImportEnum) return false;
-      if (!object.Equals(SinglePublicImportMessage, other.SinglePublicImportMessage)) return false;
-      if(!repeatedInt32_.Equals(other.repeatedInt32_)) return false;
-      if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false;
-      if(!repeatedUint32_.Equals(other.repeatedUint32_)) return false;
-      if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false;
-      if(!repeatedSint32_.Equals(other.repeatedSint32_)) return false;
-      if(!repeatedSint64_.Equals(other.repeatedSint64_)) return false;
-      if(!repeatedFixed32_.Equals(other.repeatedFixed32_)) return false;
-      if(!repeatedFixed64_.Equals(other.repeatedFixed64_)) return false;
-      if(!repeatedSfixed32_.Equals(other.repeatedSfixed32_)) return false;
-      if(!repeatedSfixed64_.Equals(other.repeatedSfixed64_)) return false;
-      if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false;
-      if(!repeatedDouble_.Equals(other.repeatedDouble_)) return false;
-      if(!repeatedBool_.Equals(other.repeatedBool_)) return false;
-      if(!repeatedString_.Equals(other.repeatedString_)) return false;
-      if(!repeatedBytes_.Equals(other.repeatedBytes_)) return false;
-      if(!repeatedNestedMessage_.Equals(other.repeatedNestedMessage_)) return false;
-      if(!repeatedForeignMessage_.Equals(other.repeatedForeignMessage_)) return false;
-      if(!repeatedImportMessage_.Equals(other.repeatedImportMessage_)) return false;
-      if(!repeatedNestedEnum_.Equals(other.repeatedNestedEnum_)) return false;
-      if(!repeatedForeignEnum_.Equals(other.repeatedForeignEnum_)) return false;
-      if(!repeatedImportEnum_.Equals(other.repeatedImportEnum_)) return false;
-      if(!repeatedPublicImportMessage_.Equals(other.repeatedPublicImportMessage_)) return false;
-      if (OneofUint32 != other.OneofUint32) return false;
-      if (!object.Equals(OneofNestedMessage, other.OneofNestedMessage)) return false;
-      if (OneofString != other.OneofString) return false;
-      if (OneofBytes != other.OneofBytes) return false;
-      if (OneofFieldCase != other.OneofFieldCase) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (SingleInt32 != 0) hash ^= SingleInt32.GetHashCode();
-      if (SingleInt64 != 0L) hash ^= SingleInt64.GetHashCode();
-      if (SingleUint32 != 0) hash ^= SingleUint32.GetHashCode();
-      if (SingleUint64 != 0UL) hash ^= SingleUint64.GetHashCode();
-      if (SingleSint32 != 0) hash ^= SingleSint32.GetHashCode();
-      if (SingleSint64 != 0L) hash ^= SingleSint64.GetHashCode();
-      if (SingleFixed32 != 0) hash ^= SingleFixed32.GetHashCode();
-      if (SingleFixed64 != 0UL) hash ^= SingleFixed64.GetHashCode();
-      if (SingleSfixed32 != 0) hash ^= SingleSfixed32.GetHashCode();
-      if (SingleSfixed64 != 0L) hash ^= SingleSfixed64.GetHashCode();
-      if (SingleFloat != 0F) hash ^= SingleFloat.GetHashCode();
-      if (SingleDouble != 0D) hash ^= SingleDouble.GetHashCode();
-      if (SingleBool != false) hash ^= SingleBool.GetHashCode();
-      if (SingleString.Length != 0) hash ^= SingleString.GetHashCode();
-      if (SingleBytes.Length != 0) hash ^= SingleBytes.GetHashCode();
-      if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode();
-      if (singleForeignMessage_ != null) hash ^= SingleForeignMessage.GetHashCode();
-      if (singleImportMessage_ != null) hash ^= SingleImportMessage.GetHashCode();
-      if (SingleNestedEnum != 0) hash ^= SingleNestedEnum.GetHashCode();
-      if (SingleForeignEnum != 0) hash ^= SingleForeignEnum.GetHashCode();
-      if (SingleImportEnum != 0) hash ^= SingleImportEnum.GetHashCode();
-      if (singlePublicImportMessage_ != null) hash ^= SinglePublicImportMessage.GetHashCode();
-      hash ^= repeatedInt32_.GetHashCode();
-      hash ^= repeatedInt64_.GetHashCode();
-      hash ^= repeatedUint32_.GetHashCode();
-      hash ^= repeatedUint64_.GetHashCode();
-      hash ^= repeatedSint32_.GetHashCode();
-      hash ^= repeatedSint64_.GetHashCode();
-      hash ^= repeatedFixed32_.GetHashCode();
-      hash ^= repeatedFixed64_.GetHashCode();
-      hash ^= repeatedSfixed32_.GetHashCode();
-      hash ^= repeatedSfixed64_.GetHashCode();
-      hash ^= repeatedFloat_.GetHashCode();
-      hash ^= repeatedDouble_.GetHashCode();
-      hash ^= repeatedBool_.GetHashCode();
-      hash ^= repeatedString_.GetHashCode();
-      hash ^= repeatedBytes_.GetHashCode();
-      hash ^= repeatedNestedMessage_.GetHashCode();
-      hash ^= repeatedForeignMessage_.GetHashCode();
-      hash ^= repeatedImportMessage_.GetHashCode();
-      hash ^= repeatedNestedEnum_.GetHashCode();
-      hash ^= repeatedForeignEnum_.GetHashCode();
-      hash ^= repeatedImportEnum_.GetHashCode();
-      hash ^= repeatedPublicImportMessage_.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) hash ^= OneofUint32.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) hash ^= OneofString.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode();
-      hash ^= (int) oneofFieldCase_;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (SingleInt32 != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(SingleInt32);
-      }
-      if (SingleInt64 != 0L) {
-        output.WriteRawTag(16);
-        output.WriteInt64(SingleInt64);
-      }
-      if (SingleUint32 != 0) {
-        output.WriteRawTag(24);
-        output.WriteUInt32(SingleUint32);
-      }
-      if (SingleUint64 != 0UL) {
-        output.WriteRawTag(32);
-        output.WriteUInt64(SingleUint64);
-      }
-      if (SingleSint32 != 0) {
-        output.WriteRawTag(40);
-        output.WriteSInt32(SingleSint32);
-      }
-      if (SingleSint64 != 0L) {
-        output.WriteRawTag(48);
-        output.WriteSInt64(SingleSint64);
-      }
-      if (SingleFixed32 != 0) {
-        output.WriteRawTag(61);
-        output.WriteFixed32(SingleFixed32);
-      }
-      if (SingleFixed64 != 0UL) {
-        output.WriteRawTag(65);
-        output.WriteFixed64(SingleFixed64);
-      }
-      if (SingleSfixed32 != 0) {
-        output.WriteRawTag(77);
-        output.WriteSFixed32(SingleSfixed32);
-      }
-      if (SingleSfixed64 != 0L) {
-        output.WriteRawTag(81);
-        output.WriteSFixed64(SingleSfixed64);
-      }
-      if (SingleFloat != 0F) {
-        output.WriteRawTag(93);
-        output.WriteFloat(SingleFloat);
-      }
-      if (SingleDouble != 0D) {
-        output.WriteRawTag(97);
-        output.WriteDouble(SingleDouble);
-      }
-      if (SingleBool != false) {
-        output.WriteRawTag(104);
-        output.WriteBool(SingleBool);
-      }
-      if (SingleString.Length != 0) {
-        output.WriteRawTag(114);
-        output.WriteString(SingleString);
-      }
-      if (SingleBytes.Length != 0) {
-        output.WriteRawTag(122);
-        output.WriteBytes(SingleBytes);
-      }
-      if (singleNestedMessage_ != null) {
-        output.WriteRawTag(146, 1);
-        output.WriteMessage(SingleNestedMessage);
-      }
-      if (singleForeignMessage_ != null) {
-        output.WriteRawTag(154, 1);
-        output.WriteMessage(SingleForeignMessage);
-      }
-      if (singleImportMessage_ != null) {
-        output.WriteRawTag(162, 1);
-        output.WriteMessage(SingleImportMessage);
-      }
-      if (SingleNestedEnum != 0) {
-        output.WriteRawTag(168, 1);
-        output.WriteEnum((int) SingleNestedEnum);
-      }
-      if (SingleForeignEnum != 0) {
-        output.WriteRawTag(176, 1);
-        output.WriteEnum((int) SingleForeignEnum);
-      }
-      if (SingleImportEnum != 0) {
-        output.WriteRawTag(184, 1);
-        output.WriteEnum((int) SingleImportEnum);
-      }
-      if (singlePublicImportMessage_ != null) {
-        output.WriteRawTag(210, 1);
-        output.WriteMessage(SinglePublicImportMessage);
-      }
-      repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec);
-      repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec);
-      repeatedUint32_.WriteTo(output, _repeated_repeatedUint32_codec);
-      repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec);
-      repeatedSint32_.WriteTo(output, _repeated_repeatedSint32_codec);
-      repeatedSint64_.WriteTo(output, _repeated_repeatedSint64_codec);
-      repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec);
-      repeatedFixed64_.WriteTo(output, _repeated_repeatedFixed64_codec);
-      repeatedSfixed32_.WriteTo(output, _repeated_repeatedSfixed32_codec);
-      repeatedSfixed64_.WriteTo(output, _repeated_repeatedSfixed64_codec);
-      repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec);
-      repeatedDouble_.WriteTo(output, _repeated_repeatedDouble_codec);
-      repeatedBool_.WriteTo(output, _repeated_repeatedBool_codec);
-      repeatedString_.WriteTo(output, _repeated_repeatedString_codec);
-      repeatedBytes_.WriteTo(output, _repeated_repeatedBytes_codec);
-      repeatedNestedMessage_.WriteTo(output, _repeated_repeatedNestedMessage_codec);
-      repeatedForeignMessage_.WriteTo(output, _repeated_repeatedForeignMessage_codec);
-      repeatedImportMessage_.WriteTo(output, _repeated_repeatedImportMessage_codec);
-      repeatedNestedEnum_.WriteTo(output, _repeated_repeatedNestedEnum_codec);
-      repeatedForeignEnum_.WriteTo(output, _repeated_repeatedForeignEnum_codec);
-      repeatedImportEnum_.WriteTo(output, _repeated_repeatedImportEnum_codec);
-      repeatedPublicImportMessage_.WriteTo(output, _repeated_repeatedPublicImportMessage_codec);
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) {
-        output.WriteRawTag(248, 6);
-        output.WriteUInt32(OneofUint32);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) {
-        output.WriteRawTag(130, 7);
-        output.WriteMessage(OneofNestedMessage);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) {
-        output.WriteRawTag(138, 7);
-        output.WriteString(OneofString);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) {
-        output.WriteRawTag(146, 7);
-        output.WriteBytes(OneofBytes);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (SingleInt32 != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(SingleInt32);
-      }
-      if (SingleInt64 != 0L) {
-        size += 1 + pb::CodedOutputStream.ComputeInt64Size(SingleInt64);
-      }
-      if (SingleUint32 != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeUInt32Size(SingleUint32);
-      }
-      if (SingleUint64 != 0UL) {
-        size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SingleUint64);
-      }
-      if (SingleSint32 != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeSInt32Size(SingleSint32);
-      }
-      if (SingleSint64 != 0L) {
-        size += 1 + pb::CodedOutputStream.ComputeSInt64Size(SingleSint64);
-      }
-      if (SingleFixed32 != 0) {
-        size += 1 + 4;
-      }
-      if (SingleFixed64 != 0UL) {
-        size += 1 + 8;
-      }
-      if (SingleSfixed32 != 0) {
-        size += 1 + 4;
-      }
-      if (SingleSfixed64 != 0L) {
-        size += 1 + 8;
-      }
-      if (SingleFloat != 0F) {
-        size += 1 + 4;
-      }
-      if (SingleDouble != 0D) {
-        size += 1 + 8;
-      }
-      if (SingleBool != false) {
-        size += 1 + 1;
-      }
-      if (SingleString.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(SingleString);
-      }
-      if (SingleBytes.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeBytesSize(SingleBytes);
-      }
-      if (singleNestedMessage_ != null) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleNestedMessage);
-      }
-      if (singleForeignMessage_ != null) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleForeignMessage);
-      }
-      if (singleImportMessage_ != null) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleImportMessage);
-      }
-      if (SingleNestedEnum != 0) {
-        size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) SingleNestedEnum);
-      }
-      if (SingleForeignEnum != 0) {
-        size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) SingleForeignEnum);
-      }
-      if (SingleImportEnum != 0) {
-        size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) SingleImportEnum);
-      }
-      if (singlePublicImportMessage_ != null) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(SinglePublicImportMessage);
-      }
-      size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec);
-      size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec);
-      size += repeatedUint32_.CalculateSize(_repeated_repeatedUint32_codec);
-      size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec);
-      size += repeatedSint32_.CalculateSize(_repeated_repeatedSint32_codec);
-      size += repeatedSint64_.CalculateSize(_repeated_repeatedSint64_codec);
-      size += repeatedFixed32_.CalculateSize(_repeated_repeatedFixed32_codec);
-      size += repeatedFixed64_.CalculateSize(_repeated_repeatedFixed64_codec);
-      size += repeatedSfixed32_.CalculateSize(_repeated_repeatedSfixed32_codec);
-      size += repeatedSfixed64_.CalculateSize(_repeated_repeatedSfixed64_codec);
-      size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec);
-      size += repeatedDouble_.CalculateSize(_repeated_repeatedDouble_codec);
-      size += repeatedBool_.CalculateSize(_repeated_repeatedBool_codec);
-      size += repeatedString_.CalculateSize(_repeated_repeatedString_codec);
-      size += repeatedBytes_.CalculateSize(_repeated_repeatedBytes_codec);
-      size += repeatedNestedMessage_.CalculateSize(_repeated_repeatedNestedMessage_codec);
-      size += repeatedForeignMessage_.CalculateSize(_repeated_repeatedForeignMessage_codec);
-      size += repeatedImportMessage_.CalculateSize(_repeated_repeatedImportMessage_codec);
-      size += repeatedNestedEnum_.CalculateSize(_repeated_repeatedNestedEnum_codec);
-      size += repeatedForeignEnum_.CalculateSize(_repeated_repeatedForeignEnum_codec);
-      size += repeatedImportEnum_.CalculateSize(_repeated_repeatedImportEnum_codec);
-      size += repeatedPublicImportMessage_.CalculateSize(_repeated_repeatedPublicImportMessage_codec);
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) {
-        size += 2 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(OneofNestedMessage);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) {
-        size += 2 + pb::CodedOutputStream.ComputeStringSize(OneofString);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) {
-        size += 2 + pb::CodedOutputStream.ComputeBytesSize(OneofBytes);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestAllTypes other) {
-      if (other == null) {
-        return;
-      }
-      if (other.SingleInt32 != 0) {
-        SingleInt32 = other.SingleInt32;
-      }
-      if (other.SingleInt64 != 0L) {
-        SingleInt64 = other.SingleInt64;
-      }
-      if (other.SingleUint32 != 0) {
-        SingleUint32 = other.SingleUint32;
-      }
-      if (other.SingleUint64 != 0UL) {
-        SingleUint64 = other.SingleUint64;
-      }
-      if (other.SingleSint32 != 0) {
-        SingleSint32 = other.SingleSint32;
-      }
-      if (other.SingleSint64 != 0L) {
-        SingleSint64 = other.SingleSint64;
-      }
-      if (other.SingleFixed32 != 0) {
-        SingleFixed32 = other.SingleFixed32;
-      }
-      if (other.SingleFixed64 != 0UL) {
-        SingleFixed64 = other.SingleFixed64;
-      }
-      if (other.SingleSfixed32 != 0) {
-        SingleSfixed32 = other.SingleSfixed32;
-      }
-      if (other.SingleSfixed64 != 0L) {
-        SingleSfixed64 = other.SingleSfixed64;
-      }
-      if (other.SingleFloat != 0F) {
-        SingleFloat = other.SingleFloat;
-      }
-      if (other.SingleDouble != 0D) {
-        SingleDouble = other.SingleDouble;
-      }
-      if (other.SingleBool != false) {
-        SingleBool = other.SingleBool;
-      }
-      if (other.SingleString.Length != 0) {
-        SingleString = other.SingleString;
-      }
-      if (other.SingleBytes.Length != 0) {
-        SingleBytes = other.SingleBytes;
-      }
-      if (other.singleNestedMessage_ != null) {
-        if (singleNestedMessage_ == null) {
-          singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
-        }
-        SingleNestedMessage.MergeFrom(other.SingleNestedMessage);
-      }
-      if (other.singleForeignMessage_ != null) {
-        if (singleForeignMessage_ == null) {
-          singleForeignMessage_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
-        }
-        SingleForeignMessage.MergeFrom(other.SingleForeignMessage);
-      }
-      if (other.singleImportMessage_ != null) {
-        if (singleImportMessage_ == null) {
-          singleImportMessage_ = new global::Google.Protobuf.TestProtos.ImportMessage();
-        }
-        SingleImportMessage.MergeFrom(other.SingleImportMessage);
-      }
-      if (other.SingleNestedEnum != 0) {
-        SingleNestedEnum = other.SingleNestedEnum;
-      }
-      if (other.SingleForeignEnum != 0) {
-        SingleForeignEnum = other.SingleForeignEnum;
-      }
-      if (other.SingleImportEnum != 0) {
-        SingleImportEnum = other.SingleImportEnum;
-      }
-      if (other.singlePublicImportMessage_ != null) {
-        if (singlePublicImportMessage_ == null) {
-          singlePublicImportMessage_ = new global::Google.Protobuf.TestProtos.PublicImportMessage();
-        }
-        SinglePublicImportMessage.MergeFrom(other.SinglePublicImportMessage);
-      }
-      repeatedInt32_.Add(other.repeatedInt32_);
-      repeatedInt64_.Add(other.repeatedInt64_);
-      repeatedUint32_.Add(other.repeatedUint32_);
-      repeatedUint64_.Add(other.repeatedUint64_);
-      repeatedSint32_.Add(other.repeatedSint32_);
-      repeatedSint64_.Add(other.repeatedSint64_);
-      repeatedFixed32_.Add(other.repeatedFixed32_);
-      repeatedFixed64_.Add(other.repeatedFixed64_);
-      repeatedSfixed32_.Add(other.repeatedSfixed32_);
-      repeatedSfixed64_.Add(other.repeatedSfixed64_);
-      repeatedFloat_.Add(other.repeatedFloat_);
-      repeatedDouble_.Add(other.repeatedDouble_);
-      repeatedBool_.Add(other.repeatedBool_);
-      repeatedString_.Add(other.repeatedString_);
-      repeatedBytes_.Add(other.repeatedBytes_);
-      repeatedNestedMessage_.Add(other.repeatedNestedMessage_);
-      repeatedForeignMessage_.Add(other.repeatedForeignMessage_);
-      repeatedImportMessage_.Add(other.repeatedImportMessage_);
-      repeatedNestedEnum_.Add(other.repeatedNestedEnum_);
-      repeatedForeignEnum_.Add(other.repeatedForeignEnum_);
-      repeatedImportEnum_.Add(other.repeatedImportEnum_);
-      repeatedPublicImportMessage_.Add(other.repeatedPublicImportMessage_);
-      switch (other.OneofFieldCase) {
-        case OneofFieldOneofCase.OneofUint32:
-          OneofUint32 = other.OneofUint32;
-          break;
-        case OneofFieldOneofCase.OneofNestedMessage:
-          OneofNestedMessage = other.OneofNestedMessage;
-          break;
-        case OneofFieldOneofCase.OneofString:
-          OneofString = other.OneofString;
-          break;
-        case OneofFieldOneofCase.OneofBytes:
-          OneofBytes = other.OneofBytes;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            SingleInt32 = input.ReadInt32();
-            break;
-          }
-          case 16: {
-            SingleInt64 = input.ReadInt64();
-            break;
-          }
-          case 24: {
-            SingleUint32 = input.ReadUInt32();
-            break;
-          }
-          case 32: {
-            SingleUint64 = input.ReadUInt64();
-            break;
-          }
-          case 40: {
-            SingleSint32 = input.ReadSInt32();
-            break;
-          }
-          case 48: {
-            SingleSint64 = input.ReadSInt64();
-            break;
-          }
-          case 61: {
-            SingleFixed32 = input.ReadFixed32();
-            break;
-          }
-          case 65: {
-            SingleFixed64 = input.ReadFixed64();
-            break;
-          }
-          case 77: {
-            SingleSfixed32 = input.ReadSFixed32();
-            break;
-          }
-          case 81: {
-            SingleSfixed64 = input.ReadSFixed64();
-            break;
-          }
-          case 93: {
-            SingleFloat = input.ReadFloat();
-            break;
-          }
-          case 97: {
-            SingleDouble = input.ReadDouble();
-            break;
-          }
-          case 104: {
-            SingleBool = input.ReadBool();
-            break;
-          }
-          case 114: {
-            SingleString = input.ReadString();
-            break;
-          }
-          case 122: {
-            SingleBytes = input.ReadBytes();
-            break;
-          }
-          case 146: {
-            if (singleNestedMessage_ == null) {
-              singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
-            }
-            input.ReadMessage(singleNestedMessage_);
-            break;
-          }
-          case 154: {
-            if (singleForeignMessage_ == null) {
-              singleForeignMessage_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
-            }
-            input.ReadMessage(singleForeignMessage_);
-            break;
-          }
-          case 162: {
-            if (singleImportMessage_ == null) {
-              singleImportMessage_ = new global::Google.Protobuf.TestProtos.ImportMessage();
-            }
-            input.ReadMessage(singleImportMessage_);
-            break;
-          }
-          case 168: {
-            singleNestedEnum_ = (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) input.ReadEnum();
-            break;
-          }
-          case 176: {
-            singleForeignEnum_ = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
-            break;
-          }
-          case 184: {
-            singleImportEnum_ = (global::Google.Protobuf.TestProtos.ImportEnum) input.ReadEnum();
-            break;
-          }
-          case 210: {
-            if (singlePublicImportMessage_ == null) {
-              singlePublicImportMessage_ = new global::Google.Protobuf.TestProtos.PublicImportMessage();
-            }
-            input.ReadMessage(singlePublicImportMessage_);
-            break;
-          }
-          case 250:
-          case 248: {
-            repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
-            break;
-          }
-          case 258:
-          case 256: {
-            repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec);
-            break;
-          }
-          case 266:
-          case 264: {
-            repeatedUint32_.AddEntriesFrom(input, _repeated_repeatedUint32_codec);
-            break;
-          }
-          case 274:
-          case 272: {
-            repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec);
-            break;
-          }
-          case 282:
-          case 280: {
-            repeatedSint32_.AddEntriesFrom(input, _repeated_repeatedSint32_codec);
-            break;
-          }
-          case 290:
-          case 288: {
-            repeatedSint64_.AddEntriesFrom(input, _repeated_repeatedSint64_codec);
-            break;
-          }
-          case 298:
-          case 301: {
-            repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec);
-            break;
-          }
-          case 306:
-          case 305: {
-            repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec);
-            break;
-          }
-          case 314:
-          case 317: {
-            repeatedSfixed32_.AddEntriesFrom(input, _repeated_repeatedSfixed32_codec);
-            break;
-          }
-          case 322:
-          case 321: {
-            repeatedSfixed64_.AddEntriesFrom(input, _repeated_repeatedSfixed64_codec);
-            break;
-          }
-          case 330:
-          case 333: {
-            repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec);
-            break;
-          }
-          case 338:
-          case 337: {
-            repeatedDouble_.AddEntriesFrom(input, _repeated_repeatedDouble_codec);
-            break;
-          }
-          case 346:
-          case 344: {
-            repeatedBool_.AddEntriesFrom(input, _repeated_repeatedBool_codec);
-            break;
-          }
-          case 354: {
-            repeatedString_.AddEntriesFrom(input, _repeated_repeatedString_codec);
-            break;
-          }
-          case 362: {
-            repeatedBytes_.AddEntriesFrom(input, _repeated_repeatedBytes_codec);
-            break;
-          }
-          case 386: {
-            repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec);
-            break;
-          }
-          case 394: {
-            repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec);
-            break;
-          }
-          case 402: {
-            repeatedImportMessage_.AddEntriesFrom(input, _repeated_repeatedImportMessage_codec);
-            break;
-          }
-          case 410:
-          case 408: {
-            repeatedNestedEnum_.AddEntriesFrom(input, _repeated_repeatedNestedEnum_codec);
-            break;
-          }
-          case 418:
-          case 416: {
-            repeatedForeignEnum_.AddEntriesFrom(input, _repeated_repeatedForeignEnum_codec);
-            break;
-          }
-          case 426:
-          case 424: {
-            repeatedImportEnum_.AddEntriesFrom(input, _repeated_repeatedImportEnum_codec);
-            break;
-          }
-          case 434: {
-            repeatedPublicImportMessage_.AddEntriesFrom(input, _repeated_repeatedPublicImportMessage_codec);
-            break;
-          }
-          case 888: {
-            OneofUint32 = input.ReadUInt32();
-            break;
-          }
-          case 898: {
-            global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
-            if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) {
-              subBuilder.MergeFrom(OneofNestedMessage);
-            }
-            input.ReadMessage(subBuilder);
-            OneofNestedMessage = subBuilder;
-            break;
-          }
-          case 906: {
-            OneofString = input.ReadString();
-            break;
-          }
-          case 914: {
-            OneofBytes = input.ReadBytes();
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the TestAllTypes message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      public enum NestedEnum {
-        [pbr::OriginalName("NESTED_ENUM_UNSPECIFIED")] Unspecified = 0,
-        [pbr::OriginalName("FOO")] Foo = 1,
-        [pbr::OriginalName("BAR")] Bar = 2,
-        [pbr::OriginalName("BAZ")] Baz = 3,
-        /// <summary>
-        ///  Intentionally negative.
-        /// </summary>
-        [pbr::OriginalName("NEG")] Neg = -1,
-      }
-
-      public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
-        private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.TestProtos.TestAllTypes.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedMessage() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedMessage(NestedMessage other) : this() {
-          bb_ = other.bb_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedMessage Clone() {
-          return new NestedMessage(this);
-        }
-
-        /// <summary>Field number for the "bb" field.</summary>
-        public const int BbFieldNumber = 1;
-        private int bb_;
-        /// <summary>
-        ///  The field name "b" fails to compile in proto1 because it conflicts with
-        ///  a local variable named "b" in one of the generated methods.  Doh.
-        ///  This file needs to compile in proto1 to test backwards-compatibility.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int Bb {
-          get { return bb_; }
-          set {
-            bb_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as NestedMessage);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(NestedMessage other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if (Bb != other.Bb) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          if (Bb != 0) hash ^= Bb.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          if (Bb != 0) {
-            output.WriteRawTag(8);
-            output.WriteInt32(Bb);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          if (Bb != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb);
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(NestedMessage other) {
-          if (other == null) {
-            return;
-          }
-          if (other.Bb != 0) {
-            Bb = other.Bb;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 8: {
-                Bb = input.ReadInt32();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  This proto includes a recusively nested message.
-  /// </summary>
-  public sealed partial class NestedTestAllTypes : pb::IMessage<NestedTestAllTypes> {
-    private static readonly pb::MessageParser<NestedTestAllTypes> _parser = new pb::MessageParser<NestedTestAllTypes>(() => new NestedTestAllTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<NestedTestAllTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[1]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public NestedTestAllTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public NestedTestAllTypes(NestedTestAllTypes other) : this() {
-      Child = other.child_ != null ? other.Child.Clone() : null;
-      Payload = other.payload_ != null ? other.Payload.Clone() : null;
-      repeatedChild_ = other.repeatedChild_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public NestedTestAllTypes Clone() {
-      return new NestedTestAllTypes(this);
-    }
-
-    /// <summary>Field number for the "child" field.</summary>
-    public const int ChildFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.NestedTestAllTypes Child {
-      get { return child_; }
-      set {
-        child_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "payload" field.</summary>
-    public const int PayloadFieldNumber = 2;
-    private global::Google.Protobuf.TestProtos.TestAllTypes payload_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestAllTypes Payload {
-      get { return payload_; }
-      set {
-        payload_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "repeated_child" field.</summary>
-    public const int RepeatedChildFieldNumber = 3;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.NestedTestAllTypes> _repeated_repeatedChild_codec
-        = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.NestedTestAllTypes> repeatedChild_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.NestedTestAllTypes>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.NestedTestAllTypes> RepeatedChild {
-      get { return repeatedChild_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as NestedTestAllTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(NestedTestAllTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(Child, other.Child)) return false;
-      if (!object.Equals(Payload, other.Payload)) return false;
-      if(!repeatedChild_.Equals(other.repeatedChild_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (child_ != null) hash ^= Child.GetHashCode();
-      if (payload_ != null) hash ^= Payload.GetHashCode();
-      hash ^= repeatedChild_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (child_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(Child);
-      }
-      if (payload_ != null) {
-        output.WriteRawTag(18);
-        output.WriteMessage(Payload);
-      }
-      repeatedChild_.WriteTo(output, _repeated_repeatedChild_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (child_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Child);
-      }
-      if (payload_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Payload);
-      }
-      size += repeatedChild_.CalculateSize(_repeated_repeatedChild_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(NestedTestAllTypes other) {
-      if (other == null) {
-        return;
-      }
-      if (other.child_ != null) {
-        if (child_ == null) {
-          child_ = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
-        }
-        Child.MergeFrom(other.Child);
-      }
-      if (other.payload_ != null) {
-        if (payload_ == null) {
-          payload_ = new global::Google.Protobuf.TestProtos.TestAllTypes();
-        }
-        Payload.MergeFrom(other.Payload);
-      }
-      repeatedChild_.Add(other.repeatedChild_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (child_ == null) {
-              child_ = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
-            }
-            input.ReadMessage(child_);
-            break;
-          }
-          case 18: {
-            if (payload_ == null) {
-              payload_ = new global::Google.Protobuf.TestProtos.TestAllTypes();
-            }
-            input.ReadMessage(payload_);
-            break;
-          }
-          case 26: {
-            repeatedChild_.AddEntriesFrom(input, _repeated_repeatedChild_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestDeprecatedFields : pb::IMessage<TestDeprecatedFields> {
-    private static readonly pb::MessageParser<TestDeprecatedFields> _parser = new pb::MessageParser<TestDeprecatedFields>(() => new TestDeprecatedFields());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestDeprecatedFields> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[2]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestDeprecatedFields() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestDeprecatedFields(TestDeprecatedFields other) : this() {
-      deprecatedInt32_ = other.deprecatedInt32_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestDeprecatedFields Clone() {
-      return new TestDeprecatedFields(this);
-    }
-
-    /// <summary>Field number for the "deprecated_int32" field.</summary>
-    public const int DeprecatedInt32FieldNumber = 1;
-    private int deprecatedInt32_;
-    [global::System.ObsoleteAttribute]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int DeprecatedInt32 {
-      get { return deprecatedInt32_; }
-      set {
-        deprecatedInt32_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestDeprecatedFields);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestDeprecatedFields other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (DeprecatedInt32 != other.DeprecatedInt32) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (DeprecatedInt32 != 0) hash ^= DeprecatedInt32.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (DeprecatedInt32 != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(DeprecatedInt32);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (DeprecatedInt32 != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(DeprecatedInt32);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestDeprecatedFields other) {
-      if (other == null) {
-        return;
-      }
-      if (other.DeprecatedInt32 != 0) {
-        DeprecatedInt32 = other.DeprecatedInt32;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            DeprecatedInt32 = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Define these after TestAllTypes to make sure the compiler can handle
-  ///  that.
-  /// </summary>
-  public sealed partial class ForeignMessage : pb::IMessage<ForeignMessage> {
-    private static readonly pb::MessageParser<ForeignMessage> _parser = new pb::MessageParser<ForeignMessage>(() => new ForeignMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<ForeignMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[3]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ForeignMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ForeignMessage(ForeignMessage other) : this() {
-      c_ = other.c_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ForeignMessage Clone() {
-      return new ForeignMessage(this);
-    }
-
-    /// <summary>Field number for the "c" field.</summary>
-    public const int CFieldNumber = 1;
-    private int c_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int C {
-      get { return c_; }
-      set {
-        c_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as ForeignMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(ForeignMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (C != other.C) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (C != 0) hash ^= C.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (C != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(C);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (C != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(C);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(ForeignMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.C != 0) {
-        C = other.C;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            C = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestReservedFields : pb::IMessage<TestReservedFields> {
-    private static readonly pb::MessageParser<TestReservedFields> _parser = new pb::MessageParser<TestReservedFields>(() => new TestReservedFields());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestReservedFields> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[4]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestReservedFields() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestReservedFields(TestReservedFields other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestReservedFields Clone() {
-      return new TestReservedFields(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestReservedFields);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestReservedFields other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestReservedFields other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test that we can use NestedMessage from outside TestAllTypes.
-  /// </summary>
-  public sealed partial class TestForeignNested : pb::IMessage<TestForeignNested> {
-    private static readonly pb::MessageParser<TestForeignNested> _parser = new pb::MessageParser<TestForeignNested>(() => new TestForeignNested());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestForeignNested> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[5]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestForeignNested() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestForeignNested(TestForeignNested other) : this() {
-      ForeignNested = other.foreignNested_ != null ? other.ForeignNested.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestForeignNested Clone() {
-      return new TestForeignNested(this);
-    }
-
-    /// <summary>Field number for the "foreign_nested" field.</summary>
-    public const int ForeignNestedFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested {
-      get { return foreignNested_; }
-      set {
-        foreignNested_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestForeignNested);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestForeignNested other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(ForeignNested, other.ForeignNested)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (foreignNested_ != null) hash ^= ForeignNested.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (foreignNested_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(ForeignNested);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (foreignNested_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(ForeignNested);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestForeignNested other) {
-      if (other == null) {
-        return;
-      }
-      if (other.foreignNested_ != null) {
-        if (foreignNested_ == null) {
-          foreignNested_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
-        }
-        ForeignNested.MergeFrom(other.ForeignNested);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (foreignNested_ == null) {
-              foreignNested_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
-            }
-            input.ReadMessage(foreignNested_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test that really large tag numbers don't break anything.
-  /// </summary>
-  public sealed partial class TestReallyLargeTagNumber : pb::IMessage<TestReallyLargeTagNumber> {
-    private static readonly pb::MessageParser<TestReallyLargeTagNumber> _parser = new pb::MessageParser<TestReallyLargeTagNumber>(() => new TestReallyLargeTagNumber());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestReallyLargeTagNumber> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[6]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestReallyLargeTagNumber() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestReallyLargeTagNumber(TestReallyLargeTagNumber other) : this() {
-      a_ = other.a_;
-      bb_ = other.bb_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestReallyLargeTagNumber Clone() {
-      return new TestReallyLargeTagNumber(this);
-    }
-
-    /// <summary>Field number for the "a" field.</summary>
-    public const int AFieldNumber = 1;
-    private int a_;
-    /// <summary>
-    ///  The largest possible tag number is 2^28 - 1, since the wire format uses
-    ///  three bits to communicate wire type.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int A {
-      get { return a_; }
-      set {
-        a_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "bb" field.</summary>
-    public const int BbFieldNumber = 268435455;
-    private int bb_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Bb {
-      get { return bb_; }
-      set {
-        bb_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestReallyLargeTagNumber);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestReallyLargeTagNumber other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (A != other.A) return false;
-      if (Bb != other.Bb) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (A != 0) hash ^= A.GetHashCode();
-      if (Bb != 0) hash ^= Bb.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (A != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(A);
-      }
-      if (Bb != 0) {
-        output.WriteRawTag(248, 255, 255, 255, 7);
-        output.WriteInt32(Bb);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (A != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(A);
-      }
-      if (Bb != 0) {
-        size += 5 + pb::CodedOutputStream.ComputeInt32Size(Bb);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestReallyLargeTagNumber other) {
-      if (other == null) {
-        return;
-      }
-      if (other.A != 0) {
-        A = other.A;
-      }
-      if (other.Bb != 0) {
-        Bb = other.Bb;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            A = input.ReadInt32();
-            break;
-          }
-          case 2147483640: {
-            Bb = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestRecursiveMessage : pb::IMessage<TestRecursiveMessage> {
-    private static readonly pb::MessageParser<TestRecursiveMessage> _parser = new pb::MessageParser<TestRecursiveMessage>(() => new TestRecursiveMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestRecursiveMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[7]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestRecursiveMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestRecursiveMessage(TestRecursiveMessage other) : this() {
-      A = other.a_ != null ? other.A.Clone() : null;
-      i_ = other.i_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestRecursiveMessage Clone() {
-      return new TestRecursiveMessage(this);
-    }
-
-    /// <summary>Field number for the "a" field.</summary>
-    public const int AFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestRecursiveMessage A {
-      get { return a_; }
-      set {
-        a_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "i" field.</summary>
-    public const int IFieldNumber = 2;
-    private int i_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int I {
-      get { return i_; }
-      set {
-        i_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestRecursiveMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestRecursiveMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(A, other.A)) return false;
-      if (I != other.I) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (a_ != null) hash ^= A.GetHashCode();
-      if (I != 0) hash ^= I.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (a_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(A);
-      }
-      if (I != 0) {
-        output.WriteRawTag(16);
-        output.WriteInt32(I);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (a_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(A);
-      }
-      if (I != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(I);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestRecursiveMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.a_ != null) {
-        if (a_ == null) {
-          a_ = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
-        }
-        A.MergeFrom(other.A);
-      }
-      if (other.I != 0) {
-        I = other.I;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (a_ == null) {
-              a_ = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
-            }
-            input.ReadMessage(a_);
-            break;
-          }
-          case 16: {
-            I = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test that mutual recursion works.
-  /// </summary>
-  public sealed partial class TestMutualRecursionA : pb::IMessage<TestMutualRecursionA> {
-    private static readonly pb::MessageParser<TestMutualRecursionA> _parser = new pb::MessageParser<TestMutualRecursionA>(() => new TestMutualRecursionA());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestMutualRecursionA> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[8]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMutualRecursionA() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMutualRecursionA(TestMutualRecursionA other) : this() {
-      Bb = other.bb_ != null ? other.Bb.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMutualRecursionA Clone() {
-      return new TestMutualRecursionA(this);
-    }
-
-    /// <summary>Field number for the "bb" field.</summary>
-    public const int BbFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestMutualRecursionB Bb {
-      get { return bb_; }
-      set {
-        bb_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestMutualRecursionA);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestMutualRecursionA other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(Bb, other.Bb)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (bb_ != null) hash ^= Bb.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (bb_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(Bb);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (bb_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bb);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestMutualRecursionA other) {
-      if (other == null) {
-        return;
-      }
-      if (other.bb_ != null) {
-        if (bb_ == null) {
-          bb_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
-        }
-        Bb.MergeFrom(other.Bb);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (bb_ == null) {
-              bb_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
-            }
-            input.ReadMessage(bb_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestMutualRecursionB : pb::IMessage<TestMutualRecursionB> {
-    private static readonly pb::MessageParser<TestMutualRecursionB> _parser = new pb::MessageParser<TestMutualRecursionB>(() => new TestMutualRecursionB());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestMutualRecursionB> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[9]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMutualRecursionB() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMutualRecursionB(TestMutualRecursionB other) : this() {
-      A = other.a_ != null ? other.A.Clone() : null;
-      optionalInt32_ = other.optionalInt32_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestMutualRecursionB Clone() {
-      return new TestMutualRecursionB(this);
-    }
-
-    /// <summary>Field number for the "a" field.</summary>
-    public const int AFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestMutualRecursionA A {
-      get { return a_; }
-      set {
-        a_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "optional_int32" field.</summary>
-    public const int OptionalInt32FieldNumber = 2;
-    private int optionalInt32_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int OptionalInt32 {
-      get { return optionalInt32_; }
-      set {
-        optionalInt32_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestMutualRecursionB);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestMutualRecursionB other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(A, other.A)) return false;
-      if (OptionalInt32 != other.OptionalInt32) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (a_ != null) hash ^= A.GetHashCode();
-      if (OptionalInt32 != 0) hash ^= OptionalInt32.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (a_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(A);
-      }
-      if (OptionalInt32 != 0) {
-        output.WriteRawTag(16);
-        output.WriteInt32(OptionalInt32);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (a_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(A);
-      }
-      if (OptionalInt32 != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestMutualRecursionB other) {
-      if (other == null) {
-        return;
-      }
-      if (other.a_ != null) {
-        if (a_ == null) {
-          a_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
-        }
-        A.MergeFrom(other.A);
-      }
-      if (other.OptionalInt32 != 0) {
-        OptionalInt32 = other.OptionalInt32;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (a_ == null) {
-              a_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
-            }
-            input.ReadMessage(a_);
-            break;
-          }
-          case 16: {
-            OptionalInt32 = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test message with CamelCase field names.  This violates Protocol Buffer
-  ///  standard style.
-  /// </summary>
-  public sealed partial class TestCamelCaseFieldNames : pb::IMessage<TestCamelCaseFieldNames> {
-    private static readonly pb::MessageParser<TestCamelCaseFieldNames> _parser = new pb::MessageParser<TestCamelCaseFieldNames>(() => new TestCamelCaseFieldNames());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestCamelCaseFieldNames> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[10]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestCamelCaseFieldNames() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestCamelCaseFieldNames(TestCamelCaseFieldNames other) : this() {
-      primitiveField_ = other.primitiveField_;
-      stringField_ = other.stringField_;
-      enumField_ = other.enumField_;
-      MessageField = other.messageField_ != null ? other.MessageField.Clone() : null;
-      repeatedPrimitiveField_ = other.repeatedPrimitiveField_.Clone();
-      repeatedStringField_ = other.repeatedStringField_.Clone();
-      repeatedEnumField_ = other.repeatedEnumField_.Clone();
-      repeatedMessageField_ = other.repeatedMessageField_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestCamelCaseFieldNames Clone() {
-      return new TestCamelCaseFieldNames(this);
-    }
-
-    /// <summary>Field number for the "PrimitiveField" field.</summary>
-    public const int PrimitiveFieldFieldNumber = 1;
-    private int primitiveField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int PrimitiveField {
-      get { return primitiveField_; }
-      set {
-        primitiveField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "StringField" field.</summary>
-    public const int StringFieldFieldNumber = 2;
-    private string stringField_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string StringField {
-      get { return stringField_; }
-      set {
-        stringField_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "EnumField" field.</summary>
-    public const int EnumFieldFieldNumber = 3;
-    private global::Google.Protobuf.TestProtos.ForeignEnum enumField_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.ForeignEnum EnumField {
-      get { return enumField_; }
-      set {
-        enumField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "MessageField" field.</summary>
-    public const int MessageFieldFieldNumber = 4;
-    private global::Google.Protobuf.TestProtos.ForeignMessage messageField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.ForeignMessage MessageField {
-      get { return messageField_; }
-      set {
-        messageField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "RepeatedPrimitiveField" field.</summary>
-    public const int RepeatedPrimitiveFieldFieldNumber = 7;
-    private static readonly pb::FieldCodec<int> _repeated_repeatedPrimitiveField_codec
-        = pb::FieldCodec.ForInt32(58);
-    private readonly pbc::RepeatedField<int> repeatedPrimitiveField_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> RepeatedPrimitiveField {
-      get { return repeatedPrimitiveField_; }
-    }
-
-    /// <summary>Field number for the "RepeatedStringField" field.</summary>
-    public const int RepeatedStringFieldFieldNumber = 8;
-    private static readonly pb::FieldCodec<string> _repeated_repeatedStringField_codec
-        = pb::FieldCodec.ForString(66);
-    private readonly pbc::RepeatedField<string> repeatedStringField_ = new pbc::RepeatedField<string>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<string> RepeatedStringField {
-      get { return repeatedStringField_; }
-    }
-
-    /// <summary>Field number for the "RepeatedEnumField" field.</summary>
-    public const int RepeatedEnumFieldFieldNumber = 9;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_repeatedEnumField_codec
-        = pb::FieldCodec.ForEnum(74, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> repeatedEnumField_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> RepeatedEnumField {
-      get { return repeatedEnumField_; }
-    }
-
-    /// <summary>Field number for the "RepeatedMessageField" field.</summary>
-    public const int RepeatedMessageFieldFieldNumber = 10;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignMessage> _repeated_repeatedMessageField_codec
-        = pb::FieldCodec.ForMessage(82, global::Google.Protobuf.TestProtos.ForeignMessage.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignMessage> repeatedMessageField_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignMessage>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignMessage> RepeatedMessageField {
-      get { return repeatedMessageField_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestCamelCaseFieldNames);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestCamelCaseFieldNames other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (PrimitiveField != other.PrimitiveField) return false;
-      if (StringField != other.StringField) return false;
-      if (EnumField != other.EnumField) return false;
-      if (!object.Equals(MessageField, other.MessageField)) return false;
-      if(!repeatedPrimitiveField_.Equals(other.repeatedPrimitiveField_)) return false;
-      if(!repeatedStringField_.Equals(other.repeatedStringField_)) return false;
-      if(!repeatedEnumField_.Equals(other.repeatedEnumField_)) return false;
-      if(!repeatedMessageField_.Equals(other.repeatedMessageField_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (PrimitiveField != 0) hash ^= PrimitiveField.GetHashCode();
-      if (StringField.Length != 0) hash ^= StringField.GetHashCode();
-      if (EnumField != 0) hash ^= EnumField.GetHashCode();
-      if (messageField_ != null) hash ^= MessageField.GetHashCode();
-      hash ^= repeatedPrimitiveField_.GetHashCode();
-      hash ^= repeatedStringField_.GetHashCode();
-      hash ^= repeatedEnumField_.GetHashCode();
-      hash ^= repeatedMessageField_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (PrimitiveField != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(PrimitiveField);
-      }
-      if (StringField.Length != 0) {
-        output.WriteRawTag(18);
-        output.WriteString(StringField);
-      }
-      if (EnumField != 0) {
-        output.WriteRawTag(24);
-        output.WriteEnum((int) EnumField);
-      }
-      if (messageField_ != null) {
-        output.WriteRawTag(34);
-        output.WriteMessage(MessageField);
-      }
-      repeatedPrimitiveField_.WriteTo(output, _repeated_repeatedPrimitiveField_codec);
-      repeatedStringField_.WriteTo(output, _repeated_repeatedStringField_codec);
-      repeatedEnumField_.WriteTo(output, _repeated_repeatedEnumField_codec);
-      repeatedMessageField_.WriteTo(output, _repeated_repeatedMessageField_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (PrimitiveField != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(PrimitiveField);
-      }
-      if (StringField.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(StringField);
-      }
-      if (EnumField != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnumField);
-      }
-      if (messageField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(MessageField);
-      }
-      size += repeatedPrimitiveField_.CalculateSize(_repeated_repeatedPrimitiveField_codec);
-      size += repeatedStringField_.CalculateSize(_repeated_repeatedStringField_codec);
-      size += repeatedEnumField_.CalculateSize(_repeated_repeatedEnumField_codec);
-      size += repeatedMessageField_.CalculateSize(_repeated_repeatedMessageField_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestCamelCaseFieldNames other) {
-      if (other == null) {
-        return;
-      }
-      if (other.PrimitiveField != 0) {
-        PrimitiveField = other.PrimitiveField;
-      }
-      if (other.StringField.Length != 0) {
-        StringField = other.StringField;
-      }
-      if (other.EnumField != 0) {
-        EnumField = other.EnumField;
-      }
-      if (other.messageField_ != null) {
-        if (messageField_ == null) {
-          messageField_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
-        }
-        MessageField.MergeFrom(other.MessageField);
-      }
-      repeatedPrimitiveField_.Add(other.repeatedPrimitiveField_);
-      repeatedStringField_.Add(other.repeatedStringField_);
-      repeatedEnumField_.Add(other.repeatedEnumField_);
-      repeatedMessageField_.Add(other.repeatedMessageField_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            PrimitiveField = input.ReadInt32();
-            break;
-          }
-          case 18: {
-            StringField = input.ReadString();
-            break;
-          }
-          case 24: {
-            enumField_ = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
-            break;
-          }
-          case 34: {
-            if (messageField_ == null) {
-              messageField_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
-            }
-            input.ReadMessage(messageField_);
-            break;
-          }
-          case 58:
-          case 56: {
-            repeatedPrimitiveField_.AddEntriesFrom(input, _repeated_repeatedPrimitiveField_codec);
-            break;
-          }
-          case 66: {
-            repeatedStringField_.AddEntriesFrom(input, _repeated_repeatedStringField_codec);
-            break;
-          }
-          case 74:
-          case 72: {
-            repeatedEnumField_.AddEntriesFrom(input, _repeated_repeatedEnumField_codec);
-            break;
-          }
-          case 82: {
-            repeatedMessageField_.AddEntriesFrom(input, _repeated_repeatedMessageField_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  We list fields out of order, to ensure that we're using field number and not
-  ///  field index to determine serialization order.
-  /// </summary>
-  public sealed partial class TestFieldOrderings : pb::IMessage<TestFieldOrderings> {
-    private static readonly pb::MessageParser<TestFieldOrderings> _parser = new pb::MessageParser<TestFieldOrderings>(() => new TestFieldOrderings());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestFieldOrderings> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[11]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestFieldOrderings() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestFieldOrderings(TestFieldOrderings other) : this() {
-      myString_ = other.myString_;
-      myInt_ = other.myInt_;
-      myFloat_ = other.myFloat_;
-      SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestFieldOrderings Clone() {
-      return new TestFieldOrderings(this);
-    }
-
-    /// <summary>Field number for the "my_string" field.</summary>
-    public const int MyStringFieldNumber = 11;
-    private string myString_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string MyString {
-      get { return myString_; }
-      set {
-        myString_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "my_int" field.</summary>
-    public const int MyIntFieldNumber = 1;
-    private long myInt_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long MyInt {
-      get { return myInt_; }
-      set {
-        myInt_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "my_float" field.</summary>
-    public const int MyFloatFieldNumber = 101;
-    private float myFloat_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public float MyFloat {
-      get { return myFloat_; }
-      set {
-        myFloat_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "single_nested_message" field.</summary>
-    public const int SingleNestedMessageFieldNumber = 200;
-    private global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage singleNestedMessage_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage SingleNestedMessage {
-      get { return singleNestedMessage_; }
-      set {
-        singleNestedMessage_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestFieldOrderings);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestFieldOrderings other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (MyString != other.MyString) return false;
-      if (MyInt != other.MyInt) return false;
-      if (MyFloat != other.MyFloat) return false;
-      if (!object.Equals(SingleNestedMessage, other.SingleNestedMessage)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (MyString.Length != 0) hash ^= MyString.GetHashCode();
-      if (MyInt != 0L) hash ^= MyInt.GetHashCode();
-      if (MyFloat != 0F) hash ^= MyFloat.GetHashCode();
-      if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (MyInt != 0L) {
-        output.WriteRawTag(8);
-        output.WriteInt64(MyInt);
-      }
-      if (MyString.Length != 0) {
-        output.WriteRawTag(90);
-        output.WriteString(MyString);
-      }
-      if (MyFloat != 0F) {
-        output.WriteRawTag(173, 6);
-        output.WriteFloat(MyFloat);
-      }
-      if (singleNestedMessage_ != null) {
-        output.WriteRawTag(194, 12);
-        output.WriteMessage(SingleNestedMessage);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (MyString.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(MyString);
-      }
-      if (MyInt != 0L) {
-        size += 1 + pb::CodedOutputStream.ComputeInt64Size(MyInt);
-      }
-      if (MyFloat != 0F) {
-        size += 2 + 4;
-      }
-      if (singleNestedMessage_ != null) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleNestedMessage);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestFieldOrderings other) {
-      if (other == null) {
-        return;
-      }
-      if (other.MyString.Length != 0) {
-        MyString = other.MyString;
-      }
-      if (other.MyInt != 0L) {
-        MyInt = other.MyInt;
-      }
-      if (other.MyFloat != 0F) {
-        MyFloat = other.MyFloat;
-      }
-      if (other.singleNestedMessage_ != null) {
-        if (singleNestedMessage_ == null) {
-          singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
-        }
-        SingleNestedMessage.MergeFrom(other.SingleNestedMessage);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            MyInt = input.ReadInt64();
-            break;
-          }
-          case 90: {
-            MyString = input.ReadString();
-            break;
-          }
-          case 813: {
-            MyFloat = input.ReadFloat();
-            break;
-          }
-          case 1602: {
-            if (singleNestedMessage_ == null) {
-              singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
-            }
-            input.ReadMessage(singleNestedMessage_);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the TestFieldOrderings message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      public sealed partial class NestedMessage : pb::IMessage<NestedMessage> {
-        private static readonly pb::MessageParser<NestedMessage> _parser = new pb::MessageParser<NestedMessage>(() => new NestedMessage());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<NestedMessage> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.TestProtos.TestFieldOrderings.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedMessage() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedMessage(NestedMessage other) : this() {
-          oo_ = other.oo_;
-          bb_ = other.bb_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NestedMessage Clone() {
-          return new NestedMessage(this);
-        }
-
-        /// <summary>Field number for the "oo" field.</summary>
-        public const int OoFieldNumber = 2;
-        private long oo_;
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public long Oo {
-          get { return oo_; }
-          set {
-            oo_ = value;
-          }
-        }
-
-        /// <summary>Field number for the "bb" field.</summary>
-        public const int BbFieldNumber = 1;
-        private int bb_;
-        /// <summary>
-        ///  The field name "b" fails to compile in proto1 because it conflicts with
-        ///  a local variable named "b" in one of the generated methods.  Doh.
-        ///  This file needs to compile in proto1 to test backwards-compatibility.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int Bb {
-          get { return bb_; }
-          set {
-            bb_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as NestedMessage);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(NestedMessage other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if (Oo != other.Oo) return false;
-          if (Bb != other.Bb) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          if (Oo != 0L) hash ^= Oo.GetHashCode();
-          if (Bb != 0) hash ^= Bb.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          if (Bb != 0) {
-            output.WriteRawTag(8);
-            output.WriteInt32(Bb);
-          }
-          if (Oo != 0L) {
-            output.WriteRawTag(16);
-            output.WriteInt64(Oo);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          if (Oo != 0L) {
-            size += 1 + pb::CodedOutputStream.ComputeInt64Size(Oo);
-          }
-          if (Bb != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(Bb);
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(NestedMessage other) {
-          if (other == null) {
-            return;
-          }
-          if (other.Oo != 0L) {
-            Oo = other.Oo;
-          }
-          if (other.Bb != 0) {
-            Bb = other.Bb;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 8: {
-                Bb = input.ReadInt32();
-                break;
-              }
-              case 16: {
-                Oo = input.ReadInt64();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  public sealed partial class SparseEnumMessage : pb::IMessage<SparseEnumMessage> {
-    private static readonly pb::MessageParser<SparseEnumMessage> _parser = new pb::MessageParser<SparseEnumMessage>(() => new SparseEnumMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<SparseEnumMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[12]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public SparseEnumMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public SparseEnumMessage(SparseEnumMessage other) : this() {
-      sparseEnum_ = other.sparseEnum_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public SparseEnumMessage Clone() {
-      return new SparseEnumMessage(this);
-    }
-
-    /// <summary>Field number for the "sparse_enum" field.</summary>
-    public const int SparseEnumFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum {
-      get { return sparseEnum_; }
-      set {
-        sparseEnum_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as SparseEnumMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(SparseEnumMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (SparseEnum != other.SparseEnum) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (SparseEnum != 0) hash ^= SparseEnum.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (SparseEnum != 0) {
-        output.WriteRawTag(8);
-        output.WriteEnum((int) SparseEnum);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (SparseEnum != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) SparseEnum);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(SparseEnumMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.SparseEnum != 0) {
-        SparseEnum = other.SparseEnum;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            sparseEnum_ = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test String and Bytes: string is for valid UTF-8 strings
-  /// </summary>
-  public sealed partial class OneString : pb::IMessage<OneString> {
-    private static readonly pb::MessageParser<OneString> _parser = new pb::MessageParser<OneString>(() => new OneString());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<OneString> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[13]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneString() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneString(OneString other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneString Clone() {
-      return new OneString(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private string data_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Data {
-      get { return data_; }
-      set {
-        data_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as OneString);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(OneString other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data.Length != 0) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(OneString other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data.Length != 0) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Data = input.ReadString();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class MoreString : pb::IMessage<MoreString> {
-    private static readonly pb::MessageParser<MoreString> _parser = new pb::MessageParser<MoreString>(() => new MoreString());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MoreString> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[14]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MoreString() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MoreString(MoreString other) : this() {
-      data_ = other.data_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MoreString Clone() {
-      return new MoreString(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private static readonly pb::FieldCodec<string> _repeated_data_codec
-        = pb::FieldCodec.ForString(10);
-    private readonly pbc::RepeatedField<string> data_ = new pbc::RepeatedField<string>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<string> Data {
-      get { return data_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MoreString);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MoreString other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!data_.Equals(other.data_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= data_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      data_.WriteTo(output, _repeated_data_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += data_.CalculateSize(_repeated_data_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MoreString other) {
-      if (other == null) {
-        return;
-      }
-      data_.Add(other.data_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            data_.AddEntriesFrom(input, _repeated_data_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class OneBytes : pb::IMessage<OneBytes> {
-    private static readonly pb::MessageParser<OneBytes> _parser = new pb::MessageParser<OneBytes>(() => new OneBytes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<OneBytes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[15]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneBytes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneBytes(OneBytes other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneBytes Clone() {
-      return new OneBytes(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private pb::ByteString data_ = pb::ByteString.Empty;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString Data {
-      get { return data_; }
-      set {
-        data_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as OneBytes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(OneBytes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data.Length != 0) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteBytes(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(OneBytes other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data.Length != 0) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Data = input.ReadBytes();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class MoreBytes : pb::IMessage<MoreBytes> {
-    private static readonly pb::MessageParser<MoreBytes> _parser = new pb::MessageParser<MoreBytes>(() => new MoreBytes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MoreBytes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[16]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MoreBytes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MoreBytes(MoreBytes other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MoreBytes Clone() {
-      return new MoreBytes(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private pb::ByteString data_ = pb::ByteString.Empty;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString Data {
-      get { return data_; }
-      set {
-        data_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MoreBytes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MoreBytes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data.Length != 0) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteBytes(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MoreBytes other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data.Length != 0) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Data = input.ReadBytes();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test int32, uint32, int64, uint64, and bool are all compatible
-  /// </summary>
-  public sealed partial class Int32Message : pb::IMessage<Int32Message> {
-    private static readonly pb::MessageParser<Int32Message> _parser = new pb::MessageParser<Int32Message>(() => new Int32Message());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<Int32Message> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[17]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Int32Message() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Int32Message(Int32Message other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Int32Message Clone() {
-      return new Int32Message(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private int data_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Data {
-      get { return data_; }
-      set {
-        data_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as Int32Message);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(Int32Message other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data != 0) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data != 0) {
-        output.WriteRawTag(8);
-        output.WriteInt32(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(Int32Message other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data != 0) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Data = input.ReadInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class Uint32Message : pb::IMessage<Uint32Message> {
-    private static readonly pb::MessageParser<Uint32Message> _parser = new pb::MessageParser<Uint32Message>(() => new Uint32Message());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<Uint32Message> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[18]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Uint32Message() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Uint32Message(Uint32Message other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Uint32Message Clone() {
-      return new Uint32Message(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private uint data_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public uint Data {
-      get { return data_; }
-      set {
-        data_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as Uint32Message);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(Uint32Message other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data != 0) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data != 0) {
-        output.WriteRawTag(8);
-        output.WriteUInt32(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(Uint32Message other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data != 0) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Data = input.ReadUInt32();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class Int64Message : pb::IMessage<Int64Message> {
-    private static readonly pb::MessageParser<Int64Message> _parser = new pb::MessageParser<Int64Message>(() => new Int64Message());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<Int64Message> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[19]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Int64Message() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Int64Message(Int64Message other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Int64Message Clone() {
-      return new Int64Message(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private long data_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long Data {
-      get { return data_; }
-      set {
-        data_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as Int64Message);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(Int64Message other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data != 0L) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data != 0L) {
-        output.WriteRawTag(8);
-        output.WriteInt64(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data != 0L) {
-        size += 1 + pb::CodedOutputStream.ComputeInt64Size(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(Int64Message other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data != 0L) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Data = input.ReadInt64();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class Uint64Message : pb::IMessage<Uint64Message> {
-    private static readonly pb::MessageParser<Uint64Message> _parser = new pb::MessageParser<Uint64Message>(() => new Uint64Message());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<Uint64Message> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[20]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Uint64Message() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Uint64Message(Uint64Message other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public Uint64Message Clone() {
-      return new Uint64Message(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private ulong data_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ulong Data {
-      get { return data_; }
-      set {
-        data_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as Uint64Message);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(Uint64Message other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data != 0UL) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data != 0UL) {
-        output.WriteRawTag(8);
-        output.WriteUInt64(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data != 0UL) {
-        size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Data);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(Uint64Message other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data != 0UL) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Data = input.ReadUInt64();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class BoolMessage : pb::IMessage<BoolMessage> {
-    private static readonly pb::MessageParser<BoolMessage> _parser = new pb::MessageParser<BoolMessage>(() => new BoolMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<BoolMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[21]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BoolMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BoolMessage(BoolMessage other) : this() {
-      data_ = other.data_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BoolMessage Clone() {
-      return new BoolMessage(this);
-    }
-
-    /// <summary>Field number for the "data" field.</summary>
-    public const int DataFieldNumber = 1;
-    private bool data_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Data {
-      get { return data_; }
-      set {
-        data_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as BoolMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(BoolMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Data != other.Data) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Data != false) hash ^= Data.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Data != false) {
-        output.WriteRawTag(8);
-        output.WriteBool(Data);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Data != false) {
-        size += 1 + 1;
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(BoolMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Data != false) {
-        Data = other.Data;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Data = input.ReadBool();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test oneofs.
-  /// </summary>
-  public sealed partial class TestOneof : pb::IMessage<TestOneof> {
-    private static readonly pb::MessageParser<TestOneof> _parser = new pb::MessageParser<TestOneof>(() => new TestOneof());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestOneof> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[22]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestOneof() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestOneof(TestOneof other) : this() {
-      switch (other.FooCase) {
-        case FooOneofCase.FooInt:
-          FooInt = other.FooInt;
-          break;
-        case FooOneofCase.FooString:
-          FooString = other.FooString;
-          break;
-        case FooOneofCase.FooMessage:
-          FooMessage = other.FooMessage.Clone();
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestOneof Clone() {
-      return new TestOneof(this);
-    }
-
-    /// <summary>Field number for the "foo_int" field.</summary>
-    public const int FooIntFieldNumber = 1;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int FooInt {
-      get { return fooCase_ == FooOneofCase.FooInt ? (int) foo_ : 0; }
-      set {
-        foo_ = value;
-        fooCase_ = FooOneofCase.FooInt;
-      }
-    }
-
-    /// <summary>Field number for the "foo_string" field.</summary>
-    public const int FooStringFieldNumber = 2;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string FooString {
-      get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; }
-      set {
-        foo_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-        fooCase_ = FooOneofCase.FooString;
-      }
-    }
-
-    /// <summary>Field number for the "foo_message" field.</summary>
-    public const int FooMessageFieldNumber = 3;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.TestProtos.TestAllTypes FooMessage {
-      get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes) foo_ : null; }
-      set {
-        foo_ = value;
-        fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooMessage;
-      }
-    }
-
-    private object foo_;
-    /// <summary>Enum of possible cases for the "foo" oneof.</summary>
-    public enum FooOneofCase {
-      None = 0,
-      FooInt = 1,
-      FooString = 2,
-      FooMessage = 3,
-    }
-    private FooOneofCase fooCase_ = FooOneofCase.None;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooOneofCase FooCase {
-      get { return fooCase_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void ClearFoo() {
-      fooCase_ = FooOneofCase.None;
-      foo_ = null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestOneof);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestOneof other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (FooInt != other.FooInt) return false;
-      if (FooString != other.FooString) return false;
-      if (!object.Equals(FooMessage, other.FooMessage)) return false;
-      if (FooCase != other.FooCase) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (fooCase_ == FooOneofCase.FooInt) hash ^= FooInt.GetHashCode();
-      if (fooCase_ == FooOneofCase.FooString) hash ^= FooString.GetHashCode();
-      if (fooCase_ == FooOneofCase.FooMessage) hash ^= FooMessage.GetHashCode();
-      hash ^= (int) fooCase_;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (fooCase_ == FooOneofCase.FooInt) {
-        output.WriteRawTag(8);
-        output.WriteInt32(FooInt);
-      }
-      if (fooCase_ == FooOneofCase.FooString) {
-        output.WriteRawTag(18);
-        output.WriteString(FooString);
-      }
-      if (fooCase_ == FooOneofCase.FooMessage) {
-        output.WriteRawTag(26);
-        output.WriteMessage(FooMessage);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (fooCase_ == FooOneofCase.FooInt) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(FooInt);
-      }
-      if (fooCase_ == FooOneofCase.FooString) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(FooString);
-      }
-      if (fooCase_ == FooOneofCase.FooMessage) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooMessage);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestOneof other) {
-      if (other == null) {
-        return;
-      }
-      switch (other.FooCase) {
-        case FooOneofCase.FooInt:
-          FooInt = other.FooInt;
-          break;
-        case FooOneofCase.FooString:
-          FooString = other.FooString;
-          break;
-        case FooOneofCase.FooMessage:
-          FooMessage = other.FooMessage;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            FooInt = input.ReadInt32();
-            break;
-          }
-          case 18: {
-            FooString = input.ReadString();
-            break;
-          }
-          case 26: {
-            global::Google.Protobuf.TestProtos.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.TestAllTypes();
-            if (fooCase_ == FooOneofCase.FooMessage) {
-              subBuilder.MergeFrom(FooMessage);
-            }
-            input.ReadMessage(subBuilder);
-            FooMessage = subBuilder;
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestPackedTypes : pb::IMessage<TestPackedTypes> {
-    private static readonly pb::MessageParser<TestPackedTypes> _parser = new pb::MessageParser<TestPackedTypes>(() => new TestPackedTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestPackedTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[23]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestPackedTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestPackedTypes(TestPackedTypes other) : this() {
-      packedInt32_ = other.packedInt32_.Clone();
-      packedInt64_ = other.packedInt64_.Clone();
-      packedUint32_ = other.packedUint32_.Clone();
-      packedUint64_ = other.packedUint64_.Clone();
-      packedSint32_ = other.packedSint32_.Clone();
-      packedSint64_ = other.packedSint64_.Clone();
-      packedFixed32_ = other.packedFixed32_.Clone();
-      packedFixed64_ = other.packedFixed64_.Clone();
-      packedSfixed32_ = other.packedSfixed32_.Clone();
-      packedSfixed64_ = other.packedSfixed64_.Clone();
-      packedFloat_ = other.packedFloat_.Clone();
-      packedDouble_ = other.packedDouble_.Clone();
-      packedBool_ = other.packedBool_.Clone();
-      packedEnum_ = other.packedEnum_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestPackedTypes Clone() {
-      return new TestPackedTypes(this);
-    }
-
-    /// <summary>Field number for the "packed_int32" field.</summary>
-    public const int PackedInt32FieldNumber = 90;
-    private static readonly pb::FieldCodec<int> _repeated_packedInt32_codec
-        = pb::FieldCodec.ForInt32(722);
-    private readonly pbc::RepeatedField<int> packedInt32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> PackedInt32 {
-      get { return packedInt32_; }
-    }
-
-    /// <summary>Field number for the "packed_int64" field.</summary>
-    public const int PackedInt64FieldNumber = 91;
-    private static readonly pb::FieldCodec<long> _repeated_packedInt64_codec
-        = pb::FieldCodec.ForInt64(730);
-    private readonly pbc::RepeatedField<long> packedInt64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> PackedInt64 {
-      get { return packedInt64_; }
-    }
-
-    /// <summary>Field number for the "packed_uint32" field.</summary>
-    public const int PackedUint32FieldNumber = 92;
-    private static readonly pb::FieldCodec<uint> _repeated_packedUint32_codec
-        = pb::FieldCodec.ForUInt32(738);
-    private readonly pbc::RepeatedField<uint> packedUint32_ = new pbc::RepeatedField<uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> PackedUint32 {
-      get { return packedUint32_; }
-    }
-
-    /// <summary>Field number for the "packed_uint64" field.</summary>
-    public const int PackedUint64FieldNumber = 93;
-    private static readonly pb::FieldCodec<ulong> _repeated_packedUint64_codec
-        = pb::FieldCodec.ForUInt64(746);
-    private readonly pbc::RepeatedField<ulong> packedUint64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> PackedUint64 {
-      get { return packedUint64_; }
-    }
-
-    /// <summary>Field number for the "packed_sint32" field.</summary>
-    public const int PackedSint32FieldNumber = 94;
-    private static readonly pb::FieldCodec<int> _repeated_packedSint32_codec
-        = pb::FieldCodec.ForSInt32(754);
-    private readonly pbc::RepeatedField<int> packedSint32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> PackedSint32 {
-      get { return packedSint32_; }
-    }
-
-    /// <summary>Field number for the "packed_sint64" field.</summary>
-    public const int PackedSint64FieldNumber = 95;
-    private static readonly pb::FieldCodec<long> _repeated_packedSint64_codec
-        = pb::FieldCodec.ForSInt64(762);
-    private readonly pbc::RepeatedField<long> packedSint64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> PackedSint64 {
-      get { return packedSint64_; }
-    }
-
-    /// <summary>Field number for the "packed_fixed32" field.</summary>
-    public const int PackedFixed32FieldNumber = 96;
-    private static readonly pb::FieldCodec<uint> _repeated_packedFixed32_codec
-        = pb::FieldCodec.ForFixed32(770);
-    private readonly pbc::RepeatedField<uint> packedFixed32_ = new pbc::RepeatedField<uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> PackedFixed32 {
-      get { return packedFixed32_; }
-    }
-
-    /// <summary>Field number for the "packed_fixed64" field.</summary>
-    public const int PackedFixed64FieldNumber = 97;
-    private static readonly pb::FieldCodec<ulong> _repeated_packedFixed64_codec
-        = pb::FieldCodec.ForFixed64(778);
-    private readonly pbc::RepeatedField<ulong> packedFixed64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> PackedFixed64 {
-      get { return packedFixed64_; }
-    }
-
-    /// <summary>Field number for the "packed_sfixed32" field.</summary>
-    public const int PackedSfixed32FieldNumber = 98;
-    private static readonly pb::FieldCodec<int> _repeated_packedSfixed32_codec
-        = pb::FieldCodec.ForSFixed32(786);
-    private readonly pbc::RepeatedField<int> packedSfixed32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> PackedSfixed32 {
-      get { return packedSfixed32_; }
-    }
-
-    /// <summary>Field number for the "packed_sfixed64" field.</summary>
-    public const int PackedSfixed64FieldNumber = 99;
-    private static readonly pb::FieldCodec<long> _repeated_packedSfixed64_codec
-        = pb::FieldCodec.ForSFixed64(794);
-    private readonly pbc::RepeatedField<long> packedSfixed64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> PackedSfixed64 {
-      get { return packedSfixed64_; }
-    }
-
-    /// <summary>Field number for the "packed_float" field.</summary>
-    public const int PackedFloatFieldNumber = 100;
-    private static readonly pb::FieldCodec<float> _repeated_packedFloat_codec
-        = pb::FieldCodec.ForFloat(802);
-    private readonly pbc::RepeatedField<float> packedFloat_ = new pbc::RepeatedField<float>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<float> PackedFloat {
-      get { return packedFloat_; }
-    }
-
-    /// <summary>Field number for the "packed_double" field.</summary>
-    public const int PackedDoubleFieldNumber = 101;
-    private static readonly pb::FieldCodec<double> _repeated_packedDouble_codec
-        = pb::FieldCodec.ForDouble(810);
-    private readonly pbc::RepeatedField<double> packedDouble_ = new pbc::RepeatedField<double>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<double> PackedDouble {
-      get { return packedDouble_; }
-    }
-
-    /// <summary>Field number for the "packed_bool" field.</summary>
-    public const int PackedBoolFieldNumber = 102;
-    private static readonly pb::FieldCodec<bool> _repeated_packedBool_codec
-        = pb::FieldCodec.ForBool(818);
-    private readonly pbc::RepeatedField<bool> packedBool_ = new pbc::RepeatedField<bool>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<bool> PackedBool {
-      get { return packedBool_; }
-    }
-
-    /// <summary>Field number for the "packed_enum" field.</summary>
-    public const int PackedEnumFieldNumber = 103;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_packedEnum_codec
-        = pb::FieldCodec.ForEnum(826, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> packedEnum_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> PackedEnum {
-      get { return packedEnum_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestPackedTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestPackedTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!packedInt32_.Equals(other.packedInt32_)) return false;
-      if(!packedInt64_.Equals(other.packedInt64_)) return false;
-      if(!packedUint32_.Equals(other.packedUint32_)) return false;
-      if(!packedUint64_.Equals(other.packedUint64_)) return false;
-      if(!packedSint32_.Equals(other.packedSint32_)) return false;
-      if(!packedSint64_.Equals(other.packedSint64_)) return false;
-      if(!packedFixed32_.Equals(other.packedFixed32_)) return false;
-      if(!packedFixed64_.Equals(other.packedFixed64_)) return false;
-      if(!packedSfixed32_.Equals(other.packedSfixed32_)) return false;
-      if(!packedSfixed64_.Equals(other.packedSfixed64_)) return false;
-      if(!packedFloat_.Equals(other.packedFloat_)) return false;
-      if(!packedDouble_.Equals(other.packedDouble_)) return false;
-      if(!packedBool_.Equals(other.packedBool_)) return false;
-      if(!packedEnum_.Equals(other.packedEnum_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= packedInt32_.GetHashCode();
-      hash ^= packedInt64_.GetHashCode();
-      hash ^= packedUint32_.GetHashCode();
-      hash ^= packedUint64_.GetHashCode();
-      hash ^= packedSint32_.GetHashCode();
-      hash ^= packedSint64_.GetHashCode();
-      hash ^= packedFixed32_.GetHashCode();
-      hash ^= packedFixed64_.GetHashCode();
-      hash ^= packedSfixed32_.GetHashCode();
-      hash ^= packedSfixed64_.GetHashCode();
-      hash ^= packedFloat_.GetHashCode();
-      hash ^= packedDouble_.GetHashCode();
-      hash ^= packedBool_.GetHashCode();
-      hash ^= packedEnum_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      packedInt32_.WriteTo(output, _repeated_packedInt32_codec);
-      packedInt64_.WriteTo(output, _repeated_packedInt64_codec);
-      packedUint32_.WriteTo(output, _repeated_packedUint32_codec);
-      packedUint64_.WriteTo(output, _repeated_packedUint64_codec);
-      packedSint32_.WriteTo(output, _repeated_packedSint32_codec);
-      packedSint64_.WriteTo(output, _repeated_packedSint64_codec);
-      packedFixed32_.WriteTo(output, _repeated_packedFixed32_codec);
-      packedFixed64_.WriteTo(output, _repeated_packedFixed64_codec);
-      packedSfixed32_.WriteTo(output, _repeated_packedSfixed32_codec);
-      packedSfixed64_.WriteTo(output, _repeated_packedSfixed64_codec);
-      packedFloat_.WriteTo(output, _repeated_packedFloat_codec);
-      packedDouble_.WriteTo(output, _repeated_packedDouble_codec);
-      packedBool_.WriteTo(output, _repeated_packedBool_codec);
-      packedEnum_.WriteTo(output, _repeated_packedEnum_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += packedInt32_.CalculateSize(_repeated_packedInt32_codec);
-      size += packedInt64_.CalculateSize(_repeated_packedInt64_codec);
-      size += packedUint32_.CalculateSize(_repeated_packedUint32_codec);
-      size += packedUint64_.CalculateSize(_repeated_packedUint64_codec);
-      size += packedSint32_.CalculateSize(_repeated_packedSint32_codec);
-      size += packedSint64_.CalculateSize(_repeated_packedSint64_codec);
-      size += packedFixed32_.CalculateSize(_repeated_packedFixed32_codec);
-      size += packedFixed64_.CalculateSize(_repeated_packedFixed64_codec);
-      size += packedSfixed32_.CalculateSize(_repeated_packedSfixed32_codec);
-      size += packedSfixed64_.CalculateSize(_repeated_packedSfixed64_codec);
-      size += packedFloat_.CalculateSize(_repeated_packedFloat_codec);
-      size += packedDouble_.CalculateSize(_repeated_packedDouble_codec);
-      size += packedBool_.CalculateSize(_repeated_packedBool_codec);
-      size += packedEnum_.CalculateSize(_repeated_packedEnum_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestPackedTypes other) {
-      if (other == null) {
-        return;
-      }
-      packedInt32_.Add(other.packedInt32_);
-      packedInt64_.Add(other.packedInt64_);
-      packedUint32_.Add(other.packedUint32_);
-      packedUint64_.Add(other.packedUint64_);
-      packedSint32_.Add(other.packedSint32_);
-      packedSint64_.Add(other.packedSint64_);
-      packedFixed32_.Add(other.packedFixed32_);
-      packedFixed64_.Add(other.packedFixed64_);
-      packedSfixed32_.Add(other.packedSfixed32_);
-      packedSfixed64_.Add(other.packedSfixed64_);
-      packedFloat_.Add(other.packedFloat_);
-      packedDouble_.Add(other.packedDouble_);
-      packedBool_.Add(other.packedBool_);
-      packedEnum_.Add(other.packedEnum_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 722:
-          case 720: {
-            packedInt32_.AddEntriesFrom(input, _repeated_packedInt32_codec);
-            break;
-          }
-          case 730:
-          case 728: {
-            packedInt64_.AddEntriesFrom(input, _repeated_packedInt64_codec);
-            break;
-          }
-          case 738:
-          case 736: {
-            packedUint32_.AddEntriesFrom(input, _repeated_packedUint32_codec);
-            break;
-          }
-          case 746:
-          case 744: {
-            packedUint64_.AddEntriesFrom(input, _repeated_packedUint64_codec);
-            break;
-          }
-          case 754:
-          case 752: {
-            packedSint32_.AddEntriesFrom(input, _repeated_packedSint32_codec);
-            break;
-          }
-          case 762:
-          case 760: {
-            packedSint64_.AddEntriesFrom(input, _repeated_packedSint64_codec);
-            break;
-          }
-          case 770:
-          case 773: {
-            packedFixed32_.AddEntriesFrom(input, _repeated_packedFixed32_codec);
-            break;
-          }
-          case 778:
-          case 777: {
-            packedFixed64_.AddEntriesFrom(input, _repeated_packedFixed64_codec);
-            break;
-          }
-          case 786:
-          case 789: {
-            packedSfixed32_.AddEntriesFrom(input, _repeated_packedSfixed32_codec);
-            break;
-          }
-          case 794:
-          case 793: {
-            packedSfixed64_.AddEntriesFrom(input, _repeated_packedSfixed64_codec);
-            break;
-          }
-          case 802:
-          case 805: {
-            packedFloat_.AddEntriesFrom(input, _repeated_packedFloat_codec);
-            break;
-          }
-          case 810:
-          case 809: {
-            packedDouble_.AddEntriesFrom(input, _repeated_packedDouble_codec);
-            break;
-          }
-          case 818:
-          case 816: {
-            packedBool_.AddEntriesFrom(input, _repeated_packedBool_codec);
-            break;
-          }
-          case 826:
-          case 824: {
-            packedEnum_.AddEntriesFrom(input, _repeated_packedEnum_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  A message with the same fields as TestPackedTypes, but without packing. Used
-  ///  to test packed &lt;-> unpacked wire compatibility.
-  /// </summary>
-  public sealed partial class TestUnpackedTypes : pb::IMessage<TestUnpackedTypes> {
-    private static readonly pb::MessageParser<TestUnpackedTypes> _parser = new pb::MessageParser<TestUnpackedTypes>(() => new TestUnpackedTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestUnpackedTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[24]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestUnpackedTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestUnpackedTypes(TestUnpackedTypes other) : this() {
-      unpackedInt32_ = other.unpackedInt32_.Clone();
-      unpackedInt64_ = other.unpackedInt64_.Clone();
-      unpackedUint32_ = other.unpackedUint32_.Clone();
-      unpackedUint64_ = other.unpackedUint64_.Clone();
-      unpackedSint32_ = other.unpackedSint32_.Clone();
-      unpackedSint64_ = other.unpackedSint64_.Clone();
-      unpackedFixed32_ = other.unpackedFixed32_.Clone();
-      unpackedFixed64_ = other.unpackedFixed64_.Clone();
-      unpackedSfixed32_ = other.unpackedSfixed32_.Clone();
-      unpackedSfixed64_ = other.unpackedSfixed64_.Clone();
-      unpackedFloat_ = other.unpackedFloat_.Clone();
-      unpackedDouble_ = other.unpackedDouble_.Clone();
-      unpackedBool_ = other.unpackedBool_.Clone();
-      unpackedEnum_ = other.unpackedEnum_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestUnpackedTypes Clone() {
-      return new TestUnpackedTypes(this);
-    }
-
-    /// <summary>Field number for the "unpacked_int32" field.</summary>
-    public const int UnpackedInt32FieldNumber = 90;
-    private static readonly pb::FieldCodec<int> _repeated_unpackedInt32_codec
-        = pb::FieldCodec.ForInt32(720);
-    private readonly pbc::RepeatedField<int> unpackedInt32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> UnpackedInt32 {
-      get { return unpackedInt32_; }
-    }
-
-    /// <summary>Field number for the "unpacked_int64" field.</summary>
-    public const int UnpackedInt64FieldNumber = 91;
-    private static readonly pb::FieldCodec<long> _repeated_unpackedInt64_codec
-        = pb::FieldCodec.ForInt64(728);
-    private readonly pbc::RepeatedField<long> unpackedInt64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> UnpackedInt64 {
-      get { return unpackedInt64_; }
-    }
-
-    /// <summary>Field number for the "unpacked_uint32" field.</summary>
-    public const int UnpackedUint32FieldNumber = 92;
-    private static readonly pb::FieldCodec<uint> _repeated_unpackedUint32_codec
-        = pb::FieldCodec.ForUInt32(736);
-    private readonly pbc::RepeatedField<uint> unpackedUint32_ = new pbc::RepeatedField<uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> UnpackedUint32 {
-      get { return unpackedUint32_; }
-    }
-
-    /// <summary>Field number for the "unpacked_uint64" field.</summary>
-    public const int UnpackedUint64FieldNumber = 93;
-    private static readonly pb::FieldCodec<ulong> _repeated_unpackedUint64_codec
-        = pb::FieldCodec.ForUInt64(744);
-    private readonly pbc::RepeatedField<ulong> unpackedUint64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> UnpackedUint64 {
-      get { return unpackedUint64_; }
-    }
-
-    /// <summary>Field number for the "unpacked_sint32" field.</summary>
-    public const int UnpackedSint32FieldNumber = 94;
-    private static readonly pb::FieldCodec<int> _repeated_unpackedSint32_codec
-        = pb::FieldCodec.ForSInt32(752);
-    private readonly pbc::RepeatedField<int> unpackedSint32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> UnpackedSint32 {
-      get { return unpackedSint32_; }
-    }
-
-    /// <summary>Field number for the "unpacked_sint64" field.</summary>
-    public const int UnpackedSint64FieldNumber = 95;
-    private static readonly pb::FieldCodec<long> _repeated_unpackedSint64_codec
-        = pb::FieldCodec.ForSInt64(760);
-    private readonly pbc::RepeatedField<long> unpackedSint64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> UnpackedSint64 {
-      get { return unpackedSint64_; }
-    }
-
-    /// <summary>Field number for the "unpacked_fixed32" field.</summary>
-    public const int UnpackedFixed32FieldNumber = 96;
-    private static readonly pb::FieldCodec<uint> _repeated_unpackedFixed32_codec
-        = pb::FieldCodec.ForFixed32(773);
-    private readonly pbc::RepeatedField<uint> unpackedFixed32_ = new pbc::RepeatedField<uint>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> UnpackedFixed32 {
-      get { return unpackedFixed32_; }
-    }
-
-    /// <summary>Field number for the "unpacked_fixed64" field.</summary>
-    public const int UnpackedFixed64FieldNumber = 97;
-    private static readonly pb::FieldCodec<ulong> _repeated_unpackedFixed64_codec
-        = pb::FieldCodec.ForFixed64(777);
-    private readonly pbc::RepeatedField<ulong> unpackedFixed64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> UnpackedFixed64 {
-      get { return unpackedFixed64_; }
-    }
-
-    /// <summary>Field number for the "unpacked_sfixed32" field.</summary>
-    public const int UnpackedSfixed32FieldNumber = 98;
-    private static readonly pb::FieldCodec<int> _repeated_unpackedSfixed32_codec
-        = pb::FieldCodec.ForSFixed32(789);
-    private readonly pbc::RepeatedField<int> unpackedSfixed32_ = new pbc::RepeatedField<int>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> UnpackedSfixed32 {
-      get { return unpackedSfixed32_; }
-    }
-
-    /// <summary>Field number for the "unpacked_sfixed64" field.</summary>
-    public const int UnpackedSfixed64FieldNumber = 99;
-    private static readonly pb::FieldCodec<long> _repeated_unpackedSfixed64_codec
-        = pb::FieldCodec.ForSFixed64(793);
-    private readonly pbc::RepeatedField<long> unpackedSfixed64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> UnpackedSfixed64 {
-      get { return unpackedSfixed64_; }
-    }
-
-    /// <summary>Field number for the "unpacked_float" field.</summary>
-    public const int UnpackedFloatFieldNumber = 100;
-    private static readonly pb::FieldCodec<float> _repeated_unpackedFloat_codec
-        = pb::FieldCodec.ForFloat(805);
-    private readonly pbc::RepeatedField<float> unpackedFloat_ = new pbc::RepeatedField<float>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<float> UnpackedFloat {
-      get { return unpackedFloat_; }
-    }
-
-    /// <summary>Field number for the "unpacked_double" field.</summary>
-    public const int UnpackedDoubleFieldNumber = 101;
-    private static readonly pb::FieldCodec<double> _repeated_unpackedDouble_codec
-        = pb::FieldCodec.ForDouble(809);
-    private readonly pbc::RepeatedField<double> unpackedDouble_ = new pbc::RepeatedField<double>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<double> UnpackedDouble {
-      get { return unpackedDouble_; }
-    }
-
-    /// <summary>Field number for the "unpacked_bool" field.</summary>
-    public const int UnpackedBoolFieldNumber = 102;
-    private static readonly pb::FieldCodec<bool> _repeated_unpackedBool_codec
-        = pb::FieldCodec.ForBool(816);
-    private readonly pbc::RepeatedField<bool> unpackedBool_ = new pbc::RepeatedField<bool>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<bool> UnpackedBool {
-      get { return unpackedBool_; }
-    }
-
-    /// <summary>Field number for the "unpacked_enum" field.</summary>
-    public const int UnpackedEnumFieldNumber = 103;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.TestProtos.ForeignEnum> _repeated_unpackedEnum_codec
-        = pb::FieldCodec.ForEnum(824, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> unpackedEnum_ = new pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.TestProtos.ForeignEnum> UnpackedEnum {
-      get { return unpackedEnum_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestUnpackedTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestUnpackedTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!unpackedInt32_.Equals(other.unpackedInt32_)) return false;
-      if(!unpackedInt64_.Equals(other.unpackedInt64_)) return false;
-      if(!unpackedUint32_.Equals(other.unpackedUint32_)) return false;
-      if(!unpackedUint64_.Equals(other.unpackedUint64_)) return false;
-      if(!unpackedSint32_.Equals(other.unpackedSint32_)) return false;
-      if(!unpackedSint64_.Equals(other.unpackedSint64_)) return false;
-      if(!unpackedFixed32_.Equals(other.unpackedFixed32_)) return false;
-      if(!unpackedFixed64_.Equals(other.unpackedFixed64_)) return false;
-      if(!unpackedSfixed32_.Equals(other.unpackedSfixed32_)) return false;
-      if(!unpackedSfixed64_.Equals(other.unpackedSfixed64_)) return false;
-      if(!unpackedFloat_.Equals(other.unpackedFloat_)) return false;
-      if(!unpackedDouble_.Equals(other.unpackedDouble_)) return false;
-      if(!unpackedBool_.Equals(other.unpackedBool_)) return false;
-      if(!unpackedEnum_.Equals(other.unpackedEnum_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= unpackedInt32_.GetHashCode();
-      hash ^= unpackedInt64_.GetHashCode();
-      hash ^= unpackedUint32_.GetHashCode();
-      hash ^= unpackedUint64_.GetHashCode();
-      hash ^= unpackedSint32_.GetHashCode();
-      hash ^= unpackedSint64_.GetHashCode();
-      hash ^= unpackedFixed32_.GetHashCode();
-      hash ^= unpackedFixed64_.GetHashCode();
-      hash ^= unpackedSfixed32_.GetHashCode();
-      hash ^= unpackedSfixed64_.GetHashCode();
-      hash ^= unpackedFloat_.GetHashCode();
-      hash ^= unpackedDouble_.GetHashCode();
-      hash ^= unpackedBool_.GetHashCode();
-      hash ^= unpackedEnum_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      unpackedInt32_.WriteTo(output, _repeated_unpackedInt32_codec);
-      unpackedInt64_.WriteTo(output, _repeated_unpackedInt64_codec);
-      unpackedUint32_.WriteTo(output, _repeated_unpackedUint32_codec);
-      unpackedUint64_.WriteTo(output, _repeated_unpackedUint64_codec);
-      unpackedSint32_.WriteTo(output, _repeated_unpackedSint32_codec);
-      unpackedSint64_.WriteTo(output, _repeated_unpackedSint64_codec);
-      unpackedFixed32_.WriteTo(output, _repeated_unpackedFixed32_codec);
-      unpackedFixed64_.WriteTo(output, _repeated_unpackedFixed64_codec);
-      unpackedSfixed32_.WriteTo(output, _repeated_unpackedSfixed32_codec);
-      unpackedSfixed64_.WriteTo(output, _repeated_unpackedSfixed64_codec);
-      unpackedFloat_.WriteTo(output, _repeated_unpackedFloat_codec);
-      unpackedDouble_.WriteTo(output, _repeated_unpackedDouble_codec);
-      unpackedBool_.WriteTo(output, _repeated_unpackedBool_codec);
-      unpackedEnum_.WriteTo(output, _repeated_unpackedEnum_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += unpackedInt32_.CalculateSize(_repeated_unpackedInt32_codec);
-      size += unpackedInt64_.CalculateSize(_repeated_unpackedInt64_codec);
-      size += unpackedUint32_.CalculateSize(_repeated_unpackedUint32_codec);
-      size += unpackedUint64_.CalculateSize(_repeated_unpackedUint64_codec);
-      size += unpackedSint32_.CalculateSize(_repeated_unpackedSint32_codec);
-      size += unpackedSint64_.CalculateSize(_repeated_unpackedSint64_codec);
-      size += unpackedFixed32_.CalculateSize(_repeated_unpackedFixed32_codec);
-      size += unpackedFixed64_.CalculateSize(_repeated_unpackedFixed64_codec);
-      size += unpackedSfixed32_.CalculateSize(_repeated_unpackedSfixed32_codec);
-      size += unpackedSfixed64_.CalculateSize(_repeated_unpackedSfixed64_codec);
-      size += unpackedFloat_.CalculateSize(_repeated_unpackedFloat_codec);
-      size += unpackedDouble_.CalculateSize(_repeated_unpackedDouble_codec);
-      size += unpackedBool_.CalculateSize(_repeated_unpackedBool_codec);
-      size += unpackedEnum_.CalculateSize(_repeated_unpackedEnum_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestUnpackedTypes other) {
-      if (other == null) {
-        return;
-      }
-      unpackedInt32_.Add(other.unpackedInt32_);
-      unpackedInt64_.Add(other.unpackedInt64_);
-      unpackedUint32_.Add(other.unpackedUint32_);
-      unpackedUint64_.Add(other.unpackedUint64_);
-      unpackedSint32_.Add(other.unpackedSint32_);
-      unpackedSint64_.Add(other.unpackedSint64_);
-      unpackedFixed32_.Add(other.unpackedFixed32_);
-      unpackedFixed64_.Add(other.unpackedFixed64_);
-      unpackedSfixed32_.Add(other.unpackedSfixed32_);
-      unpackedSfixed64_.Add(other.unpackedSfixed64_);
-      unpackedFloat_.Add(other.unpackedFloat_);
-      unpackedDouble_.Add(other.unpackedDouble_);
-      unpackedBool_.Add(other.unpackedBool_);
-      unpackedEnum_.Add(other.unpackedEnum_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 722:
-          case 720: {
-            unpackedInt32_.AddEntriesFrom(input, _repeated_unpackedInt32_codec);
-            break;
-          }
-          case 730:
-          case 728: {
-            unpackedInt64_.AddEntriesFrom(input, _repeated_unpackedInt64_codec);
-            break;
-          }
-          case 738:
-          case 736: {
-            unpackedUint32_.AddEntriesFrom(input, _repeated_unpackedUint32_codec);
-            break;
-          }
-          case 746:
-          case 744: {
-            unpackedUint64_.AddEntriesFrom(input, _repeated_unpackedUint64_codec);
-            break;
-          }
-          case 754:
-          case 752: {
-            unpackedSint32_.AddEntriesFrom(input, _repeated_unpackedSint32_codec);
-            break;
-          }
-          case 762:
-          case 760: {
-            unpackedSint64_.AddEntriesFrom(input, _repeated_unpackedSint64_codec);
-            break;
-          }
-          case 770:
-          case 773: {
-            unpackedFixed32_.AddEntriesFrom(input, _repeated_unpackedFixed32_codec);
-            break;
-          }
-          case 778:
-          case 777: {
-            unpackedFixed64_.AddEntriesFrom(input, _repeated_unpackedFixed64_codec);
-            break;
-          }
-          case 786:
-          case 789: {
-            unpackedSfixed32_.AddEntriesFrom(input, _repeated_unpackedSfixed32_codec);
-            break;
-          }
-          case 794:
-          case 793: {
-            unpackedSfixed64_.AddEntriesFrom(input, _repeated_unpackedSfixed64_codec);
-            break;
-          }
-          case 802:
-          case 805: {
-            unpackedFloat_.AddEntriesFrom(input, _repeated_unpackedFloat_codec);
-            break;
-          }
-          case 810:
-          case 809: {
-            unpackedDouble_.AddEntriesFrom(input, _repeated_unpackedDouble_codec);
-            break;
-          }
-          case 818:
-          case 816: {
-            unpackedBool_.AddEntriesFrom(input, _repeated_unpackedBool_codec);
-            break;
-          }
-          case 826:
-          case 824: {
-            unpackedEnum_.AddEntriesFrom(input, _repeated_unpackedEnum_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage<TestRepeatedScalarDifferentTagSizes> {
-    private static readonly pb::MessageParser<TestRepeatedScalarDifferentTagSizes> _parser = new pb::MessageParser<TestRepeatedScalarDifferentTagSizes>(() => new TestRepeatedScalarDifferentTagSizes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestRepeatedScalarDifferentTagSizes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[25]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestRepeatedScalarDifferentTagSizes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestRepeatedScalarDifferentTagSizes(TestRepeatedScalarDifferentTagSizes other) : this() {
-      repeatedFixed32_ = other.repeatedFixed32_.Clone();
-      repeatedInt32_ = other.repeatedInt32_.Clone();
-      repeatedFixed64_ = other.repeatedFixed64_.Clone();
-      repeatedInt64_ = other.repeatedInt64_.Clone();
-      repeatedFloat_ = other.repeatedFloat_.Clone();
-      repeatedUint64_ = other.repeatedUint64_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestRepeatedScalarDifferentTagSizes Clone() {
-      return new TestRepeatedScalarDifferentTagSizes(this);
-    }
-
-    /// <summary>Field number for the "repeated_fixed32" field.</summary>
-    public const int RepeatedFixed32FieldNumber = 12;
-    private static readonly pb::FieldCodec<uint> _repeated_repeatedFixed32_codec
-        = pb::FieldCodec.ForFixed32(98);
-    private readonly pbc::RepeatedField<uint> repeatedFixed32_ = new pbc::RepeatedField<uint>();
-    /// <summary>
-    ///  Parsing repeated fixed size values used to fail. This message needs to be
-    ///  used in order to get a tag of the right size; all of the repeated fields
-    ///  in TestAllTypes didn't trigger the check.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint> RepeatedFixed32 {
-      get { return repeatedFixed32_; }
-    }
-
-    /// <summary>Field number for the "repeated_int32" field.</summary>
-    public const int RepeatedInt32FieldNumber = 13;
-    private static readonly pb::FieldCodec<int> _repeated_repeatedInt32_codec
-        = pb::FieldCodec.ForInt32(106);
-    private readonly pbc::RepeatedField<int> repeatedInt32_ = new pbc::RepeatedField<int>();
-    /// <summary>
-    ///  Check for a varint type, just for good measure.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> RepeatedInt32 {
-      get { return repeatedInt32_; }
-    }
-
-    /// <summary>Field number for the "repeated_fixed64" field.</summary>
-    public const int RepeatedFixed64FieldNumber = 2046;
-    private static readonly pb::FieldCodec<ulong> _repeated_repeatedFixed64_codec
-        = pb::FieldCodec.ForFixed64(16370);
-    private readonly pbc::RepeatedField<ulong> repeatedFixed64_ = new pbc::RepeatedField<ulong>();
-    /// <summary>
-    ///  These have two-byte tags.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> RepeatedFixed64 {
-      get { return repeatedFixed64_; }
-    }
-
-    /// <summary>Field number for the "repeated_int64" field.</summary>
-    public const int RepeatedInt64FieldNumber = 2047;
-    private static readonly pb::FieldCodec<long> _repeated_repeatedInt64_codec
-        = pb::FieldCodec.ForInt64(16378);
-    private readonly pbc::RepeatedField<long> repeatedInt64_ = new pbc::RepeatedField<long>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long> RepeatedInt64 {
-      get { return repeatedInt64_; }
-    }
-
-    /// <summary>Field number for the "repeated_float" field.</summary>
-    public const int RepeatedFloatFieldNumber = 262142;
-    private static readonly pb::FieldCodec<float> _repeated_repeatedFloat_codec
-        = pb::FieldCodec.ForFloat(2097138);
-    private readonly pbc::RepeatedField<float> repeatedFloat_ = new pbc::RepeatedField<float>();
-    /// <summary>
-    ///  Three byte tags.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<float> RepeatedFloat {
-      get { return repeatedFloat_; }
-    }
-
-    /// <summary>Field number for the "repeated_uint64" field.</summary>
-    public const int RepeatedUint64FieldNumber = 262143;
-    private static readonly pb::FieldCodec<ulong> _repeated_repeatedUint64_codec
-        = pb::FieldCodec.ForUInt64(2097146);
-    private readonly pbc::RepeatedField<ulong> repeatedUint64_ = new pbc::RepeatedField<ulong>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong> RepeatedUint64 {
-      get { return repeatedUint64_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestRepeatedScalarDifferentTagSizes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestRepeatedScalarDifferentTagSizes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!repeatedFixed32_.Equals(other.repeatedFixed32_)) return false;
-      if(!repeatedInt32_.Equals(other.repeatedInt32_)) return false;
-      if(!repeatedFixed64_.Equals(other.repeatedFixed64_)) return false;
-      if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false;
-      if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false;
-      if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= repeatedFixed32_.GetHashCode();
-      hash ^= repeatedInt32_.GetHashCode();
-      hash ^= repeatedFixed64_.GetHashCode();
-      hash ^= repeatedInt64_.GetHashCode();
-      hash ^= repeatedFloat_.GetHashCode();
-      hash ^= repeatedUint64_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec);
-      repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec);
-      repeatedFixed64_.WriteTo(output, _repeated_repeatedFixed64_codec);
-      repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec);
-      repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec);
-      repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += repeatedFixed32_.CalculateSize(_repeated_repeatedFixed32_codec);
-      size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec);
-      size += repeatedFixed64_.CalculateSize(_repeated_repeatedFixed64_codec);
-      size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec);
-      size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec);
-      size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestRepeatedScalarDifferentTagSizes other) {
-      if (other == null) {
-        return;
-      }
-      repeatedFixed32_.Add(other.repeatedFixed32_);
-      repeatedInt32_.Add(other.repeatedInt32_);
-      repeatedFixed64_.Add(other.repeatedFixed64_);
-      repeatedInt64_.Add(other.repeatedInt64_);
-      repeatedFloat_.Add(other.repeatedFloat_);
-      repeatedUint64_.Add(other.repeatedUint64_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 98:
-          case 101: {
-            repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec);
-            break;
-          }
-          case 106:
-          case 104: {
-            repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec);
-            break;
-          }
-          case 16370:
-          case 16369: {
-            repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec);
-            break;
-          }
-          case 16378:
-          case 16376: {
-            repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec);
-            break;
-          }
-          case 2097138:
-          case 2097141: {
-            repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec);
-            break;
-          }
-          case 2097146:
-          case 2097144: {
-            repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class TestCommentInjectionMessage : pb::IMessage<TestCommentInjectionMessage> {
-    private static readonly pb::MessageParser<TestCommentInjectionMessage> _parser = new pb::MessageParser<TestCommentInjectionMessage>(() => new TestCommentInjectionMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestCommentInjectionMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[26]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestCommentInjectionMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestCommentInjectionMessage(TestCommentInjectionMessage other) : this() {
-      a_ = other.a_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestCommentInjectionMessage Clone() {
-      return new TestCommentInjectionMessage(this);
-    }
-
-    /// <summary>Field number for the "a" field.</summary>
-    public const int AFieldNumber = 1;
-    private string a_ = "";
-    /// <summary>
-    ///  */ &lt;- This should not close the generated doc comment
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string A {
-      get { return a_; }
-      set {
-        a_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestCommentInjectionMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestCommentInjectionMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (A != other.A) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (A.Length != 0) hash ^= A.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (A.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(A);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (A.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(A);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestCommentInjectionMessage other) {
-      if (other == null) {
-        return;
-      }
-      if (other.A.Length != 0) {
-        A = other.A;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            A = input.ReadString();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Test that RPC services work.
-  /// </summary>
-  public sealed partial class FooRequest : pb::IMessage<FooRequest> {
-    private static readonly pb::MessageParser<FooRequest> _parser = new pb::MessageParser<FooRequest>(() => new FooRequest());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FooRequest> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[27]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooRequest() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooRequest(FooRequest other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooRequest Clone() {
-      return new FooRequest(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FooRequest);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FooRequest other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FooRequest other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class FooResponse : pb::IMessage<FooResponse> {
-    private static readonly pb::MessageParser<FooResponse> _parser = new pb::MessageParser<FooResponse>(() => new FooResponse());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FooResponse> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[28]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooResponse() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooResponse(FooResponse other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooResponse Clone() {
-      return new FooResponse(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FooResponse);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FooResponse other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FooResponse other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class FooClientMessage : pb::IMessage<FooClientMessage> {
-    private static readonly pb::MessageParser<FooClientMessage> _parser = new pb::MessageParser<FooClientMessage>(() => new FooClientMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FooClientMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[29]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooClientMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooClientMessage(FooClientMessage other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooClientMessage Clone() {
-      return new FooClientMessage(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FooClientMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FooClientMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FooClientMessage other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class FooServerMessage : pb::IMessage<FooServerMessage> {
-    private static readonly pb::MessageParser<FooServerMessage> _parser = new pb::MessageParser<FooServerMessage>(() => new FooServerMessage());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FooServerMessage> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[30]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooServerMessage() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooServerMessage(FooServerMessage other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FooServerMessage Clone() {
-      return new FooServerMessage(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FooServerMessage);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FooServerMessage other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FooServerMessage other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class BarRequest : pb::IMessage<BarRequest> {
-    private static readonly pb::MessageParser<BarRequest> _parser = new pb::MessageParser<BarRequest>(() => new BarRequest());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<BarRequest> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[31]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BarRequest() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BarRequest(BarRequest other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BarRequest Clone() {
-      return new BarRequest(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as BarRequest);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(BarRequest other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(BarRequest other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class BarResponse : pb::IMessage<BarResponse> {
-    private static readonly pb::MessageParser<BarResponse> _parser = new pb::MessageParser<BarResponse>(() => new BarResponse());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<BarResponse> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[32]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BarResponse() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BarResponse(BarResponse other) : this() {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public BarResponse Clone() {
-      return new BarResponse(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as BarResponse);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(BarResponse other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(BarResponse other) {
-      if (other == null) {
-        return;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 2539
csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs

@@ -1,2539 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: google/protobuf/unittest_well_known_types.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos {
-
-  /// <summary>Holder for reflection information generated from google/protobuf/unittest_well_known_types.proto</summary>
-  public static partial class UnittestWellKnownTypesReflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for google/protobuf/unittest_well_known_types.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static UnittestWellKnownTypesReflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "Ci9nb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfd2VsbF9rbm93bl90eXBlcy5w",
-            "cm90bxIRcHJvdG9idWZfdW5pdHRlc3QaGWdvb2dsZS9wcm90b2J1Zi9hbnku",
-            "cHJvdG8aGWdvb2dsZS9wcm90b2J1Zi9hcGkucHJvdG8aHmdvb2dsZS9wcm90",
-            "b2J1Zi9kdXJhdGlvbi5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnBy",
-            "b3RvGiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxokZ29vZ2xl",
-            "L3Byb3RvYnVmL3NvdXJjZV9jb250ZXh0LnByb3RvGhxnb29nbGUvcHJvdG9i",
-            "dWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnBy",
-            "b3RvGhpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxoeZ29vZ2xlL3Byb3Rv",
-            "YnVmL3dyYXBwZXJzLnByb3RvIr4HChJUZXN0V2VsbEtub3duVHlwZXMSJwoJ",
-            "YW55X2ZpZWxkGAEgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFueRInCglhcGlf",
-            "ZmllbGQYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQXBpEjEKDmR1cmF0aW9u",
-            "X2ZpZWxkGAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEisKC2Vt",
-            "cHR5X2ZpZWxkGAQgASgLMhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5EjQKEGZp",
-            "ZWxkX21hc2tfZmllbGQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRN",
-            "YXNrEjwKFHNvdXJjZV9jb250ZXh0X2ZpZWxkGAYgASgLMh4uZ29vZ2xlLnBy",
-            "b3RvYnVmLlNvdXJjZUNvbnRleHQSLQoMc3RydWN0X2ZpZWxkGAcgASgLMhcu",
-            "Z29vZ2xlLnByb3RvYnVmLlN0cnVjdBIzCg90aW1lc3RhbXBfZmllbGQYCCAB",
-            "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEikKCnR5cGVfZmllbGQY",
-            "CSABKAsyFS5nb29nbGUucHJvdG9idWYuVHlwZRIyCgxkb3VibGVfZmllbGQY",
-            "CiABKAsyHC5nb29nbGUucHJvdG9idWYuRG91YmxlVmFsdWUSMAoLZmxvYXRf",
-            "ZmllbGQYCyABKAsyGy5nb29nbGUucHJvdG9idWYuRmxvYXRWYWx1ZRIwCgtp",
-            "bnQ2NF9maWVsZBgMIAEoCzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVl",
-            "EjIKDHVpbnQ2NF9maWVsZBgNIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50",
-            "NjRWYWx1ZRIwCgtpbnQzMl9maWVsZBgOIAEoCzIbLmdvb2dsZS5wcm90b2J1",
-            "Zi5JbnQzMlZhbHVlEjIKDHVpbnQzMl9maWVsZBgPIAEoCzIcLmdvb2dsZS5w",
-            "cm90b2J1Zi5VSW50MzJWYWx1ZRIuCgpib29sX2ZpZWxkGBAgASgLMhouZ29v",
-            "Z2xlLnByb3RvYnVmLkJvb2xWYWx1ZRIyCgxzdHJpbmdfZmllbGQYESABKAsy",
-            "HC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUSMAoLYnl0ZXNfZmllbGQY",
-            "EiABKAsyGy5nb29nbGUucHJvdG9idWYuQnl0ZXNWYWx1ZRIrCgt2YWx1ZV9m",
-            "aWVsZBgTIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSKVBwoWUmVwZWF0",
-            "ZWRXZWxsS25vd25UeXBlcxInCglhbnlfZmllbGQYASADKAsyFC5nb29nbGUu",
-            "cHJvdG9idWYuQW55EicKCWFwaV9maWVsZBgCIAMoCzIULmdvb2dsZS5wcm90",
-            "b2J1Zi5BcGkSMQoOZHVyYXRpb25fZmllbGQYAyADKAsyGS5nb29nbGUucHJv",
-            "dG9idWYuRHVyYXRpb24SKwoLZW1wdHlfZmllbGQYBCADKAsyFi5nb29nbGUu",
-            "cHJvdG9idWYuRW1wdHkSNAoQZmllbGRfbWFza19maWVsZBgFIAMoCzIaLmdv",
-            "b2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sSPAoUc291cmNlX2NvbnRleHRfZmll",
-            "bGQYBiADKAsyHi5nb29nbGUucHJvdG9idWYuU291cmNlQ29udGV4dBItCgxz",
-            "dHJ1Y3RfZmllbGQYByADKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EjMK",
-            "D3RpbWVzdGFtcF9maWVsZBgIIAMoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1l",
-            "c3RhbXASKQoKdHlwZV9maWVsZBgJIAMoCzIVLmdvb2dsZS5wcm90b2J1Zi5U",
-            "eXBlEjIKDGRvdWJsZV9maWVsZBgKIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5E",
-            "b3VibGVWYWx1ZRIwCgtmbG9hdF9maWVsZBgLIAMoCzIbLmdvb2dsZS5wcm90",
-            "b2J1Zi5GbG9hdFZhbHVlEjAKC2ludDY0X2ZpZWxkGAwgAygLMhsuZ29vZ2xl",
-            "LnByb3RvYnVmLkludDY0VmFsdWUSMgoMdWludDY0X2ZpZWxkGA0gAygLMhwu",
-            "Z29vZ2xlLnByb3RvYnVmLlVJbnQ2NFZhbHVlEjAKC2ludDMyX2ZpZWxkGA4g",
-            "AygLMhsuZ29vZ2xlLnByb3RvYnVmLkludDMyVmFsdWUSMgoMdWludDMyX2Zp",
-            "ZWxkGA8gAygLMhwuZ29vZ2xlLnByb3RvYnVmLlVJbnQzMlZhbHVlEi4KCmJv",
-            "b2xfZmllbGQYECADKAsyGi5nb29nbGUucHJvdG9idWYuQm9vbFZhbHVlEjIK",
-            "DHN0cmluZ19maWVsZBgRIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdW",
-            "YWx1ZRIwCgtieXRlc19maWVsZBgSIAMoCzIbLmdvb2dsZS5wcm90b2J1Zi5C",
-            "eXRlc1ZhbHVlIsUHChNPbmVvZldlbGxLbm93blR5cGVzEikKCWFueV9maWVs",
-            "ZBgBIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnlIABIpCglhcGlfZmllbGQY",
-            "AiABKAsyFC5nb29nbGUucHJvdG9idWYuQXBpSAASMwoOZHVyYXRpb25fZmll",
-            "bGQYAyABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb25IABItCgtlbXB0",
-            "eV9maWVsZBgEIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eUgAEjYKEGZp",
-            "ZWxkX21hc2tfZmllbGQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRN",
-            "YXNrSAASPgoUc291cmNlX2NvbnRleHRfZmllbGQYBiABKAsyHi5nb29nbGUu",
-            "cHJvdG9idWYuU291cmNlQ29udGV4dEgAEi8KDHN0cnVjdF9maWVsZBgHIAEo",
-            "CzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIABI1Cg90aW1lc3RhbXBfZmll",
-            "bGQYCCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAASKwoKdHlw",
-            "ZV9maWVsZBgJIAEoCzIVLmdvb2dsZS5wcm90b2J1Zi5UeXBlSAASNAoMZG91",
-            "YmxlX2ZpZWxkGAogASgLMhwuZ29vZ2xlLnByb3RvYnVmLkRvdWJsZVZhbHVl",
-            "SAASMgoLZmxvYXRfZmllbGQYCyABKAsyGy5nb29nbGUucHJvdG9idWYuRmxv",
-            "YXRWYWx1ZUgAEjIKC2ludDY0X2ZpZWxkGAwgASgLMhsuZ29vZ2xlLnByb3Rv",
-            "YnVmLkludDY0VmFsdWVIABI0Cgx1aW50NjRfZmllbGQYDSABKAsyHC5nb29n",
-            "bGUucHJvdG9idWYuVUludDY0VmFsdWVIABIyCgtpbnQzMl9maWVsZBgOIAEo",
-            "CzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlSAASNAoMdWludDMyX2Zp",
-            "ZWxkGA8gASgLMhwuZ29vZ2xlLnByb3RvYnVmLlVJbnQzMlZhbHVlSAASMAoK",
-            "Ym9vbF9maWVsZBgQIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5Cb29sVmFsdWVI",
-            "ABI0CgxzdHJpbmdfZmllbGQYESABKAsyHC5nb29nbGUucHJvdG9idWYuU3Ry",
-            "aW5nVmFsdWVIABIyCgtieXRlc19maWVsZBgSIAEoCzIbLmdvb2dsZS5wcm90",
-            "b2J1Zi5CeXRlc1ZhbHVlSABCDQoLb25lb2ZfZmllbGQilhYKEU1hcFdlbGxL",
-            "bm93blR5cGVzEkUKCWFueV9maWVsZBgBIAMoCzIyLnByb3RvYnVmX3VuaXR0",
-            "ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkFueUZpZWxkRW50cnkSRQoJYXBpX2Zp",
-            "ZWxkGAIgAygLMjIucHJvdG9idWZfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlw",
-            "ZXMuQXBpRmllbGRFbnRyeRJPCg5kdXJhdGlvbl9maWVsZBgDIAMoCzI3LnBy",
-            "b3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkR1cmF0aW9uRmll",
-            "bGRFbnRyeRJJCgtlbXB0eV9maWVsZBgEIAMoCzI0LnByb3RvYnVmX3VuaXR0",
-            "ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkVtcHR5RmllbGRFbnRyeRJSChBmaWVs",
-            "ZF9tYXNrX2ZpZWxkGAUgAygLMjgucHJvdG9idWZfdW5pdHRlc3QuTWFwV2Vs",
-            "bEtub3duVHlwZXMuRmllbGRNYXNrRmllbGRFbnRyeRJaChRzb3VyY2VfY29u",
-            "dGV4dF9maWVsZBgGIAMoCzI8LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxL",
-            "bm93blR5cGVzLlNvdXJjZUNvbnRleHRGaWVsZEVudHJ5EksKDHN0cnVjdF9m",
-            "aWVsZBgHIAMoCzI1LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5",
-            "cGVzLlN0cnVjdEZpZWxkRW50cnkSUQoPdGltZXN0YW1wX2ZpZWxkGAggAygL",
-            "MjgucHJvdG9idWZfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuVGltZXN0",
-            "YW1wRmllbGRFbnRyeRJHCgp0eXBlX2ZpZWxkGAkgAygLMjMucHJvdG9idWZf",
-            "dW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuVHlwZUZpZWxkRW50cnkSSwoM",
-            "ZG91YmxlX2ZpZWxkGAogAygLMjUucHJvdG9idWZfdW5pdHRlc3QuTWFwV2Vs",
-            "bEtub3duVHlwZXMuRG91YmxlRmllbGRFbnRyeRJJCgtmbG9hdF9maWVsZBgL",
-            "IAMoCzI0LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkZs",
-            "b2F0RmllbGRFbnRyeRJJCgtpbnQ2NF9maWVsZBgMIAMoCzI0LnByb3RvYnVm",
-            "X3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkludDY0RmllbGRFbnRyeRJL",
-            "Cgx1aW50NjRfZmllbGQYDSADKAsyNS5wcm90b2J1Zl91bml0dGVzdC5NYXBX",
-            "ZWxsS25vd25UeXBlcy5VaW50NjRGaWVsZEVudHJ5EkkKC2ludDMyX2ZpZWxk",
-            "GA4gAygLMjQucHJvdG9idWZfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMu",
-            "SW50MzJGaWVsZEVudHJ5EksKDHVpbnQzMl9maWVsZBgPIAMoCzI1LnByb3Rv",
-            "YnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLlVpbnQzMkZpZWxkRW50",
-            "cnkSRwoKYm9vbF9maWVsZBgQIAMoCzIzLnByb3RvYnVmX3VuaXR0ZXN0Lk1h",
-            "cFdlbGxLbm93blR5cGVzLkJvb2xGaWVsZEVudHJ5EksKDHN0cmluZ19maWVs",
-            "ZBgRIAMoCzI1LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVz",
-            "LlN0cmluZ0ZpZWxkRW50cnkSSQoLYnl0ZXNfZmllbGQYEiADKAsyNC5wcm90",
-            "b2J1Zl91bml0dGVzdC5NYXBXZWxsS25vd25UeXBlcy5CeXRlc0ZpZWxkRW50",
-            "cnkaRQoNQW55RmllbGRFbnRyeRILCgNrZXkYASABKAUSIwoFdmFsdWUYAiAB",
-            "KAsyFC5nb29nbGUucHJvdG9idWYuQW55OgI4ARpFCg1BcGlGaWVsZEVudHJ5",
-            "EgsKA2tleRgBIAEoBRIjCgV2YWx1ZRgCIAEoCzIULmdvb2dsZS5wcm90b2J1",
-            "Zi5BcGk6AjgBGk8KEkR1cmF0aW9uRmllbGRFbnRyeRILCgNrZXkYASABKAUS",
-            "KAoFdmFsdWUYAiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb246AjgB",
-            "GkkKD0VtcHR5RmllbGRFbnRyeRILCgNrZXkYASABKAUSJQoFdmFsdWUYAiAB",
-            "KAsyFi5nb29nbGUucHJvdG9idWYuRW1wdHk6AjgBGlEKE0ZpZWxkTWFza0Zp",
-            "ZWxkRW50cnkSCwoDa2V5GAEgASgFEikKBXZhbHVlGAIgASgLMhouZ29vZ2xl",
-            "LnByb3RvYnVmLkZpZWxkTWFzazoCOAEaWQoXU291cmNlQ29udGV4dEZpZWxk",
-            "RW50cnkSCwoDa2V5GAEgASgFEi0KBXZhbHVlGAIgASgLMh4uZ29vZ2xlLnBy",
-            "b3RvYnVmLlNvdXJjZUNvbnRleHQ6AjgBGksKEFN0cnVjdEZpZWxkRW50cnkS",
-            "CwoDa2V5GAEgASgFEiYKBXZhbHVlGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVm",
-            "LlN0cnVjdDoCOAEaUQoTVGltZXN0YW1wRmllbGRFbnRyeRILCgNrZXkYASAB",
-            "KAUSKQoFdmFsdWUYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1w",
-            "OgI4ARpHCg5UeXBlRmllbGRFbnRyeRILCgNrZXkYASABKAUSJAoFdmFsdWUY",
-            "AiABKAsyFS5nb29nbGUucHJvdG9idWYuVHlwZToCOAEaUAoQRG91YmxlRmll",
-            "bGRFbnRyeRILCgNrZXkYASABKAUSKwoFdmFsdWUYAiABKAsyHC5nb29nbGUu",
-            "cHJvdG9idWYuRG91YmxlVmFsdWU6AjgBGk4KD0Zsb2F0RmllbGRFbnRyeRIL",
-            "CgNrZXkYASABKAUSKgoFdmFsdWUYAiABKAsyGy5nb29nbGUucHJvdG9idWYu",
-            "RmxvYXRWYWx1ZToCOAEaTgoPSW50NjRGaWVsZEVudHJ5EgsKA2tleRgBIAEo",
-            "BRIqCgV2YWx1ZRgCIAEoCzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVl",
-            "OgI4ARpQChBVaW50NjRGaWVsZEVudHJ5EgsKA2tleRgBIAEoBRIrCgV2YWx1",
-            "ZRgCIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50NjRWYWx1ZToCOAEaTgoP",
-            "SW50MzJGaWVsZEVudHJ5EgsKA2tleRgBIAEoBRIqCgV2YWx1ZRgCIAEoCzIb",
-            "Lmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlOgI4ARpQChBVaW50MzJGaWVs",
-            "ZEVudHJ5EgsKA2tleRgBIAEoBRIrCgV2YWx1ZRgCIAEoCzIcLmdvb2dsZS5w",
-            "cm90b2J1Zi5VSW50MzJWYWx1ZToCOAEaTAoOQm9vbEZpZWxkRW50cnkSCwoD",
-            "a2V5GAEgASgFEikKBXZhbHVlGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkJv",
-            "b2xWYWx1ZToCOAEaUAoQU3RyaW5nRmllbGRFbnRyeRILCgNrZXkYASABKAUS",
-            "KwoFdmFsdWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWU6",
-            "AjgBGk4KD0J5dGVzRmllbGRFbnRyeRILCgNrZXkYASABKAUSKgoFdmFsdWUY",
-            "AiABKAsyGy5nb29nbGUucHJvdG9idWYuQnl0ZXNWYWx1ZToCOAFCOQoYY29t",
-            "Lmdvb2dsZS5wcm90b2J1Zi50ZXN0UAGqAhpHb29nbGUuUHJvdG9idWYuVGVz",
-            "dFByb3Rvc2IGcHJvdG8z"));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, },
-          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestWellKnownTypes), global::Google.Protobuf.TestProtos.TestWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField", "ValueField" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.RepeatedWellKnownTypes), global::Google.Protobuf.TestProtos.RepeatedWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneofWellKnownTypes), global::Google.Protobuf.TestProtos.OneofWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, new[]{ "OneofField" }, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MapWellKnownTypes), global::Google.Protobuf.TestProtos.MapWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, })
-          }));
-    }
-    #endregion
-
-  }
-  #region Messages
-  /// <summary>
-  ///  Test that we can include all well-known types.
-  ///  Each wrapper type is included separately, as languages
-  ///  map handle different wrappers in different ways.
-  /// </summary>
-  public sealed partial class TestWellKnownTypes : pb::IMessage<TestWellKnownTypes> {
-    private static readonly pb::MessageParser<TestWellKnownTypes> _parser = new pb::MessageParser<TestWellKnownTypes>(() => new TestWellKnownTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<TestWellKnownTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestWellKnownTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestWellKnownTypes(TestWellKnownTypes other) : this() {
-      AnyField = other.anyField_ != null ? other.AnyField.Clone() : null;
-      ApiField = other.apiField_ != null ? other.ApiField.Clone() : null;
-      DurationField = other.durationField_ != null ? other.DurationField.Clone() : null;
-      EmptyField = other.emptyField_ != null ? other.EmptyField.Clone() : null;
-      FieldMaskField = other.fieldMaskField_ != null ? other.FieldMaskField.Clone() : null;
-      SourceContextField = other.sourceContextField_ != null ? other.SourceContextField.Clone() : null;
-      StructField = other.structField_ != null ? other.StructField.Clone() : null;
-      TimestampField = other.timestampField_ != null ? other.TimestampField.Clone() : null;
-      TypeField = other.typeField_ != null ? other.TypeField.Clone() : null;
-      DoubleField = other.DoubleField;
-      FloatField = other.FloatField;
-      Int64Field = other.Int64Field;
-      Uint64Field = other.Uint64Field;
-      Int32Field = other.Int32Field;
-      Uint32Field = other.Uint32Field;
-      BoolField = other.BoolField;
-      StringField = other.StringField;
-      BytesField = other.BytesField;
-      ValueField = other.valueField_ != null ? other.ValueField.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public TestWellKnownTypes Clone() {
-      return new TestWellKnownTypes(this);
-    }
-
-    /// <summary>Field number for the "any_field" field.</summary>
-    public const int AnyFieldFieldNumber = 1;
-    private global::Google.Protobuf.WellKnownTypes.Any anyField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Any AnyField {
-      get { return anyField_; }
-      set {
-        anyField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "api_field" field.</summary>
-    public const int ApiFieldFieldNumber = 2;
-    private global::Google.Protobuf.WellKnownTypes.Api apiField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Api ApiField {
-      get { return apiField_; }
-      set {
-        apiField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "duration_field" field.</summary>
-    public const int DurationFieldFieldNumber = 3;
-    private global::Google.Protobuf.WellKnownTypes.Duration durationField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Duration DurationField {
-      get { return durationField_; }
-      set {
-        durationField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "empty_field" field.</summary>
-    public const int EmptyFieldFieldNumber = 4;
-    private global::Google.Protobuf.WellKnownTypes.Empty emptyField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Empty EmptyField {
-      get { return emptyField_; }
-      set {
-        emptyField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "field_mask_field" field.</summary>
-    public const int FieldMaskFieldFieldNumber = 5;
-    private global::Google.Protobuf.WellKnownTypes.FieldMask fieldMaskField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField {
-      get { return fieldMaskField_; }
-      set {
-        fieldMaskField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "source_context_field" field.</summary>
-    public const int SourceContextFieldFieldNumber = 6;
-    private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContextField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField {
-      get { return sourceContextField_; }
-      set {
-        sourceContextField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "struct_field" field.</summary>
-    public const int StructFieldFieldNumber = 7;
-    private global::Google.Protobuf.WellKnownTypes.Struct structField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Struct StructField {
-      get { return structField_; }
-      set {
-        structField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "timestamp_field" field.</summary>
-    public const int TimestampFieldFieldNumber = 8;
-    private global::Google.Protobuf.WellKnownTypes.Timestamp timestampField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField {
-      get { return timestampField_; }
-      set {
-        timestampField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "type_field" field.</summary>
-    public const int TypeFieldFieldNumber = 9;
-    private global::Google.Protobuf.WellKnownTypes.Type typeField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Type TypeField {
-      get { return typeField_; }
-      set {
-        typeField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "double_field" field.</summary>
-    public const int DoubleFieldFieldNumber = 10;
-    private static readonly pb::FieldCodec<double?> _single_doubleField_codec = pb::FieldCodec.ForStructWrapper<double>(82);
-    private double? doubleField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public double? DoubleField {
-      get { return doubleField_; }
-      set {
-        doubleField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "float_field" field.</summary>
-    public const int FloatFieldFieldNumber = 11;
-    private static readonly pb::FieldCodec<float?> _single_floatField_codec = pb::FieldCodec.ForStructWrapper<float>(90);
-    private float? floatField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public float? FloatField {
-      get { return floatField_; }
-      set {
-        floatField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "int64_field" field.</summary>
-    public const int Int64FieldFieldNumber = 12;
-    private static readonly pb::FieldCodec<long?> _single_int64Field_codec = pb::FieldCodec.ForStructWrapper<long>(98);
-    private long? int64Field_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long? Int64Field {
-      get { return int64Field_; }
-      set {
-        int64Field_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uint64_field" field.</summary>
-    public const int Uint64FieldFieldNumber = 13;
-    private static readonly pb::FieldCodec<ulong?> _single_uint64Field_codec = pb::FieldCodec.ForStructWrapper<ulong>(106);
-    private ulong? uint64Field_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ulong? Uint64Field {
-      get { return uint64Field_; }
-      set {
-        uint64Field_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "int32_field" field.</summary>
-    public const int Int32FieldFieldNumber = 14;
-    private static readonly pb::FieldCodec<int?> _single_int32Field_codec = pb::FieldCodec.ForStructWrapper<int>(114);
-    private int? int32Field_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int? Int32Field {
-      get { return int32Field_; }
-      set {
-        int32Field_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uint32_field" field.</summary>
-    public const int Uint32FieldFieldNumber = 15;
-    private static readonly pb::FieldCodec<uint?> _single_uint32Field_codec = pb::FieldCodec.ForStructWrapper<uint>(122);
-    private uint? uint32Field_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public uint? Uint32Field {
-      get { return uint32Field_; }
-      set {
-        uint32Field_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "bool_field" field.</summary>
-    public const int BoolFieldFieldNumber = 16;
-    private static readonly pb::FieldCodec<bool?> _single_boolField_codec = pb::FieldCodec.ForStructWrapper<bool>(130);
-    private bool? boolField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool? BoolField {
-      get { return boolField_; }
-      set {
-        boolField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "string_field" field.</summary>
-    public const int StringFieldFieldNumber = 17;
-    private static readonly pb::FieldCodec<string> _single_stringField_codec = pb::FieldCodec.ForClassWrapper<string>(138);
-    private string stringField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string StringField {
-      get { return stringField_; }
-      set {
-        stringField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "bytes_field" field.</summary>
-    public const int BytesFieldFieldNumber = 18;
-    private static readonly pb::FieldCodec<pb::ByteString> _single_bytesField_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
-    private pb::ByteString bytesField_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString BytesField {
-      get { return bytesField_; }
-      set {
-        bytesField_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "value_field" field.</summary>
-    public const int ValueFieldFieldNumber = 19;
-    private global::Google.Protobuf.WellKnownTypes.Value valueField_;
-    /// <summary>
-    ///  Part of struct, but useful to be able to test separately
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Value ValueField {
-      get { return valueField_; }
-      set {
-        valueField_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as TestWellKnownTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(TestWellKnownTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(AnyField, other.AnyField)) return false;
-      if (!object.Equals(ApiField, other.ApiField)) return false;
-      if (!object.Equals(DurationField, other.DurationField)) return false;
-      if (!object.Equals(EmptyField, other.EmptyField)) return false;
-      if (!object.Equals(FieldMaskField, other.FieldMaskField)) return false;
-      if (!object.Equals(SourceContextField, other.SourceContextField)) return false;
-      if (!object.Equals(StructField, other.StructField)) return false;
-      if (!object.Equals(TimestampField, other.TimestampField)) return false;
-      if (!object.Equals(TypeField, other.TypeField)) return false;
-      if (DoubleField != other.DoubleField) return false;
-      if (FloatField != other.FloatField) return false;
-      if (Int64Field != other.Int64Field) return false;
-      if (Uint64Field != other.Uint64Field) return false;
-      if (Int32Field != other.Int32Field) return false;
-      if (Uint32Field != other.Uint32Field) return false;
-      if (BoolField != other.BoolField) return false;
-      if (StringField != other.StringField) return false;
-      if (BytesField != other.BytesField) return false;
-      if (!object.Equals(ValueField, other.ValueField)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (anyField_ != null) hash ^= AnyField.GetHashCode();
-      if (apiField_ != null) hash ^= ApiField.GetHashCode();
-      if (durationField_ != null) hash ^= DurationField.GetHashCode();
-      if (emptyField_ != null) hash ^= EmptyField.GetHashCode();
-      if (fieldMaskField_ != null) hash ^= FieldMaskField.GetHashCode();
-      if (sourceContextField_ != null) hash ^= SourceContextField.GetHashCode();
-      if (structField_ != null) hash ^= StructField.GetHashCode();
-      if (timestampField_ != null) hash ^= TimestampField.GetHashCode();
-      if (typeField_ != null) hash ^= TypeField.GetHashCode();
-      if (doubleField_ != null) hash ^= DoubleField.GetHashCode();
-      if (floatField_ != null) hash ^= FloatField.GetHashCode();
-      if (int64Field_ != null) hash ^= Int64Field.GetHashCode();
-      if (uint64Field_ != null) hash ^= Uint64Field.GetHashCode();
-      if (int32Field_ != null) hash ^= Int32Field.GetHashCode();
-      if (uint32Field_ != null) hash ^= Uint32Field.GetHashCode();
-      if (boolField_ != null) hash ^= BoolField.GetHashCode();
-      if (stringField_ != null) hash ^= StringField.GetHashCode();
-      if (bytesField_ != null) hash ^= BytesField.GetHashCode();
-      if (valueField_ != null) hash ^= ValueField.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (anyField_ != null) {
-        output.WriteRawTag(10);
-        output.WriteMessage(AnyField);
-      }
-      if (apiField_ != null) {
-        output.WriteRawTag(18);
-        output.WriteMessage(ApiField);
-      }
-      if (durationField_ != null) {
-        output.WriteRawTag(26);
-        output.WriteMessage(DurationField);
-      }
-      if (emptyField_ != null) {
-        output.WriteRawTag(34);
-        output.WriteMessage(EmptyField);
-      }
-      if (fieldMaskField_ != null) {
-        output.WriteRawTag(42);
-        output.WriteMessage(FieldMaskField);
-      }
-      if (sourceContextField_ != null) {
-        output.WriteRawTag(50);
-        output.WriteMessage(SourceContextField);
-      }
-      if (structField_ != null) {
-        output.WriteRawTag(58);
-        output.WriteMessage(StructField);
-      }
-      if (timestampField_ != null) {
-        output.WriteRawTag(66);
-        output.WriteMessage(TimestampField);
-      }
-      if (typeField_ != null) {
-        output.WriteRawTag(74);
-        output.WriteMessage(TypeField);
-      }
-      if (doubleField_ != null) {
-        _single_doubleField_codec.WriteTagAndValue(output, DoubleField);
-      }
-      if (floatField_ != null) {
-        _single_floatField_codec.WriteTagAndValue(output, FloatField);
-      }
-      if (int64Field_ != null) {
-        _single_int64Field_codec.WriteTagAndValue(output, Int64Field);
-      }
-      if (uint64Field_ != null) {
-        _single_uint64Field_codec.WriteTagAndValue(output, Uint64Field);
-      }
-      if (int32Field_ != null) {
-        _single_int32Field_codec.WriteTagAndValue(output, Int32Field);
-      }
-      if (uint32Field_ != null) {
-        _single_uint32Field_codec.WriteTagAndValue(output, Uint32Field);
-      }
-      if (boolField_ != null) {
-        _single_boolField_codec.WriteTagAndValue(output, BoolField);
-      }
-      if (stringField_ != null) {
-        _single_stringField_codec.WriteTagAndValue(output, StringField);
-      }
-      if (bytesField_ != null) {
-        _single_bytesField_codec.WriteTagAndValue(output, BytesField);
-      }
-      if (valueField_ != null) {
-        output.WriteRawTag(154, 1);
-        output.WriteMessage(ValueField);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (anyField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(AnyField);
-      }
-      if (apiField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(ApiField);
-      }
-      if (durationField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(DurationField);
-      }
-      if (emptyField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(EmptyField);
-      }
-      if (fieldMaskField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(FieldMaskField);
-      }
-      if (sourceContextField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContextField);
-      }
-      if (structField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructField);
-      }
-      if (timestampField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(TimestampField);
-      }
-      if (typeField_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(TypeField);
-      }
-      if (doubleField_ != null) {
-        size += _single_doubleField_codec.CalculateSizeWithTag(DoubleField);
-      }
-      if (floatField_ != null) {
-        size += _single_floatField_codec.CalculateSizeWithTag(FloatField);
-      }
-      if (int64Field_ != null) {
-        size += _single_int64Field_codec.CalculateSizeWithTag(Int64Field);
-      }
-      if (uint64Field_ != null) {
-        size += _single_uint64Field_codec.CalculateSizeWithTag(Uint64Field);
-      }
-      if (int32Field_ != null) {
-        size += _single_int32Field_codec.CalculateSizeWithTag(Int32Field);
-      }
-      if (uint32Field_ != null) {
-        size += _single_uint32Field_codec.CalculateSizeWithTag(Uint32Field);
-      }
-      if (boolField_ != null) {
-        size += _single_boolField_codec.CalculateSizeWithTag(BoolField);
-      }
-      if (stringField_ != null) {
-        size += _single_stringField_codec.CalculateSizeWithTag(StringField);
-      }
-      if (bytesField_ != null) {
-        size += _single_bytesField_codec.CalculateSizeWithTag(BytesField);
-      }
-      if (valueField_ != null) {
-        size += 2 + pb::CodedOutputStream.ComputeMessageSize(ValueField);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(TestWellKnownTypes other) {
-      if (other == null) {
-        return;
-      }
-      if (other.anyField_ != null) {
-        if (anyField_ == null) {
-          anyField_ = new global::Google.Protobuf.WellKnownTypes.Any();
-        }
-        AnyField.MergeFrom(other.AnyField);
-      }
-      if (other.apiField_ != null) {
-        if (apiField_ == null) {
-          apiField_ = new global::Google.Protobuf.WellKnownTypes.Api();
-        }
-        ApiField.MergeFrom(other.ApiField);
-      }
-      if (other.durationField_ != null) {
-        if (durationField_ == null) {
-          durationField_ = new global::Google.Protobuf.WellKnownTypes.Duration();
-        }
-        DurationField.MergeFrom(other.DurationField);
-      }
-      if (other.emptyField_ != null) {
-        if (emptyField_ == null) {
-          emptyField_ = new global::Google.Protobuf.WellKnownTypes.Empty();
-        }
-        EmptyField.MergeFrom(other.EmptyField);
-      }
-      if (other.fieldMaskField_ != null) {
-        if (fieldMaskField_ == null) {
-          fieldMaskField_ = new global::Google.Protobuf.WellKnownTypes.FieldMask();
-        }
-        FieldMaskField.MergeFrom(other.FieldMaskField);
-      }
-      if (other.sourceContextField_ != null) {
-        if (sourceContextField_ == null) {
-          sourceContextField_ = new global::Google.Protobuf.WellKnownTypes.SourceContext();
-        }
-        SourceContextField.MergeFrom(other.SourceContextField);
-      }
-      if (other.structField_ != null) {
-        if (structField_ == null) {
-          structField_ = new global::Google.Protobuf.WellKnownTypes.Struct();
-        }
-        StructField.MergeFrom(other.StructField);
-      }
-      if (other.timestampField_ != null) {
-        if (timestampField_ == null) {
-          timestampField_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
-        }
-        TimestampField.MergeFrom(other.TimestampField);
-      }
-      if (other.typeField_ != null) {
-        if (typeField_ == null) {
-          typeField_ = new global::Google.Protobuf.WellKnownTypes.Type();
-        }
-        TypeField.MergeFrom(other.TypeField);
-      }
-      if (other.doubleField_ != null) {
-        if (doubleField_ == null || other.DoubleField != 0D) {
-          DoubleField = other.DoubleField;
-        }
-      }
-      if (other.floatField_ != null) {
-        if (floatField_ == null || other.FloatField != 0F) {
-          FloatField = other.FloatField;
-        }
-      }
-      if (other.int64Field_ != null) {
-        if (int64Field_ == null || other.Int64Field != 0L) {
-          Int64Field = other.Int64Field;
-        }
-      }
-      if (other.uint64Field_ != null) {
-        if (uint64Field_ == null || other.Uint64Field != 0UL) {
-          Uint64Field = other.Uint64Field;
-        }
-      }
-      if (other.int32Field_ != null) {
-        if (int32Field_ == null || other.Int32Field != 0) {
-          Int32Field = other.Int32Field;
-        }
-      }
-      if (other.uint32Field_ != null) {
-        if (uint32Field_ == null || other.Uint32Field != 0) {
-          Uint32Field = other.Uint32Field;
-        }
-      }
-      if (other.boolField_ != null) {
-        if (boolField_ == null || other.BoolField != false) {
-          BoolField = other.BoolField;
-        }
-      }
-      if (other.stringField_ != null) {
-        if (stringField_ == null || other.StringField != "") {
-          StringField = other.StringField;
-        }
-      }
-      if (other.bytesField_ != null) {
-        if (bytesField_ == null || other.BytesField != pb::ByteString.Empty) {
-          BytesField = other.BytesField;
-        }
-      }
-      if (other.valueField_ != null) {
-        if (valueField_ == null) {
-          valueField_ = new global::Google.Protobuf.WellKnownTypes.Value();
-        }
-        ValueField.MergeFrom(other.ValueField);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            if (anyField_ == null) {
-              anyField_ = new global::Google.Protobuf.WellKnownTypes.Any();
-            }
-            input.ReadMessage(anyField_);
-            break;
-          }
-          case 18: {
-            if (apiField_ == null) {
-              apiField_ = new global::Google.Protobuf.WellKnownTypes.Api();
-            }
-            input.ReadMessage(apiField_);
-            break;
-          }
-          case 26: {
-            if (durationField_ == null) {
-              durationField_ = new global::Google.Protobuf.WellKnownTypes.Duration();
-            }
-            input.ReadMessage(durationField_);
-            break;
-          }
-          case 34: {
-            if (emptyField_ == null) {
-              emptyField_ = new global::Google.Protobuf.WellKnownTypes.Empty();
-            }
-            input.ReadMessage(emptyField_);
-            break;
-          }
-          case 42: {
-            if (fieldMaskField_ == null) {
-              fieldMaskField_ = new global::Google.Protobuf.WellKnownTypes.FieldMask();
-            }
-            input.ReadMessage(fieldMaskField_);
-            break;
-          }
-          case 50: {
-            if (sourceContextField_ == null) {
-              sourceContextField_ = new global::Google.Protobuf.WellKnownTypes.SourceContext();
-            }
-            input.ReadMessage(sourceContextField_);
-            break;
-          }
-          case 58: {
-            if (structField_ == null) {
-              structField_ = new global::Google.Protobuf.WellKnownTypes.Struct();
-            }
-            input.ReadMessage(structField_);
-            break;
-          }
-          case 66: {
-            if (timestampField_ == null) {
-              timestampField_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
-            }
-            input.ReadMessage(timestampField_);
-            break;
-          }
-          case 74: {
-            if (typeField_ == null) {
-              typeField_ = new global::Google.Protobuf.WellKnownTypes.Type();
-            }
-            input.ReadMessage(typeField_);
-            break;
-          }
-          case 82: {
-            double? value = _single_doubleField_codec.Read(input);
-            if (doubleField_ == null || value != 0D) {
-              DoubleField = value;
-            }
-            break;
-          }
-          case 90: {
-            float? value = _single_floatField_codec.Read(input);
-            if (floatField_ == null || value != 0F) {
-              FloatField = value;
-            }
-            break;
-          }
-          case 98: {
-            long? value = _single_int64Field_codec.Read(input);
-            if (int64Field_ == null || value != 0L) {
-              Int64Field = value;
-            }
-            break;
-          }
-          case 106: {
-            ulong? value = _single_uint64Field_codec.Read(input);
-            if (uint64Field_ == null || value != 0UL) {
-              Uint64Field = value;
-            }
-            break;
-          }
-          case 114: {
-            int? value = _single_int32Field_codec.Read(input);
-            if (int32Field_ == null || value != 0) {
-              Int32Field = value;
-            }
-            break;
-          }
-          case 122: {
-            uint? value = _single_uint32Field_codec.Read(input);
-            if (uint32Field_ == null || value != 0) {
-              Uint32Field = value;
-            }
-            break;
-          }
-          case 130: {
-            bool? value = _single_boolField_codec.Read(input);
-            if (boolField_ == null || value != false) {
-              BoolField = value;
-            }
-            break;
-          }
-          case 138: {
-            string value = _single_stringField_codec.Read(input);
-            if (stringField_ == null || value != "") {
-              StringField = value;
-            }
-            break;
-          }
-          case 146: {
-            pb::ByteString value = _single_bytesField_codec.Read(input);
-            if (bytesField_ == null || value != pb::ByteString.Empty) {
-              BytesField = value;
-            }
-            break;
-          }
-          case 154: {
-            if (valueField_ == null) {
-              valueField_ = new global::Google.Protobuf.WellKnownTypes.Value();
-            }
-            input.ReadMessage(valueField_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  A repeated field for each well-known type.
-  /// </summary>
-  public sealed partial class RepeatedWellKnownTypes : pb::IMessage<RepeatedWellKnownTypes> {
-    private static readonly pb::MessageParser<RepeatedWellKnownTypes> _parser = new pb::MessageParser<RepeatedWellKnownTypes>(() => new RepeatedWellKnownTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<RepeatedWellKnownTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[1]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public RepeatedWellKnownTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public RepeatedWellKnownTypes(RepeatedWellKnownTypes other) : this() {
-      anyField_ = other.anyField_.Clone();
-      apiField_ = other.apiField_.Clone();
-      durationField_ = other.durationField_.Clone();
-      emptyField_ = other.emptyField_.Clone();
-      fieldMaskField_ = other.fieldMaskField_.Clone();
-      sourceContextField_ = other.sourceContextField_.Clone();
-      structField_ = other.structField_.Clone();
-      timestampField_ = other.timestampField_.Clone();
-      typeField_ = other.typeField_.Clone();
-      doubleField_ = other.doubleField_.Clone();
-      floatField_ = other.floatField_.Clone();
-      int64Field_ = other.int64Field_.Clone();
-      uint64Field_ = other.uint64Field_.Clone();
-      int32Field_ = other.int32Field_.Clone();
-      uint32Field_ = other.uint32Field_.Clone();
-      boolField_ = other.boolField_.Clone();
-      stringField_ = other.stringField_.Clone();
-      bytesField_ = other.bytesField_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public RepeatedWellKnownTypes Clone() {
-      return new RepeatedWellKnownTypes(this);
-    }
-
-    /// <summary>Field number for the "any_field" field.</summary>
-    public const int AnyFieldFieldNumber = 1;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Any> _repeated_anyField_codec
-        = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Any.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any> anyField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any> AnyField {
-      get { return anyField_; }
-    }
-
-    /// <summary>Field number for the "api_field" field.</summary>
-    public const int ApiFieldFieldNumber = 2;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Api> _repeated_apiField_codec
-        = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Api> apiField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Api>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Api> ApiField {
-      get { return apiField_; }
-    }
-
-    /// <summary>Field number for the "duration_field" field.</summary>
-    public const int DurationFieldFieldNumber = 3;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Duration> _repeated_durationField_codec
-        = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Duration.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Duration> durationField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Duration>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Duration> DurationField {
-      get { return durationField_; }
-    }
-
-    /// <summary>Field number for the "empty_field" field.</summary>
-    public const int EmptyFieldFieldNumber = 4;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Empty> _repeated_emptyField_codec
-        = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Empty.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Empty> emptyField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Empty>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Empty> EmptyField {
-      get { return emptyField_; }
-    }
-
-    /// <summary>Field number for the "field_mask_field" field.</summary>
-    public const int FieldMaskFieldFieldNumber = 5;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.FieldMask> _repeated_fieldMaskField_codec
-        = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.FieldMask> fieldMaskField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.FieldMask>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.FieldMask> FieldMaskField {
-      get { return fieldMaskField_; }
-    }
-
-    /// <summary>Field number for the "source_context_field" field.</summary>
-    public const int SourceContextFieldFieldNumber = 6;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.SourceContext> _repeated_sourceContextField_codec
-        = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.SourceContext> sourceContextField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.SourceContext>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.SourceContext> SourceContextField {
-      get { return sourceContextField_; }
-    }
-
-    /// <summary>Field number for the "struct_field" field.</summary>
-    public const int StructFieldFieldNumber = 7;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Struct> _repeated_structField_codec
-        = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.WellKnownTypes.Struct.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Struct> structField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Struct>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Struct> StructField {
-      get { return structField_; }
-    }
-
-    /// <summary>Field number for the "timestamp_field" field.</summary>
-    public const int TimestampFieldFieldNumber = 8;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Timestamp> _repeated_timestampField_codec
-        = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Timestamp> timestampField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Timestamp>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Timestamp> TimestampField {
-      get { return timestampField_; }
-    }
-
-    /// <summary>Field number for the "type_field" field.</summary>
-    public const int TypeFieldFieldNumber = 9;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Type> _repeated_typeField_codec
-        = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Type.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Type> typeField_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Type>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Type> TypeField {
-      get { return typeField_; }
-    }
-
-    /// <summary>Field number for the "double_field" field.</summary>
-    public const int DoubleFieldFieldNumber = 10;
-    private static readonly pb::FieldCodec<double?> _repeated_doubleField_codec
-        = pb::FieldCodec.ForStructWrapper<double>(82);
-    private readonly pbc::RepeatedField<double?> doubleField_ = new pbc::RepeatedField<double?>();
-    /// <summary>
-    ///  These don't actually make a lot of sense, but they're not prohibited...
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<double?> DoubleField {
-      get { return doubleField_; }
-    }
-
-    /// <summary>Field number for the "float_field" field.</summary>
-    public const int FloatFieldFieldNumber = 11;
-    private static readonly pb::FieldCodec<float?> _repeated_floatField_codec
-        = pb::FieldCodec.ForStructWrapper<float>(90);
-    private readonly pbc::RepeatedField<float?> floatField_ = new pbc::RepeatedField<float?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<float?> FloatField {
-      get { return floatField_; }
-    }
-
-    /// <summary>Field number for the "int64_field" field.</summary>
-    public const int Int64FieldFieldNumber = 12;
-    private static readonly pb::FieldCodec<long?> _repeated_int64Field_codec
-        = pb::FieldCodec.ForStructWrapper<long>(98);
-    private readonly pbc::RepeatedField<long?> int64Field_ = new pbc::RepeatedField<long?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<long?> Int64Field {
-      get { return int64Field_; }
-    }
-
-    /// <summary>Field number for the "uint64_field" field.</summary>
-    public const int Uint64FieldFieldNumber = 13;
-    private static readonly pb::FieldCodec<ulong?> _repeated_uint64Field_codec
-        = pb::FieldCodec.ForStructWrapper<ulong>(106);
-    private readonly pbc::RepeatedField<ulong?> uint64Field_ = new pbc::RepeatedField<ulong?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<ulong?> Uint64Field {
-      get { return uint64Field_; }
-    }
-
-    /// <summary>Field number for the "int32_field" field.</summary>
-    public const int Int32FieldFieldNumber = 14;
-    private static readonly pb::FieldCodec<int?> _repeated_int32Field_codec
-        = pb::FieldCodec.ForStructWrapper<int>(114);
-    private readonly pbc::RepeatedField<int?> int32Field_ = new pbc::RepeatedField<int?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int?> Int32Field {
-      get { return int32Field_; }
-    }
-
-    /// <summary>Field number for the "uint32_field" field.</summary>
-    public const int Uint32FieldFieldNumber = 15;
-    private static readonly pb::FieldCodec<uint?> _repeated_uint32Field_codec
-        = pb::FieldCodec.ForStructWrapper<uint>(122);
-    private readonly pbc::RepeatedField<uint?> uint32Field_ = new pbc::RepeatedField<uint?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<uint?> Uint32Field {
-      get { return uint32Field_; }
-    }
-
-    /// <summary>Field number for the "bool_field" field.</summary>
-    public const int BoolFieldFieldNumber = 16;
-    private static readonly pb::FieldCodec<bool?> _repeated_boolField_codec
-        = pb::FieldCodec.ForStructWrapper<bool>(130);
-    private readonly pbc::RepeatedField<bool?> boolField_ = new pbc::RepeatedField<bool?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<bool?> BoolField {
-      get { return boolField_; }
-    }
-
-    /// <summary>Field number for the "string_field" field.</summary>
-    public const int StringFieldFieldNumber = 17;
-    private static readonly pb::FieldCodec<string> _repeated_stringField_codec
-        = pb::FieldCodec.ForClassWrapper<string>(138);
-    private readonly pbc::RepeatedField<string> stringField_ = new pbc::RepeatedField<string>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<string> StringField {
-      get { return stringField_; }
-    }
-
-    /// <summary>Field number for the "bytes_field" field.</summary>
-    public const int BytesFieldFieldNumber = 18;
-    private static readonly pb::FieldCodec<pb::ByteString> _repeated_bytesField_codec
-        = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
-    private readonly pbc::RepeatedField<pb::ByteString> bytesField_ = new pbc::RepeatedField<pb::ByteString>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<pb::ByteString> BytesField {
-      get { return bytesField_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as RepeatedWellKnownTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(RepeatedWellKnownTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!anyField_.Equals(other.anyField_)) return false;
-      if(!apiField_.Equals(other.apiField_)) return false;
-      if(!durationField_.Equals(other.durationField_)) return false;
-      if(!emptyField_.Equals(other.emptyField_)) return false;
-      if(!fieldMaskField_.Equals(other.fieldMaskField_)) return false;
-      if(!sourceContextField_.Equals(other.sourceContextField_)) return false;
-      if(!structField_.Equals(other.structField_)) return false;
-      if(!timestampField_.Equals(other.timestampField_)) return false;
-      if(!typeField_.Equals(other.typeField_)) return false;
-      if(!doubleField_.Equals(other.doubleField_)) return false;
-      if(!floatField_.Equals(other.floatField_)) return false;
-      if(!int64Field_.Equals(other.int64Field_)) return false;
-      if(!uint64Field_.Equals(other.uint64Field_)) return false;
-      if(!int32Field_.Equals(other.int32Field_)) return false;
-      if(!uint32Field_.Equals(other.uint32Field_)) return false;
-      if(!boolField_.Equals(other.boolField_)) return false;
-      if(!stringField_.Equals(other.stringField_)) return false;
-      if(!bytesField_.Equals(other.bytesField_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= anyField_.GetHashCode();
-      hash ^= apiField_.GetHashCode();
-      hash ^= durationField_.GetHashCode();
-      hash ^= emptyField_.GetHashCode();
-      hash ^= fieldMaskField_.GetHashCode();
-      hash ^= sourceContextField_.GetHashCode();
-      hash ^= structField_.GetHashCode();
-      hash ^= timestampField_.GetHashCode();
-      hash ^= typeField_.GetHashCode();
-      hash ^= doubleField_.GetHashCode();
-      hash ^= floatField_.GetHashCode();
-      hash ^= int64Field_.GetHashCode();
-      hash ^= uint64Field_.GetHashCode();
-      hash ^= int32Field_.GetHashCode();
-      hash ^= uint32Field_.GetHashCode();
-      hash ^= boolField_.GetHashCode();
-      hash ^= stringField_.GetHashCode();
-      hash ^= bytesField_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      anyField_.WriteTo(output, _repeated_anyField_codec);
-      apiField_.WriteTo(output, _repeated_apiField_codec);
-      durationField_.WriteTo(output, _repeated_durationField_codec);
-      emptyField_.WriteTo(output, _repeated_emptyField_codec);
-      fieldMaskField_.WriteTo(output, _repeated_fieldMaskField_codec);
-      sourceContextField_.WriteTo(output, _repeated_sourceContextField_codec);
-      structField_.WriteTo(output, _repeated_structField_codec);
-      timestampField_.WriteTo(output, _repeated_timestampField_codec);
-      typeField_.WriteTo(output, _repeated_typeField_codec);
-      doubleField_.WriteTo(output, _repeated_doubleField_codec);
-      floatField_.WriteTo(output, _repeated_floatField_codec);
-      int64Field_.WriteTo(output, _repeated_int64Field_codec);
-      uint64Field_.WriteTo(output, _repeated_uint64Field_codec);
-      int32Field_.WriteTo(output, _repeated_int32Field_codec);
-      uint32Field_.WriteTo(output, _repeated_uint32Field_codec);
-      boolField_.WriteTo(output, _repeated_boolField_codec);
-      stringField_.WriteTo(output, _repeated_stringField_codec);
-      bytesField_.WriteTo(output, _repeated_bytesField_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += anyField_.CalculateSize(_repeated_anyField_codec);
-      size += apiField_.CalculateSize(_repeated_apiField_codec);
-      size += durationField_.CalculateSize(_repeated_durationField_codec);
-      size += emptyField_.CalculateSize(_repeated_emptyField_codec);
-      size += fieldMaskField_.CalculateSize(_repeated_fieldMaskField_codec);
-      size += sourceContextField_.CalculateSize(_repeated_sourceContextField_codec);
-      size += structField_.CalculateSize(_repeated_structField_codec);
-      size += timestampField_.CalculateSize(_repeated_timestampField_codec);
-      size += typeField_.CalculateSize(_repeated_typeField_codec);
-      size += doubleField_.CalculateSize(_repeated_doubleField_codec);
-      size += floatField_.CalculateSize(_repeated_floatField_codec);
-      size += int64Field_.CalculateSize(_repeated_int64Field_codec);
-      size += uint64Field_.CalculateSize(_repeated_uint64Field_codec);
-      size += int32Field_.CalculateSize(_repeated_int32Field_codec);
-      size += uint32Field_.CalculateSize(_repeated_uint32Field_codec);
-      size += boolField_.CalculateSize(_repeated_boolField_codec);
-      size += stringField_.CalculateSize(_repeated_stringField_codec);
-      size += bytesField_.CalculateSize(_repeated_bytesField_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(RepeatedWellKnownTypes other) {
-      if (other == null) {
-        return;
-      }
-      anyField_.Add(other.anyField_);
-      apiField_.Add(other.apiField_);
-      durationField_.Add(other.durationField_);
-      emptyField_.Add(other.emptyField_);
-      fieldMaskField_.Add(other.fieldMaskField_);
-      sourceContextField_.Add(other.sourceContextField_);
-      structField_.Add(other.structField_);
-      timestampField_.Add(other.timestampField_);
-      typeField_.Add(other.typeField_);
-      doubleField_.Add(other.doubleField_);
-      floatField_.Add(other.floatField_);
-      int64Field_.Add(other.int64Field_);
-      uint64Field_.Add(other.uint64Field_);
-      int32Field_.Add(other.int32Field_);
-      uint32Field_.Add(other.uint32Field_);
-      boolField_.Add(other.boolField_);
-      stringField_.Add(other.stringField_);
-      bytesField_.Add(other.bytesField_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            anyField_.AddEntriesFrom(input, _repeated_anyField_codec);
-            break;
-          }
-          case 18: {
-            apiField_.AddEntriesFrom(input, _repeated_apiField_codec);
-            break;
-          }
-          case 26: {
-            durationField_.AddEntriesFrom(input, _repeated_durationField_codec);
-            break;
-          }
-          case 34: {
-            emptyField_.AddEntriesFrom(input, _repeated_emptyField_codec);
-            break;
-          }
-          case 42: {
-            fieldMaskField_.AddEntriesFrom(input, _repeated_fieldMaskField_codec);
-            break;
-          }
-          case 50: {
-            sourceContextField_.AddEntriesFrom(input, _repeated_sourceContextField_codec);
-            break;
-          }
-          case 58: {
-            structField_.AddEntriesFrom(input, _repeated_structField_codec);
-            break;
-          }
-          case 66: {
-            timestampField_.AddEntriesFrom(input, _repeated_timestampField_codec);
-            break;
-          }
-          case 74: {
-            typeField_.AddEntriesFrom(input, _repeated_typeField_codec);
-            break;
-          }
-          case 82: {
-            doubleField_.AddEntriesFrom(input, _repeated_doubleField_codec);
-            break;
-          }
-          case 90: {
-            floatField_.AddEntriesFrom(input, _repeated_floatField_codec);
-            break;
-          }
-          case 98: {
-            int64Field_.AddEntriesFrom(input, _repeated_int64Field_codec);
-            break;
-          }
-          case 106: {
-            uint64Field_.AddEntriesFrom(input, _repeated_uint64Field_codec);
-            break;
-          }
-          case 114: {
-            int32Field_.AddEntriesFrom(input, _repeated_int32Field_codec);
-            break;
-          }
-          case 122: {
-            uint32Field_.AddEntriesFrom(input, _repeated_uint32Field_codec);
-            break;
-          }
-          case 130: {
-            boolField_.AddEntriesFrom(input, _repeated_boolField_codec);
-            break;
-          }
-          case 138: {
-            stringField_.AddEntriesFrom(input, _repeated_stringField_codec);
-            break;
-          }
-          case 146: {
-            bytesField_.AddEntriesFrom(input, _repeated_bytesField_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  public sealed partial class OneofWellKnownTypes : pb::IMessage<OneofWellKnownTypes> {
-    private static readonly pb::MessageParser<OneofWellKnownTypes> _parser = new pb::MessageParser<OneofWellKnownTypes>(() => new OneofWellKnownTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<OneofWellKnownTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[2]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofWellKnownTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofWellKnownTypes(OneofWellKnownTypes other) : this() {
-      switch (other.OneofFieldCase) {
-        case OneofFieldOneofCase.AnyField:
-          AnyField = other.AnyField.Clone();
-          break;
-        case OneofFieldOneofCase.ApiField:
-          ApiField = other.ApiField.Clone();
-          break;
-        case OneofFieldOneofCase.DurationField:
-          DurationField = other.DurationField.Clone();
-          break;
-        case OneofFieldOneofCase.EmptyField:
-          EmptyField = other.EmptyField.Clone();
-          break;
-        case OneofFieldOneofCase.FieldMaskField:
-          FieldMaskField = other.FieldMaskField.Clone();
-          break;
-        case OneofFieldOneofCase.SourceContextField:
-          SourceContextField = other.SourceContextField.Clone();
-          break;
-        case OneofFieldOneofCase.StructField:
-          StructField = other.StructField.Clone();
-          break;
-        case OneofFieldOneofCase.TimestampField:
-          TimestampField = other.TimestampField.Clone();
-          break;
-        case OneofFieldOneofCase.TypeField:
-          TypeField = other.TypeField.Clone();
-          break;
-        case OneofFieldOneofCase.DoubleField:
-          DoubleField = other.DoubleField;
-          break;
-        case OneofFieldOneofCase.FloatField:
-          FloatField = other.FloatField;
-          break;
-        case OneofFieldOneofCase.Int64Field:
-          Int64Field = other.Int64Field;
-          break;
-        case OneofFieldOneofCase.Uint64Field:
-          Uint64Field = other.Uint64Field;
-          break;
-        case OneofFieldOneofCase.Int32Field:
-          Int32Field = other.Int32Field;
-          break;
-        case OneofFieldOneofCase.Uint32Field:
-          Uint32Field = other.Uint32Field;
-          break;
-        case OneofFieldOneofCase.BoolField:
-          BoolField = other.BoolField;
-          break;
-        case OneofFieldOneofCase.StringField:
-          StringField = other.StringField;
-          break;
-        case OneofFieldOneofCase.BytesField:
-          BytesField = other.BytesField;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofWellKnownTypes Clone() {
-      return new OneofWellKnownTypes(this);
-    }
-
-    /// <summary>Field number for the "any_field" field.</summary>
-    public const int AnyFieldFieldNumber = 1;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Any AnyField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.AnyField ? (global::Google.Protobuf.WellKnownTypes.Any) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.AnyField;
-      }
-    }
-
-    /// <summary>Field number for the "api_field" field.</summary>
-    public const int ApiFieldFieldNumber = 2;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Api ApiField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.ApiField ? (global::Google.Protobuf.WellKnownTypes.Api) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.ApiField;
-      }
-    }
-
-    /// <summary>Field number for the "duration_field" field.</summary>
-    public const int DurationFieldFieldNumber = 3;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Duration DurationField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.DurationField ? (global::Google.Protobuf.WellKnownTypes.Duration) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.DurationField;
-      }
-    }
-
-    /// <summary>Field number for the "empty_field" field.</summary>
-    public const int EmptyFieldFieldNumber = 4;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Empty EmptyField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.EmptyField ? (global::Google.Protobuf.WellKnownTypes.Empty) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.EmptyField;
-      }
-    }
-
-    /// <summary>Field number for the "field_mask_field" field.</summary>
-    public const int FieldMaskFieldFieldNumber = 5;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField ? (global::Google.Protobuf.WellKnownTypes.FieldMask) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.FieldMaskField;
-      }
-    }
-
-    /// <summary>Field number for the "source_context_field" field.</summary>
-    public const int SourceContextFieldFieldNumber = 6;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.SourceContextField ? (global::Google.Protobuf.WellKnownTypes.SourceContext) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.SourceContextField;
-      }
-    }
-
-    /// <summary>Field number for the "struct_field" field.</summary>
-    public const int StructFieldFieldNumber = 7;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Struct StructField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.StructField ? (global::Google.Protobuf.WellKnownTypes.Struct) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.StructField;
-      }
-    }
-
-    /// <summary>Field number for the "timestamp_field" field.</summary>
-    public const int TimestampFieldFieldNumber = 8;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.TimestampField ? (global::Google.Protobuf.WellKnownTypes.Timestamp) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.TimestampField;
-      }
-    }
-
-    /// <summary>Field number for the "type_field" field.</summary>
-    public const int TypeFieldFieldNumber = 9;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.WellKnownTypes.Type TypeField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.TypeField ? (global::Google.Protobuf.WellKnownTypes.Type) oneofField_ : null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.TypeField;
-      }
-    }
-
-    /// <summary>Field number for the "double_field" field.</summary>
-    public const int DoubleFieldFieldNumber = 10;
-    private static readonly pb::FieldCodec<double?> _oneof_doubleField_codec = pb::FieldCodec.ForStructWrapper<double>(82);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public double? DoubleField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.DoubleField ? (double?) oneofField_ : (double?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.DoubleField;
-      }
-    }
-
-    /// <summary>Field number for the "float_field" field.</summary>
-    public const int FloatFieldFieldNumber = 11;
-    private static readonly pb::FieldCodec<float?> _oneof_floatField_codec = pb::FieldCodec.ForStructWrapper<float>(90);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public float? FloatField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.FloatField ? (float?) oneofField_ : (float?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.FloatField;
-      }
-    }
-
-    /// <summary>Field number for the "int64_field" field.</summary>
-    public const int Int64FieldFieldNumber = 12;
-    private static readonly pb::FieldCodec<long?> _oneof_int64Field_codec = pb::FieldCodec.ForStructWrapper<long>(98);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long? Int64Field {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.Int64Field ? (long?) oneofField_ : (long?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Int64Field;
-      }
-    }
-
-    /// <summary>Field number for the "uint64_field" field.</summary>
-    public const int Uint64FieldFieldNumber = 13;
-    private static readonly pb::FieldCodec<ulong?> _oneof_uint64Field_codec = pb::FieldCodec.ForStructWrapper<ulong>(106);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ulong? Uint64Field {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.Uint64Field ? (ulong?) oneofField_ : (ulong?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Uint64Field;
-      }
-    }
-
-    /// <summary>Field number for the "int32_field" field.</summary>
-    public const int Int32FieldFieldNumber = 14;
-    private static readonly pb::FieldCodec<int?> _oneof_int32Field_codec = pb::FieldCodec.ForStructWrapper<int>(114);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int? Int32Field {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.Int32Field ? (int?) oneofField_ : (int?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Int32Field;
-      }
-    }
-
-    /// <summary>Field number for the "uint32_field" field.</summary>
-    public const int Uint32FieldFieldNumber = 15;
-    private static readonly pb::FieldCodec<uint?> _oneof_uint32Field_codec = pb::FieldCodec.ForStructWrapper<uint>(122);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public uint? Uint32Field {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.Uint32Field ? (uint?) oneofField_ : (uint?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.Uint32Field;
-      }
-    }
-
-    /// <summary>Field number for the "bool_field" field.</summary>
-    public const int BoolFieldFieldNumber = 16;
-    private static readonly pb::FieldCodec<bool?> _oneof_boolField_codec = pb::FieldCodec.ForStructWrapper<bool>(130);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool? BoolField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.BoolField ? (bool?) oneofField_ : (bool?) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.BoolField;
-      }
-    }
-
-    /// <summary>Field number for the "string_field" field.</summary>
-    public const int StringFieldFieldNumber = 17;
-    private static readonly pb::FieldCodec<string> _oneof_stringField_codec = pb::FieldCodec.ForClassWrapper<string>(138);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string StringField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.StringField ? (string) oneofField_ : (string) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.StringField;
-      }
-    }
-
-    /// <summary>Field number for the "bytes_field" field.</summary>
-    public const int BytesFieldFieldNumber = 18;
-    private static readonly pb::FieldCodec<pb::ByteString> _oneof_bytesField_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString BytesField {
-      get { return oneofFieldCase_ == OneofFieldOneofCase.BytesField ? (pb::ByteString) oneofField_ : (pb::ByteString) null; }
-      set {
-        oneofField_ = value;
-        oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.BytesField;
-      }
-    }
-
-    private object oneofField_;
-    /// <summary>Enum of possible cases for the "oneof_field" oneof.</summary>
-    public enum OneofFieldOneofCase {
-      None = 0,
-      AnyField = 1,
-      ApiField = 2,
-      DurationField = 3,
-      EmptyField = 4,
-      FieldMaskField = 5,
-      SourceContextField = 6,
-      StructField = 7,
-      TimestampField = 8,
-      TypeField = 9,
-      DoubleField = 10,
-      FloatField = 11,
-      Int64Field = 12,
-      Uint64Field = 13,
-      Int32Field = 14,
-      Uint32Field = 15,
-      BoolField = 16,
-      StringField = 17,
-      BytesField = 18,
-    }
-    private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofFieldOneofCase OneofFieldCase {
-      get { return oneofFieldCase_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void ClearOneofField() {
-      oneofFieldCase_ = OneofFieldOneofCase.None;
-      oneofField_ = null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as OneofWellKnownTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(OneofWellKnownTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!object.Equals(AnyField, other.AnyField)) return false;
-      if (!object.Equals(ApiField, other.ApiField)) return false;
-      if (!object.Equals(DurationField, other.DurationField)) return false;
-      if (!object.Equals(EmptyField, other.EmptyField)) return false;
-      if (!object.Equals(FieldMaskField, other.FieldMaskField)) return false;
-      if (!object.Equals(SourceContextField, other.SourceContextField)) return false;
-      if (!object.Equals(StructField, other.StructField)) return false;
-      if (!object.Equals(TimestampField, other.TimestampField)) return false;
-      if (!object.Equals(TypeField, other.TypeField)) return false;
-      if (DoubleField != other.DoubleField) return false;
-      if (FloatField != other.FloatField) return false;
-      if (Int64Field != other.Int64Field) return false;
-      if (Uint64Field != other.Uint64Field) return false;
-      if (Int32Field != other.Int32Field) return false;
-      if (Uint32Field != other.Uint32Field) return false;
-      if (BoolField != other.BoolField) return false;
-      if (StringField != other.StringField) return false;
-      if (BytesField != other.BytesField) return false;
-      if (OneofFieldCase != other.OneofFieldCase) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) hash ^= AnyField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.ApiField) hash ^= ApiField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.DurationField) hash ^= DurationField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.EmptyField) hash ^= EmptyField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField) hash ^= FieldMaskField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.SourceContextField) hash ^= SourceContextField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.StructField) hash ^= StructField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) hash ^= TimestampField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) hash ^= TypeField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) hash ^= DoubleField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) hash ^= FloatField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.Int64Field) hash ^= Int64Field.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.Uint64Field) hash ^= Uint64Field.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.Int32Field) hash ^= Int32Field.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.Uint32Field) hash ^= Uint32Field.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.BoolField) hash ^= BoolField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.StringField) hash ^= StringField.GetHashCode();
-      if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) hash ^= BytesField.GetHashCode();
-      hash ^= (int) oneofFieldCase_;
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) {
-        output.WriteRawTag(10);
-        output.WriteMessage(AnyField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.ApiField) {
-        output.WriteRawTag(18);
-        output.WriteMessage(ApiField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.DurationField) {
-        output.WriteRawTag(26);
-        output.WriteMessage(DurationField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.EmptyField) {
-        output.WriteRawTag(34);
-        output.WriteMessage(EmptyField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField) {
-        output.WriteRawTag(42);
-        output.WriteMessage(FieldMaskField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.SourceContextField) {
-        output.WriteRawTag(50);
-        output.WriteMessage(SourceContextField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.StructField) {
-        output.WriteRawTag(58);
-        output.WriteMessage(StructField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) {
-        output.WriteRawTag(66);
-        output.WriteMessage(TimestampField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) {
-        output.WriteRawTag(74);
-        output.WriteMessage(TypeField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) {
-        _oneof_doubleField_codec.WriteTagAndValue(output, (double?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) {
-        _oneof_floatField_codec.WriteTagAndValue(output, (float?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Int64Field) {
-        _oneof_int64Field_codec.WriteTagAndValue(output, (long?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Uint64Field) {
-        _oneof_uint64Field_codec.WriteTagAndValue(output, (ulong?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Int32Field) {
-        _oneof_int32Field_codec.WriteTagAndValue(output, (int?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Uint32Field) {
-        _oneof_uint32Field_codec.WriteTagAndValue(output, (uint?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.BoolField) {
-        _oneof_boolField_codec.WriteTagAndValue(output, (bool?) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.StringField) {
-        _oneof_stringField_codec.WriteTagAndValue(output, (string) oneofField_);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) {
-        _oneof_bytesField_codec.WriteTagAndValue(output, (pb::ByteString) oneofField_);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(AnyField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.ApiField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(ApiField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.DurationField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(DurationField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.EmptyField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(EmptyField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(FieldMaskField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.SourceContextField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContextField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.StructField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(TimestampField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(TypeField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.DoubleField) {
-        size += _oneof_doubleField_codec.CalculateSizeWithTag(DoubleField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.FloatField) {
-        size += _oneof_floatField_codec.CalculateSizeWithTag(FloatField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Int64Field) {
-        size += _oneof_int64Field_codec.CalculateSizeWithTag(Int64Field);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Uint64Field) {
-        size += _oneof_uint64Field_codec.CalculateSizeWithTag(Uint64Field);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Int32Field) {
-        size += _oneof_int32Field_codec.CalculateSizeWithTag(Int32Field);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.Uint32Field) {
-        size += _oneof_uint32Field_codec.CalculateSizeWithTag(Uint32Field);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.BoolField) {
-        size += _oneof_boolField_codec.CalculateSizeWithTag(BoolField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.StringField) {
-        size += _oneof_stringField_codec.CalculateSizeWithTag(StringField);
-      }
-      if (oneofFieldCase_ == OneofFieldOneofCase.BytesField) {
-        size += _oneof_bytesField_codec.CalculateSizeWithTag(BytesField);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(OneofWellKnownTypes other) {
-      if (other == null) {
-        return;
-      }
-      switch (other.OneofFieldCase) {
-        case OneofFieldOneofCase.AnyField:
-          AnyField = other.AnyField;
-          break;
-        case OneofFieldOneofCase.ApiField:
-          ApiField = other.ApiField;
-          break;
-        case OneofFieldOneofCase.DurationField:
-          DurationField = other.DurationField;
-          break;
-        case OneofFieldOneofCase.EmptyField:
-          EmptyField = other.EmptyField;
-          break;
-        case OneofFieldOneofCase.FieldMaskField:
-          FieldMaskField = other.FieldMaskField;
-          break;
-        case OneofFieldOneofCase.SourceContextField:
-          SourceContextField = other.SourceContextField;
-          break;
-        case OneofFieldOneofCase.StructField:
-          StructField = other.StructField;
-          break;
-        case OneofFieldOneofCase.TimestampField:
-          TimestampField = other.TimestampField;
-          break;
-        case OneofFieldOneofCase.TypeField:
-          TypeField = other.TypeField;
-          break;
-        case OneofFieldOneofCase.DoubleField:
-          DoubleField = other.DoubleField;
-          break;
-        case OneofFieldOneofCase.FloatField:
-          FloatField = other.FloatField;
-          break;
-        case OneofFieldOneofCase.Int64Field:
-          Int64Field = other.Int64Field;
-          break;
-        case OneofFieldOneofCase.Uint64Field:
-          Uint64Field = other.Uint64Field;
-          break;
-        case OneofFieldOneofCase.Int32Field:
-          Int32Field = other.Int32Field;
-          break;
-        case OneofFieldOneofCase.Uint32Field:
-          Uint32Field = other.Uint32Field;
-          break;
-        case OneofFieldOneofCase.BoolField:
-          BoolField = other.BoolField;
-          break;
-        case OneofFieldOneofCase.StringField:
-          StringField = other.StringField;
-          break;
-        case OneofFieldOneofCase.BytesField:
-          BytesField = other.BytesField;
-          break;
-      }
-
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            global::Google.Protobuf.WellKnownTypes.Any subBuilder = new global::Google.Protobuf.WellKnownTypes.Any();
-            if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) {
-              subBuilder.MergeFrom(AnyField);
-            }
-            input.ReadMessage(subBuilder);
-            AnyField = subBuilder;
-            break;
-          }
-          case 18: {
-            global::Google.Protobuf.WellKnownTypes.Api subBuilder = new global::Google.Protobuf.WellKnownTypes.Api();
-            if (oneofFieldCase_ == OneofFieldOneofCase.ApiField) {
-              subBuilder.MergeFrom(ApiField);
-            }
-            input.ReadMessage(subBuilder);
-            ApiField = subBuilder;
-            break;
-          }
-          case 26: {
-            global::Google.Protobuf.WellKnownTypes.Duration subBuilder = new global::Google.Protobuf.WellKnownTypes.Duration();
-            if (oneofFieldCase_ == OneofFieldOneofCase.DurationField) {
-              subBuilder.MergeFrom(DurationField);
-            }
-            input.ReadMessage(subBuilder);
-            DurationField = subBuilder;
-            break;
-          }
-          case 34: {
-            global::Google.Protobuf.WellKnownTypes.Empty subBuilder = new global::Google.Protobuf.WellKnownTypes.Empty();
-            if (oneofFieldCase_ == OneofFieldOneofCase.EmptyField) {
-              subBuilder.MergeFrom(EmptyField);
-            }
-            input.ReadMessage(subBuilder);
-            EmptyField = subBuilder;
-            break;
-          }
-          case 42: {
-            global::Google.Protobuf.WellKnownTypes.FieldMask subBuilder = new global::Google.Protobuf.WellKnownTypes.FieldMask();
-            if (oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField) {
-              subBuilder.MergeFrom(FieldMaskField);
-            }
-            input.ReadMessage(subBuilder);
-            FieldMaskField = subBuilder;
-            break;
-          }
-          case 50: {
-            global::Google.Protobuf.WellKnownTypes.SourceContext subBuilder = new global::Google.Protobuf.WellKnownTypes.SourceContext();
-            if (oneofFieldCase_ == OneofFieldOneofCase.SourceContextField) {
-              subBuilder.MergeFrom(SourceContextField);
-            }
-            input.ReadMessage(subBuilder);
-            SourceContextField = subBuilder;
-            break;
-          }
-          case 58: {
-            global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct();
-            if (oneofFieldCase_ == OneofFieldOneofCase.StructField) {
-              subBuilder.MergeFrom(StructField);
-            }
-            input.ReadMessage(subBuilder);
-            StructField = subBuilder;
-            break;
-          }
-          case 66: {
-            global::Google.Protobuf.WellKnownTypes.Timestamp subBuilder = new global::Google.Protobuf.WellKnownTypes.Timestamp();
-            if (oneofFieldCase_ == OneofFieldOneofCase.TimestampField) {
-              subBuilder.MergeFrom(TimestampField);
-            }
-            input.ReadMessage(subBuilder);
-            TimestampField = subBuilder;
-            break;
-          }
-          case 74: {
-            global::Google.Protobuf.WellKnownTypes.Type subBuilder = new global::Google.Protobuf.WellKnownTypes.Type();
-            if (oneofFieldCase_ == OneofFieldOneofCase.TypeField) {
-              subBuilder.MergeFrom(TypeField);
-            }
-            input.ReadMessage(subBuilder);
-            TypeField = subBuilder;
-            break;
-          }
-          case 82: {
-            DoubleField = _oneof_doubleField_codec.Read(input);
-            break;
-          }
-          case 90: {
-            FloatField = _oneof_floatField_codec.Read(input);
-            break;
-          }
-          case 98: {
-            Int64Field = _oneof_int64Field_codec.Read(input);
-            break;
-          }
-          case 106: {
-            Uint64Field = _oneof_uint64Field_codec.Read(input);
-            break;
-          }
-          case 114: {
-            Int32Field = _oneof_int32Field_codec.Read(input);
-            break;
-          }
-          case 122: {
-            Uint32Field = _oneof_uint32Field_codec.Read(input);
-            break;
-          }
-          case 130: {
-            BoolField = _oneof_boolField_codec.Read(input);
-            break;
-          }
-          case 138: {
-            StringField = _oneof_stringField_codec.Read(input);
-            break;
-          }
-          case 146: {
-            BytesField = _oneof_bytesField_codec.Read(input);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  A map field for each well-known type. We only
-  ///  need to worry about the value part of the map being the
-  ///  well-known types, as messages can't be map keys.
-  /// </summary>
-  public sealed partial class MapWellKnownTypes : pb::IMessage<MapWellKnownTypes> {
-    private static readonly pb::MessageParser<MapWellKnownTypes> _parser = new pb::MessageParser<MapWellKnownTypes>(() => new MapWellKnownTypes());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MapWellKnownTypes> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[3]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MapWellKnownTypes() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MapWellKnownTypes(MapWellKnownTypes other) : this() {
-      anyField_ = other.anyField_.Clone();
-      apiField_ = other.apiField_.Clone();
-      durationField_ = other.durationField_.Clone();
-      emptyField_ = other.emptyField_.Clone();
-      fieldMaskField_ = other.fieldMaskField_.Clone();
-      sourceContextField_ = other.sourceContextField_.Clone();
-      structField_ = other.structField_.Clone();
-      timestampField_ = other.timestampField_.Clone();
-      typeField_ = other.typeField_.Clone();
-      doubleField_ = other.doubleField_.Clone();
-      floatField_ = other.floatField_.Clone();
-      int64Field_ = other.int64Field_.Clone();
-      uint64Field_ = other.uint64Field_.Clone();
-      int32Field_ = other.int32Field_.Clone();
-      uint32Field_ = other.uint32Field_.Clone();
-      boolField_ = other.boolField_.Clone();
-      stringField_ = other.stringField_.Clone();
-      bytesField_ = other.bytesField_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MapWellKnownTypes Clone() {
-      return new MapWellKnownTypes(this);
-    }
-
-    /// <summary>Field number for the "any_field" field.</summary>
-    public const int AnyFieldFieldNumber = 1;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec _map_anyField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any> anyField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Any> AnyField {
-      get { return anyField_; }
-    }
-
-    /// <summary>Field number for the "api_field" field.</summary>
-    public const int ApiFieldFieldNumber = 2;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api>.Codec _map_apiField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser), 18);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api> apiField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Api> ApiField {
-      get { return apiField_; }
-    }
-
-    /// <summary>Field number for the "duration_field" field.</summary>
-    public const int DurationFieldFieldNumber = 3;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration>.Codec _map_durationField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Duration.Parser), 26);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration> durationField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Duration> DurationField {
-      get { return durationField_; }
-    }
-
-    /// <summary>Field number for the "empty_field" field.</summary>
-    public const int EmptyFieldFieldNumber = 4;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty>.Codec _map_emptyField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Empty.Parser), 34);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty> emptyField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Empty> EmptyField {
-      get { return emptyField_; }
-    }
-
-    /// <summary>Field number for the "field_mask_field" field.</summary>
-    public const int FieldMaskFieldFieldNumber = 5;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask>.Codec _map_fieldMaskField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser), 42);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask> fieldMaskField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.FieldMask> FieldMaskField {
-      get { return fieldMaskField_; }
-    }
-
-    /// <summary>Field number for the "source_context_field" field.</summary>
-    public const int SourceContextFieldFieldNumber = 6;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext>.Codec _map_sourceContextField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser), 50);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext> sourceContextField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.SourceContext> SourceContextField {
-      get { return sourceContextField_; }
-    }
-
-    /// <summary>Field number for the "struct_field" field.</summary>
-    public const int StructFieldFieldNumber = 7;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct>.Codec _map_structField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Struct.Parser), 58);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct> structField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Struct> StructField {
-      get { return structField_; }
-    }
-
-    /// <summary>Field number for the "timestamp_field" field.</summary>
-    public const int TimestampFieldFieldNumber = 8;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp>.Codec _map_timestampField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser), 66);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp> timestampField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Timestamp> TimestampField {
-      get { return timestampField_; }
-    }
-
-    /// <summary>Field number for the "type_field" field.</summary>
-    public const int TypeFieldFieldNumber = 9;
-    private static readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type>.Codec _map_typeField_codec
-        = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Type.Parser), 74);
-    private readonly pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type> typeField_ = new pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, global::Google.Protobuf.WellKnownTypes.Type> TypeField {
-      get { return typeField_; }
-    }
-
-    /// <summary>Field number for the "double_field" field.</summary>
-    public const int DoubleFieldFieldNumber = 10;
-    private static readonly pbc::MapField<int, double?>.Codec _map_doubleField_codec
-        = new pbc::MapField<int, double?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<double>(18), 82);
-    private readonly pbc::MapField<int, double?> doubleField_ = new pbc::MapField<int, double?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, double?> DoubleField {
-      get { return doubleField_; }
-    }
-
-    /// <summary>Field number for the "float_field" field.</summary>
-    public const int FloatFieldFieldNumber = 11;
-    private static readonly pbc::MapField<int, float?>.Codec _map_floatField_codec
-        = new pbc::MapField<int, float?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<float>(18), 90);
-    private readonly pbc::MapField<int, float?> floatField_ = new pbc::MapField<int, float?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, float?> FloatField {
-      get { return floatField_; }
-    }
-
-    /// <summary>Field number for the "int64_field" field.</summary>
-    public const int Int64FieldFieldNumber = 12;
-    private static readonly pbc::MapField<int, long?>.Codec _map_int64Field_codec
-        = new pbc::MapField<int, long?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<long>(18), 98);
-    private readonly pbc::MapField<int, long?> int64Field_ = new pbc::MapField<int, long?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, long?> Int64Field {
-      get { return int64Field_; }
-    }
-
-    /// <summary>Field number for the "uint64_field" field.</summary>
-    public const int Uint64FieldFieldNumber = 13;
-    private static readonly pbc::MapField<int, ulong?>.Codec _map_uint64Field_codec
-        = new pbc::MapField<int, ulong?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<ulong>(18), 106);
-    private readonly pbc::MapField<int, ulong?> uint64Field_ = new pbc::MapField<int, ulong?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, ulong?> Uint64Field {
-      get { return uint64Field_; }
-    }
-
-    /// <summary>Field number for the "int32_field" field.</summary>
-    public const int Int32FieldFieldNumber = 14;
-    private static readonly pbc::MapField<int, int?>.Codec _map_int32Field_codec
-        = new pbc::MapField<int, int?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<int>(18), 114);
-    private readonly pbc::MapField<int, int?> int32Field_ = new pbc::MapField<int, int?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, int?> Int32Field {
-      get { return int32Field_; }
-    }
-
-    /// <summary>Field number for the "uint32_field" field.</summary>
-    public const int Uint32FieldFieldNumber = 15;
-    private static readonly pbc::MapField<int, uint?>.Codec _map_uint32Field_codec
-        = new pbc::MapField<int, uint?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<uint>(18), 122);
-    private readonly pbc::MapField<int, uint?> uint32Field_ = new pbc::MapField<int, uint?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, uint?> Uint32Field {
-      get { return uint32Field_; }
-    }
-
-    /// <summary>Field number for the "bool_field" field.</summary>
-    public const int BoolFieldFieldNumber = 16;
-    private static readonly pbc::MapField<int, bool?>.Codec _map_boolField_codec
-        = new pbc::MapField<int, bool?>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper<bool>(18), 130);
-    private readonly pbc::MapField<int, bool?> boolField_ = new pbc::MapField<int, bool?>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, bool?> BoolField {
-      get { return boolField_; }
-    }
-
-    /// <summary>Field number for the "string_field" field.</summary>
-    public const int StringFieldFieldNumber = 17;
-    private static readonly pbc::MapField<int, string>.Codec _map_stringField_codec
-        = new pbc::MapField<int, string>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper<string>(18), 138);
-    private readonly pbc::MapField<int, string> stringField_ = new pbc::MapField<int, string>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, string> StringField {
-      get { return stringField_; }
-    }
-
-    /// <summary>Field number for the "bytes_field" field.</summary>
-    public const int BytesFieldFieldNumber = 18;
-    private static readonly pbc::MapField<int, pb::ByteString>.Codec _map_bytesField_codec
-        = new pbc::MapField<int, pb::ByteString>.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper<pb::ByteString>(18), 146);
-    private readonly pbc::MapField<int, pb::ByteString> bytesField_ = new pbc::MapField<int, pb::ByteString>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::MapField<int, pb::ByteString> BytesField {
-      get { return bytesField_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MapWellKnownTypes);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MapWellKnownTypes other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (!AnyField.Equals(other.AnyField)) return false;
-      if (!ApiField.Equals(other.ApiField)) return false;
-      if (!DurationField.Equals(other.DurationField)) return false;
-      if (!EmptyField.Equals(other.EmptyField)) return false;
-      if (!FieldMaskField.Equals(other.FieldMaskField)) return false;
-      if (!SourceContextField.Equals(other.SourceContextField)) return false;
-      if (!StructField.Equals(other.StructField)) return false;
-      if (!TimestampField.Equals(other.TimestampField)) return false;
-      if (!TypeField.Equals(other.TypeField)) return false;
-      if (!DoubleField.Equals(other.DoubleField)) return false;
-      if (!FloatField.Equals(other.FloatField)) return false;
-      if (!Int64Field.Equals(other.Int64Field)) return false;
-      if (!Uint64Field.Equals(other.Uint64Field)) return false;
-      if (!Int32Field.Equals(other.Int32Field)) return false;
-      if (!Uint32Field.Equals(other.Uint32Field)) return false;
-      if (!BoolField.Equals(other.BoolField)) return false;
-      if (!StringField.Equals(other.StringField)) return false;
-      if (!BytesField.Equals(other.BytesField)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= AnyField.GetHashCode();
-      hash ^= ApiField.GetHashCode();
-      hash ^= DurationField.GetHashCode();
-      hash ^= EmptyField.GetHashCode();
-      hash ^= FieldMaskField.GetHashCode();
-      hash ^= SourceContextField.GetHashCode();
-      hash ^= StructField.GetHashCode();
-      hash ^= TimestampField.GetHashCode();
-      hash ^= TypeField.GetHashCode();
-      hash ^= DoubleField.GetHashCode();
-      hash ^= FloatField.GetHashCode();
-      hash ^= Int64Field.GetHashCode();
-      hash ^= Uint64Field.GetHashCode();
-      hash ^= Int32Field.GetHashCode();
-      hash ^= Uint32Field.GetHashCode();
-      hash ^= BoolField.GetHashCode();
-      hash ^= StringField.GetHashCode();
-      hash ^= BytesField.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      anyField_.WriteTo(output, _map_anyField_codec);
-      apiField_.WriteTo(output, _map_apiField_codec);
-      durationField_.WriteTo(output, _map_durationField_codec);
-      emptyField_.WriteTo(output, _map_emptyField_codec);
-      fieldMaskField_.WriteTo(output, _map_fieldMaskField_codec);
-      sourceContextField_.WriteTo(output, _map_sourceContextField_codec);
-      structField_.WriteTo(output, _map_structField_codec);
-      timestampField_.WriteTo(output, _map_timestampField_codec);
-      typeField_.WriteTo(output, _map_typeField_codec);
-      doubleField_.WriteTo(output, _map_doubleField_codec);
-      floatField_.WriteTo(output, _map_floatField_codec);
-      int64Field_.WriteTo(output, _map_int64Field_codec);
-      uint64Field_.WriteTo(output, _map_uint64Field_codec);
-      int32Field_.WriteTo(output, _map_int32Field_codec);
-      uint32Field_.WriteTo(output, _map_uint32Field_codec);
-      boolField_.WriteTo(output, _map_boolField_codec);
-      stringField_.WriteTo(output, _map_stringField_codec);
-      bytesField_.WriteTo(output, _map_bytesField_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += anyField_.CalculateSize(_map_anyField_codec);
-      size += apiField_.CalculateSize(_map_apiField_codec);
-      size += durationField_.CalculateSize(_map_durationField_codec);
-      size += emptyField_.CalculateSize(_map_emptyField_codec);
-      size += fieldMaskField_.CalculateSize(_map_fieldMaskField_codec);
-      size += sourceContextField_.CalculateSize(_map_sourceContextField_codec);
-      size += structField_.CalculateSize(_map_structField_codec);
-      size += timestampField_.CalculateSize(_map_timestampField_codec);
-      size += typeField_.CalculateSize(_map_typeField_codec);
-      size += doubleField_.CalculateSize(_map_doubleField_codec);
-      size += floatField_.CalculateSize(_map_floatField_codec);
-      size += int64Field_.CalculateSize(_map_int64Field_codec);
-      size += uint64Field_.CalculateSize(_map_uint64Field_codec);
-      size += int32Field_.CalculateSize(_map_int32Field_codec);
-      size += uint32Field_.CalculateSize(_map_uint32Field_codec);
-      size += boolField_.CalculateSize(_map_boolField_codec);
-      size += stringField_.CalculateSize(_map_stringField_codec);
-      size += bytesField_.CalculateSize(_map_bytesField_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MapWellKnownTypes other) {
-      if (other == null) {
-        return;
-      }
-      anyField_.Add(other.anyField_);
-      apiField_.Add(other.apiField_);
-      durationField_.Add(other.durationField_);
-      emptyField_.Add(other.emptyField_);
-      fieldMaskField_.Add(other.fieldMaskField_);
-      sourceContextField_.Add(other.sourceContextField_);
-      structField_.Add(other.structField_);
-      timestampField_.Add(other.timestampField_);
-      typeField_.Add(other.typeField_);
-      doubleField_.Add(other.doubleField_);
-      floatField_.Add(other.floatField_);
-      int64Field_.Add(other.int64Field_);
-      uint64Field_.Add(other.uint64Field_);
-      int32Field_.Add(other.int32Field_);
-      uint32Field_.Add(other.uint32Field_);
-      boolField_.Add(other.boolField_);
-      stringField_.Add(other.stringField_);
-      bytesField_.Add(other.bytesField_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            anyField_.AddEntriesFrom(input, _map_anyField_codec);
-            break;
-          }
-          case 18: {
-            apiField_.AddEntriesFrom(input, _map_apiField_codec);
-            break;
-          }
-          case 26: {
-            durationField_.AddEntriesFrom(input, _map_durationField_codec);
-            break;
-          }
-          case 34: {
-            emptyField_.AddEntriesFrom(input, _map_emptyField_codec);
-            break;
-          }
-          case 42: {
-            fieldMaskField_.AddEntriesFrom(input, _map_fieldMaskField_codec);
-            break;
-          }
-          case 50: {
-            sourceContextField_.AddEntriesFrom(input, _map_sourceContextField_codec);
-            break;
-          }
-          case 58: {
-            structField_.AddEntriesFrom(input, _map_structField_codec);
-            break;
-          }
-          case 66: {
-            timestampField_.AddEntriesFrom(input, _map_timestampField_codec);
-            break;
-          }
-          case 74: {
-            typeField_.AddEntriesFrom(input, _map_typeField_codec);
-            break;
-          }
-          case 82: {
-            doubleField_.AddEntriesFrom(input, _map_doubleField_codec);
-            break;
-          }
-          case 90: {
-            floatField_.AddEntriesFrom(input, _map_floatField_codec);
-            break;
-          }
-          case 98: {
-            int64Field_.AddEntriesFrom(input, _map_int64Field_codec);
-            break;
-          }
-          case 106: {
-            uint64Field_.AddEntriesFrom(input, _map_uint64Field_codec);
-            break;
-          }
-          case 114: {
-            int32Field_.AddEntriesFrom(input, _map_int32Field_codec);
-            break;
-          }
-          case 122: {
-            uint32Field_.AddEntriesFrom(input, _map_uint32Field_codec);
-            break;
-          }
-          case 130: {
-            boolField_.AddEntriesFrom(input, _map_boolField_codec);
-            break;
-          }
-          case 138: {
-            stringField_.AddEntriesFrom(input, _map_stringField_codec);
-            break;
-          }
-          case 146: {
-            bytesField_.AddEntriesFrom(input, _map_bytesField_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 116
csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs

@@ -1,116 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.TestProtos;
-using NUnit.Framework;
-
-namespace Google.Protobuf.WellKnownTypes
-{
-    public class AnyTest
-    {
-        [Test]
-        public void Pack()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message);
-            Assert.AreEqual("type.googleapis.com/protobuf_unittest.TestAllTypes", any.TypeUrl);
-            Assert.AreEqual(message.CalculateSize(), any.Value.Length);
-        }
-
-        [Test]
-        public void Pack_WithCustomPrefix()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message, "foo.bar/baz");
-            Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl);
-            Assert.AreEqual(message.CalculateSize(), any.Value.Length);
-        }
-
-        [Test]
-        public void Pack_WithCustomPrefixTrailingSlash()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message, "foo.bar/baz/");
-            Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl);
-            Assert.AreEqual(message.CalculateSize(), any.Value.Length);
-        }
-
-        [Test]
-        public void Unpack_WrongType()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message);
-            Assert.Throws<InvalidProtocolBufferException>(() => any.Unpack<TestOneof>());
-        }
-
-        [Test]
-        public void Unpack_Success()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message);
-            var unpacked = any.Unpack<TestAllTypes>();
-            Assert.AreEqual(message, unpacked);
-        }
-
-        [Test]
-        public void Unpack_CustomPrefix_Success()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message, "foo.bar/baz");
-            var unpacked = any.Unpack<TestAllTypes>();
-            Assert.AreEqual(message, unpacked);
-        }
-
-        [Test]
-        public void ToString_WithValues()
-        {
-            var message = SampleMessages.CreateFullTestAllTypes();
-            var any = Any.Pack(message);
-            var text = any.ToString();
-            Assert.That(text, Does.Contain("\"@value\": \"" + message.ToByteString().ToBase64() + "\""));
-        }
-
-        [Test]
-        public void ToString_Empty()
-        {
-            var any = new Any();
-            Assert.AreEqual("{ \"@type\": \"\", \"@value\": \"\" }", any.ToString());
-        }
-
-        [Test]
-        public void ToString_MessageContainingAny()
-        {
-            var message = new TestWellKnownTypes { AnyField = new Any() };
-            Assert.AreEqual("{ \"anyField\": { \"@type\": \"\", \"@value\": \"\" } }", message.ToString());
-        }
-    }
-}

+ 0 - 132
csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs

@@ -1,132 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-using System;
-
-namespace Google.Protobuf.WellKnownTypes
-{
-    public class DurationTest
-    {
-        [Test]
-        public void ToTimeSpan()
-        {
-            Assert.AreEqual(TimeSpan.FromSeconds(1), new Duration { Seconds = 1 }.ToTimeSpan());
-            Assert.AreEqual(TimeSpan.FromSeconds(-1), new Duration { Seconds = -1 }.ToTimeSpan());
-            Assert.AreEqual(TimeSpan.FromMilliseconds(1), new Duration { Nanos = 1000000 }.ToTimeSpan());
-            Assert.AreEqual(TimeSpan.FromMilliseconds(-1), new Duration { Nanos = -1000000 }.ToTimeSpan());
-            Assert.AreEqual(TimeSpan.FromTicks(1), new Duration { Nanos = 100 }.ToTimeSpan());
-            Assert.AreEqual(TimeSpan.FromTicks(-1), new Duration { Nanos = -100 }.ToTimeSpan());
-
-            // Rounding is towards 0
-            Assert.AreEqual(TimeSpan.FromTicks(2), new Duration { Nanos = 250 }.ToTimeSpan());
-            Assert.AreEqual(TimeSpan.FromTicks(-2), new Duration { Nanos = -250 }.ToTimeSpan());
-        }
-
-        [Test]
-        public void Addition()
-        {
-            Assert.AreEqual(new Duration { Seconds = 2, Nanos = 100000000 },
-                new Duration { Seconds = 1, Nanos = 600000000 } + new Duration { Nanos = 500000000 });
-            Assert.AreEqual(new Duration { Seconds = -2, Nanos = -100000000 },
-                new Duration { Seconds = -1, Nanos = -600000000 } + new Duration { Nanos = -500000000 });
-            Assert.AreEqual(new Duration { Seconds = 1, Nanos = 100000000 },
-                new Duration { Seconds = 1, Nanos = 600000000 } + new Duration { Nanos = -500000000 });
-
-            // Non-normalized durations, or non-normalized intermediate results
-            Assert.AreEqual(new Duration { Seconds = 1 },
-                new Duration { Seconds = 1, Nanos = -500000000 } + new Duration { Nanos = 500000000 });
-
-            Assert.AreEqual(new Duration { Nanos = -900000000 },
-                new Duration { Seconds = -1, Nanos = -100000000 } + new Duration { Nanos = 200000000 });
-            Assert.AreEqual(new Duration { Nanos = 900000000 },
-                new Duration { Seconds = 1, Nanos = 100000000 } + new Duration { Nanos = -200000000 });
-        }
-
-        [Test]
-        public void Subtraction()
-        {
-            Assert.AreEqual(new Duration { Seconds = 1, Nanos = 100000000 },
-                new Duration { Seconds = 1, Nanos = 600000000 } - new Duration { Nanos = 500000000 });
-            Assert.AreEqual(new Duration { Seconds = -1, Nanos = -100000000 },
-                new Duration { Seconds = -1, Nanos = -600000000 } - new Duration { Nanos = -500000000 });
-            Assert.AreEqual(new Duration { Seconds = 2, Nanos = 100000000 },
-                new Duration { Seconds = 1, Nanos = 600000000 } - new Duration { Nanos = -500000000 });
-
-            // Non-normalized durations
-            Assert.AreEqual(new Duration(),
-                new Duration { Seconds = 1, Nanos = -500000000 } - new Duration { Nanos = 500000000 });
-            Assert.AreEqual(new Duration { Seconds = 1 },
-                new Duration { Nanos = 2000000000 } - new Duration { Nanos = 1000000000 });
-        }
-
-        [Test]
-        public void FromTimeSpan()
-        {
-            Assert.AreEqual(new Duration { Seconds = 1 }, Duration.FromTimeSpan(TimeSpan.FromSeconds(1)));
-            Assert.AreEqual(new Duration { Nanos = Duration.NanosecondsPerTick }, Duration.FromTimeSpan(TimeSpan.FromTicks(1)));
-        }
-
-        [Test]
-        [TestCase(0, Duration.MaxNanoseconds + 1)]
-        [TestCase(0, Duration.MinNanoseconds - 1)]
-        [TestCase(Duration.MinSeconds - 1, 0)]
-        [TestCase(Duration.MaxSeconds + 1, 0)]
-        [TestCase(1, -1)]
-        [TestCase(-1, 1)]
-        public void ToTimeSpan_Invalid(long seconds, int nanoseconds)
-        {
-            var duration = new Duration { Seconds = seconds, Nanos = nanoseconds };
-            Assert.Throws<InvalidOperationException>(() => duration.ToTimeSpan());
-        }
-
-        [Test]
-        [TestCase(0, Duration.MaxNanoseconds)]
-        [TestCase(0, Duration.MinNanoseconds)]
-        [TestCase(Duration.MinSeconds, Duration.MinNanoseconds)]
-        [TestCase(Duration.MaxSeconds, Duration.MaxNanoseconds)]
-        public void ToTimeSpan_Valid(long seconds, int nanoseconds)
-        {
-            // Only testing that these values don't throw, unlike their similar tests in ToTimeSpan_Invalid
-            var duration = new Duration { Seconds = seconds, Nanos = nanoseconds };
-            duration.ToTimeSpan();
-        }
-
-        [Test]
-        public void ToString_NonNormalized()
-        {
-            // Just a single example should be sufficient...
-            var duration = new Duration { Seconds = 1, Nanos = -1 };
-            Assert.AreEqual("{ \"@warning\": \"Invalid Duration\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString());
-        }
-    }
-}

+ 0 - 62
csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs

@@ -1,62 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2016 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-
-namespace Google.Protobuf.WellKnownTypes
-{
-    public class FieldMaskTest
-    {
-        [Test]
-        [TestCase("foo__bar")]
-        [TestCase("foo_3_ar")]
-        [TestCase("fooBar")]
-        public void ToString_Invalid(string input)
-        {
-            var mask = new FieldMask { Paths = { input } };
-            var text = mask.ToString();
-            // More specific test below
-            Assert.That(text, Does.Contain("@warning"));
-            Assert.That(text, Does.Contain(input));
-        }
-
-        [Test]
-        public void ToString_Invalid_Precise()
-        {
-            var mask = new FieldMask { Paths = { "x", "foo__bar", @"x\y" } };
-            Assert.AreEqual(
-                "{ \"@warning\": \"Invalid FieldMask\", \"paths\": [ \"x\", \"foo__bar\", \"x\\\\y\" ] }",
-                mask.ToString());
-        }
-    }
-}

+ 0 - 115
csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs

@@ -1,115 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 NUnit.Framework;
-using System;
-
-namespace Google.Protobuf.WellKnownTypes
-{
-    public class TimestampTest
-    {
-        [Test]
-        public void FromAndToDateTime()
-        {
-            DateTime utcMin = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);
-            DateTime utcMax = DateTime.SpecifyKind(DateTime.MaxValue, DateTimeKind.Utc);
-            AssertRoundtrip(new Timestamp { Seconds = -62135596800 }, utcMin);
-            AssertRoundtrip(new Timestamp { Seconds = 253402300799, Nanos = 999999900 }, utcMax);
-            AssertRoundtrip(new Timestamp(), new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc));
-            AssertRoundtrip(new Timestamp { Nanos = 1000000}, new DateTime(1970, 1, 1, 0, 0, 0, 1, DateTimeKind.Utc));
-            AssertRoundtrip(new Timestamp { Seconds = -1, Nanos = 999000000 }, new DateTime(1969, 12, 31, 23, 59, 59, 999, DateTimeKind.Utc));
-            AssertRoundtrip(new Timestamp { Seconds = 3600 }, new DateTime(1970, 1, 1, 1, 0, 0, DateTimeKind.Utc));
-            AssertRoundtrip(new Timestamp { Seconds = -3600 }, new DateTime(1969, 12, 31, 23, 0, 0, DateTimeKind.Utc));
-        }
-
-        [Test]
-        public void ToDateTimeTruncation()
-        {
-            var t1 = new Timestamp { Seconds = 1, Nanos = 1000000 + Duration.NanosecondsPerTick - 1 };
-            Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc).AddMilliseconds(1), t1.ToDateTime());
-
-            var t2 = new Timestamp { Seconds = -1, Nanos = 1000000 + Duration.NanosecondsPerTick - 1 };
-            Assert.AreEqual(new DateTime(1969, 12, 31, 23, 59, 59).AddMilliseconds(1), t2.ToDateTime());
-        }
-
-        [Test]
-        [TestCase(Timestamp.UnixSecondsAtBclMinValue - 1, Timestamp.MaxNanos)]
-        [TestCase(Timestamp.UnixSecondsAtBclMaxValue + 1, 0)]
-        [TestCase(0, -1)]
-        [TestCase(0, Timestamp.MaxNanos + 1)]
-        public void ToDateTime_OutOfRange(long seconds, int nanoseconds)
-        {
-            var value = new Timestamp { Seconds = seconds, Nanos = nanoseconds };
-            Assert.Throws<InvalidOperationException>(() => value.ToDateTime());
-        }
-
-        // 1ns larger or smaller than the above values
-        [Test]
-        [TestCase(Timestamp.UnixSecondsAtBclMinValue, 0)]
-        [TestCase(Timestamp.UnixSecondsAtBclMaxValue, Timestamp.MaxNanos)]
-        [TestCase(0, 0)]
-        [TestCase(0, Timestamp.MaxNanos)]
-        public void ToDateTime_ValidBoundaries(long seconds, int nanoseconds)
-        {
-            var value = new Timestamp { Seconds = seconds, Nanos = nanoseconds };
-            value.ToDateTime();
-        }
-
-        private static void AssertRoundtrip(Timestamp timestamp, DateTime dateTime)
-        {
-            Assert.AreEqual(timestamp, Timestamp.FromDateTime(dateTime));
-            Assert.AreEqual(dateTime, timestamp.ToDateTime());
-            Assert.AreEqual(DateTimeKind.Utc, timestamp.ToDateTime().Kind);
-        }
-
-        [Test]
-        public void Arithmetic()
-        {
-            Timestamp t1 = new Timestamp { Seconds = 10000, Nanos = 5000 };
-            Timestamp t2 = new Timestamp { Seconds = 8000, Nanos = 10000 };
-            Duration difference = new Duration { Seconds = 1999, Nanos = Duration.NanosecondsPerSecond - 5000 };
-            Assert.AreEqual(difference, t1 - t2);
-            Assert.AreEqual(-difference, t2 - t1);
-            
-            Assert.AreEqual(t1, t2 + difference);
-            Assert.AreEqual(t2, t1 - difference);
-        }
-
-        [Test]
-        public void ToString_NonNormalized()
-        {
-            // Just a single example should be sufficient...
-            var duration = new Timestamp { Seconds = 1, Nanos = -1 };
-            Assert.AreEqual("{ \"@warning\": \"Invalid Timestamp\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString());
-        }
-    }
-}

+ 0 - 421
csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs

@@ -1,421 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.TestProtos;
-using NUnit.Framework;
-using System.Collections;
-using System.IO;
-
-namespace Google.Protobuf.WellKnownTypes
-{
-    public class WrappersTest
-    {
-        [Test]
-        public void NullIsDefault()
-        {
-            var message = new TestWellKnownTypes();
-            Assert.IsNull(message.StringField);
-            Assert.IsNull(message.BytesField);
-            Assert.IsNull(message.BoolField);
-            Assert.IsNull(message.FloatField);
-            Assert.IsNull(message.DoubleField);
-            Assert.IsNull(message.Int32Field);
-            Assert.IsNull(message.Int64Field);
-            Assert.IsNull(message.Uint32Field);
-            Assert.IsNull(message.Uint64Field);
-        }
-
-        [Test]
-        public void NonDefaultSingleValues()
-        {
-            var message = new TestWellKnownTypes
-            {
-                StringField = "x",
-                BytesField = ByteString.CopyFrom(1, 2, 3),
-                BoolField = true,
-                FloatField = 12.5f,
-                DoubleField = 12.25d,
-                Int32Field = 1,
-                Int64Field = 2,
-                Uint32Field = 3,
-                Uint64Field = 4
-            };
-
-            var bytes = message.ToByteArray();
-            var parsed = TestWellKnownTypes.Parser.ParseFrom(bytes);
-
-            Assert.AreEqual("x", parsed.StringField);
-            Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), parsed.BytesField);
-            Assert.AreEqual(true, parsed.BoolField);
-            Assert.AreEqual(12.5f, parsed.FloatField);
-            Assert.AreEqual(12.25d, parsed.DoubleField);
-            Assert.AreEqual(1, parsed.Int32Field);
-            Assert.AreEqual(2L, parsed.Int64Field);
-            Assert.AreEqual(3U, parsed.Uint32Field);
-            Assert.AreEqual(4UL, parsed.Uint64Field);
-        }
-
-        [Test]
-        public void NonNullDefaultIsPreservedThroughSerialization()
-        {
-            var message = new TestWellKnownTypes
-            {
-                StringField = "",
-                BytesField = ByteString.Empty,
-                BoolField = false,
-                FloatField = 0f,
-                DoubleField = 0d,
-                Int32Field = 0,
-                Int64Field = 0,
-                Uint32Field = 0,
-                Uint64Field = 0
-            };
-
-            var bytes = message.ToByteArray();
-            var parsed = TestWellKnownTypes.Parser.ParseFrom(bytes);
-
-            Assert.AreEqual("", parsed.StringField);
-            Assert.AreEqual(ByteString.Empty, parsed.BytesField);
-            Assert.AreEqual(false, parsed.BoolField);
-            Assert.AreEqual(0f, parsed.FloatField);
-            Assert.AreEqual(0d, parsed.DoubleField);
-            Assert.AreEqual(0, parsed.Int32Field);
-            Assert.AreEqual(0L, parsed.Int64Field);
-            Assert.AreEqual(0U, parsed.Uint32Field);
-            Assert.AreEqual(0UL, parsed.Uint64Field);
-        }
-
-        [Test]
-        public void RepeatedWrappersProhibitNullItems()
-        {
-            var message = new RepeatedWellKnownTypes();
-            Assert.Throws<ArgumentNullException>(() => message.BoolField.Add((bool?) null));
-            Assert.Throws<ArgumentNullException>(() => message.Int32Field.Add((int?) null));
-            Assert.Throws<ArgumentNullException>(() => message.StringField.Add((string) null));
-            Assert.Throws<ArgumentNullException>(() => message.BytesField.Add((ByteString) null));
-        }
-
-        [Test]
-        public void RepeatedWrappersSerializeDeserialize()
-        {
-            var message = new RepeatedWellKnownTypes
-            {
-                BoolField = { true, false },
-                BytesField = { ByteString.CopyFrom(1, 2, 3), ByteString.CopyFrom(4, 5, 6), ByteString.Empty },
-                DoubleField = { 12.5, -1.5, 0d },
-                FloatField = { 123.25f, -20f, 0f },
-                Int32Field = { int.MaxValue, int.MinValue, 0 },
-                Int64Field = { long.MaxValue, long.MinValue, 0L },                
-                StringField = { "First", "Second", "" },
-                Uint32Field = { uint.MaxValue, uint.MinValue, 0U },
-                Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL },
-            };
-            var bytes = message.ToByteArray();
-            var parsed = RepeatedWellKnownTypes.Parser.ParseFrom(bytes);
-
-            Assert.AreEqual(message, parsed);
-            // Just to test a single value for sanity...
-            Assert.AreEqual("Second", message.StringField[1]);
-        }
-
-        [Test]
-        public void RepeatedWrappersBinaryFormat()
-        {
-            // At one point we accidentally used a packed format for repeated wrappers, which is wrong (and weird).
-            // This test is just to prove that we use the right format.
-
-            var rawOutput = new MemoryStream();
-            var output = new CodedOutputStream(rawOutput);
-            // Write a value of 5
-            output.WriteTag(RepeatedWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(2);
-            output.WriteTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint);
-            output.WriteInt32(5);
-            // Write a value of 0 (empty message)
-            output.WriteTag(RepeatedWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited);
-            output.WriteLength(0);
-            output.Flush();
-            var expectedBytes = rawOutput.ToArray();
-
-            var message = new RepeatedWellKnownTypes { Int32Field = { 5, 0 } };
-            var actualBytes = message.ToByteArray();
-            Assert.AreEqual(expectedBytes, actualBytes);
-        }
-
-        [Test]
-        public void MapWrappersSerializeDeserialize()
-        {
-            // Note: no null values here, as they are prohibited in map fields
-            // (despite being representable).
-            var message = new MapWellKnownTypes
-            {
-                BoolField = { { 10, false }, { 20, true } },
-                BytesField = {
-                    { -1, ByteString.CopyFrom(1, 2, 3) },
-                    { 10, ByteString.CopyFrom(4, 5, 6) },
-                    { 1000, ByteString.Empty },
-                },
-                DoubleField = { { 1, 12.5 }, { 10, -1.5 }, { 20, 0d } },
-                FloatField = { { 2, 123.25f }, { 3, -20f }, { 4, 0f } },
-                Int32Field = { { 5, int.MaxValue }, { 6, int.MinValue }, { 7, 0 } },
-                Int64Field = { { 8, long.MaxValue }, { 9, long.MinValue }, { 10, 0L } },
-                StringField = { { 11, "First" }, { 12, "Second" }, { 13, "" } },
-                Uint32Field = { { 15, uint.MaxValue }, { 16, uint.MinValue }, { 17, 0U } },
-                Uint64Field = { { 18, ulong.MaxValue }, { 19, ulong.MinValue }, { 20, 0UL } },
-            };
-
-            var bytes = message.ToByteArray();
-            var parsed = MapWellKnownTypes.Parser.ParseFrom(bytes);
-
-            Assert.AreEqual(message, parsed);
-            // Just to test a single value for sanity...
-            Assert.AreEqual("Second", message.StringField[12]);
-        }
-
-        [Test]
-        public void Reflection_SingleValues()
-        {
-            var message = new TestWellKnownTypes
-            {
-                StringField = "x",
-                BytesField = ByteString.CopyFrom(1, 2, 3),
-                BoolField = true,
-                FloatField = 12.5f,
-                DoubleField = 12.25d,
-                Int32Field = 1,
-                Int64Field = 2,
-                Uint32Field = 3,
-                Uint64Field = 4
-            };
-            var fields = TestWellKnownTypes.Descriptor.Fields;
-
-            Assert.AreEqual("x", fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), fields[TestWellKnownTypes.BytesFieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(true, fields[TestWellKnownTypes.BoolFieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(12.5f, fields[TestWellKnownTypes.FloatFieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(12.25d, fields[TestWellKnownTypes.DoubleFieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(1, fields[TestWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(2L, fields[TestWellKnownTypes.Int64FieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(3U, fields[TestWellKnownTypes.Uint32FieldFieldNumber].Accessor.GetValue(message));
-            Assert.AreEqual(4UL, fields[TestWellKnownTypes.Uint64FieldFieldNumber].Accessor.GetValue(message));
-
-            // And a couple of null fields...
-            message.StringField = null;
-            message.FloatField = null;
-            Assert.IsNull(fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.GetValue(message));
-            Assert.IsNull(fields[TestWellKnownTypes.FloatFieldFieldNumber].Accessor.GetValue(message));
-        }
-
-        [Test]
-        public void Reflection_RepeatedFields()
-        {
-            // Just a single example... note that we can't have a null value here
-            var message = new RepeatedWellKnownTypes { Int32Field = { 1, 2 } };
-            var fields = RepeatedWellKnownTypes.Descriptor.Fields;
-            var list = (IList) fields[RepeatedWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message);
-            CollectionAssert.AreEqual(new[] { 1, 2 }, list);
-        }
-
-        [Test]
-        public void Reflection_MapFields()
-        {
-            // Just a single example... note that we can't have a null value here despite the value type being int?
-            var message = new MapWellKnownTypes { Int32Field = { { 1, 2 } } };
-            var fields = MapWellKnownTypes.Descriptor.Fields;
-            var dictionary = (IDictionary) fields[MapWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message);
-            Assert.AreEqual(2, dictionary[1]);
-        }
-
-        [Test]
-        public void Oneof()
-        {
-            var message = new OneofWellKnownTypes { EmptyField = new Empty() };
-            // Start off with a non-wrapper
-            Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.EmptyField, message.OneofFieldCase);
-            AssertOneofRoundTrip(message);
-
-            message.StringField = "foo";
-            Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.StringField, message.OneofFieldCase);
-            AssertOneofRoundTrip(message);
-
-            message.StringField = "foo";
-            Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.StringField, message.OneofFieldCase);
-            AssertOneofRoundTrip(message);
-
-            message.DoubleField = 0.0f;
-            Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.DoubleField, message.OneofFieldCase);
-            AssertOneofRoundTrip(message);
-
-            message.DoubleField = 1.0f;
-            Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.DoubleField, message.OneofFieldCase);
-            AssertOneofRoundTrip(message);
-
-            message.ClearOneofField();
-            Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
-            AssertOneofRoundTrip(message);
-        }
-
-        private void AssertOneofRoundTrip(OneofWellKnownTypes message)
-        {
-            // Normal roundtrip, but explicitly checking the case...
-            var bytes = message.ToByteArray();
-            var parsed = OneofWellKnownTypes.Parser.ParseFrom(bytes);
-            Assert.AreEqual(message, parsed);
-            Assert.AreEqual(message.OneofFieldCase, parsed.OneofFieldCase);
-        }
-
-        [Test]
-        [TestCase("x", "y", "y")]
-        [TestCase("x", "", "x")]
-        [TestCase("x", null, "x")]
-        [TestCase("", "y", "y")]
-        [TestCase("", "", "")]
-        [TestCase("", null, "")]
-        [TestCase(null, "y", "y")]
-        [TestCase(null, "", "")]
-        [TestCase(null, null, null)]
-        public void Merging(string original, string merged, string expected)
-        {
-            var originalMessage = new TestWellKnownTypes { StringField = original };
-            var mergingMessage = new TestWellKnownTypes { StringField = merged };
-            originalMessage.MergeFrom(mergingMessage);
-            Assert.AreEqual(expected, originalMessage.StringField);
-
-            // Try it using MergeFrom(CodedInputStream) too...
-            originalMessage = new TestWellKnownTypes { StringField = original };
-            originalMessage.MergeFrom(mergingMessage.ToByteArray());
-            Assert.AreEqual(expected, originalMessage.StringField);
-        }
-
-        // Merging is odd with wrapper types, due to the way that default values aren't emitted in
-        // the binary stream. In fact we cheat a little bit - a message with an explicitly present default
-        // value will have that default value ignored. See issue 615. Fixing this would require significant upheaval to
-        // the FieldCodec side of things.
-        [Test]
-        public void MergingStreamExplicitValue()
-        {
-            var message = new TestWellKnownTypes { Int32Field = 5 };
-
-            // Create a byte array which has the data of an Int32Value explicitly containing a value of 0.
-            // This wouldn't normally happen.
-            byte[] bytes;
-            var wrapperTag = WireFormat.MakeTag(TestWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited);
-            var valueTag = WireFormat.MakeTag(Int32Value.ValueFieldNumber, WireFormat.WireType.Varint);
-            using (var stream = new MemoryStream())
-            {
-                var coded = new CodedOutputStream(stream);
-                coded.WriteTag(wrapperTag);
-                coded.WriteLength(2); // valueTag + a value 0, each one byte
-                coded.WriteTag(valueTag);
-                coded.WriteInt32(0);
-                coded.Flush();
-                bytes = stream.ToArray();
-            }
-
-            message.MergeFrom(bytes);
-            // A normal implementation would have 0 now, as the explicit default would have been overwritten the 5.
-            // With the FieldCodec for Nullable<int>, we can't tell the difference between an implicit 0 and an explicit 0.
-            Assert.AreEqual(5, message.Int32Field);
-        }
-
-        [Test]
-        public void MergingStreamNoValue()
-        {
-            var message = new TestWellKnownTypes { Int32Field = 5 };
-
-            // Create a byte array which an Int32 field, but with no value.
-            var bytes = new TestWellKnownTypes { Int32Field = 0 }.ToByteArray();
-            Assert.AreEqual(2, bytes.Length); // The tag for Int32Field is a single byte, then a byte indicating a 0-length message.
-            message.MergeFrom(bytes);
-
-            // The "implicit" 0 did *not* overwrite the value.
-            // (This is the correct behaviour.)
-            Assert.AreEqual(5, message.Int32Field);
-        }
-
-        // All permutations of origin/merging value being null, zero (default) or non-default.
-        // As this is the in-memory version, we don't need to worry about the difference between implicit and explicit 0.
-        [Test]
-        [TestCase(null, null, null)]
-        [TestCase(null, 0, 0)]
-        [TestCase(null, 5, 5)]
-        [TestCase(0, null, 0)]
-        [TestCase(0, 0, 0)]
-        [TestCase(0, 5, 5)]
-        [TestCase(5, null, 5)]
-        [TestCase(5, 0, 5)]
-        [TestCase(5, 10, 10)]
-        public void MergingMessageWithZero(int? originValue, int? mergingValue, int? expectedResult)
-        {
-            // This differs from the MergingStreamCornerCase because when we merge message *objects*,
-            // we ignore default values from the "source".
-            var message1 = new TestWellKnownTypes { Int32Field = originValue };
-            var message2 = new TestWellKnownTypes { Int32Field = mergingValue };
-            message1.MergeFrom(message2);
-            Assert.AreEqual(expectedResult, message1.Int32Field);
-        }
-
-        [Test]
-        public void UnknownFieldInWrapper()
-        {
-            var stream = new MemoryStream();
-            var output = new CodedOutputStream(stream);
-            var wrapperTag = WireFormat.MakeTag(TestWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited);
-            var unknownTag = WireFormat.MakeTag(15, WireFormat.WireType.Varint);
-            var valueTag = WireFormat.MakeTag(Int32Value.ValueFieldNumber, WireFormat.WireType.Varint);
-
-            output.WriteTag(wrapperTag);
-            output.WriteLength(4); // unknownTag + value 5 + valueType + value 6, each 1 byte
-            output.WriteTag(unknownTag);
-            output.WriteInt32((int) valueTag); // Sneakily "pretend" it's a tag when it's really a value
-            output.WriteTag(valueTag);
-            output.WriteInt32(6);
-
-            output.Flush();
-            stream.Position = 0;
-            
-            var message = TestWellKnownTypes.Parser.ParseFrom(stream);
-            Assert.AreEqual(6, message.Int32Field);
-        }
-
-        [Test]
-        public void ClearWithReflection()
-        {
-            // String and Bytes are the tricky ones here, as the CLR type of the property
-            // is the same between the wrapper and non-wrapper types.
-            var message = new TestWellKnownTypes { StringField = "foo" };
-            TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message);
-            Assert.IsNull(message.StringField);
-        }
-    }
-}

+ 0 - 44
csharp/src/Google.Protobuf.Test/project.json

@@ -1,44 +0,0 @@
-{
-  "buildOptions": {
-    "debugType": "portable",
-    "keyFile": "../../keys/Google.Protobuf.snk"
-  },
-
-  "configurations": {
-    "Debug": {
-      "buildOptions": {
-        "define": [ "DEBUG", "TRACE" ]
-      }
-    },
-    "Release": {
-      "buildOptions": {
-        "define": [ "RELEASE", "TRACE" ],
-        "optimize": true
-      }
-    }
-  },
-
-  "dependencies": {
-    "Google.Protobuf": { "target": "project" },
-    "NUnit": "3.4.0",
-    "dotnet-test-nunit": "3.4.0-alpha-2",
-  },
-
-  "testRunner": "nunit",
-
-  "frameworks": {
-    "netcoreapp1.0": {
-      "imports" : [ "dnxcore50", "netcoreapp1.0", "portable-net45+win8" ],
-      "buildOptions": {
-        "define": [ "PCL" ]
-      },
-      "dependencies": {
-        "Microsoft.NETCore.App": { 
-          "version": "1.0.0",
-          "type": "platform"
-        },
-        "System.Console": "4.0.0"
-      }
-    }
-  }
-}

+ 0 - 45
csharp/src/Google.Protobuf.sln

@@ -1,45 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 14.0.24720.0
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AddressBook", "AddressBook\AddressBook.xproj", "{AFB63919-1E05-43B4-802A-8FB8C9B2F463}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf", "Google.Protobuf\Google.Protobuf.xproj", "{9B576380-726D-4142-8238-60A43AB0E35A}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.Test", "Google.Protobuf.Test\Google.Protobuf.Test.xproj", "{580EB013-D3C7-4578-B845-015F4A3B0591}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.Conformance", "Google.Protobuf.Conformance\Google.Protobuf.Conformance.xproj", "{DDDC055B-E185-4181-BAB0-072F0F984569}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Google.Protobuf.JsonDump", "Google.Protobuf.JsonDump\Google.Protobuf.JsonDump.xproj", "{9695E08F-9829-497D-B95C-B38F28D48690}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{AFB63919-1E05-43B4-802A-8FB8C9B2F463}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9B576380-726D-4142-8238-60A43AB0E35A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{9B576380-726D-4142-8238-60A43AB0E35A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{9B576380-726D-4142-8238-60A43AB0E35A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{9B576380-726D-4142-8238-60A43AB0E35A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{580EB013-D3C7-4578-B845-015F4A3B0591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{580EB013-D3C7-4578-B845-015F4A3B0591}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{580EB013-D3C7-4578-B845-015F4A3B0591}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{580EB013-D3C7-4578-B845-015F4A3B0591}.Release|Any CPU.Build.0 = Release|Any CPU
-		{DDDC055B-E185-4181-BAB0-072F0F984569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{DDDC055B-E185-4181-BAB0-072F0F984569}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{DDDC055B-E185-4181-BAB0-072F0F984569}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{DDDC055B-E185-4181-BAB0-072F0F984569}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9695E08F-9829-497D-B95C-B38F28D48690}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{9695E08F-9829-497D-B95C-B38F28D48690}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{9695E08F-9829-497D-B95C-B38F28D48690}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{9695E08F-9829-497D-B95C-B38F28D48690}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal

+ 0 - 79
csharp/src/Google.Protobuf/ByteArray.cs

@@ -1,79 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf
-{
-    /// <summary>
-    /// Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy
-    /// </summary>
-    internal static class ByteArray
-    {
-        /// <summary>
-        /// The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy
-        /// </summary>
-        private const int CopyThreshold = 12;
-
-        /// <summary>
-        /// Determines which copy routine to use based on the number of bytes to be copied.
-        /// </summary>
-        internal static void Copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count)
-        {
-            if (count > CopyThreshold)
-            {
-                Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count);
-            }
-            else
-            {
-                int stop = srcOffset + count;
-                for (int i = srcOffset; i < stop; i++)
-                {
-                    dst[dstOffset++] = src[i];
-                }
-            }
-        }
-
-        /// <summary>
-        /// Reverses the order of bytes in the array
-        /// </summary>
-        internal static void Reverse(byte[] bytes)
-        {
-            for (int first = 0, last = bytes.Length - 1; first < last; first++, last--)
-            {
-                byte temp = bytes[first];
-                bytes[first] = bytes[last];
-                bytes[last] = temp;
-            }
-        }
-    }
-}

+ 0 - 345
csharp/src/Google.Protobuf/ByteString.cs

@@ -1,345 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Immutable array of bytes.
-    /// </summary>
-    public sealed class ByteString : IEnumerable<byte>, IEquatable<ByteString>
-    {
-        private static readonly ByteString empty = new ByteString(new byte[0]);
-
-        private readonly byte[] bytes;
-
-        /// <summary>
-        /// Unsafe operations that can cause IO Failure and/or other catestrophic side-effects.
-        /// </summary>
-        internal static class Unsafe
-        {
-            /// <summary>
-            /// Constructs a new ByteString from the given byte array. The array is
-            /// *not* copied, and must not be modified after this constructor is called.
-            /// </summary>
-            internal static ByteString FromBytes(byte[] bytes)
-            {
-                return new ByteString(bytes);
-            }
-
-            /// <summary>
-            /// Provides direct, unrestricted access to the bytes contained in this instance.
-            /// You must not modify or resize the byte array returned by this method.
-            /// </summary>
-            internal static byte[] GetBuffer(ByteString bytes)
-            {
-                return bytes.bytes;
-            }
-        }
-
-        /// <summary>
-        /// Internal use only.  Ensure that the provided array is not mutated and belongs to this instance.
-        /// </summary>
-        internal static ByteString AttachBytes(byte[] bytes)
-        {
-            return new ByteString(bytes);
-        }
-
-        /// <summary>
-        /// Constructs a new ByteString from the given byte array. The array is
-        /// *not* copied, and must not be modified after this constructor is called.
-        /// </summary>
-        private ByteString(byte[] bytes)
-        {
-            this.bytes = bytes;
-        }
-
-        /// <summary>
-        /// Returns an empty ByteString.
-        /// </summary>
-        public static ByteString Empty
-        {
-            get { return empty; }
-        }
-
-        /// <summary>
-        /// Returns the length of this ByteString in bytes.
-        /// </summary>
-        public int Length
-        {
-            get { return bytes.Length; }
-        }
-
-        /// <summary>
-        /// Returns <c>true</c> if this byte string is empty, <c>false</c> otherwise.
-        /// </summary>
-        public bool IsEmpty
-        {
-            get { return Length == 0; }
-        }
-
-        /// <summary>
-        /// Converts this <see cref="ByteString"/> into a byte array.
-        /// </summary>
-        /// <remarks>The data is copied - changes to the returned array will not be reflected in this <c>ByteString</c>.</remarks>
-        /// <returns>A byte array with the same data as this <c>ByteString</c>.</returns>
-        public byte[] ToByteArray()
-        {
-            return (byte[]) bytes.Clone();
-        }
-
-        /// <summary>
-        /// Converts this <see cref="ByteString"/> into a standard base64 representation.
-        /// </summary>
-        /// <returns>A base64 representation of this <c>ByteString</c>.</returns>
-        public string ToBase64()
-        {
-            return Convert.ToBase64String(bytes);
-        }
-
-        /// <summary>
-        /// Constructs a <see cref="ByteString" /> from the Base64 Encoded String.
-        /// </summary>
-        public static ByteString FromBase64(string bytes)
-        {
-            // By handling the empty string explicitly, we not only optimize but we fix a
-            // problem on CF 2.0. See issue 61 for details.
-            return bytes == "" ? Empty : new ByteString(Convert.FromBase64String(bytes));
-        }
-
-        /// <summary>
-        /// Constructs a <see cref="ByteString" /> from the given array. The contents
-        /// are copied, so further modifications to the array will not
-        /// be reflected in the returned ByteString.
-        /// This method can also be invoked in <c>ByteString.CopyFrom(0xaa, 0xbb, ...)</c> form
-        /// which is primarily useful for testing.
-        /// </summary>
-        public static ByteString CopyFrom(params byte[] bytes)
-        {
-            return new ByteString((byte[]) bytes.Clone());
-        }
-
-        /// <summary>
-        /// Constructs a <see cref="ByteString" /> from a portion of a byte array.
-        /// </summary>
-        public static ByteString CopyFrom(byte[] bytes, int offset, int count)
-        {
-            byte[] portion = new byte[count];
-            ByteArray.Copy(bytes, offset, portion, 0, count);
-            return new ByteString(portion);
-        }
-
-        /// <summary>
-        /// Creates a new <see cref="ByteString" /> by encoding the specified text with
-        /// the given encoding.
-        /// </summary>
-        public static ByteString CopyFrom(string text, Encoding encoding)
-        {
-            return new ByteString(encoding.GetBytes(text));
-        }
-
-        /// <summary>
-        /// Creates a new <see cref="ByteString" /> by encoding the specified text in UTF-8.
-        /// </summary>
-        public static ByteString CopyFromUtf8(string text)
-        {
-            return CopyFrom(text, Encoding.UTF8);
-        }
-
-        /// <summary>
-        /// Retuns the byte at the given index.
-        /// </summary>
-        public byte this[int index]
-        {
-            get { return bytes[index]; }
-        }
-
-        /// <summary>
-        /// Converts this <see cref="ByteString"/> into a string by applying the given encoding.
-        /// </summary>
-        /// <remarks>
-        /// This method should only be used to convert binary data which was the result of encoding
-        /// text with the given encoding.
-        /// </remarks>
-        /// <param name="encoding">The encoding to use to decode the binary data into text.</param>
-        /// <returns>The result of decoding the binary data with the given decoding.</returns>
-        public string ToString(Encoding encoding)
-        {
-            return encoding.GetString(bytes, 0, bytes.Length);
-        }
-
-        /// <summary>
-        /// Converts this <see cref="ByteString"/> into a string by applying the UTF-8 encoding.
-        /// </summary>
-        /// <remarks>
-        /// This method should only be used to convert binary data which was the result of encoding
-        /// text with UTF-8.
-        /// </remarks>
-        /// <returns>The result of decoding the binary data with the given decoding.</returns>
-        public string ToStringUtf8()
-        {
-            return ToString(Encoding.UTF8);
-        }
-
-        /// <summary>
-        /// Returns an iterator over the bytes in this <see cref="ByteString"/>.
-        /// </summary>
-        /// <returns>An iterator over the bytes in this object.</returns>
-        public IEnumerator<byte> GetEnumerator()
-        {
-            return ((IEnumerable<byte>) bytes).GetEnumerator();
-        }
-
-        /// <summary>
-        /// Returns an iterator over the bytes in this <see cref="ByteString"/>.
-        /// </summary>
-        /// <returns>An iterator over the bytes in this object.</returns>
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            return GetEnumerator();
-        }
-
-        /// <summary>
-        /// Creates a CodedInputStream from this ByteString's data.
-        /// </summary>
-        public CodedInputStream CreateCodedInput()
-        {
-            // We trust CodedInputStream not to reveal the provided byte array or modify it
-            return new CodedInputStream(bytes);
-        }
-
-        /// <summary>
-        /// Compares two byte strings for equality.
-        /// </summary>
-        /// <param name="lhs">The first byte string to compare.</param>
-        /// <param name="rhs">The second byte string to compare.</param>
-        /// <returns><c>true</c> if the byte strings are equal; false otherwise.</returns>
-        public static bool operator ==(ByteString lhs, ByteString rhs)
-        {
-            if (ReferenceEquals(lhs, rhs))
-            {
-                return true;
-            }
-            if (ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null))
-            {
-                return false;
-            }
-            if (lhs.bytes.Length != rhs.bytes.Length)
-            {
-                return false;
-            }
-            for (int i = 0; i < lhs.Length; i++)
-            {
-                if (rhs.bytes[i] != lhs.bytes[i])
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// Compares two byte strings for inequality.
-        /// </summary>
-        /// <param name="lhs">The first byte string to compare.</param>
-        /// <param name="rhs">The second byte string to compare.</param>
-        /// <returns><c>false</c> if the byte strings are equal; true otherwise.</returns>
-        public static bool operator !=(ByteString lhs, ByteString rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        /// <summary>
-        /// Compares this byte string with another object.
-        /// </summary>
-        /// <param name="obj">The object to compare this with.</param>
-        /// <returns><c>true</c> if <paramref name="obj"/> refers to an equal <see cref="ByteString"/>; <c>false</c> otherwise.</returns>
-        public override bool Equals(object obj)
-        {
-            return this == (obj as ByteString);
-        }
-
-        /// <summary>
-        /// Returns a hash code for this object. Two equal byte strings
-        /// will return the same hash code.
-        /// </summary>
-        /// <returns>A hash code for this object.</returns>
-        public override int GetHashCode()
-        {
-            int ret = 23;
-            foreach (byte b in bytes)
-            {
-                ret = (ret << 8) | b;
-            }
-            return ret;
-        }
-
-        /// <summary>
-        /// Compares this byte string with another.
-        /// </summary>
-        /// <param name="other">The <see cref="ByteString"/> to compare this with.</param>
-        /// <returns><c>true</c> if <paramref name="other"/> refers to an equal byte string; <c>false</c> otherwise.</returns>
-        public bool Equals(ByteString other)
-        {
-            return this == other;
-        }
-
-        /// <summary>
-        /// Used internally by CodedOutputStream to avoid creating a copy for the write
-        /// </summary>
-        internal void WriteRawBytesTo(CodedOutputStream outputStream)
-        {
-            outputStream.WriteRawBytes(bytes, 0, bytes.Length);
-        }
-
-        /// <summary>
-        /// Copies the entire byte array to the destination array provided at the offset specified.
-        /// </summary>
-        public void CopyTo(byte[] array, int position)
-        {
-            ByteArray.Copy(bytes, 0, array, position, bytes.Length);
-        }
-
-        /// <summary>
-        /// Writes the entire byte array to the provided stream
-        /// </summary>
-        public void WriteTo(Stream outputStream)
-        {
-            outputStream.Write(bytes, 0, bytes.Length);
-        }
-    }
-}

+ 0 - 1275
csharp/src/Google.Protobuf/CodedInputStream.cs

@@ -1,1275 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Collections;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Reads and decodes protocol message fields.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// This class is generally used by generated code to read appropriate
-    /// primitives from the stream. It effectively encapsulates the lowest
-    /// levels of protocol buffer format.
-    /// </para>
-    /// <para>
-    /// Repeated fields and map fields are not handled by this class; use <see cref="RepeatedField{T}"/>
-    /// and <see cref="MapField{TKey, TValue}"/> to serialize such fields.
-    /// </para>
-    /// </remarks>
-    public sealed class CodedInputStream : IDisposable
-    {
-        /// <summary>
-        /// Whether to leave the underlying stream open when disposing of this stream.
-        /// This is always true when there's no stream.
-        /// </summary>
-        private readonly bool leaveOpen;
-
-        /// <summary>
-        /// Buffer of data read from the stream or provided at construction time.
-        /// </summary>
-        private readonly byte[] buffer;
-
-        /// <summary>
-        /// The index of the buffer at which we need to refill from the stream (if there is one).
-        /// </summary>
-        private int bufferSize;
-
-        private int bufferSizeAfterLimit = 0;
-        /// <summary>
-        /// The position within the current buffer (i.e. the next byte to read)
-        /// </summary>
-        private int bufferPos = 0;
-
-        /// <summary>
-        /// The stream to read further input from, or null if the byte array buffer was provided
-        /// directly on construction, with no further data available.
-        /// </summary>
-        private readonly Stream input;
-
-        /// <summary>
-        /// The last tag we read. 0 indicates we've read to the end of the stream
-        /// (or haven't read anything yet).
-        /// </summary>
-        private uint lastTag = 0;
-
-        /// <summary>
-        /// The next tag, used to store the value read by PeekTag.
-        /// </summary>
-        private uint nextTag = 0;
-        private bool hasNextTag = false;
-
-        internal const int DefaultRecursionLimit = 64;
-        internal const int DefaultSizeLimit = 64 << 20; // 64MB
-        internal const int BufferSize = 4096;
-
-        /// <summary>
-        /// The total number of bytes read before the current buffer. The
-        /// total bytes read up to the current position can be computed as
-        /// totalBytesRetired + bufferPos.
-        /// </summary>
-        private int totalBytesRetired = 0;
-
-        /// <summary>
-        /// The absolute position of the end of the current message.
-        /// </summary> 
-        private int currentLimit = int.MaxValue;
-
-        private int recursionDepth = 0;
-
-        private readonly int recursionLimit;
-        private readonly int sizeLimit;
-
-        #region Construction
-        // Note that the checks are performed such that we don't end up checking obviously-valid things
-        // like non-null references for arrays we've just created.
-
-        /// <summary>
-        /// Creates a new CodedInputStream reading data from the given byte array.
-        /// </summary>
-        public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length)
-        {            
-        }
-
-        /// <summary>
-        /// Creates a new <see cref="CodedInputStream"/> that reads from the given byte array slice.
-        /// </summary>
-        public CodedInputStream(byte[] buffer, int offset, int length)
-            : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length)
-        {            
-            if (offset < 0 || offset > buffer.Length)
-            {
-                throw new ArgumentOutOfRangeException("offset", "Offset must be within the buffer");
-            }
-            if (length < 0 || offset + length > buffer.Length)
-            {
-                throw new ArgumentOutOfRangeException("length", "Length must be non-negative and within the buffer");
-            }
-        }
-
-        /// <summary>
-        /// Creates a new <see cref="CodedInputStream"/> reading data from the given stream, which will be disposed
-        /// when the returned object is disposed.
-        /// </summary>
-        /// <param name="input">The stream to read from.</param>
-        public CodedInputStream(Stream input) : this(input, false)
-        {
-        }
-
-        /// <summary>
-        /// Creates a new <see cref="CodedInputStream"/> reading data from the given stream.
-        /// </summary>
-        /// <param name="input">The stream to read from.</param>
-        /// <param name="leaveOpen"><c>true</c> to leave <paramref name="input"/> open when the returned
-        /// <c cref="CodedInputStream"/> is disposed; <c>false</c> to dispose of the given stream when the
-        /// returned object is disposed.</param>
-        public CodedInputStream(Stream input, bool leaveOpen)
-            : this(ProtoPreconditions.CheckNotNull(input, "input"), new byte[BufferSize], 0, 0)
-        {
-            this.leaveOpen = leaveOpen;
-        }
-        
-        /// <summary>
-        /// Creates a new CodedInputStream reading data from the given
-        /// stream and buffer, using the default limits.
-        /// </summary>
-        internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize)
-        {
-            this.input = input;
-            this.buffer = buffer;
-            this.bufferPos = bufferPos;
-            this.bufferSize = bufferSize;
-            this.sizeLimit = DefaultSizeLimit;
-            this.recursionLimit = DefaultRecursionLimit;
-        }
-
-        /// <summary>
-        /// Creates a new CodedInputStream reading data from the given
-        /// stream and buffer, using the specified limits.
-        /// </summary>
-        /// <remarks>
-        /// This chains to the version with the default limits instead of vice versa to avoid
-        /// having to check that the default values are valid every time.
-        /// </remarks>
-        internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit)
-            : this(input, buffer, bufferPos, bufferSize)
-        {
-            if (sizeLimit <= 0)
-            {
-                throw new ArgumentOutOfRangeException("sizeLimit", "Size limit must be positive");
-            }
-            if (recursionLimit <= 0)
-            {
-                throw new ArgumentOutOfRangeException("recursionLimit!", "Recursion limit must be positive");
-            }
-            this.sizeLimit = sizeLimit;
-            this.recursionLimit = recursionLimit;
-        }
-        #endregion
-
-        /// <summary>
-        /// Creates a <see cref="CodedInputStream"/> with the specified size and recursion limits, reading
-        /// from an input stream.
-        /// </summary>
-        /// <remarks>
-        /// This method exists separately from the constructor to reduce the number of constructor overloads.
-        /// It is likely to be used considerably less frequently than the constructors, as the default limits
-        /// are suitable for most use cases.
-        /// </remarks>
-        /// <param name="input">The input stream to read from</param>
-        /// <param name="sizeLimit">The total limit of data to read from the stream.</param>
-        /// <param name="recursionLimit">The maximum recursion depth to allow while reading.</param>
-        /// <returns>A <c>CodedInputStream</c> reading from <paramref name="input"/> with the specified size
-        /// and recursion limits.</returns>
-        public static CodedInputStream CreateWithLimits(Stream input, int sizeLimit, int recursionLimit)
-        {
-            return new CodedInputStream(input, new byte[BufferSize], 0, 0, sizeLimit, recursionLimit);
-        }
-
-        /// <summary>
-        /// Returns the current position in the input stream, or the position in the input buffer
-        /// </summary>
-        public long Position 
-        {
-            get
-            {
-                if (input != null)
-                {
-                    return input.Position - ((bufferSize + bufferSizeAfterLimit) - bufferPos);
-                }
-                return bufferPos;
-            }
-        }
-
-        /// <summary>
-        /// Returns the last tag read, or 0 if no tags have been read or we've read beyond
-        /// the end of the stream.
-        /// </summary>
-        internal uint LastTag { get { return lastTag; } }
-
-        /// <summary>
-        /// Returns the size limit for this stream.
-        /// </summary>
-        /// <remarks>
-        /// This limit is applied when reading from the underlying stream, as a sanity check. It is
-        /// not applied when reading from a byte array data source without an underlying stream.
-        /// The default value is 64MB.
-        /// </remarks>
-        /// <value>
-        /// The size limit.
-        /// </value>
-        public int SizeLimit { get { return sizeLimit; } }
-
-        /// <summary>
-        /// Returns the recursion limit for this stream. This limit is applied whilst reading messages,
-        /// to avoid maliciously-recursive data.
-        /// </summary>
-        /// <remarks>
-        /// The default limit is 64.
-        /// </remarks>
-        /// <value>
-        /// The recursion limit for this stream.
-        /// </value>
-        public int RecursionLimit { get { return recursionLimit; } }
-
-        /// <summary>
-        /// Disposes of this instance, potentially closing any underlying stream.
-        /// </summary>
-        /// <remarks>
-        /// As there is no flushing to perform here, disposing of a <see cref="CodedInputStream"/> which
-        /// was constructed with the <c>leaveOpen</c> option parameter set to <c>true</c> (or one which
-        /// was constructed to read from a byte array) has no effect.
-        /// </remarks>
-        public void Dispose()
-        {
-            if (!leaveOpen)
-            {
-                input.Dispose();
-            }
-        }
-
-        #region Validation
-        /// <summary>
-        /// Verifies that the last call to ReadTag() returned tag 0 - in other words,
-        /// we've reached the end of the stream when we expected to.
-        /// </summary>
-        /// <exception cref="InvalidProtocolBufferException">The 
-        /// tag read was not the one specified</exception>
-        internal void CheckReadEndOfStreamTag()
-        {
-            if (lastTag != 0)
-            {
-                throw InvalidProtocolBufferException.MoreDataAvailable();
-            }
-        }
-        #endregion
-
-        #region Reading of tags etc
-
-        /// <summary>
-        /// Peeks at the next field tag. This is like calling <see cref="ReadTag"/>, but the
-        /// tag is not consumed. (So a subsequent call to <see cref="ReadTag"/> will return the
-        /// same value.)
-        /// </summary>
-        public uint PeekTag()
-        {
-            if (hasNextTag)
-            {
-                return nextTag;
-            }
-
-            uint savedLast = lastTag;
-            nextTag = ReadTag();
-            hasNextTag = true;
-            lastTag = savedLast; // Undo the side effect of ReadTag
-            return nextTag;
-        }
-
-        /// <summary>
-        /// Reads a field tag, returning the tag of 0 for "end of stream".
-        /// </summary>
-        /// <remarks>
-        /// If this method returns 0, it doesn't necessarily mean the end of all
-        /// the data in this CodedInputStream; it may be the end of the logical stream
-        /// for an embedded message, for example.
-        /// </remarks>
-        /// <returns>The next field tag, or 0 for end of stream. (0 is never a valid tag.)</returns>
-        public uint ReadTag()
-        {
-            if (hasNextTag)
-            {
-                lastTag = nextTag;
-                hasNextTag = false;
-                return lastTag;
-            }
-
-            // Optimize for the incredibly common case of having at least two bytes left in the buffer,
-            // and those two bytes being enough to get the tag. This will be true for fields up to 4095.
-            if (bufferPos + 2 <= bufferSize)
-            {
-                int tmp = buffer[bufferPos++];
-                if (tmp < 128)
-                {
-                    lastTag = (uint)tmp;
-                }
-                else
-                {
-                    int result = tmp & 0x7f;
-                    if ((tmp = buffer[bufferPos++]) < 128)
-                    {
-                        result |= tmp << 7;
-                        lastTag = (uint) result;
-                    }
-                    else
-                    {
-                        // Nope, rewind and go the potentially slow route.
-                        bufferPos -= 2;
-                        lastTag = ReadRawVarint32();
-                    }
-                }
-            }
-            else
-            {
-                if (IsAtEnd)
-                {
-                    lastTag = 0;
-                    return 0; // This is the only case in which we return 0.
-                }
-
-                lastTag = ReadRawVarint32();
-            }
-            if (lastTag == 0)
-            {
-                // If we actually read zero, that's not a valid tag.
-                throw InvalidProtocolBufferException.InvalidTag();
-            }
-            return lastTag;
-        }
-
-        /// <summary>
-        /// Skips the data for the field with the tag we've just read.
-        /// This should be called directly after <see cref="ReadTag"/>, when
-        /// the caller wishes to skip an unknown field.
-        /// </summary>
-        /// <remarks>
-        /// This method throws <see cref="InvalidProtocolBufferException"/> if the last-read tag was an end-group tag.
-        /// If a caller wishes to skip a group, they should skip the whole group, by calling this method after reading the
-        /// start-group tag. This behavior allows callers to call this method on any field they don't understand, correctly
-        /// resulting in an error if an end-group tag has not been paired with an earlier start-group tag.
-        /// </remarks>
-        /// <exception cref="InvalidProtocolBufferException">The last tag was an end-group tag</exception>
-        /// <exception cref="InvalidOperationException">The last read operation read to the end of the logical stream</exception>
-        public void SkipLastField()
-        {
-            if (lastTag == 0)
-            {
-                throw new InvalidOperationException("SkipLastField cannot be called at the end of a stream");
-            }
-            switch (WireFormat.GetTagWireType(lastTag))
-            {
-                case WireFormat.WireType.StartGroup:
-                    SkipGroup(lastTag);
-                    break;
-                case WireFormat.WireType.EndGroup:
-                    throw new InvalidProtocolBufferException(
-                        "SkipLastField called on an end-group tag, indicating that the corresponding start-group was missing");
-                case WireFormat.WireType.Fixed32:
-                    ReadFixed32();
-                    break;
-                case WireFormat.WireType.Fixed64:
-                    ReadFixed64();
-                    break;
-                case WireFormat.WireType.LengthDelimited:
-                    var length = ReadLength();
-                    SkipRawBytes(length);
-                    break;
-                case WireFormat.WireType.Varint:
-                    ReadRawVarint32();
-                    break;
-            }
-        }
-
-        private void SkipGroup(uint startGroupTag)
-        {
-            // Note: Currently we expect this to be the way that groups are read. We could put the recursion
-            // depth changes into the ReadTag method instead, potentially...
-            recursionDepth++;
-            if (recursionDepth >= recursionLimit)
-            {
-                throw InvalidProtocolBufferException.RecursionLimitExceeded();
-            }
-            uint tag;
-            while (true)
-            {
-                tag = ReadTag();
-                if (tag == 0)
-                {
-                    throw InvalidProtocolBufferException.TruncatedMessage();
-                }
-                // Can't call SkipLastField for this case- that would throw.
-                if (WireFormat.GetTagWireType(tag) == WireFormat.WireType.EndGroup)
-                {
-                    break;
-                }
-                // This recursion will allow us to handle nested groups.
-                SkipLastField();
-            }
-            int startField = WireFormat.GetTagFieldNumber(startGroupTag);
-            int endField = WireFormat.GetTagFieldNumber(tag);
-            if (startField != endField)
-            {
-                throw new InvalidProtocolBufferException(
-                    $"Mismatched end-group tag. Started with field {startField}; ended with field {endField}");
-            }
-            recursionDepth--;
-        }
-
-        /// <summary>
-        /// Reads a double field from the stream.
-        /// </summary>
-        public double ReadDouble()
-        {
-            return BitConverter.Int64BitsToDouble((long) ReadRawLittleEndian64());
-        }
-
-        /// <summary>
-        /// Reads a float field from the stream.
-        /// </summary>
-        public float ReadFloat()
-        {
-            if (BitConverter.IsLittleEndian && 4 <= bufferSize - bufferPos)
-            {
-                float ret = BitConverter.ToSingle(buffer, bufferPos);
-                bufferPos += 4;
-                return ret;
-            }
-            else
-            {
-                byte[] rawBytes = ReadRawBytes(4);
-                if (!BitConverter.IsLittleEndian)
-                {
-                    ByteArray.Reverse(rawBytes);
-                }
-                return BitConverter.ToSingle(rawBytes, 0);
-            }
-        }
-
-        /// <summary>
-        /// Reads a uint64 field from the stream.
-        /// </summary>
-        public ulong ReadUInt64()
-        {
-            return ReadRawVarint64();
-        }
-
-        /// <summary>
-        /// Reads an int64 field from the stream.
-        /// </summary>
-        public long ReadInt64()
-        {
-            return (long) ReadRawVarint64();
-        }
-
-        /// <summary>
-        /// Reads an int32 field from the stream.
-        /// </summary>
-        public int ReadInt32()
-        {
-            return (int) ReadRawVarint32();
-        }
-
-        /// <summary>
-        /// Reads a fixed64 field from the stream.
-        /// </summary>
-        public ulong ReadFixed64()
-        {
-            return ReadRawLittleEndian64();
-        }
-
-        /// <summary>
-        /// Reads a fixed32 field from the stream.
-        /// </summary>
-        public uint ReadFixed32()
-        {
-            return ReadRawLittleEndian32();
-        }
-
-        /// <summary>
-        /// Reads a bool field from the stream.
-        /// </summary>
-        public bool ReadBool()
-        {
-            return ReadRawVarint32() != 0;
-        }
-
-        /// <summary>
-        /// Reads a string field from the stream.
-        /// </summary>
-        public string ReadString()
-        {
-            int length = ReadLength();
-            // No need to read any data for an empty string.
-            if (length == 0)
-            {
-                return "";
-            }
-            if (length <= bufferSize - bufferPos)
-            {
-                // Fast path:  We already have the bytes in a contiguous buffer, so
-                //   just copy directly from it.
-                String result = CodedOutputStream.Utf8Encoding.GetString(buffer, bufferPos, length);
-                bufferPos += length;
-                return result;
-            }
-            // Slow path: Build a byte array first then copy it.
-            return CodedOutputStream.Utf8Encoding.GetString(ReadRawBytes(length), 0, length);
-        }
-
-        /// <summary>
-        /// Reads an embedded message field value from the stream.
-        /// </summary>   
-        public void ReadMessage(IMessage builder)
-        {
-            int length = ReadLength();
-            if (recursionDepth >= recursionLimit)
-            {
-                throw InvalidProtocolBufferException.RecursionLimitExceeded();
-            }
-            int oldLimit = PushLimit(length);
-            ++recursionDepth;
-            builder.MergeFrom(this);
-            CheckReadEndOfStreamTag();
-            // Check that we've read exactly as much data as expected.
-            if (!ReachedLimit)
-            {
-                throw InvalidProtocolBufferException.TruncatedMessage();
-            }
-            --recursionDepth;
-            PopLimit(oldLimit);
-        }
-
-        /// <summary>
-        /// Reads a bytes field value from the stream.
-        /// </summary>   
-        public ByteString ReadBytes()
-        {
-            int length = ReadLength();
-            if (length <= bufferSize - bufferPos && length > 0)
-            {
-                // Fast path:  We already have the bytes in a contiguous buffer, so
-                //   just copy directly from it.
-                ByteString result = ByteString.CopyFrom(buffer, bufferPos, length);
-                bufferPos += length;
-                return result;
-            }
-            else
-            {
-                // Slow path:  Build a byte array and attach it to a new ByteString.
-                return ByteString.AttachBytes(ReadRawBytes(length));
-            }
-        }
-
-        /// <summary>
-        /// Reads a uint32 field value from the stream.
-        /// </summary>   
-        public uint ReadUInt32()
-        {
-            return ReadRawVarint32();
-        }
-
-        /// <summary>
-        /// Reads an enum field value from the stream.
-        /// </summary>   
-        public int ReadEnum()
-        {
-            // Currently just a pass-through, but it's nice to separate it logically from WriteInt32.
-            return (int) ReadRawVarint32();
-        }
-
-        /// <summary>
-        /// Reads an sfixed32 field value from the stream.
-        /// </summary>   
-        public int ReadSFixed32()
-        {
-            return (int) ReadRawLittleEndian32();
-        }
-
-        /// <summary>
-        /// Reads an sfixed64 field value from the stream.
-        /// </summary>   
-        public long ReadSFixed64()
-        {
-            return (long) ReadRawLittleEndian64();
-        }
-
-        /// <summary>
-        /// Reads an sint32 field value from the stream.
-        /// </summary>   
-        public int ReadSInt32()
-        {
-            return DecodeZigZag32(ReadRawVarint32());
-        }
-
-        /// <summary>
-        /// Reads an sint64 field value from the stream.
-        /// </summary>   
-        public long ReadSInt64()
-        {
-            return DecodeZigZag64(ReadRawVarint64());
-        }
-
-        /// <summary>
-        /// Reads a length for length-delimited data.
-        /// </summary>
-        /// <remarks>
-        /// This is internally just reading a varint, but this method exists
-        /// to make the calling code clearer.
-        /// </remarks>
-        public int ReadLength()
-        {
-            return (int) ReadRawVarint32();
-        }
-
-        /// <summary>
-        /// Peeks at the next tag in the stream. If it matches <paramref name="tag"/>,
-        /// the tag is consumed and the method returns <c>true</c>; otherwise, the
-        /// stream is left in the original position and the method returns <c>false</c>.
-        /// </summary>
-        public bool MaybeConsumeTag(uint tag)
-        {
-            if (PeekTag() == tag)
-            {
-                hasNextTag = false;
-                return true;
-            }
-            return false;
-        }
-
-        #endregion
-
-        #region Underlying reading primitives
-
-        /// <summary>
-        /// Same code as ReadRawVarint32, but read each byte individually, checking for
-        /// buffer overflow.
-        /// </summary>
-        private uint SlowReadRawVarint32()
-        {
-            int tmp = ReadRawByte();
-            if (tmp < 128)
-            {
-                return (uint) tmp;
-            }
-            int result = tmp & 0x7f;
-            if ((tmp = ReadRawByte()) < 128)
-            {
-                result |= tmp << 7;
-            }
-            else
-            {
-                result |= (tmp & 0x7f) << 7;
-                if ((tmp = ReadRawByte()) < 128)
-                {
-                    result |= tmp << 14;
-                }
-                else
-                {
-                    result |= (tmp & 0x7f) << 14;
-                    if ((tmp = ReadRawByte()) < 128)
-                    {
-                        result |= tmp << 21;
-                    }
-                    else
-                    {
-                        result |= (tmp & 0x7f) << 21;
-                        result |= (tmp = ReadRawByte()) << 28;
-                        if (tmp >= 128)
-                        {
-                            // Discard upper 32 bits.
-                            for (int i = 0; i < 5; i++)
-                            {
-                                if (ReadRawByte() < 128)
-                                {
-                                    return (uint) result;
-                                }
-                            }
-                            throw InvalidProtocolBufferException.MalformedVarint();
-                        }
-                    }
-                }
-            }
-            return (uint) result;
-        }
-
-        /// <summary>
-        /// Reads a raw Varint from the stream.  If larger than 32 bits, discard the upper bits.
-        /// This method is optimised for the case where we've got lots of data in the buffer.
-        /// That means we can check the size just once, then just read directly from the buffer
-        /// without constant rechecking of the buffer length.
-        /// </summary>
-        internal uint ReadRawVarint32()
-        {
-            if (bufferPos + 5 > bufferSize)
-            {
-                return SlowReadRawVarint32();
-            }
-
-            int tmp = buffer[bufferPos++];
-            if (tmp < 128)
-            {
-                return (uint) tmp;
-            }
-            int result = tmp & 0x7f;
-            if ((tmp = buffer[bufferPos++]) < 128)
-            {
-                result |= tmp << 7;
-            }
-            else
-            {
-                result |= (tmp & 0x7f) << 7;
-                if ((tmp = buffer[bufferPos++]) < 128)
-                {
-                    result |= tmp << 14;
-                }
-                else
-                {
-                    result |= (tmp & 0x7f) << 14;
-                    if ((tmp = buffer[bufferPos++]) < 128)
-                    {
-                        result |= tmp << 21;
-                    }
-                    else
-                    {
-                        result |= (tmp & 0x7f) << 21;
-                        result |= (tmp = buffer[bufferPos++]) << 28;
-                        if (tmp >= 128)
-                        {
-                            // Discard upper 32 bits.
-                            // Note that this has to use ReadRawByte() as we only ensure we've
-                            // got at least 5 bytes at the start of the method. This lets us
-                            // use the fast path in more cases, and we rarely hit this section of code.
-                            for (int i = 0; i < 5; i++)
-                            {
-                                if (ReadRawByte() < 128)
-                                {
-                                    return (uint) result;
-                                }
-                            }
-                            throw InvalidProtocolBufferException.MalformedVarint();
-                        }
-                    }
-                }
-            }
-            return (uint) result;
-        }
-
-        /// <summary>
-        /// Reads a varint from the input one byte at a time, so that it does not
-        /// read any bytes after the end of the varint. If you simply wrapped the
-        /// stream in a CodedInputStream and used ReadRawVarint32(Stream)
-        /// then you would probably end up reading past the end of the varint since
-        /// CodedInputStream buffers its input.
-        /// </summary>
-        /// <param name="input"></param>
-        /// <returns></returns>
-        internal static uint ReadRawVarint32(Stream input)
-        {
-            int result = 0;
-            int offset = 0;
-            for (; offset < 32; offset += 7)
-            {
-                int b = input.ReadByte();
-                if (b == -1)
-                {
-                    throw InvalidProtocolBufferException.TruncatedMessage();
-                }
-                result |= (b & 0x7f) << offset;
-                if ((b & 0x80) == 0)
-                {
-                    return (uint) result;
-                }
-            }
-            // Keep reading up to 64 bits.
-            for (; offset < 64; offset += 7)
-            {
-                int b = input.ReadByte();
-                if (b == -1)
-                {
-                    throw InvalidProtocolBufferException.TruncatedMessage();
-                }
-                if ((b & 0x80) == 0)
-                {
-                    return (uint) result;
-                }
-            }
-            throw InvalidProtocolBufferException.MalformedVarint();
-        }
-
-        /// <summary>
-        /// Reads a raw varint from the stream.
-        /// </summary>
-        internal ulong ReadRawVarint64()
-        {
-            int shift = 0;
-            ulong result = 0;
-            while (shift < 64)
-            {
-                byte b = ReadRawByte();
-                result |= (ulong) (b & 0x7F) << shift;
-                if ((b & 0x80) == 0)
-                {
-                    return result;
-                }
-                shift += 7;
-            }
-            throw InvalidProtocolBufferException.MalformedVarint();
-        }
-
-        /// <summary>
-        /// Reads a 32-bit little-endian integer from the stream.
-        /// </summary>
-        internal uint ReadRawLittleEndian32()
-        {
-            uint b1 = ReadRawByte();
-            uint b2 = ReadRawByte();
-            uint b3 = ReadRawByte();
-            uint b4 = ReadRawByte();
-            return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24);
-        }
-
-        /// <summary>
-        /// Reads a 64-bit little-endian integer from the stream.
-        /// </summary>
-        internal ulong ReadRawLittleEndian64()
-        {
-            ulong b1 = ReadRawByte();
-            ulong b2 = ReadRawByte();
-            ulong b3 = ReadRawByte();
-            ulong b4 = ReadRawByte();
-            ulong b5 = ReadRawByte();
-            ulong b6 = ReadRawByte();
-            ulong b7 = ReadRawByte();
-            ulong b8 = ReadRawByte();
-            return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24)
-                   | (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56);
-        }
-
-        /// <summary>
-        /// Decode a 32-bit value with ZigZag encoding.
-        /// </summary>
-        /// <remarks>
-        /// ZigZag encodes signed integers into values that can be efficiently
-        /// encoded with varint.  (Otherwise, negative values must be 
-        /// sign-extended to 64 bits to be varint encoded, thus always taking
-        /// 10 bytes on the wire.)
-        /// </remarks>
-        internal static int DecodeZigZag32(uint n)
-        {
-            return (int)(n >> 1) ^ -(int)(n & 1);
-        }
-
-        /// <summary>
-        /// Decode a 32-bit value with ZigZag encoding.
-        /// </summary>
-        /// <remarks>
-        /// ZigZag encodes signed integers into values that can be efficiently
-        /// encoded with varint.  (Otherwise, negative values must be 
-        /// sign-extended to 64 bits to be varint encoded, thus always taking
-        /// 10 bytes on the wire.)
-        /// </remarks>
-        internal static long DecodeZigZag64(ulong n)
-        {
-            return (long)(n >> 1) ^ -(long)(n & 1);
-        }
-        #endregion
-
-        #region Internal reading and buffer management
-
-        /// <summary>
-        /// Sets currentLimit to (current position) + byteLimit. This is called
-        /// when descending into a length-delimited embedded message. The previous
-        /// limit is returned.
-        /// </summary>
-        /// <returns>The old limit.</returns>
-        internal int PushLimit(int byteLimit)
-        {
-            if (byteLimit < 0)
-            {
-                throw InvalidProtocolBufferException.NegativeSize();
-            }
-            byteLimit += totalBytesRetired + bufferPos;
-            int oldLimit = currentLimit;
-            if (byteLimit > oldLimit)
-            {
-                throw InvalidProtocolBufferException.TruncatedMessage();
-            }
-            currentLimit = byteLimit;
-
-            RecomputeBufferSizeAfterLimit();
-
-            return oldLimit;
-        }
-
-        private void RecomputeBufferSizeAfterLimit()
-        {
-            bufferSize += bufferSizeAfterLimit;
-            int bufferEnd = totalBytesRetired + bufferSize;
-            if (bufferEnd > currentLimit)
-            {
-                // Limit is in current buffer.
-                bufferSizeAfterLimit = bufferEnd - currentLimit;
-                bufferSize -= bufferSizeAfterLimit;
-            }
-            else
-            {
-                bufferSizeAfterLimit = 0;
-            }
-        }
-
-        /// <summary>
-        /// Discards the current limit, returning the previous limit.
-        /// </summary>
-        internal void PopLimit(int oldLimit)
-        {
-            currentLimit = oldLimit;
-            RecomputeBufferSizeAfterLimit();
-        }
-
-        /// <summary>
-        /// Returns whether or not all the data before the limit has been read.
-        /// </summary>
-        /// <returns></returns>
-        internal bool ReachedLimit
-        {
-            get
-            {
-                if (currentLimit == int.MaxValue)
-                {
-                    return false;
-                }
-                int currentAbsolutePosition = totalBytesRetired + bufferPos;
-                return currentAbsolutePosition >= currentLimit;
-            }
-        }
-
-        /// <summary>
-        /// Returns true if the stream has reached the end of the input. This is the
-        /// case if either the end of the underlying input source has been reached or
-        /// the stream has reached a limit created using PushLimit.
-        /// </summary>
-        public bool IsAtEnd
-        {
-            get { return bufferPos == bufferSize && !RefillBuffer(false); }
-        }
-
-        /// <summary>
-        /// Called when buffer is empty to read more bytes from the
-        /// input.  If <paramref name="mustSucceed"/> is true, RefillBuffer() gurantees that
-        /// either there will be at least one byte in the buffer when it returns
-        /// or it will throw an exception.  If <paramref name="mustSucceed"/> is false,
-        /// RefillBuffer() returns false if no more bytes were available.
-        /// </summary>
-        /// <param name="mustSucceed"></param>
-        /// <returns></returns>
-        private bool RefillBuffer(bool mustSucceed)
-        {
-            if (bufferPos < bufferSize)
-            {
-                throw new InvalidOperationException("RefillBuffer() called when buffer wasn't empty.");
-            }
-
-            if (totalBytesRetired + bufferSize == currentLimit)
-            {
-                // Oops, we hit a limit.
-                if (mustSucceed)
-                {
-                    throw InvalidProtocolBufferException.TruncatedMessage();
-                }
-                else
-                {
-                    return false;
-                }
-            }
-
-            totalBytesRetired += bufferSize;
-
-            bufferPos = 0;
-            bufferSize = (input == null) ? 0 : input.Read(buffer, 0, buffer.Length);
-            if (bufferSize < 0)
-            {
-                throw new InvalidOperationException("Stream.Read returned a negative count");
-            }
-            if (bufferSize == 0)
-            {
-                if (mustSucceed)
-                {
-                    throw InvalidProtocolBufferException.TruncatedMessage();
-                }
-                else
-                {
-                    return false;
-                }
-            }
-            else
-            {
-                RecomputeBufferSizeAfterLimit();
-                int totalBytesRead =
-                    totalBytesRetired + bufferSize + bufferSizeAfterLimit;
-                if (totalBytesRead > sizeLimit || totalBytesRead < 0)
-                {
-                    throw InvalidProtocolBufferException.SizeLimitExceeded();
-                }
-                return true;
-            }
-        }
-
-        /// <summary>
-        /// Read one byte from the input.
-        /// </summary>
-        /// <exception cref="InvalidProtocolBufferException">
-        /// the end of the stream or the current limit was reached
-        /// </exception>
-        internal byte ReadRawByte()
-        {
-            if (bufferPos == bufferSize)
-            {
-                RefillBuffer(true);
-            }
-            return buffer[bufferPos++];
-        }
-
-        /// <summary>
-        /// Reads a fixed size of bytes from the input.
-        /// </summary>
-        /// <exception cref="InvalidProtocolBufferException">
-        /// the end of the stream or the current limit was reached
-        /// </exception>
-        internal byte[] ReadRawBytes(int size)
-        {
-            if (size < 0)
-            {
-                throw InvalidProtocolBufferException.NegativeSize();
-            }
-
-            if (totalBytesRetired + bufferPos + size > currentLimit)
-            {
-                // Read to the end of the stream (up to the current limit) anyway.
-                SkipRawBytes(currentLimit - totalBytesRetired - bufferPos);
-                // Then fail.
-                throw InvalidProtocolBufferException.TruncatedMessage();
-            }
-
-            if (size <= bufferSize - bufferPos)
-            {
-                // We have all the bytes we need already.
-                byte[] bytes = new byte[size];
-                ByteArray.Copy(buffer, bufferPos, bytes, 0, size);
-                bufferPos += size;
-                return bytes;
-            }
-            else if (size < buffer.Length)
-            {
-                // Reading more bytes than are in the buffer, but not an excessive number
-                // of bytes.  We can safely allocate the resulting array ahead of time.
-
-                // First copy what we have.
-                byte[] bytes = new byte[size];
-                int pos = bufferSize - bufferPos;
-                ByteArray.Copy(buffer, bufferPos, bytes, 0, pos);
-                bufferPos = bufferSize;
-
-                // We want to use RefillBuffer() and then copy from the buffer into our
-                // byte array rather than reading directly into our byte array because
-                // the input may be unbuffered.
-                RefillBuffer(true);
-
-                while (size - pos > bufferSize)
-                {
-                    Buffer.BlockCopy(buffer, 0, bytes, pos, bufferSize);
-                    pos += bufferSize;
-                    bufferPos = bufferSize;
-                    RefillBuffer(true);
-                }
-
-                ByteArray.Copy(buffer, 0, bytes, pos, size - pos);
-                bufferPos = size - pos;
-
-                return bytes;
-            }
-            else
-            {
-                // The size is very large.  For security reasons, we can't allocate the
-                // entire byte array yet.  The size comes directly from the input, so a
-                // maliciously-crafted message could provide a bogus very large size in
-                // order to trick the app into allocating a lot of memory.  We avoid this
-                // by allocating and reading only a small chunk at a time, so that the
-                // malicious message must actually *be* extremely large to cause
-                // problems.  Meanwhile, we limit the allowed size of a message elsewhere.
-
-                // Remember the buffer markers since we'll have to copy the bytes out of
-                // it later.
-                int originalBufferPos = bufferPos;
-                int originalBufferSize = bufferSize;
-
-                // Mark the current buffer consumed.
-                totalBytesRetired += bufferSize;
-                bufferPos = 0;
-                bufferSize = 0;
-
-                // Read all the rest of the bytes we need.
-                int sizeLeft = size - (originalBufferSize - originalBufferPos);
-                List<byte[]> chunks = new List<byte[]>();
-
-                while (sizeLeft > 0)
-                {
-                    byte[] chunk = new byte[Math.Min(sizeLeft, buffer.Length)];
-                    int pos = 0;
-                    while (pos < chunk.Length)
-                    {
-                        int n = (input == null) ? -1 : input.Read(chunk, pos, chunk.Length - pos);
-                        if (n <= 0)
-                        {
-                            throw InvalidProtocolBufferException.TruncatedMessage();
-                        }
-                        totalBytesRetired += n;
-                        pos += n;
-                    }
-                    sizeLeft -= chunk.Length;
-                    chunks.Add(chunk);
-                }
-
-                // OK, got everything.  Now concatenate it all into one buffer.
-                byte[] bytes = new byte[size];
-
-                // Start by copying the leftover bytes from this.buffer.
-                int newPos = originalBufferSize - originalBufferPos;
-                ByteArray.Copy(buffer, originalBufferPos, bytes, 0, newPos);
-
-                // And now all the chunks.
-                foreach (byte[] chunk in chunks)
-                {
-                    Buffer.BlockCopy(chunk, 0, bytes, newPos, chunk.Length);
-                    newPos += chunk.Length;
-                }
-
-                // Done.
-                return bytes;
-            }
-        }
-
-        /// <summary>
-        /// Reads and discards <paramref name="size"/> bytes.
-        /// </summary>
-        /// <exception cref="InvalidProtocolBufferException">the end of the stream
-        /// or the current limit was reached</exception>
-        private void SkipRawBytes(int size)
-        {
-            if (size < 0)
-            {
-                throw InvalidProtocolBufferException.NegativeSize();
-            }
-
-            if (totalBytesRetired + bufferPos + size > currentLimit)
-            {
-                // Read to the end of the stream anyway.
-                SkipRawBytes(currentLimit - totalBytesRetired - bufferPos);
-                // Then fail.
-                throw InvalidProtocolBufferException.TruncatedMessage();
-            }
-
-            if (size <= bufferSize - bufferPos)
-            {
-                // We have all the bytes we need already.
-                bufferPos += size;
-            }
-            else
-            {
-                // Skipping more bytes than are in the buffer.  First skip what we have.
-                int pos = bufferSize - bufferPos;
-
-                // ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize)
-                // totalBytesRetired += pos;
-                totalBytesRetired += bufferSize;
-                
-                bufferPos = 0;
-                bufferSize = 0;
-
-                // Then skip directly from the InputStream for the rest.
-                if (pos < size)
-                {
-                    if (input == null)
-                    {
-                        throw InvalidProtocolBufferException.TruncatedMessage();
-                    }
-                    SkipImpl(size - pos);
-                    totalBytesRetired += size - pos;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Abstraction of skipping to cope with streams which can't really skip.
-        /// </summary>
-        private void SkipImpl(int amountToSkip)
-        {
-            if (input.CanSeek)
-            {
-                long previousPosition = input.Position;
-                input.Position += amountToSkip;
-                if (input.Position != previousPosition + amountToSkip)
-                {
-                    throw InvalidProtocolBufferException.TruncatedMessage();
-                }
-            }
-            else
-            {
-                byte[] skipBuffer = new byte[Math.Min(1024, amountToSkip)];
-                while (amountToSkip > 0)
-                {
-                    int bytesRead = input.Read(skipBuffer, 0, Math.Min(skipBuffer.Length, amountToSkip));
-                    if (bytesRead <= 0)
-                    {
-                        throw InvalidProtocolBufferException.TruncatedMessage();
-                    }
-                    amountToSkip -= bytesRead;
-                }
-            }
-        }
-
-        #endregion
-    }
-}

+ 0 - 304
csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs

@@ -1,304 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf
-{
-    // This part of CodedOutputStream provides all the static entry points that are used
-    // by generated code and internally to compute the size of messages prior to being
-    // written to an instance of CodedOutputStream.
-    public sealed partial class CodedOutputStream
-    {
-        private const int LittleEndian64Size = 8;
-        private const int LittleEndian32Size = 4;        
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// double field, including the tag.
-        /// </summary>
-        public static int ComputeDoubleSize(double value)
-        {
-            return LittleEndian64Size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// float field, including the tag.
-        /// </summary>
-        public static int ComputeFloatSize(float value)
-        {
-            return LittleEndian32Size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// uint64 field, including the tag.
-        /// </summary>
-        public static int ComputeUInt64Size(ulong value)
-        {
-            return ComputeRawVarint64Size(value);
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// int64 field, including the tag.
-        /// </summary>
-        public static int ComputeInt64Size(long value)
-        {
-            return ComputeRawVarint64Size((ulong) value);
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// int32 field, including the tag.
-        /// </summary>
-        public static int ComputeInt32Size(int value)
-        {
-            if (value >= 0)
-            {
-                return ComputeRawVarint32Size((uint) value);
-            }
-            else
-            {
-                // Must sign-extend.
-                return 10;
-            }
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// fixed64 field, including the tag.
-        /// </summary>
-        public static int ComputeFixed64Size(ulong value)
-        {
-            return LittleEndian64Size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// fixed32 field, including the tag.
-        /// </summary>
-        public static int ComputeFixed32Size(uint value)
-        {
-            return LittleEndian32Size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// bool field, including the tag.
-        /// </summary>
-        public static int ComputeBoolSize(bool value)
-        {
-            return 1;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// string field, including the tag.
-        /// </summary>
-        public static int ComputeStringSize(String value)
-        {
-            int byteArraySize = Utf8Encoding.GetByteCount(value);
-            return ComputeLengthSize(byteArraySize) + byteArraySize;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// group field, including the tag.
-        /// </summary>
-        public static int ComputeGroupSize(IMessage value)
-        {
-            return value.CalculateSize();
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// embedded message field, including the tag.
-        /// </summary>
-        public static int ComputeMessageSize(IMessage value)
-        {
-            int size = value.CalculateSize();
-            return ComputeLengthSize(size) + size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// bytes field, including the tag.
-        /// </summary>
-        public static int ComputeBytesSize(ByteString value)
-        {
-            return ComputeLengthSize(value.Length) + value.Length;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// uint32 field, including the tag.
-        /// </summary>
-        public static int ComputeUInt32Size(uint value)
-        {
-            return ComputeRawVarint32Size(value);
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a
-        /// enum field, including the tag. The caller is responsible for
-        /// converting the enum value to its numeric value.
-        /// </summary>
-        public static int ComputeEnumSize(int value)
-        {
-            // Currently just a pass-through, but it's nice to separate it logically.
-            return ComputeInt32Size(value);
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// sfixed32 field, including the tag.
-        /// </summary>
-        public static int ComputeSFixed32Size(int value)
-        {
-            return LittleEndian32Size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// sfixed64 field, including the tag.
-        /// </summary>
-        public static int ComputeSFixed64Size(long value)
-        {
-            return LittleEndian64Size;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// sint32 field, including the tag.
-        /// </summary>
-        public static int ComputeSInt32Size(int value)
-        {
-            return ComputeRawVarint32Size(EncodeZigZag32(value));
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode an
-        /// sint64 field, including the tag.
-        /// </summary>
-        public static int ComputeSInt64Size(long value)
-        {
-            return ComputeRawVarint64Size(EncodeZigZag64(value));
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a length,
-        /// as written by <see cref="WriteLength"/>.
-        /// </summary>
-        public static int ComputeLengthSize(int length)
-        {
-            return ComputeRawVarint32Size((uint) length);
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a varint.
-        /// </summary>
-        public static int ComputeRawVarint32Size(uint value)
-        {
-            if ((value & (0xffffffff << 7)) == 0)
-            {
-                return 1;
-            }
-            if ((value & (0xffffffff << 14)) == 0)
-            {
-                return 2;
-            }
-            if ((value & (0xffffffff << 21)) == 0)
-            {
-                return 3;
-            }
-            if ((value & (0xffffffff << 28)) == 0)
-            {
-                return 4;
-            }
-            return 5;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a varint.
-        /// </summary>
-        public static int ComputeRawVarint64Size(ulong value)
-        {
-            if ((value & (0xffffffffffffffffL << 7)) == 0)
-            {
-                return 1;
-            }
-            if ((value & (0xffffffffffffffffL << 14)) == 0)
-            {
-                return 2;
-            }
-            if ((value & (0xffffffffffffffffL << 21)) == 0)
-            {
-                return 3;
-            }
-            if ((value & (0xffffffffffffffffL << 28)) == 0)
-            {
-                return 4;
-            }
-            if ((value & (0xffffffffffffffffL << 35)) == 0)
-            {
-                return 5;
-            }
-            if ((value & (0xffffffffffffffffL << 42)) == 0)
-            {
-                return 6;
-            }
-            if ((value & (0xffffffffffffffffL << 49)) == 0)
-            {
-                return 7;
-            }
-            if ((value & (0xffffffffffffffffL << 56)) == 0)
-            {
-                return 8;
-            }
-            if ((value & (0xffffffffffffffffL << 63)) == 0)
-            {
-                return 9;
-            }
-            return 10;
-        }
-
-        /// <summary>
-        /// Computes the number of bytes that would be needed to encode a tag.
-        /// </summary>
-        public static int ComputeTagSize(int fieldNumber)
-        {
-            return ComputeRawVarint32Size(WireFormat.MakeTag(fieldNumber, 0));
-        }
-    }
-}

+ 0 - 761
csharp/src/Google.Protobuf/CodedOutputStream.cs

@@ -1,761 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Collections;
-using System;
-using System.IO;
-using System.Text;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Encodes and writes protocol message fields.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// This class is generally used by generated code to write appropriate
-    /// primitives to the stream. It effectively encapsulates the lowest
-    /// levels of protocol buffer format. Unlike some other implementations,
-    /// this does not include combined "write tag and value" methods. Generated
-    /// code knows the exact byte representations of the tags they're going to write,
-    /// so there's no need to re-encode them each time. Manually-written code calling
-    /// this class should just call one of the <c>WriteTag</c> overloads before each value.
-    /// </para>
-    /// <para>
-    /// Repeated fields and map fields are not handled by this class; use <c>RepeatedField&lt;T&gt;</c>
-    /// and <c>MapField&lt;TKey, TValue&gt;</c> to serialize such fields.
-    /// </para>
-    /// </remarks>
-    public sealed partial class CodedOutputStream : IDisposable
-    {
-        // "Local" copy of Encoding.UTF8, for efficiency. (Yes, it makes a difference.)
-        internal static readonly Encoding Utf8Encoding = Encoding.UTF8;
-
-        /// <summary>
-        /// The buffer size used by CreateInstance(Stream).
-        /// </summary>
-        public static readonly int DefaultBufferSize = 4096;
-
-        private readonly bool leaveOpen;
-        private readonly byte[] buffer;
-        private readonly int limit;
-        private int position;
-        private readonly Stream output;
-
-        #region Construction
-        /// <summary>
-        /// Creates a new CodedOutputStream that writes directly to the given
-        /// byte array. If more bytes are written than fit in the array,
-        /// OutOfSpaceException will be thrown.
-        /// </summary>
-        public CodedOutputStream(byte[] flatArray) : this(flatArray, 0, flatArray.Length)
-        {
-        }
-
-        /// <summary>
-        /// Creates a new CodedOutputStream that writes directly to the given
-        /// byte array slice. If more bytes are written than fit in the array,
-        /// OutOfSpaceException will be thrown.
-        /// </summary>
-        private CodedOutputStream(byte[] buffer, int offset, int length)
-        {
-            this.output = null;
-            this.buffer = buffer;
-            this.position = offset;
-            this.limit = offset + length;
-            leaveOpen = true; // Simple way of avoiding trying to dispose of a null reference
-        }
-
-        private CodedOutputStream(Stream output, byte[] buffer, bool leaveOpen)
-        {
-            this.output = ProtoPreconditions.CheckNotNull(output, nameof(output));
-            this.buffer = buffer;
-            this.position = 0;
-            this.limit = buffer.Length;
-            this.leaveOpen = leaveOpen;
-        }
-
-        /// <summary>
-        /// Creates a new <see cref="CodedOutputStream" /> which write to the given stream, and disposes of that
-        /// stream when the returned <c>CodedOutputStream</c> is disposed.
-        /// </summary>
-        /// <param name="output">The stream to write to. It will be disposed when the returned <c>CodedOutputStream is disposed.</c></param>
-        public CodedOutputStream(Stream output) : this(output, DefaultBufferSize, false)
-        {
-        }
-
-        /// <summary>
-        /// Creates a new CodedOutputStream which write to the given stream and uses
-        /// the specified buffer size.
-        /// </summary>
-        /// <param name="output">The stream to write to. It will be disposed when the returned <c>CodedOutputStream is disposed.</c></param>
-        /// <param name="bufferSize">The size of buffer to use internally.</param>
-        public CodedOutputStream(Stream output, int bufferSize) : this(output, new byte[bufferSize], false)
-        {
-        }
-
-        /// <summary>
-        /// Creates a new CodedOutputStream which write to the given stream.
-        /// </summary>
-        /// <param name="output">The stream to write to.</param>
-        /// <param name="leaveOpen">If <c>true</c>, <paramref name="output"/> is left open when the returned <c>CodedOutputStream</c> is disposed;
-        /// if <c>false</c>, the provided stream is disposed as well.</param>
-        public CodedOutputStream(Stream output, bool leaveOpen) : this(output, DefaultBufferSize, leaveOpen)
-        {
-        }
-
-        /// <summary>
-        /// Creates a new CodedOutputStream which write to the given stream and uses
-        /// the specified buffer size.
-        /// </summary>
-        /// <param name="output">The stream to write to.</param>
-        /// <param name="bufferSize">The size of buffer to use internally.</param>
-        /// <param name="leaveOpen">If <c>true</c>, <paramref name="output"/> is left open when the returned <c>CodedOutputStream</c> is disposed;
-        /// if <c>false</c>, the provided stream is disposed as well.</param>
-        public CodedOutputStream(Stream output, int bufferSize, bool leaveOpen) : this(output, new byte[bufferSize], leaveOpen)
-        {
-        }
-        #endregion
-
-        /// <summary>
-        /// Returns the current position in the stream, or the position in the output buffer
-        /// </summary>
-        public long Position
-        {
-            get
-            {
-                if (output != null)
-                {
-                    return output.Position + position;
-                }
-                return position;
-            }
-        }
-
-        #region Writing of values (not including tags)
-
-        /// <summary>
-        /// Writes a double field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteDouble(double value)
-        {
-            WriteRawLittleEndian64((ulong)BitConverter.DoubleToInt64Bits(value));
-        }
-
-        /// <summary>
-        /// Writes a float field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteFloat(float value)
-        {
-            byte[] rawBytes = BitConverter.GetBytes(value);
-            if (!BitConverter.IsLittleEndian)
-            {
-                ByteArray.Reverse(rawBytes);
-            }
-
-            if (limit - position >= 4)
-            {
-                buffer[position++] = rawBytes[0];
-                buffer[position++] = rawBytes[1];
-                buffer[position++] = rawBytes[2];
-                buffer[position++] = rawBytes[3];
-            }
-            else
-            {
-                WriteRawBytes(rawBytes, 0, 4);
-            }
-        }
-
-        /// <summary>
-        /// Writes a uint64 field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteUInt64(ulong value)
-        {
-            WriteRawVarint64(value);
-        }
-
-        /// <summary>
-        /// Writes an int64 field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteInt64(long value)
-        {
-            WriteRawVarint64((ulong) value);
-        }
-
-        /// <summary>
-        /// Writes an int32 field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteInt32(int value)
-        {
-            if (value >= 0)
-            {
-                WriteRawVarint32((uint) value);
-            }
-            else
-            {
-                // Must sign-extend.
-                WriteRawVarint64((ulong) value);
-            }
-        }
-
-        /// <summary>
-        /// Writes a fixed64 field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteFixed64(ulong value)
-        {
-            WriteRawLittleEndian64(value);
-        }
-
-        /// <summary>
-        /// Writes a fixed32 field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteFixed32(uint value)
-        {
-            WriteRawLittleEndian32(value);
-        }
-
-        /// <summary>
-        /// Writes a bool field value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteBool(bool value)
-        {
-            WriteRawByte(value ? (byte) 1 : (byte) 0);
-        }
-
-        /// <summary>
-        /// Writes a string field value, without a tag, to the stream.
-        /// The data is length-prefixed.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteString(string value)
-        {
-            // Optimise the case where we have enough space to write
-            // the string directly to the buffer, which should be common.
-            int length = Utf8Encoding.GetByteCount(value);
-            WriteLength(length);
-            if (limit - position >= length)
-            {
-                if (length == value.Length) // Must be all ASCII...
-                {
-                    for (int i = 0; i < length; i++)
-                    {
-                        buffer[position + i] = (byte)value[i];
-                    }
-                }
-                else
-                {
-                    Utf8Encoding.GetBytes(value, 0, value.Length, buffer, position);
-                }
-                position += length;
-            }
-            else
-            {
-                byte[] bytes = Utf8Encoding.GetBytes(value);
-                WriteRawBytes(bytes);
-            }
-        }
-
-        /// <summary>
-        /// Writes a message, without a tag, to the stream.
-        /// The data is length-prefixed.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteMessage(IMessage value)
-        {
-            WriteLength(value.CalculateSize());
-            value.WriteTo(this);
-        }
-
-        /// <summary>
-        /// Write a byte string, without a tag, to the stream.
-        /// The data is length-prefixed.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteBytes(ByteString value)
-        {
-            WriteLength(value.Length);
-            value.WriteRawBytesTo(this);
-        }
-
-        /// <summary>
-        /// Writes a uint32 value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteUInt32(uint value)
-        {
-            WriteRawVarint32(value);
-        }
-
-        /// <summary>
-        /// Writes an enum value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteEnum(int value)
-        {
-            WriteInt32(value);
-        }
-
-        /// <summary>
-        /// Writes an sfixed32 value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write.</param>
-        public void WriteSFixed32(int value)
-        {
-            WriteRawLittleEndian32((uint) value);
-        }
-
-        /// <summary>
-        /// Writes an sfixed64 value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteSFixed64(long value)
-        {
-            WriteRawLittleEndian64((ulong) value);
-        }
-
-        /// <summary>
-        /// Writes an sint32 value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteSInt32(int value)
-        {
-            WriteRawVarint32(EncodeZigZag32(value));
-        }
-
-        /// <summary>
-        /// Writes an sint64 value, without a tag, to the stream.
-        /// </summary>
-        /// <param name="value">The value to write</param>
-        public void WriteSInt64(long value)
-        {
-            WriteRawVarint64(EncodeZigZag64(value));
-        }
-
-        /// <summary>
-        /// Writes a length (in bytes) for length-delimited data.
-        /// </summary>
-        /// <remarks>
-        /// This method simply writes a rawint, but exists for clarity in calling code.
-        /// </remarks>
-        /// <param name="length">Length value, in bytes.</param>
-        public void WriteLength(int length)
-        {
-            WriteRawVarint32((uint) length);
-        }
-
-        #endregion
-
-        #region Raw tag writing
-        /// <summary>
-        /// Encodes and writes a tag.
-        /// </summary>
-        /// <param name="fieldNumber">The number of the field to write the tag for</param>
-        /// <param name="type">The wire format type of the tag to write</param>
-        public void WriteTag(int fieldNumber, WireFormat.WireType type)
-        {
-            WriteRawVarint32(WireFormat.MakeTag(fieldNumber, type));
-        }
-
-        /// <summary>
-        /// Writes an already-encoded tag.
-        /// </summary>
-        /// <param name="tag">The encoded tag</param>
-        public void WriteTag(uint tag)
-        {
-            WriteRawVarint32(tag);
-        }
-
-        /// <summary>
-        /// Writes the given single-byte tag directly to the stream.
-        /// </summary>
-        /// <param name="b1">The encoded tag</param>
-        public void WriteRawTag(byte b1)
-        {
-            WriteRawByte(b1);
-        }
-
-        /// <summary>
-        /// Writes the given two-byte tag directly to the stream.
-        /// </summary>
-        /// <param name="b1">The first byte of the encoded tag</param>
-        /// <param name="b2">The second byte of the encoded tag</param>
-        public void WriteRawTag(byte b1, byte b2)
-        {
-            WriteRawByte(b1);
-            WriteRawByte(b2);
-        }
-
-        /// <summary>
-        /// Writes the given three-byte tag directly to the stream.
-        /// </summary>
-        /// <param name="b1">The first byte of the encoded tag</param>
-        /// <param name="b2">The second byte of the encoded tag</param>
-        /// <param name="b3">The third byte of the encoded tag</param>
-        public void WriteRawTag(byte b1, byte b2, byte b3)
-        {
-            WriteRawByte(b1);
-            WriteRawByte(b2);
-            WriteRawByte(b3);
-        }
-
-        /// <summary>
-        /// Writes the given four-byte tag directly to the stream.
-        /// </summary>
-        /// <param name="b1">The first byte of the encoded tag</param>
-        /// <param name="b2">The second byte of the encoded tag</param>
-        /// <param name="b3">The third byte of the encoded tag</param>
-        /// <param name="b4">The fourth byte of the encoded tag</param>
-        public void WriteRawTag(byte b1, byte b2, byte b3, byte b4)
-        {
-            WriteRawByte(b1);
-            WriteRawByte(b2);
-            WriteRawByte(b3);
-            WriteRawByte(b4);
-        }
-
-        /// <summary>
-        /// Writes the given five-byte tag directly to the stream.
-        /// </summary>
-        /// <param name="b1">The first byte of the encoded tag</param>
-        /// <param name="b2">The second byte of the encoded tag</param>
-        /// <param name="b3">The third byte of the encoded tag</param>
-        /// <param name="b4">The fourth byte of the encoded tag</param>
-        /// <param name="b5">The fifth byte of the encoded tag</param>
-        public void WriteRawTag(byte b1, byte b2, byte b3, byte b4, byte b5)
-        {
-            WriteRawByte(b1);
-            WriteRawByte(b2);
-            WriteRawByte(b3);
-            WriteRawByte(b4);
-            WriteRawByte(b5);
-        }
-        #endregion
-
-        #region Underlying writing primitives
-        /// <summary>
-        /// Writes a 32 bit value as a varint. The fast route is taken when
-        /// there's enough buffer space left to whizz through without checking
-        /// for each byte; otherwise, we resort to calling WriteRawByte each time.
-        /// </summary>
-        internal void WriteRawVarint32(uint value)
-        {
-            // Optimize for the common case of a single byte value
-            if (value < 128 && position < limit)
-            {
-                buffer[position++] = (byte)value;
-                return;
-            }
-
-            while (value > 127 && position < limit)
-            {
-                buffer[position++] = (byte) ((value & 0x7F) | 0x80);
-                value >>= 7;
-            }
-            while (value > 127)
-            {
-                WriteRawByte((byte) ((value & 0x7F) | 0x80));
-                value >>= 7;
-            }
-            if (position < limit)
-            {
-                buffer[position++] = (byte) value;
-            }
-            else
-            {
-                WriteRawByte((byte) value);
-            }
-        }
-
-        internal void WriteRawVarint64(ulong value)
-        {
-            while (value > 127 && position < limit)
-            {
-                buffer[position++] = (byte) ((value & 0x7F) | 0x80);
-                value >>= 7;
-            }
-            while (value > 127)
-            {
-                WriteRawByte((byte) ((value & 0x7F) | 0x80));
-                value >>= 7;
-            }
-            if (position < limit)
-            {
-                buffer[position++] = (byte) value;
-            }
-            else
-            {
-                WriteRawByte((byte) value);
-            }
-        }
-
-        internal void WriteRawLittleEndian32(uint value)
-        {
-            if (position + 4 > limit)
-            {
-                WriteRawByte((byte) value);
-                WriteRawByte((byte) (value >> 8));
-                WriteRawByte((byte) (value >> 16));
-                WriteRawByte((byte) (value >> 24));
-            }
-            else
-            {
-                buffer[position++] = ((byte) value);
-                buffer[position++] = ((byte) (value >> 8));
-                buffer[position++] = ((byte) (value >> 16));
-                buffer[position++] = ((byte) (value >> 24));
-            }
-        }
-
-        internal void WriteRawLittleEndian64(ulong value)
-        {
-            if (position + 8 > limit)
-            {
-                WriteRawByte((byte) value);
-                WriteRawByte((byte) (value >> 8));
-                WriteRawByte((byte) (value >> 16));
-                WriteRawByte((byte) (value >> 24));
-                WriteRawByte((byte) (value >> 32));
-                WriteRawByte((byte) (value >> 40));
-                WriteRawByte((byte) (value >> 48));
-                WriteRawByte((byte) (value >> 56));
-            }
-            else
-            {
-                buffer[position++] = ((byte) value);
-                buffer[position++] = ((byte) (value >> 8));
-                buffer[position++] = ((byte) (value >> 16));
-                buffer[position++] = ((byte) (value >> 24));
-                buffer[position++] = ((byte) (value >> 32));
-                buffer[position++] = ((byte) (value >> 40));
-                buffer[position++] = ((byte) (value >> 48));
-                buffer[position++] = ((byte) (value >> 56));
-            }
-        }
-
-        internal void WriteRawByte(byte value)
-        {
-            if (position == limit)
-            {
-                RefreshBuffer();
-            }
-
-            buffer[position++] = value;
-        }
-
-        internal void WriteRawByte(uint value)
-        {
-            WriteRawByte((byte) value);
-        }
-
-        /// <summary>
-        /// Writes out an array of bytes.
-        /// </summary>
-        internal void WriteRawBytes(byte[] value)
-        {
-            WriteRawBytes(value, 0, value.Length);
-        }
-
-        /// <summary>
-        /// Writes out part of an array of bytes.
-        /// </summary>
-        internal void WriteRawBytes(byte[] value, int offset, int length)
-        {
-            if (limit - position >= length)
-            {
-                ByteArray.Copy(value, offset, buffer, position, length);
-                // We have room in the current buffer.
-                position += length;
-            }
-            else
-            {
-                // Write extends past current buffer.  Fill the rest of this buffer and
-                // flush.
-                int bytesWritten = limit - position;
-                ByteArray.Copy(value, offset, buffer, position, bytesWritten);
-                offset += bytesWritten;
-                length -= bytesWritten;
-                position = limit;
-                RefreshBuffer();
-
-                // Now deal with the rest.
-                // Since we have an output stream, this is our buffer
-                // and buffer offset == 0
-                if (length <= limit)
-                {
-                    // Fits in new buffer.
-                    ByteArray.Copy(value, offset, buffer, 0, length);
-                    position = length;
-                }
-                else
-                {
-                    // Write is very big.  Let's do it all at once.
-                    output.Write(value, offset, length);
-                }
-            }
-        }
-
-        #endregion
-
-        /// <summary>
-        /// Encode a 32-bit value with ZigZag encoding.
-        /// </summary>
-        /// <remarks>
-        /// ZigZag encodes signed integers into values that can be efficiently
-        /// encoded with varint.  (Otherwise, negative values must be 
-        /// sign-extended to 64 bits to be varint encoded, thus always taking
-        /// 10 bytes on the wire.)
-        /// </remarks>
-        internal static uint EncodeZigZag32(int n)
-        {
-            // Note:  the right-shift must be arithmetic
-            return (uint) ((n << 1) ^ (n >> 31));
-        }
-
-        /// <summary>
-        /// Encode a 64-bit value with ZigZag encoding.
-        /// </summary>
-        /// <remarks>
-        /// ZigZag encodes signed integers into values that can be efficiently
-        /// encoded with varint.  (Otherwise, negative values must be 
-        /// sign-extended to 64 bits to be varint encoded, thus always taking
-        /// 10 bytes on the wire.)
-        /// </remarks>
-        internal static ulong EncodeZigZag64(long n)
-        {
-            return (ulong) ((n << 1) ^ (n >> 63));
-        }
-
-        private void RefreshBuffer()
-        {
-            if (output == null)
-            {
-                // We're writing to a single buffer.
-                throw new OutOfSpaceException();
-            }
-
-            // Since we have an output stream, this is our buffer
-            // and buffer offset == 0
-            output.Write(buffer, 0, position);
-            position = 0;
-        }
-
-        /// <summary>
-        /// Indicates that a CodedOutputStream wrapping a flat byte array
-        /// ran out of space.
-        /// </summary>
-        public sealed class OutOfSpaceException : IOException
-        {
-            internal OutOfSpaceException()
-                : base("CodedOutputStream was writing to a flat byte array and ran out of space.")
-            {
-            }
-        }
-
-        /// <summary>
-        /// Flushes any buffered data and optionally closes the underlying stream, if any.
-        /// </summary>
-        /// <remarks>
-        /// <para>
-        /// By default, any underlying stream is closed by this method. To configure this behaviour,
-        /// use a constructor overload with a <c>leaveOpen</c> parameter. If this instance does not
-        /// have an underlying stream, this method does nothing.
-        /// </para>
-        /// <para>
-        /// For the sake of efficiency, calling this method does not prevent future write calls - but
-        /// if a later write ends up writing to a stream which has been disposed, that is likely to
-        /// fail. It is recommend that you not call any other methods after this.
-        /// </para>
-        /// </remarks>
-        public void Dispose()
-        {
-            Flush();
-            if (!leaveOpen)
-            {
-                output.Dispose();
-            }
-        }
-
-        /// <summary>
-        /// Flushes any buffered data to the underlying stream (if there is one).
-        /// </summary>
-        public void Flush()
-        {
-            if (output != null)
-            {
-                RefreshBuffer();
-            }
-        }
-
-        /// <summary>
-        /// Verifies that SpaceLeft returns zero. It's common to create a byte array
-        /// that is exactly big enough to hold a message, then write to it with
-        /// a CodedOutputStream. Calling CheckNoSpaceLeft after writing verifies that
-        /// the message was actually as big as expected, which can help bugs.
-        /// </summary>
-        public void CheckNoSpaceLeft()
-        {
-            if (SpaceLeft != 0)
-            {
-                throw new InvalidOperationException("Did not write as much data as expected.");
-            }
-        }
-
-        /// <summary>
-        /// If writing to a flat array, returns the space left in the array. Otherwise,
-        /// throws an InvalidOperationException.
-        /// </summary>
-        public int SpaceLeft
-        {
-            get
-            {
-                if (output == null)
-                {
-                    return limit - position;
-                }
-                else
-                {
-                    throw new InvalidOperationException(
-                        "SpaceLeft can only be called on CodedOutputStreams that are " +
-                        "writing to a flat array.");
-                }
-            }
-        }
-    }
-}

+ 0 - 760
csharp/src/Google.Protobuf/Collections/MapField.cs

@@ -1,760 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Compatibility;
-using Google.Protobuf.Reflection;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace Google.Protobuf.Collections
-{
-    /// <summary>
-    /// Representation of a map field in a Protocol Buffer message.
-    /// </summary>
-    /// <typeparam name="TKey">Key type in the map. Must be a type supported by Protocol Buffer map keys.</typeparam>
-    /// <typeparam name="TValue">Value type in the map. Must be a type supported by Protocol Buffers.</typeparam>
-    /// <remarks>
-    /// <para>
-    /// For string keys, the equality comparison is provided by <see cref="StringComparer.Ordinal" />.
-    /// </para>
-    /// <para>
-    /// Null values are not permitted in the map, either for wrapper types or regular messages.
-    /// If a map is deserialized from a data stream and the value is missing from an entry, a default value
-    /// is created instead. For primitive types, that is the regular default value (0, the empty string and so
-    /// on); for message types, an empty instance of the message is created, as if the map entry contained a 0-length
-    /// encoded value for the field.
-    /// </para>
-    /// <para>
-    /// This implementation does not generally prohibit the use of key/value types which are not
-    /// supported by Protocol Buffers (e.g. using a key type of <code>byte</code>) but nor does it guarantee
-    /// that all operations will work in such cases.
-    /// </para>
-    /// <para>
-    /// The order in which entries are returned when iterating over this object is undefined, and may change
-    /// in future versions.
-    /// </para>
-    /// </remarks>
-    public sealed class MapField<TKey, TValue> : IDeepCloneable<MapField<TKey, TValue>>, IDictionary<TKey, TValue>, IEquatable<MapField<TKey, TValue>>, IDictionary
-    {
-        // TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.)
-        private readonly Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> map =
-            new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>>();
-        private readonly LinkedList<KeyValuePair<TKey, TValue>> list = new LinkedList<KeyValuePair<TKey, TValue>>();
-
-        /// <summary>
-        /// Creates a deep clone of this object.
-        /// </summary>
-        /// <returns>
-        /// A deep clone of this object.
-        /// </returns>
-        public MapField<TKey, TValue> Clone()
-        {
-            var clone = new MapField<TKey, TValue>();
-            // Keys are never cloneable. Values might be.
-            if (typeof(IDeepCloneable<TValue>).IsAssignableFrom(typeof(TValue)))
-            {
-                foreach (var pair in list)
-                {
-                    clone.Add(pair.Key, ((IDeepCloneable<TValue>)pair.Value).Clone());
-                }
-            }
-            else
-            {
-                // Nothing is cloneable, so we don't need to worry.
-                clone.Add(this);
-            }
-            return clone;
-        }
-
-        /// <summary>
-        /// Adds the specified key/value pair to the map.
-        /// </summary>
-        /// <remarks>
-        /// This operation fails if the key already exists in the map. To replace an existing entry, use the indexer.
-        /// </remarks>
-        /// <param name="key">The key to add</param>
-        /// <param name="value">The value to add.</param>
-        /// <exception cref="System.ArgumentException">The given key already exists in map.</exception>
-        public void Add(TKey key, TValue value)
-        {
-            // Validation of arguments happens in ContainsKey and the indexer
-            if (ContainsKey(key))
-            {
-                throw new ArgumentException("Key already exists in map", nameof(key));
-            }
-            this[key] = value;
-        }
-
-        /// <summary>
-        /// Determines whether the specified key is present in the map.
-        /// </summary>
-        /// <param name="key">The key to check.</param>
-        /// <returns><c>true</c> if the map contains the given key; <c>false</c> otherwise.</returns>
-        public bool ContainsKey(TKey key)
-        {
-            ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
-            return map.ContainsKey(key);
-        }
-
-        private bool ContainsValue(TValue value)
-        {
-            var comparer = EqualityComparer<TValue>.Default;
-            return list.Any(pair => comparer.Equals(pair.Value, value));
-        }
-
-        /// <summary>
-        /// Removes the entry identified by the given key from the map.
-        /// </summary>
-        /// <param name="key">The key indicating the entry to remove from the map.</param>
-        /// <returns><c>true</c> if the map contained the given key before the entry was removed; <c>false</c> otherwise.</returns>
-        public bool Remove(TKey key)
-        {
-            ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
-            LinkedListNode<KeyValuePair<TKey, TValue>> node;
-            if (map.TryGetValue(key, out node))
-            {
-                map.Remove(key);
-                node.List.Remove(node);
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// Gets the value associated with the specified key.
-        /// </summary>
-        /// <param name="key">The key whose value to get.</param>
-        /// <param name="value">When this method returns, the value associated with the specified key, if the key is found;
-        /// otherwise, the default value for the type of the <paramref name="value"/> parameter.
-        /// This parameter is passed uninitialized.</param>
-        /// <returns><c>true</c> if the map contains an element with the specified key; otherwise, <c>false</c>.</returns>
-        public bool TryGetValue(TKey key, out TValue value)
-        {
-            LinkedListNode<KeyValuePair<TKey, TValue>> node;
-            if (map.TryGetValue(key, out node))
-            {
-                value = node.Value.Value;
-                return true;
-            }
-            else
-            {
-                value = default(TValue);
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// Gets or sets the value associated with the specified key.
-        /// </summary>
-        /// <param name="key">The key of the value to get or set.</param>
-        /// <exception cref="KeyNotFoundException">The property is retrieved and key does not exist in the collection.</exception>
-        /// <returns>The value associated with the specified key. If the specified key is not found,
-        /// a get operation throws a <see cref="KeyNotFoundException"/>, and a set operation creates a new element with the specified key.</returns>
-        public TValue this[TKey key]
-        {
-            get
-            {
-                ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
-                TValue value;
-                if (TryGetValue(key, out value))
-                {
-                    return value;
-                }
-                throw new KeyNotFoundException();
-            }
-            set
-            {
-                ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key));
-                // value == null check here is redundant, but avoids boxing.
-                if (value == null)
-                {
-                    ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value));
-                }
-                LinkedListNode<KeyValuePair<TKey, TValue>> node;
-                var pair = new KeyValuePair<TKey, TValue>(key, value);
-                if (map.TryGetValue(key, out node))
-                {
-                    node.Value = pair;
-                }
-                else
-                {
-                    node = list.AddLast(pair);
-                    map[key] = node;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Gets a collection containing the keys in the map.
-        /// </summary>
-        public ICollection<TKey> Keys { get { return new MapView<TKey>(this, pair => pair.Key, ContainsKey); } }
-
-        /// <summary>
-        /// Gets a collection containing the values in the map.
-        /// </summary>
-        public ICollection<TValue> Values { get { return new MapView<TValue>(this, pair => pair.Value, ContainsValue); } }
-
-        /// <summary>
-        /// Adds the specified entries to the map. The keys and values are not automatically cloned.
-        /// </summary>
-        /// <param name="entries">The entries to add to the map.</param>
-        public void Add(IDictionary<TKey, TValue> entries)
-        {
-            ProtoPreconditions.CheckNotNull(entries, nameof(entries));
-            foreach (var pair in entries)
-            {
-                Add(pair.Key, pair.Value);
-            }
-        }
-
-        /// <summary>
-        /// Returns an enumerator that iterates through the collection.
-        /// </summary>
-        /// <returns>
-        /// An enumerator that can be used to iterate through the collection.
-        /// </returns>
-        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
-        {
-            return list.GetEnumerator();
-        }
-
-        /// <summary>
-        /// Returns an enumerator that iterates through a collection.
-        /// </summary>
-        /// <returns>
-        /// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
-        /// </returns>
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            return GetEnumerator();
-        }
-
-        /// <summary>
-        /// Adds the specified item to the map.
-        /// </summary>
-        /// <param name="item">The item to add to the map.</param>
-        void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
-        {
-            Add(item.Key, item.Value);
-        }
-
-        /// <summary>
-        /// Removes all items from the map.
-        /// </summary>
-        public void Clear()
-        {
-            list.Clear();
-            map.Clear();
-        }
-
-        /// <summary>
-        /// Determines whether map contains an entry equivalent to the given key/value pair.
-        /// </summary>
-        /// <param name="item">The key/value pair to find.</param>
-        /// <returns></returns>
-        bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
-        {
-            TValue value;
-            return TryGetValue(item.Key, out value)
-                && EqualityComparer<TValue>.Default.Equals(item.Value, value);
-        }
-
-        /// <summary>
-        /// Copies the key/value pairs in this map to an array.
-        /// </summary>
-        /// <param name="array">The array to copy the entries into.</param>
-        /// <param name="arrayIndex">The index of the array at which to start copying values.</param>
-        void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
-        {
-            list.CopyTo(array, arrayIndex);
-        }
-
-        /// <summary>
-        /// Removes the specified key/value pair from the map.
-        /// </summary>
-        /// <remarks>Both the key and the value must be found for the entry to be removed.</remarks>
-        /// <param name="item">The key/value pair to remove.</param>
-        /// <returns><c>true</c> if the key/value pair was found and removed; <c>false</c> otherwise.</returns>
-        bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
-        {
-            if (item.Key == null)
-            {
-                throw new ArgumentException("Key is null", nameof(item));
-            }
-            LinkedListNode<KeyValuePair<TKey, TValue>> node;
-            if (map.TryGetValue(item.Key, out node) &&
-                EqualityComparer<TValue>.Default.Equals(item.Value, node.Value.Value))
-            {
-                map.Remove(item.Key);
-                node.List.Remove(node);
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// Gets the number of elements contained in the map.
-        /// </summary>
-        public int Count { get { return list.Count; } }
-
-        /// <summary>
-        /// Gets a value indicating whether the map is read-only.
-        /// </summary>
-        public bool IsReadOnly { get { return false; } }
-
-        /// <summary>
-        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
-        /// </summary>
-        /// <param name="other">The <see cref="System.Object" /> to compare with this instance.</param>
-        /// <returns>
-        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
-        /// </returns>
-        public override bool Equals(object other)
-        {
-            return Equals(other as MapField<TKey, TValue>);
-        }
-
-        /// <summary>
-        /// Returns a hash code for this instance.
-        /// </summary>
-        /// <returns>
-        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
-        /// </returns>
-        public override int GetHashCode()
-        {
-            var valueComparer = EqualityComparer<TValue>.Default;
-            int hash = 0;
-            foreach (var pair in list)
-            {
-                hash ^= pair.Key.GetHashCode() * 31 + valueComparer.GetHashCode(pair.Value);
-            }
-            return hash;
-        }
-
-        /// <summary>
-        /// Compares this map with another for equality.
-        /// </summary>
-        /// <remarks>
-        /// The order of the key/value pairs in the maps is not deemed significant in this comparison.
-        /// </remarks>
-        /// <param name="other">The map to compare this with.</param>
-        /// <returns><c>true</c> if <paramref name="other"/> refers to an equal map; <c>false</c> otherwise.</returns>
-        public bool Equals(MapField<TKey, TValue> other)
-        {
-            if (other == null)
-            {
-                return false;
-            }
-            if (other == this)
-            {
-                return true;
-            }
-            if (other.Count != this.Count)
-            {
-                return false;
-            }
-            var valueComparer = EqualityComparer<TValue>.Default;
-            foreach (var pair in this)
-            {
-                TValue value;
-                if (!other.TryGetValue(pair.Key, out value))
-                {
-                    return false;
-                }
-                if (!valueComparer.Equals(value, pair.Value))
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// Adds entries to the map from the given stream.
-        /// </summary>
-        /// <remarks>
-        /// It is assumed that the stream is initially positioned after the tag specified by the codec.
-        /// This method will continue reading entries from the stream until the end is reached, or
-        /// a different tag is encountered.
-        /// </remarks>
-        /// <param name="input">Stream to read from</param>
-        /// <param name="codec">Codec describing how the key/value pairs are encoded</param>
-        public void AddEntriesFrom(CodedInputStream input, Codec codec)
-        {
-            var adapter = new Codec.MessageAdapter(codec);
-            do
-            {
-                adapter.Reset();
-                input.ReadMessage(adapter);
-                this[adapter.Key] = adapter.Value;
-            } while (input.MaybeConsumeTag(codec.MapTag));
-        }
-
-        /// <summary>
-        /// Writes the contents of this map to the given coded output stream, using the specified codec
-        /// to encode each entry.
-        /// </summary>
-        /// <param name="output">The output stream to write to.</param>
-        /// <param name="codec">The codec to use for each entry.</param>
-        public void WriteTo(CodedOutputStream output, Codec codec)
-        {
-            var message = new Codec.MessageAdapter(codec);
-            foreach (var entry in list)
-            {
-                message.Key = entry.Key;
-                message.Value = entry.Value;
-                output.WriteTag(codec.MapTag);
-                output.WriteMessage(message);
-            }
-        }
-
-        /// <summary>
-        /// Calculates the size of this map based on the given entry codec.
-        /// </summary>
-        /// <param name="codec">The codec to use to encode each entry.</param>
-        /// <returns></returns>
-        public int CalculateSize(Codec codec)
-        {
-            if (Count == 0)
-            {
-                return 0;
-            }
-            var message = new Codec.MessageAdapter(codec);
-            int size = 0;
-            foreach (var entry in list)
-            {
-                message.Key = entry.Key;
-                message.Value = entry.Value;
-                size += CodedOutputStream.ComputeRawVarint32Size(codec.MapTag);
-                size += CodedOutputStream.ComputeMessageSize(message);
-            }
-            return size;
-        }
-
-        /// <summary>
-        /// Returns a string representation of this repeated field, in the same
-        /// way as it would be represented by the default JSON formatter.
-        /// </summary>
-        public override string ToString()
-        {
-            var writer = new StringWriter();
-            JsonFormatter.Default.WriteDictionary(writer, this);
-            return writer.ToString();
-        }
-
-        #region IDictionary explicit interface implementation
-        void IDictionary.Add(object key, object value)
-        {
-            Add((TKey)key, (TValue)value);
-        }
-
-        bool IDictionary.Contains(object key)
-        {
-            if (!(key is TKey))
-            {
-                return false;
-            }
-            return ContainsKey((TKey)key);
-        }
-
-        IDictionaryEnumerator IDictionary.GetEnumerator()
-        {
-            return new DictionaryEnumerator(GetEnumerator());
-        }
-
-        void IDictionary.Remove(object key)
-        {
-            ProtoPreconditions.CheckNotNull(key, nameof(key));
-            if (!(key is TKey))
-            {
-                return;
-            }
-            Remove((TKey)key);
-        }
-
-        void ICollection.CopyTo(Array array, int index)
-        {
-            // This is ugly and slow as heck, but with any luck it will never be used anyway.
-            ICollection temp = this.Select(pair => new DictionaryEntry(pair.Key, pair.Value)).ToList();
-            temp.CopyTo(array, index);
-        }
-
-        bool IDictionary.IsFixedSize { get { return false; } }
-
-        ICollection IDictionary.Keys { get { return (ICollection)Keys; } }
-
-        ICollection IDictionary.Values { get { return (ICollection)Values; } }
-
-        bool ICollection.IsSynchronized { get { return false; } }
-
-        object ICollection.SyncRoot { get { return this; } }
-
-        object IDictionary.this[object key]
-        {
-            get
-            {
-                ProtoPreconditions.CheckNotNull(key, nameof(key));
-                if (!(key is TKey))
-                {
-                    return null;
-                }
-                TValue value;
-                TryGetValue((TKey)key, out value);
-                return value;
-            }
-
-            set
-            {
-                this[(TKey)key] = (TValue)value;
-            }
-        }
-        #endregion
-
-        private class DictionaryEnumerator : IDictionaryEnumerator
-        {
-            private readonly IEnumerator<KeyValuePair<TKey, TValue>> enumerator;
-
-            internal DictionaryEnumerator(IEnumerator<KeyValuePair<TKey, TValue>> enumerator)
-            {
-                this.enumerator = enumerator;
-            }
-
-            public bool MoveNext()
-            {
-                return enumerator.MoveNext();
-            }
-
-            public void Reset()
-            {
-                enumerator.Reset();
-            }
-
-            public object Current { get { return Entry; } }
-            public DictionaryEntry Entry { get { return new DictionaryEntry(Key, Value); } }
-            public object Key { get { return enumerator.Current.Key; } }
-            public object Value { get { return enumerator.Current.Value; } }
-        }
-
-        /// <summary>
-        /// A codec for a specific map field. This contains all the information required to encode and
-        /// decode the nested messages.
-        /// </summary>
-        public sealed class Codec
-        {
-            private readonly FieldCodec<TKey> keyCodec;
-            private readonly FieldCodec<TValue> valueCodec;
-            private readonly uint mapTag;
-
-            /// <summary>
-            /// Creates a new entry codec based on a separate key codec and value codec,
-            /// and the tag to use for each map entry.
-            /// </summary>
-            /// <param name="keyCodec">The key codec.</param>
-            /// <param name="valueCodec">The value codec.</param>
-            /// <param name="mapTag">The map tag to use to introduce each map entry.</param>
-            public Codec(FieldCodec<TKey> keyCodec, FieldCodec<TValue> valueCodec, uint mapTag)
-            {
-                this.keyCodec = keyCodec;
-                this.valueCodec = valueCodec;
-                this.mapTag = mapTag;
-            }
-
-            /// <summary>
-            /// The tag used in the enclosing message to indicate map entries.
-            /// </summary>
-            internal uint MapTag { get { return mapTag; } }
-
-            /// <summary>
-            /// A mutable message class, used for parsing and serializing. This
-            /// delegates the work to a codec, but implements the <see cref="IMessage"/> interface
-            /// for interop with <see cref="CodedInputStream"/> and <see cref="CodedOutputStream"/>.
-            /// This is nested inside Codec as it's tightly coupled to the associated codec,
-            /// and it's simpler if it has direct access to all its fields.
-            /// </summary>
-            internal class MessageAdapter : IMessage
-            {
-                private static readonly byte[] ZeroLengthMessageStreamData = new byte[] { 0 };
-
-                private readonly Codec codec;
-                internal TKey Key { get; set; }
-                internal TValue Value { get; set; }
-
-                internal MessageAdapter(Codec codec)
-                {
-                    this.codec = codec;
-                }
-
-                internal void Reset()
-                {
-                    Key = codec.keyCodec.DefaultValue;
-                    Value = codec.valueCodec.DefaultValue;
-                }
-
-                public void MergeFrom(CodedInputStream input)
-                {
-                    uint tag;
-                    while ((tag = input.ReadTag()) != 0)
-                    {
-                        if (tag == codec.keyCodec.Tag)
-                        {
-                            Key = codec.keyCodec.Read(input);
-                        }
-                        else if (tag == codec.valueCodec.Tag)
-                        {
-                            Value = codec.valueCodec.Read(input);
-                        }
-                        else 
-                        {
-                            input.SkipLastField();
-                        }
-                    }
-
-                    // Corner case: a map entry with a key but no value, where the value type is a message.
-                    // Read it as if we'd seen an input stream with no data (i.e. create a "default" message).
-                    if (Value == null)
-                    {
-                        Value = codec.valueCodec.Read(new CodedInputStream(ZeroLengthMessageStreamData));
-                    }
-                }
-
-                public void WriteTo(CodedOutputStream output)
-                {
-                    codec.keyCodec.WriteTagAndValue(output, Key);
-                    codec.valueCodec.WriteTagAndValue(output, Value);
-                }
-
-                public int CalculateSize()
-                {
-                    return codec.keyCodec.CalculateSizeWithTag(Key) + codec.valueCodec.CalculateSizeWithTag(Value);
-                }
-
-                MessageDescriptor IMessage.Descriptor { get { return null; } }
-            }
-        }
-
-        private class MapView<T> : ICollection<T>, ICollection
-        {
-            private readonly MapField<TKey, TValue> parent;
-            private readonly Func<KeyValuePair<TKey, TValue>, T> projection;
-            private readonly Func<T, bool> containsCheck;
-
-            internal MapView(
-                MapField<TKey, TValue> parent,
-                Func<KeyValuePair<TKey, TValue>, T> projection,
-                Func<T, bool> containsCheck)
-            {
-                this.parent = parent;
-                this.projection = projection;
-                this.containsCheck = containsCheck;
-            }
-
-            public int Count { get { return parent.Count; } }
-
-            public bool IsReadOnly { get { return true; } }
-
-            public bool IsSynchronized { get { return false; } }
-
-            public object SyncRoot { get { return parent; } }
-
-            public void Add(T item)
-            {
-                throw new NotSupportedException();
-            }
-
-            public void Clear()
-            {
-                throw new NotSupportedException();
-            }
-
-            public bool Contains(T item)
-            {
-                return containsCheck(item);
-            }
-
-            public void CopyTo(T[] array, int arrayIndex)
-            {
-                if (arrayIndex < 0)
-                {
-                    throw new ArgumentOutOfRangeException(nameof(arrayIndex));
-                }
-                if (arrayIndex + Count  >= array.Length)
-                {
-                    throw new ArgumentException("Not enough space in the array", nameof(array));
-                }
-                foreach (var item in this)
-                {
-                    array[arrayIndex++] = item;
-                }
-            }
-
-            public IEnumerator<T> GetEnumerator()
-            {
-                return parent.list.Select(projection).GetEnumerator();
-            }
-
-            public bool Remove(T item)
-            {
-                throw new NotSupportedException();
-            }
-
-            IEnumerator IEnumerable.GetEnumerator()
-            {
-                return GetEnumerator();
-            }
-
-            public void CopyTo(Array array, int index)
-            {
-                if (index < 0)
-                {
-                    throw new ArgumentOutOfRangeException(nameof(index));
-                }
-                if (index + Count >= array.Length)
-                {
-                    throw new ArgumentException("Not enough space in the array", nameof(array));
-                }
-                foreach (var item in this)
-                {
-                    array.SetValue(item, index++);
-                }
-            }
-        }
-    }
-}

+ 0 - 147
csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs

@@ -1,147 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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;
-using System.Collections.Generic;
-
-namespace Google.Protobuf.Collections
-{
-    /// <summary>
-    /// Read-only wrapper around another dictionary.
-    /// </summary>
-    internal sealed class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>
-    {
-        private readonly IDictionary<TKey, TValue> wrapped;
-
-        public ReadOnlyDictionary(IDictionary<TKey, TValue> wrapped)
-        {
-            this.wrapped = wrapped;
-        }
-
-        public void Add(TKey key, TValue value)
-        {
-            throw new InvalidOperationException();
-        }
-
-        public bool ContainsKey(TKey key)
-        {
-            return wrapped.ContainsKey(key);
-        }
-
-        public ICollection<TKey> Keys
-        {
-            get { return wrapped.Keys; }
-        }
-
-        public bool Remove(TKey key)
-        {
-            throw new InvalidOperationException();
-        }
-
-        public bool TryGetValue(TKey key, out TValue value)
-        {
-            return wrapped.TryGetValue(key, out value);
-        }
-
-        public ICollection<TValue> Values
-        {
-            get { return wrapped.Values; }
-        }
-
-        public TValue this[TKey key]
-        {
-            get { return wrapped[key]; }
-            set { throw new InvalidOperationException(); }
-        }
-
-        public void Add(KeyValuePair<TKey, TValue> item)
-        {
-            throw new InvalidOperationException();
-        }
-
-        public void Clear()
-        {
-            throw new InvalidOperationException();
-        }
-
-        public bool Contains(KeyValuePair<TKey, TValue> item)
-        {
-            return wrapped.Contains(item);
-        }
-
-        public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
-        {
-            wrapped.CopyTo(array, arrayIndex);
-        }
-
-        public int Count
-        {
-            get { return wrapped.Count; }
-        }
-
-        public bool IsReadOnly
-        {
-            get { return true; }
-        }
-
-        public bool Remove(KeyValuePair<TKey, TValue> item)
-        {
-            throw new InvalidOperationException();
-        }
-
-        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
-        {
-            return wrapped.GetEnumerator();
-        }
-
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            return ((IEnumerable) wrapped).GetEnumerator();
-        }
-
-        public override bool Equals(object obj)
-        {
-            return wrapped.Equals(obj);
-        }
-
-        public override int GetHashCode()
-        {
-            return wrapped.GetHashCode();
-        }
-
-        public override string ToString()
-        {
-            return wrapped.ToString();
-        }
-    }
-}

+ 0 - 591
csharp/src/Google.Protobuf/Collections/RepeatedField.cs

@@ -1,591 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Google.Protobuf.Collections
-{
-    /// <summary>
-    /// The contents of a repeated field: essentially, a collection with some extra
-    /// restrictions (no null values) and capabilities (deep cloning).
-    /// </summary>
-    /// <remarks>
-    /// This implementation does not generally prohibit the use of types which are not
-    /// supported by Protocol Buffers but nor does it guarantee that all operations will work in such cases.
-    /// </remarks>
-    /// <typeparam name="T">The element type of the repeated field.</typeparam>
-    public sealed class RepeatedField<T> : IList<T>, IList, IDeepCloneable<RepeatedField<T>>, IEquatable<RepeatedField<T>>
-    {
-        private static readonly T[] EmptyArray = new T[0];
-        private const int MinArraySize = 8;
-
-        private T[] array = EmptyArray;
-        private int count = 0;
-
-        /// <summary>
-        /// Creates a deep clone of this repeated field.
-        /// </summary>
-        /// <remarks>
-        /// If the field type is
-        /// a message type, each element is also cloned; otherwise, it is
-        /// assumed that the field type is primitive (including string and
-        /// bytes, both of which are immutable) and so a simple copy is
-        /// equivalent to a deep clone.
-        /// </remarks>
-        /// <returns>A deep clone of this repeated field.</returns>
-        public RepeatedField<T> Clone()
-        {
-            RepeatedField<T> clone = new RepeatedField<T>();
-            if (array != EmptyArray)
-            {
-                clone.array = (T[])array.Clone();
-                IDeepCloneable<T>[] cloneableArray = clone.array as IDeepCloneable<T>[];
-                if (cloneableArray != null)
-                {
-                    for (int i = 0; i < count; i++)
-                    {
-                        clone.array[i] = cloneableArray[i].Clone();
-                    }
-                }
-            }
-            clone.count = count;
-            return clone;
-        }
-
-        /// <summary>
-        /// Adds the entries from the given input stream, decoding them with the specified codec.
-        /// </summary>
-        /// <param name="input">The input stream to read from.</param>
-        /// <param name="codec">The codec to use in order to read each entry.</param>
-        public void AddEntriesFrom(CodedInputStream input, FieldCodec<T> codec)
-        {
-            // TODO: Inline some of the Add code, so we can avoid checking the size on every
-            // iteration.
-            uint tag = input.LastTag;
-            var reader = codec.ValueReader;
-            // Non-nullable value types can be packed or not.
-            if (FieldCodec<T>.IsPackedRepeatedField(tag))
-            {
-                int length = input.ReadLength();
-                if (length > 0)
-                {
-                    int oldLimit = input.PushLimit(length);
-                    while (!input.ReachedLimit)
-                    {
-                        Add(reader(input));
-                    }
-                    input.PopLimit(oldLimit);
-                }
-                // Empty packed field. Odd, but valid - just ignore.
-            }
-            else
-            {
-                // Not packed... (possibly not packable)
-                do
-                {
-                    Add(reader(input));
-                } while (input.MaybeConsumeTag(tag));
-            }
-        }
-
-        /// <summary>
-        /// Calculates the size of this collection based on the given codec.
-        /// </summary>
-        /// <param name="codec">The codec to use when encoding each field.</param>
-        /// <returns>The number of bytes that would be written to a <see cref="CodedOutputStream"/> by <see cref="WriteTo"/>,
-        /// using the same codec.</returns>
-        public int CalculateSize(FieldCodec<T> codec)
-        {
-            if (count == 0)
-            {
-                return 0;
-            }
-            uint tag = codec.Tag;
-            if (codec.PackedRepeatedField)
-            {
-                int dataSize = CalculatePackedDataSize(codec);
-                return CodedOutputStream.ComputeRawVarint32Size(tag) +
-                    CodedOutputStream.ComputeLengthSize(dataSize) +
-                    dataSize;
-            }
-            else
-            {
-                var sizeCalculator = codec.ValueSizeCalculator;
-                int size = count * CodedOutputStream.ComputeRawVarint32Size(tag);
-                for (int i = 0; i < count; i++)
-                {
-                    size += sizeCalculator(array[i]);
-                }
-                return size;
-            }
-        }
-
-        private int CalculatePackedDataSize(FieldCodec<T> codec)
-        {
-            int fixedSize = codec.FixedSize;
-            if (fixedSize == 0)
-            {
-                var calculator = codec.ValueSizeCalculator;
-                int tmp = 0;
-                for (int i = 0; i < count; i++)
-                {
-                    tmp += calculator(array[i]);
-                }
-                return tmp;
-            }
-            else
-            {
-                return fixedSize * Count;
-            }
-        }
-
-        /// <summary>
-        /// Writes the contents of this collection to the given <see cref="CodedOutputStream"/>,
-        /// encoding each value using the specified codec.
-        /// </summary>
-        /// <param name="output">The output stream to write to.</param>
-        /// <param name="codec">The codec to use when encoding each value.</param>
-        public void WriteTo(CodedOutputStream output, FieldCodec<T> codec)
-        {
-            if (count == 0)
-            {
-                return;
-            }
-            var writer = codec.ValueWriter;
-            var tag = codec.Tag;
-            if (codec.PackedRepeatedField)
-            {
-                // Packed primitive type
-                uint size = (uint)CalculatePackedDataSize(codec);
-                output.WriteTag(tag);
-                output.WriteRawVarint32(size);
-                for (int i = 0; i < count; i++)
-                {
-                    writer(output, array[i]);
-                }
-            }
-            else
-            {
-                // Not packed: a simple tag/value pair for each value.
-                // Can't use codec.WriteTagAndValue, as that omits default values.
-                for (int i = 0; i < count; i++)
-                {
-                    output.WriteTag(tag);
-                    writer(output, array[i]);
-                }
-            }
-        }
-
-        private void EnsureSize(int size)
-        {
-            if (array.Length < size)
-            {
-                size = Math.Max(size, MinArraySize);
-                int newSize = Math.Max(array.Length * 2, size);
-                var tmp = new T[newSize];
-                Array.Copy(array, 0, tmp, 0, array.Length);
-                array = tmp;
-            }
-        }
-
-        /// <summary>
-        /// Adds the specified item to the collection.
-        /// </summary>
-        /// <param name="item">The item to add.</param>
-        public void Add(T item)
-        {
-            ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
-            EnsureSize(count + 1);
-            array[count++] = item;
-        }
-
-        /// <summary>
-        /// Removes all items from the collection.
-        /// </summary>
-        public void Clear()
-        {
-            array = EmptyArray;
-            count = 0;
-        }
-
-        /// <summary>
-        /// Determines whether this collection contains the given item.
-        /// </summary>
-        /// <param name="item">The item to find.</param>
-        /// <returns><c>true</c> if this collection contains the given item; <c>false</c> otherwise.</returns>
-        public bool Contains(T item)
-        {
-            return IndexOf(item) != -1;
-        }
-
-        /// <summary>
-        /// Copies this collection to the given array.
-        /// </summary>
-        /// <param name="array">The array to copy to.</param>
-        /// <param name="arrayIndex">The first index of the array to copy to.</param>
-        public void CopyTo(T[] array, int arrayIndex)
-        {
-            Array.Copy(this.array, 0, array, arrayIndex, count);
-        }
-
-        /// <summary>
-        /// Removes the specified item from the collection
-        /// </summary>
-        /// <param name="item">The item to remove.</param>
-        /// <returns><c>true</c> if the item was found and removed; <c>false</c> otherwise.</returns>
-        public bool Remove(T item)
-        {
-            int index = IndexOf(item);
-            if (index == -1)
-            {
-                return false;
-            }            
-            Array.Copy(array, index + 1, array, index, count - index - 1);
-            count--;
-            array[count] = default(T);
-            return true;
-        }
-
-        /// <summary>
-        /// Gets the number of elements contained in the collection.
-        /// </summary>
-        public int Count => count;
-
-        /// <summary>
-        /// Gets a value indicating whether the collection is read-only.
-        /// </summary>
-        public bool IsReadOnly => false;
-
-        /// <summary>
-        /// Adds all of the specified values into this collection.
-        /// </summary>
-        /// <param name="values">The values to add to this collection.</param>
-        public void AddRange(IEnumerable<T> values)
-        {
-            ProtoPreconditions.CheckNotNull(values, nameof(values));
-
-            // Optimization 1: If the collection we're adding is already a RepeatedField<T>,
-            // we know the values are valid.
-            var otherRepeatedField = values as RepeatedField<T>;
-            if (otherRepeatedField != null)
-            {
-                EnsureSize(count + otherRepeatedField.count);
-                Array.Copy(otherRepeatedField.array, 0, array, count, otherRepeatedField.count);
-                count += otherRepeatedField.count;
-                return;
-            }
-
-            // Optimization 2: The collection is an ICollection, so we can expand
-            // just once and ask the collection to copy itself into the array.
-            var collection = values as ICollection;
-            if (collection != null)
-            {
-                var extraCount = collection.Count;
-                // For reference types and nullable value types, we need to check that there are no nulls
-                // present. (This isn't a thread-safe approach, but we don't advertise this is thread-safe.)
-                // We expect the JITter to optimize this test to true/false, so it's effectively conditional
-                // specialization.
-                if (default(T) == null)
-                {
-                    // TODO: Measure whether iterating once to check and then letting the collection copy
-                    // itself is faster or slower than iterating and adding as we go. For large
-                    // collections this will not be great in terms of cache usage... but the optimized
-                    // copy may be significantly faster than doing it one at a time.
-                    foreach (var item in collection)
-                    {
-                        if (item == null)
-                        {
-                            throw new ArgumentException("Sequence contained null element", nameof(values));
-                        }
-                    }
-                }
-                EnsureSize(count + extraCount);
-                collection.CopyTo(array, count);
-                count += extraCount;
-                return;
-            }
-
-            // We *could* check for ICollection<T> as well, but very very few collections implement
-            // ICollection<T> but not ICollection. (HashSet<T> does, for one...)
-
-            // Fall back to a slower path of adding items one at a time.
-            foreach (T item in values)
-            {
-                Add(item);
-            }
-        }
-
-        /// <summary>
-        /// Adds all of the specified values into this collection. This method is present to
-        /// allow repeated fields to be constructed from queries within collection initializers.
-        /// Within non-collection-initializer code, consider using the equivalent <see cref="AddRange"/>
-        /// method instead for clarity.
-        /// </summary>
-        /// <param name="values">The values to add to this collection.</param>
-        public void Add(IEnumerable<T> values)
-        {
-            AddRange(values);
-        }
-
-        /// <summary>
-        /// Returns an enumerator that iterates through the collection.
-        /// </summary>
-        /// <returns>
-        /// An enumerator that can be used to iterate through the collection.
-        /// </returns>
-        public IEnumerator<T> GetEnumerator()
-        {
-            for (int i = 0; i < count; i++)
-            {
-                yield return array[i];
-            }
-        }
-
-        /// <summary>
-        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
-        /// </summary>
-        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
-        /// <returns>
-        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
-        /// </returns>
-        public override bool Equals(object obj)
-        {
-            return Equals(obj as RepeatedField<T>);
-        }
-
-        /// <summary>
-        /// Returns an enumerator that iterates through a collection.
-        /// </summary>
-        /// <returns>
-        /// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
-        /// </returns>
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            return GetEnumerator();
-        }
-
-        /// <summary>
-        /// Returns a hash code for this instance.
-        /// </summary>
-        /// <returns>
-        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
-        /// </returns>
-        public override int GetHashCode()
-        {
-            int hash = 0;
-            for (int i = 0; i < count; i++)
-            {
-                hash = hash * 31 + array[i].GetHashCode();
-            }
-            return hash;
-        }
-
-        /// <summary>
-        /// Compares this repeated field with another for equality.
-        /// </summary>
-        /// <param name="other">The repeated field to compare this with.</param>
-        /// <returns><c>true</c> if <paramref name="other"/> refers to an equal repeated field; <c>false</c> otherwise.</returns>
-        public bool Equals(RepeatedField<T> other)
-        {
-            if (ReferenceEquals(other, null))
-            {
-                return false;
-            }
-            if (ReferenceEquals(other, this))
-            {
-                return true;
-            }
-            if (other.Count != this.Count)
-            {
-                return false;
-            }
-            EqualityComparer<T> comparer = EqualityComparer<T>.Default;
-            for (int i = 0; i < count; i++)
-            {
-                if (!comparer.Equals(array[i], other.array[i]))
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// Returns the index of the given item within the collection, or -1 if the item is not
-        /// present.
-        /// </summary>
-        /// <param name="item">The item to find in the collection.</param>
-        /// <returns>The zero-based index of the item, or -1 if it is not found.</returns>
-        public int IndexOf(T item)
-        {
-            ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
-            EqualityComparer<T> comparer = EqualityComparer<T>.Default;
-            for (int i = 0; i < count; i++)
-            {
-                if (comparer.Equals(array[i], item))
-                {
-                    return i;
-                }
-            }
-            return -1;
-        }
-
-        /// <summary>
-        /// Inserts the given item at the specified index.
-        /// </summary>
-        /// <param name="index">The index at which to insert the item.</param>
-        /// <param name="item">The item to insert.</param>
-        public void Insert(int index, T item)
-        {
-            ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item));
-            if (index < 0 || index > count)
-            {
-                throw new ArgumentOutOfRangeException(nameof(index));
-            }
-            EnsureSize(count + 1);
-            Array.Copy(array, index, array, index + 1, count - index);
-            array[index] = item;
-            count++;
-        }
-
-        /// <summary>
-        /// Removes the item at the given index.
-        /// </summary>
-        /// <param name="index">The zero-based index of the item to remove.</param>
-        public void RemoveAt(int index)
-        {
-            if (index < 0 || index >= count)
-            {
-                throw new ArgumentOutOfRangeException(nameof(index));
-            }
-            Array.Copy(array, index + 1, array, index, count - index - 1);
-            count--;
-            array[count] = default(T);
-        }
-
-        /// <summary>
-        /// Returns a string representation of this repeated field, in the same
-        /// way as it would be represented by the default JSON formatter.
-        /// </summary>
-        public override string ToString()
-        {
-            var writer = new StringWriter();
-            JsonFormatter.Default.WriteList(writer, this);
-            return writer.ToString();
-        }
-
-        /// <summary>
-        /// Gets or sets the item at the specified index.
-        /// </summary>
-        /// <value>
-        /// The element at the specified index.
-        /// </value>
-        /// <param name="index">The zero-based index of the element to get or set.</param>
-        /// <returns>The item at the specified index.</returns>
-        public T this[int index]
-        {
-            get
-            {
-                if (index < 0 || index >= count)
-                {
-                    throw new ArgumentOutOfRangeException(nameof(index));
-                }
-                return array[index];
-            }
-            set
-            {
-                if (index < 0 || index >= count)
-                {
-                    throw new ArgumentOutOfRangeException(nameof(index));
-                }
-                ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value));
-                array[index] = value;
-            }
-        }
-
-        #region Explicit interface implementation for IList and ICollection.
-        bool IList.IsFixedSize => false;
-
-        void ICollection.CopyTo(Array array, int index)
-        {
-            Array.Copy(this.array, 0, array, index, count);
-        }
-
-        bool ICollection.IsSynchronized => false;
-
-        object ICollection.SyncRoot => this;
-
-        object IList.this[int index]
-        {
-            get { return this[index]; }
-            set { this[index] = (T)value; }
-        }
-
-        int IList.Add(object value)
-        {
-            Add((T) value);
-            return count - 1;
-        }
-
-        bool IList.Contains(object value)
-        {
-            return (value is T && Contains((T)value));
-        }
-
-        int IList.IndexOf(object value)
-        {
-            if (!(value is T))
-            {
-                return -1;
-            }
-            return IndexOf((T)value);
-        }
-
-        void IList.Insert(int index, object value)
-        {
-            Insert(index, (T) value);
-        }
-
-        void IList.Remove(object value)
-        {
-            if (!(value is T))
-            {
-                return;
-            }
-            Remove((T)value);
-        }
-        #endregion        
-    }
-}

+ 0 - 72
csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs

@@ -1,72 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Reflection;
-
-namespace Google.Protobuf.Compatibility
-{
-    /// <summary>
-    /// Extension methods for <see cref="PropertyInfo"/>, effectively providing
-    /// the familiar members from previous desktop framework versions while
-    /// targeting the newer releases, .NET Core etc.
-    /// </summary>
-    internal static class PropertyInfoExtensions
-    {
-        /// <summary>
-        /// Returns the public getter of a property, or null if there is no such getter
-        /// (either because it's read-only, or the getter isn't public).
-        /// </summary>
-        internal static MethodInfo GetGetMethod(this PropertyInfo target)
-        {
-#if DOTNET35
-            var method = target.GetGetMethod();
-#else
-            var method = target.GetMethod;
-#endif
-            return method != null && method.IsPublic ? method : null;
-        }
-
-        /// <summary>
-        /// Returns the public setter of a property, or null if there is no such setter
-        /// (either because it's write-only, or the setter isn't public).
-        /// </summary>
-        internal static MethodInfo GetSetMethod(this PropertyInfo target)
-        {
-#if DOTNET35
-            var method = target.GetSetMethod();
-#else
-            var method = target.SetMethod;
-#endif
-            return method != null && method.IsPublic ? method : null;
-        }
-    }
-}

+ 0 - 106
csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs

@@ -1,106 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Reflection;
-
-#if !DOTNET35
-namespace Google.Protobuf.Compatibility
-{
-    /// <summary>
-    /// Provides extension methods on Type that just proxy to TypeInfo.
-    /// These are used to support the new type system from .NET 4.5, without
-    /// having calls to GetTypeInfo all over the place. While the methods here are meant to be
-    /// broadly compatible with the desktop framework, there are some subtle differences in behaviour - but
-    /// they're not expected to affect our use cases. While the class is internal, that should be fine: we can
-    /// evaluate each new use appropriately.
-    /// </summary>
-    internal static class TypeExtensions
-    {
-        /// <summary>
-        /// See https://msdn.microsoft.com/en-us/library/system.type.isassignablefrom
-        /// </summary>
-        internal static bool IsAssignableFrom(this Type target, Type c)
-        {
-            return target.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
-        }
-
-        /// <summary>
-        /// Returns a representation of the public property associated with the given name in the given type,
-        /// including inherited properties or null if there is no such public property.
-        /// Here, "public property" means a property where either the getter, or the setter, or both, is public.
-        /// </summary>
-        internal static PropertyInfo GetProperty(this Type target, string name)
-        {
-            // GetDeclaredProperty only returns properties declared in the given type, so we need to recurse.
-            while (target != null)
-            {
-                var typeInfo = target.GetTypeInfo();
-                var ret = typeInfo.GetDeclaredProperty(name);
-                if (ret != null && ((ret.CanRead && ret.GetMethod.IsPublic) || (ret.CanWrite && ret.SetMethod.IsPublic)))
-                {
-                    return ret;
-                }
-                target = typeInfo.BaseType;
-            }
-            return null;
-        }
-
-        /// <summary>
-        /// Returns a representation of the public method associated with the given name in the given type,
-        /// including inherited methods.
-        /// </summary>
-        /// <remarks>
-        /// This has a few differences compared with Type.GetMethod in the desktop framework. It will throw
-        /// if there is an ambiguous match even between a private method and a public one, but it *won't* throw
-        /// if there are two overloads at different levels in the type hierarchy (e.g. class Base declares public void Foo(int) and
-        /// class Child : Base declares public void Foo(long)).
-        /// </remarks>
-        /// <exception cref="AmbiguousMatchException">One type in the hierarchy declared more than one method with the same name</exception>
-        internal static MethodInfo GetMethod(this Type target, string name)
-        {
-            // GetDeclaredMethod only returns methods declared in the given type, so we need to recurse.
-            while (target != null)
-            {
-                var typeInfo = target.GetTypeInfo();
-                var ret = typeInfo.GetDeclaredMethod(name);
-                if (ret != null && ret.IsPublic)
-                {
-                    return ret;
-                }
-                target = typeInfo.BaseType;
-            }
-            return null;
-        }
-    }
-}
-#endif

+ 0 - 474
csharp/src/Google.Protobuf/FieldCodec.cs

@@ -1,474 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Compatibility;
-using Google.Protobuf.WellKnownTypes;
-using System;
-using System.Collections.Generic;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Factory methods for <see cref="FieldCodec{T}"/>.
-    /// </summary>
-    public static class FieldCodec
-    {
-        // TODO: Avoid the "dual hit" of lambda expressions: create open delegates instead. (At least test...)
-
-        /// <summary>
-        /// Retrieves a codec suitable for a string field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<string> ForString(uint tag)
-        {
-            return new FieldCodec<string>(input => input.ReadString(), (output, value) => output.WriteString(value), CodedOutputStream.ComputeStringSize, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a bytes field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<ByteString> ForBytes(uint tag)
-        {
-            return new FieldCodec<ByteString>(input => input.ReadBytes(), (output, value) => output.WriteBytes(value), CodedOutputStream.ComputeBytesSize, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a bool field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<bool> ForBool(uint tag)
-        {
-            return new FieldCodec<bool>(input => input.ReadBool(), (output, value) => output.WriteBool(value), CodedOutputStream.ComputeBoolSize, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for an int32 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<int> ForInt32(uint tag)
-        {
-            return new FieldCodec<int>(input => input.ReadInt32(), (output, value) => output.WriteInt32(value), CodedOutputStream.ComputeInt32Size, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for an sint32 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<int> ForSInt32(uint tag)
-        {
-            return new FieldCodec<int>(input => input.ReadSInt32(), (output, value) => output.WriteSInt32(value), CodedOutputStream.ComputeSInt32Size, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a fixed32 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<uint> ForFixed32(uint tag)
-        {
-            return new FieldCodec<uint>(input => input.ReadFixed32(), (output, value) => output.WriteFixed32(value), 4, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for an sfixed32 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<int> ForSFixed32(uint tag)
-        {
-            return new FieldCodec<int>(input => input.ReadSFixed32(), (output, value) => output.WriteSFixed32(value), 4, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a uint32 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<uint> ForUInt32(uint tag)
-        {
-            return new FieldCodec<uint>(input => input.ReadUInt32(), (output, value) => output.WriteUInt32(value), CodedOutputStream.ComputeUInt32Size, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for an int64 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<long> ForInt64(uint tag)
-        {
-            return new FieldCodec<long>(input => input.ReadInt64(), (output, value) => output.WriteInt64(value), CodedOutputStream.ComputeInt64Size, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for an sint64 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<long> ForSInt64(uint tag)
-        {
-            return new FieldCodec<long>(input => input.ReadSInt64(), (output, value) => output.WriteSInt64(value), CodedOutputStream.ComputeSInt64Size, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a fixed64 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<ulong> ForFixed64(uint tag)
-        {
-            return new FieldCodec<ulong>(input => input.ReadFixed64(), (output, value) => output.WriteFixed64(value), 8, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for an sfixed64 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<long> ForSFixed64(uint tag)
-        {
-            return new FieldCodec<long>(input => input.ReadSFixed64(), (output, value) => output.WriteSFixed64(value), 8, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a uint64 field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<ulong> ForUInt64(uint tag)
-        {
-            return new FieldCodec<ulong>(input => input.ReadUInt64(), (output, value) => output.WriteUInt64(value), CodedOutputStream.ComputeUInt64Size, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a float field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<float> ForFloat(uint tag)
-        {
-            return new FieldCodec<float>(input => input.ReadFloat(), (output, value) => output.WriteFloat(value), CodedOutputStream.ComputeFloatSize, tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a double field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<double> ForDouble(uint tag)
-        {
-            return new FieldCodec<double>(input => input.ReadDouble(), (output, value) => output.WriteDouble(value), CodedOutputStream.ComputeDoubleSize, tag);
-        }
-
-        // Enums are tricky. We can probably use expression trees to build these delegates automatically,
-        // but it's easy to generate the code for it.
-
-        /// <summary>
-        /// Retrieves a codec suitable for an enum field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <param name="toInt32">A conversion function from <see cref="Int32"/> to the enum type.</param>
-        /// <param name="fromInt32">A conversion function from the enum type to <see cref="Int32"/>.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<T> ForEnum<T>(uint tag, Func<T, int> toInt32, Func<int, T> fromInt32)
-        {
-            return new FieldCodec<T>(input => fromInt32(
-                input.ReadEnum()),
-                (output, value) => output.WriteEnum(toInt32(value)),
-                value => CodedOutputStream.ComputeEnumSize(toInt32(value)), tag);
-        }
-
-        /// <summary>
-        /// Retrieves a codec suitable for a message field with the given tag.
-        /// </summary>
-        /// <param name="tag">The tag.</param>
-        /// <param name="parser">A parser to use for the message type.</param>
-        /// <returns>A codec for the given tag.</returns>
-        public static FieldCodec<T> ForMessage<T>(uint tag, MessageParser<T> parser) where T : IMessage<T>
-        {
-            return new FieldCodec<T>(input => { T message = parser.CreateTemplate(); input.ReadMessage(message); return message; },
-                (output, value) => output.WriteMessage(value), message => CodedOutputStream.ComputeMessageSize(message), tag);
-        }
-
-        /// <summary>
-        /// Creates a codec for a wrapper type of a class - which must be string or ByteString.
-        /// </summary>
-        public static FieldCodec<T> ForClassWrapper<T>(uint tag) where T : class
-        {
-            var nestedCodec = WrapperCodecs.GetCodec<T>();
-            return new FieldCodec<T>(
-                input => WrapperCodecs.Read<T>(input, nestedCodec),
-                (output, value) => WrapperCodecs.Write<T>(output, value, nestedCodec),
-                value => WrapperCodecs.CalculateSize<T>(value, nestedCodec),
-                tag,
-                null); // Default value for the wrapper
-        }
-
-        /// <summary>
-        /// Creates a codec for a wrapper type of a struct - which must be Int32, Int64, UInt32, UInt64,
-        /// Bool, Single or Double.
-        /// </summary>
-        public static FieldCodec<T?> ForStructWrapper<T>(uint tag) where T : struct
-        {
-            var nestedCodec = WrapperCodecs.GetCodec<T>();
-            return new FieldCodec<T?>(
-                input => WrapperCodecs.Read<T>(input, nestedCodec),
-                (output, value) => WrapperCodecs.Write<T>(output, value.Value, nestedCodec),
-                value => value == null ? 0 : WrapperCodecs.CalculateSize<T>(value.Value, nestedCodec),
-                tag,
-                null); // Default value for the wrapper
-        }
-
-        /// <summary>
-        /// Helper code to create codecs for wrapper types.
-        /// </summary>
-        /// <remarks>
-        /// Somewhat ugly with all the static methods, but the conversions involved to/from nullable types make it
-        /// slightly tricky to improve. So long as we keep the public API (ForClassWrapper, ForStructWrapper) in place,
-        /// we can refactor later if we come up with something cleaner.
-        /// </remarks>
-        private static class WrapperCodecs
-        {
-            private static readonly Dictionary<System.Type, object> Codecs = new Dictionary<System.Type, object>
-            {
-                { typeof(bool), ForBool(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint)) },
-                { typeof(int), ForInt32(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint)) },
-                { typeof(long), ForInt64(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint)) },
-                { typeof(uint), ForUInt32(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint)) },
-                { typeof(ulong), ForUInt64(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint)) },
-                { typeof(float), ForFloat(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Fixed32)) },
-                { typeof(double), ForDouble(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Fixed64)) },
-                { typeof(string), ForString(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.LengthDelimited)) },
-                { typeof(ByteString), ForBytes(WireFormat.MakeTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.LengthDelimited)) }
-            };
-
-            /// <summary>
-            /// Returns a field codec which effectively wraps a value of type T in a message.
-            /// 
-            /// </summary>
-            internal static FieldCodec<T> GetCodec<T>()
-            {
-                object value;
-                if (!Codecs.TryGetValue(typeof(T), out value))
-                {
-                    throw new InvalidOperationException("Invalid type argument requested for wrapper codec: " + typeof(T));
-                }
-                return (FieldCodec<T>) value;
-            }
-
-            internal static T Read<T>(CodedInputStream input, FieldCodec<T> codec)
-            {
-                int length = input.ReadLength();
-                int oldLimit = input.PushLimit(length);
-
-                uint tag;
-                T value = codec.DefaultValue;
-                while ((tag = input.ReadTag()) != 0)
-                {
-                    if (tag == codec.Tag)
-                    {
-                        value = codec.Read(input);
-                    }
-                    else
-                    {
-                        input.SkipLastField();
-                    }
-
-                }
-                input.CheckReadEndOfStreamTag();
-                input.PopLimit(oldLimit);
-
-                return value;
-            }
-
-            internal static void Write<T>(CodedOutputStream output, T value, FieldCodec<T> codec)
-            {
-                output.WriteLength(codec.CalculateSizeWithTag(value));
-                codec.WriteTagAndValue(output, value);
-            }
-
-            internal  static int CalculateSize<T>(T value, FieldCodec<T> codec)
-            {
-                int fieldLength = codec.CalculateSizeWithTag(value);
-                return CodedOutputStream.ComputeLengthSize(fieldLength) + fieldLength;
-            }
-        }
-    }
-
-    /// <summary>
-    /// <para>
-    /// An encode/decode pair for a single field. This effectively encapsulates
-    /// all the information needed to read or write the field value from/to a coded
-    /// stream.
-    /// </para>
-    /// <para>
-    /// This class is public and has to be as it is used by generated code, but its public
-    /// API is very limited - just what the generated code needs to call directly.
-    /// </para>
-    /// </summary>
-    /// <remarks>
-    /// This never writes default values to the stream, and does not address "packedness"
-    /// in repeated fields itself, other than to know whether or not the field *should* be packed.
-    /// </remarks>
-    public sealed class FieldCodec<T>
-    {
-        private static readonly T DefaultDefault;
-        // Only non-nullable value types support packing. This is the simplest way of detecting that.
-        private static readonly bool TypeSupportsPacking = default(T) != null;
-
-        static FieldCodec()
-        {
-            if (typeof(T) == typeof(string))
-            {
-                DefaultDefault = (T)(object)"";
-            }
-            else if (typeof(T) == typeof(ByteString))
-            {
-                DefaultDefault = (T)(object)ByteString.Empty;
-            }
-            // Otherwise it's the default value of the CLR type
-        }
-
-        internal static bool IsPackedRepeatedField(uint tag) =>
-            TypeSupportsPacking && WireFormat.GetTagWireType(tag) == WireFormat.WireType.LengthDelimited;
-
-        internal bool PackedRepeatedField { get; }
-
-        /// <summary>
-        /// Returns a delegate to write a value (unconditionally) to a coded output stream.
-        /// </summary>
-        internal Action<CodedOutputStream, T> ValueWriter { get; }
-
-        /// <summary>
-        /// Returns the size calculator for just a value.
-        /// </summary>
-        internal Func<T, int> ValueSizeCalculator { get; }
-
-        /// <summary>
-        /// Returns a delegate to read a value from a coded input stream. It is assumed that
-        /// the stream is already positioned on the appropriate tag.
-        /// </summary>
-        internal Func<CodedInputStream, T> ValueReader { get; }
-
-        /// <summary>
-        /// Returns the fixed size for an entry, or 0 if sizes vary.
-        /// </summary>
-        internal int FixedSize { get; }
-
-        /// <summary>
-        /// Gets the tag of the codec.
-        /// </summary>
-        /// <value>
-        /// The tag of the codec.
-        /// </value>
-        internal uint Tag { get; }
-
-        /// <summary>
-        /// Default value for this codec. Usually the same for every instance of the same type, but
-        /// for string/ByteString wrapper fields the codec's default value is null, whereas for
-        /// other string/ByteString fields it's "" or ByteString.Empty.
-        /// </summary>
-        /// <value>
-        /// The default value of the codec's type.
-        /// </value>
-        internal T DefaultValue { get; }
-
-        private readonly int tagSize;
-        
-        internal FieldCodec(
-                Func<CodedInputStream, T> reader,
-                Action<CodedOutputStream, T> writer,
-                int fixedSize,
-                uint tag) : this(reader, writer, _ => fixedSize, tag)
-        {
-            FixedSize = fixedSize;
-        }
-
-        internal FieldCodec(
-            Func<CodedInputStream, T> reader,
-            Action<CodedOutputStream, T> writer,
-            Func<T, int> sizeCalculator,
-            uint tag) : this(reader, writer, sizeCalculator, tag, DefaultDefault)
-        {
-        }
-
-        internal FieldCodec(
-            Func<CodedInputStream, T> reader,
-            Action<CodedOutputStream, T> writer,
-            Func<T, int> sizeCalculator,
-            uint tag,
-            T defaultValue)
-        {
-            ValueReader = reader;
-            ValueWriter = writer;
-            ValueSizeCalculator = sizeCalculator;
-            FixedSize = 0;
-            Tag = tag;
-            DefaultValue = defaultValue;
-            tagSize = CodedOutputStream.ComputeRawVarint32Size(tag);
-            // Detect packed-ness once, so we can check for it within RepeatedField<T>.
-            PackedRepeatedField = IsPackedRepeatedField(tag);
-        }
-
-        /// <summary>
-        /// Write a tag and the given value, *if* the value is not the default.
-        /// </summary>
-        public void WriteTagAndValue(CodedOutputStream output, T value)
-        {
-            if (!IsDefault(value))
-            {
-                output.WriteTag(Tag);
-                ValueWriter(output, value);
-            }
-        }
-
-        /// <summary>
-        /// Reads a value of the codec type from the given <see cref="CodedInputStream"/>.
-        /// </summary>
-        /// <param name="input">The input stream to read from.</param>
-        /// <returns>The value read from the stream.</returns>
-        public T Read(CodedInputStream input) => ValueReader(input);
-
-        /// <summary>
-        /// Calculates the size required to write the given value, with a tag,
-        /// if the value is not the default.
-        /// </summary>
-        public int CalculateSizeWithTag(T value) => IsDefault(value) ? 0 : ValueSizeCalculator(value) + tagSize;
-
-        private bool IsDefault(T value) => EqualityComparer<T>.Default.Equals(value, DefaultValue);
-    }
-}

+ 0 - 49
csharp/src/Google.Protobuf/FrameworkPortability.cs

@@ -1,49 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Text.RegularExpressions;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Class containing helpful workarounds for various platform compatibility
-    /// </summary>
-    internal static class FrameworkPortability
-    {
-        // The value of RegexOptions.Compiled is 8. We can test for the presence at
-        // execution time using Enum.IsDefined, so a single build will do the right thing
-        // on each platform. (RegexOptions.Compiled isn't supported by PCLs.)
-        internal static readonly RegexOptions CompiledRegexWhereAvailable =
-            Enum.IsDefined(typeof(RegexOptions), 8) ? (RegexOptions)8 : RegexOptions.None;
-    }
-}

+ 0 - 19
csharp/src/Google.Protobuf/Google.Protobuf.xproj

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>9b576380-726d-4142-8238-60a43ab0e35a</ProjectGuid>
-    <RootNamespace>Google.Protobuf</RootNamespace>
-    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
-    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <SchemaVersion>2.0</SchemaVersion>
-  </PropertyGroup>
-  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
-</Project>

+ 0 - 69
csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs

@@ -1,69 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2016 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// A message type that has a custom string format for diagnostic purposes.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// Calling <see cref="object.ToString"/> on a generated message type normally
-    /// returns the JSON representation. If a message type implements this interface,
-    /// then the <see cref="ToDiagnosticString"/> method will be called instead of the regular
-    /// JSON formatting code, but only when <c>ToString()</c> is called either on the message itself
-    /// or on another message which contains it. This does not affect the normal JSON formatting of
-    /// the message.
-    /// </para>
-    /// <para>
-    /// For example, if you create a proto message representing a GUID, the internal
-    /// representation may be a <c>bytes</c> field or four <c>fixed32</c> fields. However, when debugging
-    /// it may be more convenient to see a result in the same format as <see cref="System.Guid"/> provides.
-    /// </para>
-    /// <para>This interface extends <see cref="IMessage"/> to avoid it accidentally being implemented
-    /// on types other than messages, where it would not be used by anything in the framework.</para>
-    /// </remarks>
-    public interface ICustomDiagnosticMessage : IMessage
-    {
-        /// <summary>
-        /// Returns a string representation of this object, for diagnostic purposes.
-        /// </summary>
-        /// <remarks>
-        /// This method is called when a message is formatted as part of a <see cref="object.ToString"/>
-        /// call. It does not affect the JSON representation used by <see cref="JsonFormatter"/> other than
-        /// in calls to <see cref="JsonFormatter.ToDiagnosticString(IMessage)"/>. While it is recommended
-        /// that the result is valid JSON, this is never assumed by the Protobuf library.
-        /// </remarks>
-        /// <returns>A string representation of this object, for diagnostic purposes.</returns>
-        string ToDiagnosticString();
-    }
-}

+ 0 - 54
csharp/src/Google.Protobuf/IDeepCloneable.cs

@@ -1,54 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Generic interface for a deeply cloneable type.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// All generated messages implement this interface, but so do some non-message types.
-    /// Additionally, due to the type constraint on <c>T</c> in <see cref="IMessage{T}"/>,
-    /// it is simpler to keep this as a separate interface.
-    /// </para>
-    /// </remarks>
-    /// <typeparam name="T">The type itself, returned by the <see cref="Clone"/> method.</typeparam>
-    public interface IDeepCloneable<T>
-    {
-        /// <summary>
-        /// Creates a deep clone of this object.
-        /// </summary>
-        /// <returns>A deep clone of this object.</returns>
-        T Clone();
-    }
-}

+ 0 - 87
csharp/src/Google.Protobuf/IMessage.cs

@@ -1,87 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.Reflection;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Interface for a Protocol Buffers message, supporting
-    /// basic operations required for serialization.
-    /// </summary>
-    public interface IMessage
-    {
-        /// <summary>
-        /// Merges the data from the specified coded input stream with the current message.
-        /// </summary>
-        /// <remarks>See the user guide for precise merge semantics.</remarks>
-        /// <param name="input"></param>
-        void MergeFrom(CodedInputStream input);
-
-        /// <summary>
-        /// Writes the data to the given coded output stream.
-        /// </summary>
-        /// <param name="output">Coded output stream to write the data to. Must not be null.</param>
-        void WriteTo(CodedOutputStream output);
-
-        /// <summary>
-        /// Calculates the size of this message in Protocol Buffer wire format, in bytes.
-        /// </summary>
-        /// <returns>The number of bytes required to write this message
-        /// to a coded output stream.</returns>
-        int CalculateSize();
-
-        /// <summary>
-        /// Descriptor for this message. All instances are expected to return the same descriptor,
-        /// and for generated types this will be an explicitly-implemented member, returning the
-        /// same value as the static property declared on the type.
-        /// </summary>
-        MessageDescriptor Descriptor { get; }
-    }
-
-    /// <summary>
-    /// Generic interface for a Protocol Buffers message,
-    /// where the type parameter is expected to be the same type as
-    /// the implementation class.
-    /// </summary>
-    /// <typeparam name="T">The message type.</typeparam>
-    public interface IMessage<T> : IMessage, IEquatable<T>, IDeepCloneable<T> where T : IMessage<T>
-    {
-        /// <summary>
-        /// Merges the given message into this one.
-        /// </summary>
-        /// <remarks>See the user guide for precise merge semantics.</remarks>
-        /// <param name="message">The message to merge with this one. Must not be null.</param>
-        void MergeFrom(T message);
-    }
-}

+ 0 - 53
csharp/src/Google.Protobuf/InvalidJsonException.cs

@@ -1,53 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Thrown when an attempt is made to parse invalid JSON, e.g. using
-    /// a non-string property key, or including a redundant comma. Parsing a protocol buffer
-    /// message represented in JSON using <see cref="JsonParser"/> can throw both this
-    /// exception and <see cref="InvalidProtocolBufferException"/> depending on the situation. This
-    /// exception is only thrown for "pure JSON" errors, whereas <c>InvalidProtocolBufferException</c>
-    /// is thrown when the JSON may be valid in and of itself, but cannot be parsed as a protocol buffer
-    /// message.
-    /// </summary>
-    public sealed class InvalidJsonException : IOException
-    {
-        internal InvalidJsonException(string message)
-            : base(message)
-        {
-        }
-    }
-}

+ 0 - 129
csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs

@@ -1,129 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Thrown when a protocol message being parsed is invalid in some way,
-    /// e.g. it contains a malformed varint or a negative byte length.
-    /// </summary>
-    public sealed class InvalidProtocolBufferException : IOException
-    {
-        internal InvalidProtocolBufferException(string message)
-            : base(message)
-        {
-        }
-
-        internal InvalidProtocolBufferException(string message, Exception innerException)
-            : base(message, innerException)
-        {
-        }
-
-        internal static InvalidProtocolBufferException MoreDataAvailable()
-        {
-            return new InvalidProtocolBufferException(
-                "Completed reading a message while more data was available in the stream.");
-        }
-
-        internal static InvalidProtocolBufferException TruncatedMessage()
-        {
-            return new InvalidProtocolBufferException(
-                "While parsing a protocol message, the input ended unexpectedly " +
-                "in the middle of a field.  This could mean either than the " +
-                "input has been truncated or that an embedded message " +
-                "misreported its own length.");
-        }
-
-        internal static InvalidProtocolBufferException NegativeSize()
-        {
-            return new InvalidProtocolBufferException(
-                "CodedInputStream encountered an embedded string or message " +
-                "which claimed to have negative size.");
-        }
-
-        internal static InvalidProtocolBufferException MalformedVarint()
-        {
-            return new InvalidProtocolBufferException(
-                "CodedInputStream encountered a malformed varint.");
-        }
-
-        /// <summary>
-        /// Creates an exception for an error condition of an invalid tag being encountered.
-        /// </summary>
-        internal static InvalidProtocolBufferException InvalidTag()
-        {
-            return new InvalidProtocolBufferException(
-                "Protocol message contained an invalid tag (zero).");
-        }
-
-        internal static InvalidProtocolBufferException InvalidBase64(Exception innerException)
-        {
-            return new InvalidProtocolBufferException("Invalid base64 data", innerException);
-        }
-
-        internal static InvalidProtocolBufferException InvalidEndTag()
-        {
-            return new InvalidProtocolBufferException(
-                "Protocol message end-group tag did not match expected tag.");
-        }
-
-        internal static InvalidProtocolBufferException RecursionLimitExceeded()
-        {
-            return new InvalidProtocolBufferException(
-                "Protocol message had too many levels of nesting.  May be malicious.  " +
-                "Use CodedInputStream.SetRecursionLimit() to increase the depth limit.");
-        }
-
-        internal static InvalidProtocolBufferException JsonRecursionLimitExceeded()
-        {
-            return new InvalidProtocolBufferException(
-                "Protocol message had too many levels of nesting.  May be malicious.  " +
-                "Use JsonParser.Settings to increase the depth limit.");
-        }
-
-        internal static InvalidProtocolBufferException SizeLimitExceeded()
-        {
-            return new InvalidProtocolBufferException(
-                "Protocol message was too large.  May be malicious.  " +
-                "Use CodedInputStream.SetSizeLimit() to increase the size limit.");
-        }
-
-        internal static InvalidProtocolBufferException InvalidMessageStreamTag()
-        {
-            return new InvalidProtocolBufferException(
-                "Stream of protocol messages had invalid tag. Expected tag is length-delimited field 1.");
-        }
-    }
-}

+ 0 - 909
csharp/src/Google.Protobuf/JsonFormatter.cs

@@ -1,909 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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;
-using System.Globalization;
-using System.Text;
-using Google.Protobuf.Reflection;
-using Google.Protobuf.WellKnownTypes;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Reflection-based converter from messages to JSON.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// Instances of this class are thread-safe, with no mutable state.
-    /// </para>
-    /// <para>
-    /// This is a simple start to get JSON formatting working. As it's reflection-based,
-    /// it's not as quick as baking calls into generated messages - but is a simpler implementation.
-    /// (This code is generally not heavily optimized.)
-    /// </para>
-    /// </remarks>
-    public sealed class JsonFormatter
-    {
-        internal const string AnyTypeUrlField = "@type";
-        internal const string AnyDiagnosticValueField = "@value";
-        internal const string AnyWellKnownTypeValueField = "value";
-        private const string TypeUrlPrefix = "type.googleapis.com";
-        private const string NameValueSeparator = ": ";
-        private const string PropertySeparator = ", ";
-
-        /// <summary>
-        /// Returns a formatter using the default settings.
-        /// </summary>
-        public static JsonFormatter Default { get; } = new JsonFormatter(Settings.Default);
-
-        // A JSON formatter which *only* exists 
-        private static readonly JsonFormatter diagnosticFormatter = new JsonFormatter(Settings.Default);
-
-        /// <summary>
-        /// The JSON representation of the first 160 characters of Unicode.
-        /// Empty strings are replaced by the static constructor.
-        /// </summary>
-        private static readonly string[] CommonRepresentations = {
-            // C0 (ASCII and derivatives) control characters
-            "\\u0000", "\\u0001", "\\u0002", "\\u0003",  // 0x00
-          "\\u0004", "\\u0005", "\\u0006", "\\u0007",
-          "\\b",     "\\t",     "\\n",     "\\u000b",
-          "\\f",     "\\r",     "\\u000e", "\\u000f",
-          "\\u0010", "\\u0011", "\\u0012", "\\u0013",  // 0x10
-          "\\u0014", "\\u0015", "\\u0016", "\\u0017",
-          "\\u0018", "\\u0019", "\\u001a", "\\u001b",
-          "\\u001c", "\\u001d", "\\u001e", "\\u001f",
-            // Escaping of " and \ are required by www.json.org string definition.
-            // Escaping of < and > are required for HTML security.
-            "", "", "\\\"", "", "",        "", "",        "",  // 0x20
-          "", "", "",     "", "",        "", "",        "",
-          "", "", "",     "", "",        "", "",        "",  // 0x30
-          "", "", "",     "", "\\u003c", "", "\\u003e", "",
-          "", "", "",     "", "",        "", "",        "",  // 0x40
-          "", "", "",     "", "",        "", "",        "",
-          "", "", "",     "", "",        "", "",        "",  // 0x50
-          "", "", "",     "", "\\\\",    "", "",        "",
-          "", "", "",     "", "",        "", "",        "",  // 0x60
-          "", "", "",     "", "",        "", "",        "",
-          "", "", "",     "", "",        "", "",        "",  // 0x70
-          "", "", "",     "", "",        "", "",        "\\u007f",
-            // C1 (ISO 8859 and Unicode) extended control characters
-            "\\u0080", "\\u0081", "\\u0082", "\\u0083",  // 0x80
-          "\\u0084", "\\u0085", "\\u0086", "\\u0087",
-          "\\u0088", "\\u0089", "\\u008a", "\\u008b",
-          "\\u008c", "\\u008d", "\\u008e", "\\u008f",
-          "\\u0090", "\\u0091", "\\u0092", "\\u0093",  // 0x90
-          "\\u0094", "\\u0095", "\\u0096", "\\u0097",
-          "\\u0098", "\\u0099", "\\u009a", "\\u009b",
-          "\\u009c", "\\u009d", "\\u009e", "\\u009f"
-        };
-
-        static JsonFormatter()
-        {
-            for (int i = 0; i < CommonRepresentations.Length; i++)
-            {
-                if (CommonRepresentations[i] == "")
-                {
-                    CommonRepresentations[i] = ((char) i).ToString();
-                }
-            }
-        }
-
-        private readonly Settings settings;
-
-        private bool DiagnosticOnly => ReferenceEquals(this, diagnosticFormatter);
-
-        /// <summary>
-        /// Creates a new formatted with the given settings.
-        /// </summary>
-        /// <param name="settings">The settings.</param>
-        public JsonFormatter(Settings settings)
-        {
-            this.settings = settings;
-        }
-
-        /// <summary>
-        /// Formats the specified message as JSON.
-        /// </summary>
-        /// <param name="message">The message to format.</param>
-        /// <returns>The formatted message.</returns>
-        public string Format(IMessage message)
-        {
-            var writer = new StringWriter();
-            Format(message, writer);
-            return writer.ToString();
-        }
-
-        /// <summary>
-        /// Formats the specified message as JSON.
-        /// </summary>
-        /// <param name="message">The message to format.</param>
-        /// <param name="writer">The TextWriter to write the formatted message to.</param>
-        /// <returns>The formatted message.</returns>
-        public void Format(IMessage message, TextWriter writer)
-        {
-            ProtoPreconditions.CheckNotNull(message, nameof(message));
-            ProtoPreconditions.CheckNotNull(writer, nameof(writer));
-
-            if (message.Descriptor.IsWellKnownType)
-            {
-                WriteWellKnownTypeValue(writer, message.Descriptor, message);
-            }
-            else
-            {
-                WriteMessage(writer, message);
-            }
-        }
-
-        /// <summary>
-        /// Converts a message to JSON for diagnostic purposes with no extra context.
-        /// </summary>
-        /// <remarks>
-        /// <para>
-        /// This differs from calling <see cref="Format(IMessage)"/> on the default JSON
-        /// formatter in its handling of <see cref="Any"/>. As no type registry is available
-        /// in <see cref="object.ToString"/> calls, the normal way of resolving the type of
-        /// an <c>Any</c> message cannot be applied. Instead, a JSON property named <c>@value</c>
-        /// is included with the base64 data from the <see cref="Any.Value"/> property of the message.
-        /// </para>
-        /// <para>The value returned by this method is only designed to be used for diagnostic
-        /// purposes. It may not be parsable by <see cref="JsonParser"/>, and may not be parsable
-        /// by other Protocol Buffer implementations.</para>
-        /// </remarks>
-        /// <param name="message">The message to format for diagnostic purposes.</param>
-        /// <returns>The diagnostic-only JSON representation of the message</returns>
-        public static string ToDiagnosticString(IMessage message)
-        {
-            ProtoPreconditions.CheckNotNull(message, nameof(message));
-            return diagnosticFormatter.Format(message);
-        }
-
-        private void WriteMessage(TextWriter writer, IMessage message)
-        {
-            if (message == null)
-            {
-                WriteNull(writer);
-                return;
-            }
-            if (DiagnosticOnly)
-            {
-                ICustomDiagnosticMessage customDiagnosticMessage = message as ICustomDiagnosticMessage;
-                if (customDiagnosticMessage != null)
-                {
-                    writer.Write(customDiagnosticMessage.ToDiagnosticString());
-                    return;
-                }
-            }
-            writer.Write("{ ");
-            bool writtenFields = WriteMessageFields(writer, message, false);
-            writer.Write(writtenFields ? " }" : "}");
-        }
-
-        private bool WriteMessageFields(TextWriter writer, IMessage message, bool assumeFirstFieldWritten)
-        {
-            var fields = message.Descriptor.Fields;
-            bool first = !assumeFirstFieldWritten;
-            // First non-oneof fields
-            foreach (var field in fields.InFieldNumberOrder())
-            {
-                var accessor = field.Accessor;
-                if (field.ContainingOneof != null && field.ContainingOneof.Accessor.GetCaseFieldDescriptor(message) != field)
-                {
-                    continue;
-                }
-                // Omit default values unless we're asked to format them, or they're oneofs (where the default
-                // value is still formatted regardless, because that's how we preserve the oneof case).
-                object value = accessor.GetValue(message);
-                if (field.ContainingOneof == null && !settings.FormatDefaultValues && IsDefaultValue(accessor, value))
-                {
-                    continue;
-                }
-
-                // Okay, all tests complete: let's write the field value...
-                if (!first)
-                {
-                    writer.Write(PropertySeparator);
-                }
-
-                WriteString(writer, accessor.Descriptor.JsonName);
-                writer.Write(NameValueSeparator);
-                WriteValue(writer, value);
-
-                first = false;
-            }
-            return !first;
-        }
-
-        /// <summary>
-        /// Camel-case converter with added strictness for field mask formatting.
-        /// </summary>
-        /// <exception cref="InvalidOperationException">The field mask is invalid for JSON representation</exception>
-        private static string ToCamelCaseForFieldMask(string input)
-        {
-            for (int i = 0; i < input.Length; i++)
-            {
-                char c = input[i];
-                if (c >= 'A' && c <= 'Z')
-                {
-                    throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}");
-                }
-                if (c == '_' && i < input.Length - 1)
-                {
-                    char next = input[i + 1];
-                    if (next < 'a' || next > 'z')
-                    {
-                        throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}");
-                    }
-                }
-            }
-            return ToCamelCase(input);
-        }
-
-        // Converted from src/google/protobuf/util/internal/utility.cc ToCamelCase
-        // TODO: Use the new field in FieldDescriptor.
-        internal static string ToCamelCase(string input)
-        {
-            bool capitalizeNext = false;
-            bool wasCap = true;
-            bool isCap = false;
-            bool firstWord = true;
-            StringBuilder result = new StringBuilder(input.Length);
-
-            for (int i = 0; i < input.Length; i++, wasCap = isCap)
-            {
-                isCap = char.IsUpper(input[i]);
-                if (input[i] == '_')
-                {
-                    capitalizeNext = true;
-                    if (result.Length != 0)
-                    {
-                        firstWord = false;
-                    }
-                    continue;
-                }
-                else if (firstWord)
-                {
-                    // Consider when the current character B is capitalized,
-                    // first word ends when:
-                    // 1) following a lowercase:   "...aB..."
-                    // 2) followed by a lowercase: "...ABc..."
-                    if (result.Length != 0 && isCap &&
-                        (!wasCap || (i + 1 < input.Length && char.IsLower(input[i + 1]))))
-                    {
-                        firstWord = false;
-                    }
-                    else
-                    {
-                        result.Append(char.ToLowerInvariant(input[i]));
-                        continue;
-                    }
-                }
-                else if (capitalizeNext)
-                {
-                    capitalizeNext = false;
-                    if (char.IsLower(input[i]))
-                    {
-                        result.Append(char.ToUpperInvariant(input[i]));
-                        continue;
-                    }
-                }
-                result.Append(input[i]);
-            }
-            return result.ToString();
-        }
-        
-        private static void WriteNull(TextWriter writer)
-        {
-            writer.Write("null");
-        }
-
-        private static bool IsDefaultValue(IFieldAccessor accessor, object value)
-        {
-            if (accessor.Descriptor.IsMap)
-            {
-                IDictionary dictionary = (IDictionary) value;
-                return dictionary.Count == 0;
-            }
-            if (accessor.Descriptor.IsRepeated)
-            {
-                IList list = (IList) value;
-                return list.Count == 0;
-            }
-            switch (accessor.Descriptor.FieldType)
-            {
-                case FieldType.Bool:
-                    return (bool) value == false;
-                case FieldType.Bytes:
-                    return (ByteString) value == ByteString.Empty;
-                case FieldType.String:
-                    return (string) value == "";
-                case FieldType.Double:
-                    return (double) value == 0.0;
-                case FieldType.SInt32:
-                case FieldType.Int32:
-                case FieldType.SFixed32:
-                case FieldType.Enum:
-                    return (int) value == 0;
-                case FieldType.Fixed32:
-                case FieldType.UInt32:
-                    return (uint) value == 0;
-                case FieldType.Fixed64:
-                case FieldType.UInt64:
-                    return (ulong) value == 0;
-                case FieldType.SFixed64:
-                case FieldType.Int64:
-                case FieldType.SInt64:
-                    return (long) value == 0;
-                case FieldType.Float:
-                    return (float) value == 0f;
-                case FieldType.Message:
-                case FieldType.Group: // Never expect to get this, but...
-                    return value == null;
-                default:
-                    throw new ArgumentException("Invalid field type");
-            }
-        }
-
-        /// <summary>
-        /// Writes a single value to the given writer as JSON. Only types understood by
-        /// Protocol Buffers can be written in this way. This method is only exposed for
-        /// advanced use cases; most users should be using <see cref="Format(IMessage)"/>
-        /// or <see cref="Format(IMessage, TextWriter)"/>.
-        /// </summary>
-        /// <param name="writer">The writer to write the value to. Must not be null.</param>
-        /// <param name="value">The value to write. May be null.</param>
-        public void WriteValue(TextWriter writer, object value)
-        {
-            if (value == null)
-            {
-                WriteNull(writer);
-            }
-            else if (value is bool)
-            {
-                writer.Write((bool)value ? "true" : "false");
-            }
-            else if (value is ByteString)
-            {
-                // Nothing in Base64 needs escaping
-                writer.Write('"');
-                writer.Write(((ByteString)value).ToBase64());
-                writer.Write('"');
-            }
-            else if (value is string)
-            {
-                WriteString(writer, (string)value);
-            }
-            else if (value is IDictionary)
-            {
-                WriteDictionary(writer, (IDictionary)value);
-            }
-            else if (value is IList)
-            {
-                WriteList(writer, (IList)value);
-            }
-            else if (value is int || value is uint)
-            {
-                IFormattable formattable = (IFormattable) value;
-                writer.Write(formattable.ToString("d", CultureInfo.InvariantCulture));
-            }
-            else if (value is long || value is ulong)
-            {
-                writer.Write('"');
-                IFormattable formattable = (IFormattable) value;
-                writer.Write(formattable.ToString("d", CultureInfo.InvariantCulture));
-                writer.Write('"');
-            }
-            else if (value is System.Enum)
-            {
-                string name = OriginalEnumValueHelper.GetOriginalName(value);
-                if (name != null)
-                {
-                    WriteString(writer, name);
-                }
-                else
-                {
-                    WriteValue(writer, (int)value);
-                }
-            }
-            else if (value is float || value is double)
-            {
-                string text = ((IFormattable) value).ToString("r", CultureInfo.InvariantCulture);
-                if (text == "NaN" || text == "Infinity" || text == "-Infinity")
-                {
-                    writer.Write('"');
-                    writer.Write(text);
-                    writer.Write('"');
-                }
-                else
-                {
-                    writer.Write(text);
-                }
-            }
-            else if (value is IMessage)
-            {
-                Format((IMessage)value, writer);
-            }
-            else
-            {
-                throw new ArgumentException("Unable to format value of type " + value.GetType());
-            }
-        }
-
-        /// <summary>
-        /// Central interception point for well-known type formatting. Any well-known types which
-        /// don't need special handling can fall back to WriteMessage. We avoid assuming that the
-        /// values are using the embedded well-known types, in order to allow for dynamic messages
-        /// in the future.
-        /// </summary>
-        private void WriteWellKnownTypeValue(TextWriter writer, MessageDescriptor descriptor, object value)
-        {
-            // Currently, we can never actually get here, because null values are always handled by the caller. But if we *could*,
-            // this would do the right thing.
-            if (value == null)
-            {
-                WriteNull(writer);
-                return;
-            }
-            // For wrapper types, the value will either be the (possibly boxed) "native" value,
-            // or the message itself if we're formatting it at the top level (e.g. just calling ToString on the object itself).
-            // If it's the message form, we can extract the value first, which *will* be the (possibly boxed) native value,
-            // and then proceed, writing it as if we were definitely in a field. (We never need to wrap it in an extra string...
-            // WriteValue will do the right thing.)
-            if (descriptor.IsWrapperType)
-            {
-                if (value is IMessage)
-                {
-                    var message = (IMessage) value;
-                    value = message.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber].Accessor.GetValue(message);
-                }
-                WriteValue(writer, value);
-                return;
-            }
-            if (descriptor.FullName == Timestamp.Descriptor.FullName)
-            {
-                WriteTimestamp(writer, (IMessage)value);
-                return;
-            }
-            if (descriptor.FullName == Duration.Descriptor.FullName)
-            {
-                WriteDuration(writer, (IMessage)value);
-                return;
-            }
-            if (descriptor.FullName == FieldMask.Descriptor.FullName)
-            {
-                WriteFieldMask(writer, (IMessage)value);
-                return;
-            }
-            if (descriptor.FullName == Struct.Descriptor.FullName)
-            {
-                WriteStruct(writer, (IMessage)value);
-                return;
-            }
-            if (descriptor.FullName == ListValue.Descriptor.FullName)
-            {
-                var fieldAccessor = descriptor.Fields[ListValue.ValuesFieldNumber].Accessor;
-                WriteList(writer, (IList)fieldAccessor.GetValue((IMessage)value));
-                return;
-            }
-            if (descriptor.FullName == Value.Descriptor.FullName)
-            {
-                WriteStructFieldValue(writer, (IMessage)value);
-                return;
-            }
-            if (descriptor.FullName == Any.Descriptor.FullName)
-            {
-                WriteAny(writer, (IMessage)value);
-                return;
-            }
-            WriteMessage(writer, (IMessage)value);
-        }
-
-        private void WriteTimestamp(TextWriter writer, IMessage value)
-        {
-            // TODO: In the common case where this *is* using the built-in Timestamp type, we could
-            // avoid all the reflection at this point, by casting to Timestamp. In the interests of
-            // avoiding subtle bugs, don't do that until we've implemented DynamicMessage so that we can prove
-            // it still works in that case.
-            int nanos = (int) value.Descriptor.Fields[Timestamp.NanosFieldNumber].Accessor.GetValue(value);
-            long seconds = (long) value.Descriptor.Fields[Timestamp.SecondsFieldNumber].Accessor.GetValue(value);
-            writer.Write(Timestamp.ToJson(seconds, nanos, DiagnosticOnly));
-        }
-
-        private void WriteDuration(TextWriter writer, IMessage value)
-        {
-            // TODO: Same as for WriteTimestamp
-            int nanos = (int) value.Descriptor.Fields[Duration.NanosFieldNumber].Accessor.GetValue(value);
-            long seconds = (long) value.Descriptor.Fields[Duration.SecondsFieldNumber].Accessor.GetValue(value);
-            writer.Write(Duration.ToJson(seconds, nanos, DiagnosticOnly));
-        }
-
-        private void WriteFieldMask(TextWriter writer, IMessage value)
-        {
-            var paths = (IList<string>) value.Descriptor.Fields[FieldMask.PathsFieldNumber].Accessor.GetValue(value);
-            writer.Write(FieldMask.ToJson(paths, DiagnosticOnly));
-        }
-
-        private void WriteAny(TextWriter writer, IMessage value)
-        {
-            if (DiagnosticOnly)
-            {
-                WriteDiagnosticOnlyAny(writer, value);
-                return;
-            }
-
-            string typeUrl = (string) value.Descriptor.Fields[Any.TypeUrlFieldNumber].Accessor.GetValue(value);
-            ByteString data = (ByteString) value.Descriptor.Fields[Any.ValueFieldNumber].Accessor.GetValue(value);
-            string typeName = Any.GetTypeName(typeUrl);
-            MessageDescriptor descriptor = settings.TypeRegistry.Find(typeName);
-            if (descriptor == null)
-            {
-                throw new InvalidOperationException($"Type registry has no descriptor for type name '{typeName}'");
-            }
-            IMessage message = descriptor.Parser.ParseFrom(data);
-            writer.Write("{ ");
-            WriteString(writer, AnyTypeUrlField);
-            writer.Write(NameValueSeparator);
-            WriteString(writer, typeUrl);
-
-            if (descriptor.IsWellKnownType)
-            {
-                writer.Write(PropertySeparator);
-                WriteString(writer, AnyWellKnownTypeValueField);
-                writer.Write(NameValueSeparator);
-                WriteWellKnownTypeValue(writer, descriptor, message);
-            }
-            else
-            {
-                WriteMessageFields(writer, message, true);
-            }
-            writer.Write(" }");
-        }
-
-        private void WriteDiagnosticOnlyAny(TextWriter writer, IMessage value)
-        {
-            string typeUrl = (string) value.Descriptor.Fields[Any.TypeUrlFieldNumber].Accessor.GetValue(value);
-            ByteString data = (ByteString) value.Descriptor.Fields[Any.ValueFieldNumber].Accessor.GetValue(value);
-            writer.Write("{ ");
-            WriteString(writer, AnyTypeUrlField);
-            writer.Write(NameValueSeparator);
-            WriteString(writer, typeUrl);
-            writer.Write(PropertySeparator);
-            WriteString(writer, AnyDiagnosticValueField);
-            writer.Write(NameValueSeparator);
-            writer.Write('"');
-            writer.Write(data.ToBase64());
-            writer.Write('"');
-            writer.Write(" }");
-        }        
-
-        private void WriteStruct(TextWriter writer, IMessage message)
-        {
-            writer.Write("{ ");
-            IDictionary fields = (IDictionary) message.Descriptor.Fields[Struct.FieldsFieldNumber].Accessor.GetValue(message);
-            bool first = true;
-            foreach (DictionaryEntry entry in fields)
-            {
-                string key = (string) entry.Key;
-                IMessage value = (IMessage) entry.Value;
-                if (string.IsNullOrEmpty(key) || value == null)
-                {
-                    throw new InvalidOperationException("Struct fields cannot have an empty key or a null value.");
-                }
-
-                if (!first)
-                {
-                    writer.Write(PropertySeparator);
-                }
-                WriteString(writer, key);
-                writer.Write(NameValueSeparator);
-                WriteStructFieldValue(writer, value);
-                first = false;
-            }
-            writer.Write(first ? "}" : " }");
-        }
-
-        private void WriteStructFieldValue(TextWriter writer, IMessage message)
-        {
-            var specifiedField = message.Descriptor.Oneofs[0].Accessor.GetCaseFieldDescriptor(message);
-            if (specifiedField == null)
-            {
-                throw new InvalidOperationException("Value message must contain a value for the oneof.");
-            }
-
-            object value = specifiedField.Accessor.GetValue(message);
-            
-            switch (specifiedField.FieldNumber)
-            {
-                case Value.BoolValueFieldNumber:
-                case Value.StringValueFieldNumber:
-                case Value.NumberValueFieldNumber:
-                    WriteValue(writer, value);
-                    return;
-                case Value.StructValueFieldNumber:
-                case Value.ListValueFieldNumber:
-                    // Structs and ListValues are nested messages, and already well-known types.
-                    var nestedMessage = (IMessage) specifiedField.Accessor.GetValue(message);
-                    WriteWellKnownTypeValue(writer, nestedMessage.Descriptor, nestedMessage);
-                    return;
-                case Value.NullValueFieldNumber:
-                    WriteNull(writer);
-                    return;
-                default:
-                    throw new InvalidOperationException("Unexpected case in struct field: " + specifiedField.FieldNumber);
-            }
-        }
-
-        internal void WriteList(TextWriter writer, IList list)
-        {
-            writer.Write("[ ");
-            bool first = true;
-            foreach (var value in list)
-            {
-                if (!first)
-                {
-                    writer.Write(PropertySeparator);
-                }
-                WriteValue(writer, value);
-                first = false;
-            }
-            writer.Write(first ? "]" : " ]");
-        }
-
-        internal void WriteDictionary(TextWriter writer, IDictionary dictionary)
-        {
-            writer.Write("{ ");
-            bool first = true;
-            // This will box each pair. Could use IDictionaryEnumerator, but that's ugly in terms of disposal.
-            foreach (DictionaryEntry pair in dictionary)
-            {
-                if (!first)
-                {
-                    writer.Write(PropertySeparator);
-                }
-                string keyText;
-                if (pair.Key is string)
-                {
-                    keyText = (string) pair.Key;
-                }
-                else if (pair.Key is bool)
-                {
-                    keyText = (bool) pair.Key ? "true" : "false";
-                }
-                else if (pair.Key is int || pair.Key is uint | pair.Key is long || pair.Key is ulong)
-                {
-                    keyText = ((IFormattable) pair.Key).ToString("d", CultureInfo.InvariantCulture);
-                }
-                else
-                {
-                    if (pair.Key == null)
-                    {
-                        throw new ArgumentException("Dictionary has entry with null key");
-                    }
-                    throw new ArgumentException("Unhandled dictionary key type: " + pair.Key.GetType());
-                }
-                WriteString(writer, keyText);
-                writer.Write(NameValueSeparator);
-                WriteValue(writer, pair.Value);
-                first = false;
-            }
-            writer.Write(first ? "}" : " }");
-        }
-
-        /// <summary>
-        /// Writes a string (including leading and trailing double quotes) to a builder, escaping as required.
-        /// </summary>
-        /// <remarks>
-        /// Other than surrogate pair handling, this code is mostly taken from src/google/protobuf/util/internal/json_escaping.cc.
-        /// </remarks>
-        internal static void WriteString(TextWriter writer, string text)
-        {
-            writer.Write('"');
-            for (int i = 0; i < text.Length; i++)
-            {
-                char c = text[i];
-                if (c < 0xa0)
-                {
-                    writer.Write(CommonRepresentations[c]);
-                    continue;
-                }
-                if (char.IsHighSurrogate(c))
-                {
-                    // Encountered first part of a surrogate pair.
-                    // Check that we have the whole pair, and encode both parts as hex.
-                    i++;
-                    if (i == text.Length || !char.IsLowSurrogate(text[i]))
-                    {
-                        throw new ArgumentException("String contains low surrogate not followed by high surrogate");
-                    }
-                    HexEncodeUtf16CodeUnit(writer, c);
-                    HexEncodeUtf16CodeUnit(writer, text[i]);
-                    continue;
-                }
-                else if (char.IsLowSurrogate(c))
-                {
-                    throw new ArgumentException("String contains high surrogate not preceded by low surrogate");
-                }
-                switch ((uint) c)
-                {
-                    // These are not required by json spec
-                    // but used to prevent security bugs in javascript.
-                    case 0xfeff:  // Zero width no-break space
-                    case 0xfff9:  // Interlinear annotation anchor
-                    case 0xfffa:  // Interlinear annotation separator
-                    case 0xfffb:  // Interlinear annotation terminator
-
-                    case 0x00ad:  // Soft-hyphen
-                    case 0x06dd:  // Arabic end of ayah
-                    case 0x070f:  // Syriac abbreviation mark
-                    case 0x17b4:  // Khmer vowel inherent Aq
-                    case 0x17b5:  // Khmer vowel inherent Aa
-                        HexEncodeUtf16CodeUnit(writer, c);
-                        break;
-
-                    default:
-                        if ((c >= 0x0600 && c <= 0x0603) ||  // Arabic signs
-                            (c >= 0x200b && c <= 0x200f) ||  // Zero width etc.
-                            (c >= 0x2028 && c <= 0x202e) ||  // Separators etc.
-                            (c >= 0x2060 && c <= 0x2064) ||  // Invisible etc.
-                            (c >= 0x206a && c <= 0x206f))
-                        {
-                            HexEncodeUtf16CodeUnit(writer, c);
-                        }
-                        else
-                        {
-                            // No handling of surrogates here - that's done earlier
-                            writer.Write(c);
-                        }
-                        break;
-                }
-            }
-            writer.Write('"');
-        }
-
-        private const string Hex = "0123456789abcdef";
-        private static void HexEncodeUtf16CodeUnit(TextWriter writer, char c)
-        {
-            writer.Write("\\u");
-            writer.Write(Hex[(c >> 12) & 0xf]);
-            writer.Write(Hex[(c >> 8) & 0xf]);
-            writer.Write(Hex[(c >> 4) & 0xf]);
-            writer.Write(Hex[(c >> 0) & 0xf]);
-        }
-
-        /// <summary>
-        /// Settings controlling JSON formatting.
-        /// </summary>
-        public sealed class Settings
-        {
-            /// <summary>
-            /// Default settings, as used by <see cref="JsonFormatter.Default"/>
-            /// </summary>
-            public static Settings Default { get; }
-
-            // Workaround for the Mono compiler complaining about XML comments not being on
-            // valid language elements.
-            static Settings()
-            {
-                Default = new Settings(false);
-            }
-
-            /// <summary>
-            /// Whether fields whose values are the default for the field type (e.g. 0 for integers)
-            /// should be formatted (true) or omitted (false).
-            /// </summary>
-            public bool FormatDefaultValues { get; }
-
-            /// <summary>
-            /// The type registry used to format <see cref="Any"/> messages.
-            /// </summary>
-            public TypeRegistry TypeRegistry { get; }
-
-            // TODO: Work out how we're going to scale this to multiple settings. "WithXyz" methods?
-
-            /// <summary>
-            /// Creates a new <see cref="Settings"/> object with the specified formatting of default values
-            /// and an empty type registry.
-            /// </summary>
-            /// <param name="formatDefaultValues"><c>true</c> if default values (0, empty strings etc) should be formatted; <c>false</c> otherwise.</param>
-            public Settings(bool formatDefaultValues) : this(formatDefaultValues, TypeRegistry.Empty)
-            {
-            }
-
-            /// <summary>
-            /// Creates a new <see cref="Settings"/> object with the specified formatting of default values
-            /// and type registry.
-            /// </summary>
-            /// <param name="formatDefaultValues"><c>true</c> if default values (0, empty strings etc) should be formatted; <c>false</c> otherwise.</param>
-            /// <param name="typeRegistry">The <see cref="TypeRegistry"/> to use when formatting <see cref="Any"/> messages.</param>
-            public Settings(bool formatDefaultValues, TypeRegistry typeRegistry)
-            {
-                FormatDefaultValues = formatDefaultValues;
-                TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry));
-            }
-        }
-
-        // Effectively a cache of mapping from enum values to the original name as specified in the proto file,
-        // fetched by reflection.
-        // The need for this is unfortunate, as is its unbounded size, but realistically it shouldn't cause issues.
-        private static class OriginalEnumValueHelper
-        {
-            // TODO: In the future we might want to use ConcurrentDictionary, at the point where all
-            // the platforms we target have it.
-            private static readonly Dictionary<System.Type, Dictionary<object, string>> dictionaries
-                = new Dictionary<System.Type, Dictionary<object, string>>();
-            
-            internal static string GetOriginalName(object value)
-            {
-                var enumType = value.GetType();
-                Dictionary<object, string> nameMapping;
-                lock (dictionaries)
-                {
-                    if (!dictionaries.TryGetValue(enumType, out nameMapping))
-                    {
-                        nameMapping = GetNameMapping(enumType);
-                        dictionaries[enumType] = nameMapping;
-                    }
-                }
-
-                string originalName;
-                // If this returns false, originalName will be null, which is what we want.
-                nameMapping.TryGetValue(value, out originalName);
-                return originalName;
-            }
-
-#if DOTNET35
-            // TODO: Consider adding functionality to TypeExtensions to avoid this difference.
-            private static Dictionary<object, string> GetNameMapping(System.Type enumType) =>
-                enumType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)
-                    .ToDictionary(f => f.GetValue(null),
-                                  f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false)
-                                        .FirstOrDefault() as OriginalNameAttribute)
-                                        // If the attribute hasn't been applied, fall back to the name of the field.
-                                        ?.Name ?? f.Name);
-#else
-            private static Dictionary<object, string> GetNameMapping(System.Type enumType) =>
-                enumType.GetTypeInfo().DeclaredFields
-                    .Where(f => f.IsStatic)
-                    .ToDictionary(f => f.GetValue(null),
-                                  f => f.GetCustomAttributes<OriginalNameAttribute>()
-                                        .FirstOrDefault()
-                                        // If the attribute hasn't been applied, fall back to the name of the field.
-                                        ?.Name ?? f.Name);
-#endif
-        }
-    }
-}

+ 0 - 1019
csharp/src/Google.Protobuf/JsonParser.cs

@@ -1,1019 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Reflection;
-using Google.Protobuf.WellKnownTypes;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Reflection-based converter from JSON to messages.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// Instances of this class are thread-safe, with no mutable state.
-    /// </para>
-    /// <para>
-    /// This is a simple start to get JSON parsing working. As it's reflection-based,
-    /// it's not as quick as baking calls into generated messages - but is a simpler implementation.
-    /// (This code is generally not heavily optimized.)
-    /// </para>
-    /// </remarks>
-    public sealed class JsonParser
-    {
-        // Note: using 0-9 instead of \d to ensure no non-ASCII digits.
-        // This regex isn't a complete validator, but will remove *most* invalid input. We rely on parsing to do the rest.
-        private static readonly Regex TimestampRegex = new Regex(@"^(?<datetime>[0-9]{4}-[01][0-9]-[0-3][0-9]T[012][0-9]:[0-5][0-9]:[0-5][0-9])(?<subseconds>\.[0-9]{1,9})?(?<offset>(Z|[+-][0-1][0-9]:[0-5][0-9]))$", FrameworkPortability.CompiledRegexWhereAvailable);
-        private static readonly Regex DurationRegex = new Regex(@"^(?<sign>-)?(?<int>[0-9]{1,12})(?<subseconds>\.[0-9]{1,9})?s$", FrameworkPortability.CompiledRegexWhereAvailable);
-        private static readonly int[] SubsecondScalingFactors = { 0, 100000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1 };
-        private static readonly char[] FieldMaskPathSeparators = new[] { ',' };
-
-        private static readonly JsonParser defaultInstance = new JsonParser(Settings.Default);
-
-        // TODO: Consider introducing a class containing parse state of the parser, tokenizer and depth. That would simplify these handlers
-        // and the signatures of various methods.
-        private static readonly Dictionary<string, Action<JsonParser, IMessage, JsonTokenizer>>
-            WellKnownTypeHandlers = new Dictionary<string, Action<JsonParser, IMessage, JsonTokenizer>>
-        {
-            { Timestamp.Descriptor.FullName, (parser, message, tokenizer) => MergeTimestamp(message, tokenizer.Next()) },
-            { Duration.Descriptor.FullName, (parser, message, tokenizer) => MergeDuration(message, tokenizer.Next()) },
-            { Value.Descriptor.FullName, (parser, message, tokenizer) => parser.MergeStructValue(message, tokenizer) },
-            { ListValue.Descriptor.FullName, (parser, message, tokenizer) =>
-                parser.MergeRepeatedField(message, message.Descriptor.Fields[ListValue.ValuesFieldNumber], tokenizer) },
-            { Struct.Descriptor.FullName, (parser, message, tokenizer) => parser.MergeStruct(message, tokenizer) },
-            { Any.Descriptor.FullName, (parser, message, tokenizer) => parser.MergeAny(message, tokenizer) },
-            { FieldMask.Descriptor.FullName, (parser, message, tokenizer) => MergeFieldMask(message, tokenizer.Next()) },
-            { Int32Value.Descriptor.FullName, MergeWrapperField },
-            { Int64Value.Descriptor.FullName, MergeWrapperField },
-            { UInt32Value.Descriptor.FullName, MergeWrapperField },
-            { UInt64Value.Descriptor.FullName, MergeWrapperField },
-            { FloatValue.Descriptor.FullName, MergeWrapperField },
-            { DoubleValue.Descriptor.FullName, MergeWrapperField },
-            { BytesValue.Descriptor.FullName, MergeWrapperField },
-            { StringValue.Descriptor.FullName, MergeWrapperField },
-            { BoolValue.Descriptor.FullName, MergeWrapperField }
-        };
-
-        // Convenience method to avoid having to repeat the same code multiple times in the above
-        // dictionary initialization.
-        private static void MergeWrapperField(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
-        {
-            parser.MergeField(message, message.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber], tokenizer);
-        }
-
-        /// <summary>
-        /// Returns a formatter using the default settings.
-        /// </summary>
-        public static JsonParser Default { get { return defaultInstance; } }
-
-        private readonly Settings settings;
-
-        /// <summary>
-        /// Creates a new formatted with the given settings.
-        /// </summary>
-        /// <param name="settings">The settings.</param>
-        public JsonParser(Settings settings)
-        {
-            this.settings = settings;
-        }
-
-        /// <summary>
-        /// Parses <paramref name="json"/> and merges the information into the given message.
-        /// </summary>
-        /// <param name="message">The message to merge the JSON information into.</param>
-        /// <param name="json">The JSON to parse.</param>
-        internal void Merge(IMessage message, string json)
-        {
-            Merge(message, new StringReader(json));
-        }
-
-        /// <summary>
-        /// Parses JSON read from <paramref name="jsonReader"/> and merges the information into the given message.
-        /// </summary>
-        /// <param name="message">The message to merge the JSON information into.</param>
-        /// <param name="jsonReader">Reader providing the JSON to parse.</param>
-        internal void Merge(IMessage message, TextReader jsonReader)
-        {
-            var tokenizer = JsonTokenizer.FromTextReader(jsonReader);
-            Merge(message, tokenizer);
-            var lastToken = tokenizer.Next();
-            if (lastToken != JsonToken.EndDocument)
-            {
-                throw new InvalidProtocolBufferException("Expected end of JSON after object");
-            }
-        }
-
-        /// <summary>
-        /// Merges the given message using data from the given tokenizer. In most cases, the next
-        /// token should be a "start object" token, but wrapper types and nullity can invalidate
-        /// that assumption. This is implemented as an LL(1) recursive descent parser over the stream
-        /// of tokens provided by the tokenizer. This token stream is assumed to be valid JSON, with the
-        /// tokenizer performing that validation - but not every token stream is valid "protobuf JSON".
-        /// </summary>
-        private void Merge(IMessage message, JsonTokenizer tokenizer)
-        {
-            if (tokenizer.ObjectDepth > settings.RecursionLimit)
-            {
-                throw InvalidProtocolBufferException.JsonRecursionLimitExceeded();
-            }
-            if (message.Descriptor.IsWellKnownType)
-            {
-                Action<JsonParser, IMessage, JsonTokenizer> handler;
-                if (WellKnownTypeHandlers.TryGetValue(message.Descriptor.FullName, out handler))
-                {
-                    handler(this, message, tokenizer);
-                    return;
-                }
-                // Well-known types with no special handling continue in the normal way.
-            }
-            var token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.StartObject)
-            {
-                throw new InvalidProtocolBufferException("Expected an object");
-            }
-            var descriptor = message.Descriptor;
-            var jsonFieldMap = descriptor.Fields.ByJsonName();
-            // All the oneof fields we've already accounted for - we can only see each of them once.
-            // The set is created lazily to avoid the overhead of creating a set for every message
-            // we parsed, when oneofs are relatively rare.
-            HashSet<OneofDescriptor> seenOneofs = null;
-            while (true)
-            {
-                token = tokenizer.Next();
-                if (token.Type == JsonToken.TokenType.EndObject)
-                {
-                    return;
-                }
-                if (token.Type != JsonToken.TokenType.Name)
-                {
-                    throw new InvalidOperationException("Unexpected token type " + token.Type);
-                }
-                string name = token.StringValue;
-                FieldDescriptor field;
-                if (jsonFieldMap.TryGetValue(name, out field))
-                {
-                    if (field.ContainingOneof != null)
-                    {
-                        if (seenOneofs == null)
-                        {
-                            seenOneofs = new HashSet<OneofDescriptor>();
-                        }
-                        if (!seenOneofs.Add(field.ContainingOneof))
-                        {
-                            throw new InvalidProtocolBufferException($"Multiple values specified for oneof {field.ContainingOneof.Name}");
-                        }
-                    }
-                    MergeField(message, field, tokenizer);
-                }
-                else
-                {
-                    // TODO: Is this what we want to do? If not, we'll need to skip the value,
-                    // which may be an object or array. (We might want to put code in the tokenizer
-                    // to do that.)
-                    throw new InvalidProtocolBufferException("Unknown field: " + name);
-                }
-            }
-        }
-
-        private void MergeField(IMessage message, FieldDescriptor field, JsonTokenizer tokenizer)
-        {
-            var token = tokenizer.Next();
-            if (token.Type == JsonToken.TokenType.Null)
-            {
-                // Clear the field if we see a null token, unless it's for a singular field of type
-                // google.protobuf.Value.
-                // Note: different from Java API, which just ignores it.
-                // TODO: Bring it more in line? Discuss...
-                if (field.IsMap || field.IsRepeated || !IsGoogleProtobufValueField(field))
-                {
-                    field.Accessor.Clear(message);
-                    return;
-                }
-            }
-            tokenizer.PushBack(token);
-
-            if (field.IsMap)
-            {
-                MergeMapField(message, field, tokenizer);
-            }
-            else if (field.IsRepeated)
-            {
-                MergeRepeatedField(message, field, tokenizer);
-            }
-            else
-            {
-                var value = ParseSingleValue(field, tokenizer);
-                field.Accessor.SetValue(message, value);
-            }
-        }
-
-        private void MergeRepeatedField(IMessage message, FieldDescriptor field, JsonTokenizer tokenizer)
-        {
-            var token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.StartArray)
-            {
-                throw new InvalidProtocolBufferException("Repeated field value was not an array. Token type: " + token.Type);
-            }
-
-            IList list = (IList) field.Accessor.GetValue(message);
-            while (true)
-            {
-                token = tokenizer.Next();
-                if (token.Type == JsonToken.TokenType.EndArray)
-                {
-                    return;
-                }
-                tokenizer.PushBack(token);
-                if (token.Type == JsonToken.TokenType.Null)
-                {
-                    throw new InvalidProtocolBufferException("Repeated field elements cannot be null");
-                }
-                list.Add(ParseSingleValue(field, tokenizer));
-            }
-        }
-
-        private void MergeMapField(IMessage message, FieldDescriptor field, JsonTokenizer tokenizer)
-        {
-            // Map fields are always objects, even if the values are well-known types: ParseSingleValue handles those.
-            var token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.StartObject)
-            {
-                throw new InvalidProtocolBufferException("Expected an object to populate a map");
-            }
-
-            var type = field.MessageType;
-            var keyField = type.FindFieldByNumber(1);
-            var valueField = type.FindFieldByNumber(2);
-            if (keyField == null || valueField == null)
-            {
-                throw new InvalidProtocolBufferException("Invalid map field: " + field.FullName);
-            }
-            IDictionary dictionary = (IDictionary) field.Accessor.GetValue(message);
-
-            while (true)
-            {
-                token = tokenizer.Next();
-                if (token.Type == JsonToken.TokenType.EndObject)
-                {
-                    return;
-                }
-                object key = ParseMapKey(keyField, token.StringValue);
-                object value = ParseSingleValue(valueField, tokenizer);
-                if (value == null)
-                {
-                    throw new InvalidProtocolBufferException("Map values must not be null");
-                }
-                dictionary[key] = value;
-            }
-        }
-
-        private static bool IsGoogleProtobufValueField(FieldDescriptor field)
-        {
-            return field.FieldType == FieldType.Message &&
-                field.MessageType.FullName == Value.Descriptor.FullName;
-        }
-
-        private object ParseSingleValue(FieldDescriptor field, JsonTokenizer tokenizer)
-        {
-            var token = tokenizer.Next();
-            if (token.Type == JsonToken.TokenType.Null)
-            {
-                // TODO: In order to support dynamic messages, we should really build this up
-                // dynamically.
-                if (IsGoogleProtobufValueField(field))
-                {
-                    return Value.ForNull();
-                }
-                return null;
-            }
-
-            var fieldType = field.FieldType;
-            if (fieldType == FieldType.Message)
-            {
-                // Parse wrapper types as their constituent types.
-                // TODO: What does this mean for null?
-                if (field.MessageType.IsWrapperType)
-                {
-                    field = field.MessageType.Fields[WrappersReflection.WrapperValueFieldNumber];
-                    fieldType = field.FieldType;
-                }
-                else
-                {
-                    // TODO: Merge the current value in message? (Public API currently doesn't make this relevant as we don't expose merging.)
-                    tokenizer.PushBack(token);
-                    IMessage subMessage = NewMessageForField(field);
-                    Merge(subMessage, tokenizer);
-                    return subMessage;
-                }
-            }
-
-            switch (token.Type)
-            {
-                case JsonToken.TokenType.True:
-                case JsonToken.TokenType.False:
-                    if (fieldType == FieldType.Bool)
-                    {
-                        return token.Type == JsonToken.TokenType.True;
-                    }
-                    // Fall through to "we don't support this type for this case"; could duplicate the behaviour of the default
-                    // case instead, but this way we'd only need to change one place.
-                    goto default;
-                case JsonToken.TokenType.StringValue:
-                    return ParseSingleStringValue(field, token.StringValue);
-                // Note: not passing the number value itself here, as we may end up storing the string value in the token too.
-                case JsonToken.TokenType.Number:
-                    return ParseSingleNumberValue(field, token);
-                case JsonToken.TokenType.Null:
-                    throw new NotImplementedException("Haven't worked out what to do for null yet");
-                default:
-                    throw new InvalidProtocolBufferException("Unsupported JSON token type " + token.Type + " for field type " + fieldType);
-            }
-        }
-
-        /// <summary>
-        /// Parses <paramref name="json"/> into a new message.
-        /// </summary>
-        /// <typeparam name="T">The type of message to create.</typeparam>
-        /// <param name="json">The JSON to parse.</param>
-        /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
-        /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
-        public T Parse<T>(string json) where T : IMessage, new()
-        {
-            ProtoPreconditions.CheckNotNull(json, nameof(json));
-            return Parse<T>(new StringReader(json));
-        }
-
-        /// <summary>
-        /// Parses JSON read from <paramref name="jsonReader"/> into a new message.
-        /// </summary>
-        /// <typeparam name="T">The type of message to create.</typeparam>
-        /// <param name="jsonReader">Reader providing the JSON to parse.</param>
-        /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
-        /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
-        public T Parse<T>(TextReader jsonReader) where T : IMessage, new()
-        {
-            ProtoPreconditions.CheckNotNull(jsonReader, nameof(jsonReader));
-            T message = new T();
-            Merge(message, jsonReader);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses <paramref name="json"/> into a new message.
-        /// </summary>
-        /// <param name="json">The JSON to parse.</param>
-        /// <param name="descriptor">Descriptor of message type to parse.</param>
-        /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
-        /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
-        public IMessage Parse(string json, MessageDescriptor descriptor)
-        {
-            ProtoPreconditions.CheckNotNull(json, nameof(json));
-            ProtoPreconditions.CheckNotNull(descriptor, nameof(descriptor));
-            return Parse(new StringReader(json), descriptor);
-        }
-
-        /// <summary>
-        /// Parses JSON read from <paramref name="jsonReader"/> into a new message.
-        /// </summary>
-        /// <param name="jsonReader">Reader providing the JSON to parse.</param>
-        /// <param name="descriptor">Descriptor of message type to parse.</param>
-        /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
-        /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
-        public IMessage Parse(TextReader jsonReader, MessageDescriptor descriptor)
-        {
-            ProtoPreconditions.CheckNotNull(jsonReader, nameof(jsonReader));
-            ProtoPreconditions.CheckNotNull(descriptor, nameof(descriptor));
-            IMessage message = descriptor.Parser.CreateTemplate();
-            Merge(message, jsonReader);
-            return message;
-        }
-
-        private void MergeStructValue(IMessage message, JsonTokenizer tokenizer)
-        {
-            var firstToken = tokenizer.Next();
-            var fields = message.Descriptor.Fields;
-            switch (firstToken.Type)
-            {
-                case JsonToken.TokenType.Null:
-                    fields[Value.NullValueFieldNumber].Accessor.SetValue(message, 0);
-                    return;
-                case JsonToken.TokenType.StringValue:
-                    fields[Value.StringValueFieldNumber].Accessor.SetValue(message, firstToken.StringValue);
-                    return;
-                case JsonToken.TokenType.Number:
-                    fields[Value.NumberValueFieldNumber].Accessor.SetValue(message, firstToken.NumberValue);
-                    return;
-                case JsonToken.TokenType.False:
-                case JsonToken.TokenType.True:
-                    fields[Value.BoolValueFieldNumber].Accessor.SetValue(message, firstToken.Type == JsonToken.TokenType.True);
-                    return;
-                case JsonToken.TokenType.StartObject:
-                    {
-                        var field = fields[Value.StructValueFieldNumber];
-                        var structMessage = NewMessageForField(field);
-                        tokenizer.PushBack(firstToken);
-                        Merge(structMessage, tokenizer);
-                        field.Accessor.SetValue(message, structMessage);
-                        return;
-                    }
-                case JsonToken.TokenType.StartArray:
-                    {
-                        var field = fields[Value.ListValueFieldNumber];
-                        var list = NewMessageForField(field);
-                        tokenizer.PushBack(firstToken);
-                        Merge(list, tokenizer);
-                        field.Accessor.SetValue(message, list);
-                        return;
-                    }
-                default:
-                    throw new InvalidOperationException("Unexpected token type: " + firstToken.Type);
-            }
-        }
-
-        private void MergeStruct(IMessage message, JsonTokenizer tokenizer)
-        {
-            var token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.StartObject)
-            {
-                throw new InvalidProtocolBufferException("Expected object value for Struct");
-            }
-            tokenizer.PushBack(token);
-
-            var field = message.Descriptor.Fields[Struct.FieldsFieldNumber];
-            MergeMapField(message, field, tokenizer);
-        }
-
-        private void MergeAny(IMessage message, JsonTokenizer tokenizer)
-        {
-            // Record the token stream until we see the @type property. At that point, we can take the value, consult
-            // the type registry for the relevant message, and replay the stream, omitting the @type property.
-            var tokens = new List<JsonToken>();
-
-            var token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.StartObject)
-            {
-                throw new InvalidProtocolBufferException("Expected object value for Any");
-            }
-            int typeUrlObjectDepth = tokenizer.ObjectDepth;
-
-            // The check for the property depth protects us from nested Any values which occur before the type URL
-            // for *this* Any.
-            while (token.Type != JsonToken.TokenType.Name ||
-                token.StringValue != JsonFormatter.AnyTypeUrlField ||
-                tokenizer.ObjectDepth != typeUrlObjectDepth)
-            {
-                tokens.Add(token);
-                token = tokenizer.Next();
-
-                if (tokenizer.ObjectDepth < typeUrlObjectDepth)
-                {
-                    throw new InvalidProtocolBufferException("Any message with no @type");
-                }
-            }
-
-            // Don't add the @type property or its value to the recorded token list
-            token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.StringValue)
-            {
-                throw new InvalidProtocolBufferException("Expected string value for Any.@type");
-            }
-            string typeUrl = token.StringValue;
-            string typeName = Any.GetTypeName(typeUrl);
-
-            MessageDescriptor descriptor = settings.TypeRegistry.Find(typeName);
-            if (descriptor == null)
-            {
-                throw new InvalidOperationException($"Type registry has no descriptor for type name '{typeName}'");
-            }
-
-            // Now replay the token stream we've already read and anything that remains of the object, just parsing it
-            // as normal. Our original tokenizer should end up at the end of the object.
-            var replay = JsonTokenizer.FromReplayedTokens(tokens, tokenizer);
-            var body = descriptor.Parser.CreateTemplate();
-            if (descriptor.IsWellKnownType)
-            {
-                MergeWellKnownTypeAnyBody(body, replay);
-            }
-            else
-            {
-                Merge(body, replay);
-            }
-            var data = body.ToByteString();
-
-            // Now that we have the message data, we can pack it into an Any (the message received as a parameter).
-            message.Descriptor.Fields[Any.TypeUrlFieldNumber].Accessor.SetValue(message, typeUrl);
-            message.Descriptor.Fields[Any.ValueFieldNumber].Accessor.SetValue(message, data);
-        }
-
-        // Well-known types end up in a property called "value" in the JSON. As there's no longer a @type property
-        // in the given JSON token stream, we should *only* have tokens of start-object, name("value"), the value
-        // itself, and then end-object.
-        private void MergeWellKnownTypeAnyBody(IMessage body, JsonTokenizer tokenizer)
-        {
-            var token = tokenizer.Next(); // Definitely start-object; checked in previous method
-            token = tokenizer.Next();
-            // TODO: What about an absent Int32Value, for example?
-            if (token.Type != JsonToken.TokenType.Name || token.StringValue != JsonFormatter.AnyWellKnownTypeValueField)
-            {
-                throw new InvalidProtocolBufferException($"Expected '{JsonFormatter.AnyWellKnownTypeValueField}' property for well-known type Any body");
-            }
-            Merge(body, tokenizer);
-            token = tokenizer.Next();
-            if (token.Type != JsonToken.TokenType.EndObject)
-            {
-                throw new InvalidProtocolBufferException($"Expected end-object token after @type/value for well-known type");
-            }
-        }
-
-        #region Utility methods which don't depend on the state (or settings) of the parser.
-        private static object ParseMapKey(FieldDescriptor field, string keyText)
-        {
-            switch (field.FieldType)
-            {
-                case FieldType.Bool:
-                    if (keyText == "true")
-                    {
-                        return true;
-                    }
-                    if (keyText == "false")
-                    {
-                        return false;
-                    }
-                    throw new InvalidProtocolBufferException("Invalid string for bool map key: " + keyText);
-                case FieldType.String:
-                    return keyText;
-                case FieldType.Int32:
-                case FieldType.SInt32:
-                case FieldType.SFixed32:
-                    return ParseNumericString(keyText, int.Parse);
-                case FieldType.UInt32:
-                case FieldType.Fixed32:
-                    return ParseNumericString(keyText, uint.Parse);
-                case FieldType.Int64:
-                case FieldType.SInt64:
-                case FieldType.SFixed64:
-                    return ParseNumericString(keyText, long.Parse);
-                case FieldType.UInt64:
-                case FieldType.Fixed64:
-                    return ParseNumericString(keyText, ulong.Parse);
-                default:
-                    throw new InvalidProtocolBufferException("Invalid field type for map: " + field.FieldType);
-            }
-        }
-
-        private static object ParseSingleNumberValue(FieldDescriptor field, JsonToken token)
-        {
-            double value = token.NumberValue;
-            checked
-            {
-                try
-                {
-                    switch (field.FieldType)
-                    {
-                        case FieldType.Int32:
-                        case FieldType.SInt32:
-                        case FieldType.SFixed32:
-                            CheckInteger(value);
-                            return (int) value;
-                        case FieldType.UInt32:
-                        case FieldType.Fixed32:
-                            CheckInteger(value);
-                            return (uint) value;
-                        case FieldType.Int64:
-                        case FieldType.SInt64:
-                        case FieldType.SFixed64:
-                            CheckInteger(value);
-                            return (long) value;
-                        case FieldType.UInt64:
-                        case FieldType.Fixed64:
-                            CheckInteger(value);
-                            return (ulong) value;
-                        case FieldType.Double:
-                            return value;
-                        case FieldType.Float:
-                            if (double.IsNaN(value))
-                            {
-                                return float.NaN;
-                            }
-                            if (value > float.MaxValue || value < float.MinValue)
-                            {
-                                if (double.IsPositiveInfinity(value))
-                                {
-                                    return float.PositiveInfinity;
-                                }
-                                if (double.IsNegativeInfinity(value))
-                                {
-                                    return float.NegativeInfinity;
-                                }
-                                throw new InvalidProtocolBufferException($"Value out of range: {value}");
-                            }
-                            return (float) value;
-                        case FieldType.Enum:
-                            CheckInteger(value);
-                            // Just return it as an int, and let the CLR convert it.
-                            // Note that we deliberately don't check that it's a known value.
-                            return (int) value;
-                        default:
-                            throw new InvalidProtocolBufferException($"Unsupported conversion from JSON number for field type {field.FieldType}");
-                    }
-                }
-                catch (OverflowException)
-                {
-                    throw new InvalidProtocolBufferException($"Value out of range: {value}");
-                }
-            }
-        }
-
-        private static void CheckInteger(double value)
-        {
-            if (double.IsInfinity(value) || double.IsNaN(value))
-            {
-                throw new InvalidProtocolBufferException($"Value not an integer: {value}");
-            }
-            if (value != Math.Floor(value))
-            {
-                throw new InvalidProtocolBufferException($"Value not an integer: {value}");
-            }            
-        }
-
-        private static object ParseSingleStringValue(FieldDescriptor field, string text)
-        {
-            switch (field.FieldType)
-            {
-                case FieldType.String:
-                    return text;
-                case FieldType.Bytes:
-                    try
-                    {
-                        return ByteString.FromBase64(text);
-                    }
-                    catch (FormatException e)
-                    {
-                        throw InvalidProtocolBufferException.InvalidBase64(e);
-                    }
-                case FieldType.Int32:
-                case FieldType.SInt32:
-                case FieldType.SFixed32:
-                    return ParseNumericString(text, int.Parse);
-                case FieldType.UInt32:
-                case FieldType.Fixed32:
-                    return ParseNumericString(text, uint.Parse);
-                case FieldType.Int64:
-                case FieldType.SInt64:
-                case FieldType.SFixed64:
-                    return ParseNumericString(text, long.Parse);
-                case FieldType.UInt64:
-                case FieldType.Fixed64:
-                    return ParseNumericString(text, ulong.Parse);
-                case FieldType.Double:
-                    double d = ParseNumericString(text, double.Parse);
-                    ValidateInfinityAndNan(text, double.IsPositiveInfinity(d), double.IsNegativeInfinity(d), double.IsNaN(d));
-                    return d;
-                case FieldType.Float:
-                    float f = ParseNumericString(text, float.Parse);
-                    ValidateInfinityAndNan(text, float.IsPositiveInfinity(f), float.IsNegativeInfinity(f), float.IsNaN(f));
-                    return f;
-                case FieldType.Enum:
-                    var enumValue = field.EnumType.FindValueByName(text);
-                    if (enumValue == null)
-                    {
-                        throw new InvalidProtocolBufferException($"Invalid enum value: {text} for enum type: {field.EnumType.FullName}");
-                    }
-                    // Just return it as an int, and let the CLR convert it.
-                    return enumValue.Number;
-                default:
-                    throw new InvalidProtocolBufferException($"Unsupported conversion from JSON string for field type {field.FieldType}");
-            }
-        }
-
-        /// <summary>
-        /// Creates a new instance of the message type for the given field.
-        /// </summary>
-        private static IMessage NewMessageForField(FieldDescriptor field)
-        {
-            return field.MessageType.Parser.CreateTemplate();
-        }
-
-        private static T ParseNumericString<T>(string text, Func<string, NumberStyles, IFormatProvider, T> parser)
-        {
-            // Can't prohibit this with NumberStyles.
-            if (text.StartsWith("+"))
-            {
-                throw new InvalidProtocolBufferException($"Invalid numeric value: {text}");
-            }
-            if (text.StartsWith("0") && text.Length > 1)
-            {
-                if (text[1] >= '0' && text[1] <= '9')
-                {
-                    throw new InvalidProtocolBufferException($"Invalid numeric value: {text}");
-                }
-            }
-            else if (text.StartsWith("-0") && text.Length > 2)
-            {
-                if (text[2] >= '0' && text[2] <= '9')
-                {
-                    throw new InvalidProtocolBufferException($"Invalid numeric value: {text}");
-                }
-            }
-            try
-            {
-                return parser(text, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, CultureInfo.InvariantCulture);
-            }
-            catch (FormatException)
-            {
-                throw new InvalidProtocolBufferException($"Invalid numeric value for type: {text}");
-            }
-            catch (OverflowException)
-            {
-                throw new InvalidProtocolBufferException($"Value out of range: {text}");
-            }
-        }
-
-        /// <summary>
-        /// Checks that any infinite/NaN values originated from the correct text.
-        /// This corrects the lenient whitespace handling of double.Parse/float.Parse, as well as the
-        /// way that Mono parses out-of-range values as infinity.
-        /// </summary>
-        private static void ValidateInfinityAndNan(string text, bool isPositiveInfinity, bool isNegativeInfinity, bool isNaN)
-        {
-            if ((isPositiveInfinity && text != "Infinity") ||
-                (isNegativeInfinity && text != "-Infinity") ||
-                (isNaN && text != "NaN"))
-            {
-                throw new InvalidProtocolBufferException($"Invalid numeric value: {text}");
-            }
-        }
-
-        private static void MergeTimestamp(IMessage message, JsonToken token)
-        {
-            if (token.Type != JsonToken.TokenType.StringValue)
-            {
-                throw new InvalidProtocolBufferException("Expected string value for Timestamp");
-            }
-            var match = TimestampRegex.Match(token.StringValue);
-            if (!match.Success)
-            {
-                throw new InvalidProtocolBufferException($"Invalid Timestamp value: {token.StringValue}");
-            }
-            var dateTime = match.Groups["datetime"].Value;
-            var subseconds = match.Groups["subseconds"].Value;
-            var offset = match.Groups["offset"].Value;
-
-            try
-            {
-                DateTime parsed = DateTime.ParseExact(
-                    dateTime,
-                    "yyyy-MM-dd'T'HH:mm:ss",
-                    CultureInfo.InvariantCulture,
-                    DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
-                // TODO: It would be nice not to have to create all these objects... easy to optimize later though.
-                Timestamp timestamp = Timestamp.FromDateTime(parsed);
-                int nanosToAdd = 0;
-                if (subseconds != "")
-                {
-                    // This should always work, as we've got 1-9 digits.
-                    int parsedFraction = int.Parse(subseconds.Substring(1), CultureInfo.InvariantCulture);
-                    nanosToAdd = parsedFraction * SubsecondScalingFactors[subseconds.Length];
-                }
-                int secondsToAdd = 0;
-                if (offset != "Z")
-                {
-                    // This is the amount we need to *subtract* from the local time to get to UTC - hence - => +1 and vice versa.
-                    int sign = offset[0] == '-' ? 1 : -1;
-                    int hours = int.Parse(offset.Substring(1, 2), CultureInfo.InvariantCulture);
-                    int minutes = int.Parse(offset.Substring(4, 2));
-                    int totalMinutes = hours * 60 + minutes;
-                    if (totalMinutes > 18 * 60)
-                    {
-                        throw new InvalidProtocolBufferException("Invalid Timestamp value: " + token.StringValue);
-                    }
-                    if (totalMinutes == 0 && sign == 1)
-                    {
-                        // This is an offset of -00:00, which means "unknown local offset". It makes no sense for a timestamp.
-                        throw new InvalidProtocolBufferException("Invalid Timestamp value: " + token.StringValue);
-                    }
-                    // We need to *subtract* the offset from local time to get UTC.
-                    secondsToAdd = sign * totalMinutes * 60;
-                }
-                // Ensure we've got the right signs. Currently unnecessary, but easy to do.
-                if (secondsToAdd < 0 && nanosToAdd > 0)
-                {
-                    secondsToAdd++;
-                    nanosToAdd = nanosToAdd - Duration.NanosecondsPerSecond;
-                }
-                if (secondsToAdd != 0 || nanosToAdd != 0)
-                {
-                    timestamp += new Duration { Nanos = nanosToAdd, Seconds = secondsToAdd };
-                    // The resulting timestamp after offset change would be out of our expected range. Currently the Timestamp message doesn't validate this
-                    // anywhere, but we shouldn't parse it.
-                    if (timestamp.Seconds < Timestamp.UnixSecondsAtBclMinValue || timestamp.Seconds > Timestamp.UnixSecondsAtBclMaxValue)
-                    {
-                        throw new InvalidProtocolBufferException("Invalid Timestamp value: " + token.StringValue);
-                    }
-                }
-                message.Descriptor.Fields[Timestamp.SecondsFieldNumber].Accessor.SetValue(message, timestamp.Seconds);
-                message.Descriptor.Fields[Timestamp.NanosFieldNumber].Accessor.SetValue(message, timestamp.Nanos);
-            }
-            catch (FormatException)
-            {
-                throw new InvalidProtocolBufferException("Invalid Timestamp value: " + token.StringValue);
-            }
-        }
-
-        private static void MergeDuration(IMessage message, JsonToken token)
-        {
-            if (token.Type != JsonToken.TokenType.StringValue)
-            {
-                throw new InvalidProtocolBufferException("Expected string value for Duration");
-            }
-            var match = DurationRegex.Match(token.StringValue);
-            if (!match.Success)
-            {
-                throw new InvalidProtocolBufferException("Invalid Duration value: " + token.StringValue);
-            }
-            var sign = match.Groups["sign"].Value;
-            var secondsText = match.Groups["int"].Value;
-            // Prohibit leading insignficant zeroes
-            if (secondsText[0] == '0' && secondsText.Length > 1)
-            {
-                throw new InvalidProtocolBufferException("Invalid Duration value: " + token.StringValue);
-            }
-            var subseconds = match.Groups["subseconds"].Value;
-            var multiplier = sign == "-" ? -1 : 1;
-
-            try
-            {
-                long seconds = long.Parse(secondsText, CultureInfo.InvariantCulture) * multiplier;
-                int nanos = 0;
-                if (subseconds != "")
-                {
-                    // This should always work, as we've got 1-9 digits.
-                    int parsedFraction = int.Parse(subseconds.Substring(1));
-                    nanos = parsedFraction * SubsecondScalingFactors[subseconds.Length] * multiplier;
-                }
-                if (!Duration.IsNormalized(seconds, nanos))
-                {
-                    throw new InvalidProtocolBufferException($"Invalid Duration value: {token.StringValue}");
-                }
-                message.Descriptor.Fields[Duration.SecondsFieldNumber].Accessor.SetValue(message, seconds);
-                message.Descriptor.Fields[Duration.NanosFieldNumber].Accessor.SetValue(message, nanos);
-            }
-            catch (FormatException)
-            {
-                throw new InvalidProtocolBufferException($"Invalid Duration value: {token.StringValue}");
-            }
-        }
-
-        private static void MergeFieldMask(IMessage message, JsonToken token)
-        {
-            if (token.Type != JsonToken.TokenType.StringValue)
-            {
-                throw new InvalidProtocolBufferException("Expected string value for FieldMask");
-            }
-            // TODO: Do we *want* to remove empty entries? Probably okay to treat "" as "no paths", but "foo,,bar"?
-            string[] jsonPaths = token.StringValue.Split(FieldMaskPathSeparators, StringSplitOptions.RemoveEmptyEntries);
-            IList messagePaths = (IList) message.Descriptor.Fields[FieldMask.PathsFieldNumber].Accessor.GetValue(message);
-            foreach (var path in jsonPaths)
-            {
-                messagePaths.Add(ToSnakeCase(path));
-            }
-        }
-        
-        // Ported from src/google/protobuf/util/internal/utility.cc
-        private static string ToSnakeCase(string text)
-        {
-            var builder = new StringBuilder(text.Length * 2);
-            // Note: this is probably unnecessary now, but currently retained to be as close as possible to the
-            // C++, whilst still throwing an exception on underscores.
-            bool wasNotUnderscore = false;  // Initialize to false for case 1 (below)
-            bool wasNotCap = false;
-
-            for (int i = 0; i < text.Length; i++)
-            {
-                char c = text[i];
-                if (c >= 'A' && c <= 'Z') // ascii_isupper
-                {
-                    // Consider when the current character B is capitalized:
-                    // 1) At beginning of input:   "B..." => "b..."
-                    //    (e.g. "Biscuit" => "biscuit")
-                    // 2) Following a lowercase:   "...aB..." => "...a_b..."
-                    //    (e.g. "gBike" => "g_bike")
-                    // 3) At the end of input:     "...AB" => "...ab"
-                    //    (e.g. "GoogleLAB" => "google_lab")
-                    // 4) Followed by a lowercase: "...ABc..." => "...a_bc..."
-                    //    (e.g. "GBike" => "g_bike")
-                    if (wasNotUnderscore &&               //            case 1 out
-                        (wasNotCap ||                     // case 2 in, case 3 out
-                         (i + 1 < text.Length &&         //            case 3 out
-                          (text[i + 1] >= 'a' && text[i + 1] <= 'z')))) // ascii_islower(text[i + 1])
-                    {  // case 4 in
-                       // We add an underscore for case 2 and case 4.
-                        builder.Append('_');
-                    }
-                    // ascii_tolower, but we already know that c *is* an upper case ASCII character...
-                    builder.Append((char) (c + 'a' - 'A'));
-                    wasNotUnderscore = true;
-                    wasNotCap = false;
-                }
-                else
-                {
-                    builder.Append(c);
-                    if (c == '_')
-                    {
-                        throw new InvalidProtocolBufferException($"Invalid field mask: {text}");
-                    }
-                    wasNotUnderscore = true;
-                    wasNotCap = true;
-                }
-            }
-            return builder.ToString();
-        }
-        #endregion
-
-        /// <summary>
-        /// Settings controlling JSON parsing.
-        /// </summary>
-        public sealed class Settings
-        {
-            /// <summary>
-            /// Default settings, as used by <see cref="JsonParser.Default"/>. This has the same default
-            /// recursion limit as <see cref="CodedInputStream"/>, and an empty type registry.
-            /// </summary>
-            public static Settings Default { get; }
-
-            // Workaround for the Mono compiler complaining about XML comments not being on
-            // valid language elements.
-            static Settings()
-            {
-                Default = new Settings(CodedInputStream.DefaultRecursionLimit);
-            }
-
-            /// <summary>
-            /// The maximum depth of messages to parse. Note that this limit only applies to parsing
-            /// messages, not collections - so a message within a collection within a message only counts as
-            /// depth 2, not 3.
-            /// </summary>
-            public int RecursionLimit { get; }
-
-            /// <summary>
-            /// The type registry used to parse <see cref="Any"/> messages.
-            /// </summary>
-            public TypeRegistry TypeRegistry { get; }
-
-            /// <summary>
-            /// Creates a new <see cref="Settings"/> object with the specified recursion limit.
-            /// </summary>
-            /// <param name="recursionLimit">The maximum depth of messages to parse</param>
-            public Settings(int recursionLimit) : this(recursionLimit, TypeRegistry.Empty)
-            {
-            }
-
-            /// <summary>
-            /// Creates a new <see cref="Settings"/> object with the specified recursion limit and type registry.
-            /// </summary>
-            /// <param name="recursionLimit">The maximum depth of messages to parse</param>
-            /// <param name="typeRegistry">The type registry used to parse <see cref="Any"/> messages</param>
-            public Settings(int recursionLimit, TypeRegistry typeRegistry)
-            {
-                RecursionLimit = recursionLimit;
-                TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry));
-            }
-        }
-    }
-}

+ 0 - 166
csharp/src/Google.Protobuf/JsonToken.cs

@@ -1,166 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf
-{
-    internal sealed class JsonToken : IEquatable<JsonToken>
-    {
-        // Tokens with no value can be reused.
-        private static readonly JsonToken _true = new JsonToken(TokenType.True);
-        private static readonly JsonToken _false = new JsonToken(TokenType.False);
-        private static readonly JsonToken _null = new JsonToken(TokenType.Null);
-        private static readonly JsonToken startObject = new JsonToken(TokenType.StartObject);
-        private static readonly JsonToken endObject = new JsonToken(TokenType.EndObject);
-        private static readonly JsonToken startArray = new JsonToken(TokenType.StartArray);
-        private static readonly JsonToken endArray = new JsonToken(TokenType.EndArray);
-        private static readonly JsonToken endDocument = new JsonToken(TokenType.EndDocument);
-
-        internal static JsonToken Null { get { return _null; } }
-        internal static JsonToken False { get { return _false; } }
-        internal static JsonToken True { get { return _true; } }
-        internal static JsonToken StartObject{ get { return startObject; } }
-        internal static JsonToken EndObject { get { return endObject; } }
-        internal static JsonToken StartArray { get { return startArray; } }
-        internal static JsonToken EndArray { get { return endArray; } }
-        internal static JsonToken EndDocument { get { return endDocument; } }
-
-        internal static JsonToken Name(string name)
-        {
-            return new JsonToken(TokenType.Name, stringValue: name);
-        }
-
-        internal static JsonToken Value(string value)
-        {
-            return new JsonToken(TokenType.StringValue, stringValue: value);
-        }
-
-        internal static JsonToken Value(double value)
-        {
-            return new JsonToken(TokenType.Number, numberValue: value);
-        }
-
-        internal enum TokenType
-        {
-            Null,
-            False,
-            True,
-            StringValue,
-            Number,
-            Name,
-            StartObject,
-            EndObject,
-            StartArray,
-            EndArray,
-            EndDocument
-        }
-
-        // A value is a string, number, array, object, null, true or false
-        // Arrays and objects have start/end
-        // A document consists of a value
-        // Objects are name/value sequences.
-
-        private readonly TokenType type;
-        private readonly string stringValue;
-        private readonly double numberValue;
-
-        internal TokenType Type { get { return type; } }
-        internal string StringValue { get { return stringValue; } }
-        internal double NumberValue { get { return numberValue; } }
-
-        private JsonToken(TokenType type, string stringValue = null, double numberValue = 0)
-        {
-            this.type = type;
-            this.stringValue = stringValue;
-            this.numberValue = numberValue;
-        }
-
-        public override bool Equals(object obj)
-        {
-            return Equals(obj as JsonToken);
-        }
-
-        public override int GetHashCode()
-        {
-            unchecked
-            {
-                int hash = 17;
-                hash = hash * 31 + (int) type;
-                hash = hash * 31 + stringValue == null ? 0 : stringValue.GetHashCode();
-                hash = hash * 31 + numberValue.GetHashCode();
-                return hash;
-            }
-        }
-
-        public override string ToString()
-        {
-            switch (type)
-            {
-                case TokenType.Null:
-                    return "null";
-                case TokenType.True:
-                    return "true";
-                case TokenType.False:
-                    return "false";
-                case TokenType.Name:
-                    return "name (" + stringValue + ")";
-                case TokenType.StringValue:
-                    return "value (" + stringValue + ")";
-                case TokenType.Number:
-                    return "number (" + numberValue + ")";
-                case TokenType.StartObject:
-                    return "start-object";
-                case TokenType.EndObject:
-                    return "end-object";
-                case TokenType.StartArray:
-                    return "start-array";
-                case TokenType.EndArray:
-                    return "end-array";
-                case TokenType.EndDocument:
-                    return "end-document";
-                default:
-                    throw new InvalidOperationException("Token is of unknown type " + type);
-            }
-        }
-
-        public bool Equals(JsonToken other)
-        {
-            if (ReferenceEquals(other, null))
-            {
-                return false;
-            }
-            // Note use of other.numberValue.Equals rather than ==, so that NaN compares appropriately.
-            return other.type == type && other.stringValue == stringValue && other.numberValue.Equals(numberValue);
-        }
-    }
-}

+ 0 - 738
csharp/src/Google.Protobuf/JsonTokenizer.cs

@@ -1,738 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 System.Globalization;
-using System.IO;
-using System.Text;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Simple but strict JSON tokenizer, rigidly following RFC 7159.
-    /// </summary>
-    /// <remarks>
-    /// <para>
-    /// This tokenizer is stateful, and only returns "useful" tokens - names, values etc.
-    /// It does not create tokens for the separator between names and values, or for the comma
-    /// between values. It validates the token stream as it goes - so callers can assume that the
-    /// tokens it produces are appropriate. For example, it would never produce "start object, end array."
-    /// </para>
-    /// <para>Implementation details: the base class handles single token push-back and </para>
-    /// <para>Not thread-safe.</para>
-    /// </remarks>
-    internal abstract class JsonTokenizer
-    {
-        private JsonToken bufferedToken;
-
-        /// <summary>
-        ///  Creates a tokenizer that reads from the given text reader.
-        /// </summary>
-        internal static JsonTokenizer FromTextReader(TextReader reader)
-        {
-            return new JsonTextTokenizer(reader);
-        }
-
-        /// <summary>
-        /// Creates a tokenizer that first replays the given list of tokens, then continues reading
-        /// from another tokenizer. Note that if the returned tokenizer is "pushed back", that does not push back
-        /// on the continuation tokenizer, or vice versa. Care should be taken when using this method - it was
-        /// created for the sake of Any parsing.
-        /// </summary>
-        internal static JsonTokenizer FromReplayedTokens(IList<JsonToken> tokens, JsonTokenizer continuation)
-        {
-            return new JsonReplayTokenizer(tokens, continuation);
-        }
-
-        /// <summary>
-        /// Returns the depth of the stack, purely in objects (not collections).
-        /// Informally, this is the number of remaining unclosed '{' characters we have.
-        /// </summary>
-        internal int ObjectDepth { get; private set; }
-
-        // TODO: Why do we allow a different token to be pushed back? It might be better to always remember the previous
-        // token returned, and allow a parameterless Rewind() method (which could only be called once, just like the current PushBack).
-        internal void PushBack(JsonToken token)
-        {
-            if (bufferedToken != null)
-            {
-                throw new InvalidOperationException("Can't push back twice");
-            }
-            bufferedToken = token;
-            if (token.Type == JsonToken.TokenType.StartObject)
-            {
-                ObjectDepth--;
-            }
-            else if (token.Type == JsonToken.TokenType.EndObject)
-            {
-                ObjectDepth++;
-            }
-        }
-
-        /// <summary>
-        /// Returns the next JSON token in the stream. An EndDocument token is returned to indicate the end of the stream,
-        /// after which point <c>Next()</c> should not be called again.
-        /// </summary>
-        /// <remarks>This implementation provides single-token buffering, and calls <see cref="NextImpl"/> if there is no buffered token.</remarks>
-        /// <returns>The next token in the stream. This is never null.</returns>
-        /// <exception cref="InvalidOperationException">This method is called after an EndDocument token has been returned</exception>
-        /// <exception cref="InvalidJsonException">The input text does not comply with RFC 7159</exception>
-        internal JsonToken Next()
-        {
-            JsonToken tokenToReturn;
-            if (bufferedToken != null)
-            {
-                tokenToReturn = bufferedToken;
-                bufferedToken = null;
-            }
-            else
-            {
-                tokenToReturn = NextImpl();
-            }
-            if (tokenToReturn.Type == JsonToken.TokenType.StartObject)
-            {
-                ObjectDepth++;
-            }
-            else if (tokenToReturn.Type == JsonToken.TokenType.EndObject)
-            {
-                ObjectDepth--;
-            }
-            return tokenToReturn;
-        }
-
-        /// <summary>
-        /// Returns the next JSON token in the stream, when requested by the base class. (The <see cref="Next"/> method delegates
-        /// to this if it doesn't have a buffered token.)
-        /// </summary>
-        /// <exception cref="InvalidOperationException">This method is called after an EndDocument token has been returned</exception>
-        /// <exception cref="InvalidJsonException">The input text does not comply with RFC 7159</exception>
-        protected abstract JsonToken NextImpl();
-
-        /// <summary>
-        /// Tokenizer which first exhausts a list of tokens, then consults another tokenizer.
-        /// </summary>
-        private class JsonReplayTokenizer : JsonTokenizer
-        {
-            private readonly IList<JsonToken> tokens;
-            private readonly JsonTokenizer nextTokenizer;
-            private int nextTokenIndex;
-
-            internal JsonReplayTokenizer(IList<JsonToken> tokens, JsonTokenizer nextTokenizer)
-            {
-                this.tokens = tokens;
-                this.nextTokenizer = nextTokenizer;
-            }
-
-            // FIXME: Object depth not maintained...
-            protected override JsonToken NextImpl()
-            {
-                if (nextTokenIndex >= tokens.Count)
-                {
-                    return nextTokenizer.Next();
-                }
-                return tokens[nextTokenIndex++];
-            }
-        }
-
-        /// <summary>
-        /// Tokenizer which does all the *real* work of parsing JSON.
-        /// </summary>
-        private sealed class JsonTextTokenizer : JsonTokenizer
-        {
-            // The set of states in which a value is valid next token.
-            private static readonly State ValueStates = State.ArrayStart | State.ArrayAfterComma | State.ObjectAfterColon | State.StartOfDocument;
-
-            private readonly Stack<ContainerType> containerStack = new Stack<ContainerType>();
-            private readonly PushBackReader reader;
-            private State state;
-
-            internal JsonTextTokenizer(TextReader reader)
-            {
-                this.reader = new PushBackReader(reader);
-                state = State.StartOfDocument;
-                containerStack.Push(ContainerType.Document);
-            }
-
-            /// <remarks>
-            /// This method essentially just loops through characters skipping whitespace, validating and
-            /// changing state (e.g. from ObjectBeforeColon to ObjectAfterColon)
-            /// until it reaches something which will be a genuine token (e.g. a start object, or a value) at which point
-            /// it returns the token. Although the method is large, it would be relatively hard to break down further... most
-            /// of it is the large switch statement, which sometimes returns and sometimes doesn't.
-            /// </remarks>
-            protected override JsonToken NextImpl()
-            {
-                if (state == State.ReaderExhausted)
-                {
-                    throw new InvalidOperationException("Next() called after end of document");
-                }
-                while (true)
-                {
-                    var next = reader.Read();
-                    if (next == null)
-                    {
-                        ValidateState(State.ExpectedEndOfDocument, "Unexpected end of document in state: ");
-                        state = State.ReaderExhausted;
-                        return JsonToken.EndDocument;
-                    }
-                    switch (next.Value)
-                    {
-                        // Skip whitespace between tokens
-                        case ' ':
-                        case '\t':
-                        case '\r':
-                        case '\n':
-                            break;
-                        case ':':
-                            ValidateState(State.ObjectBeforeColon, "Invalid state to read a colon: ");
-                            state = State.ObjectAfterColon;
-                            break;
-                        case ',':
-                            ValidateState(State.ObjectAfterProperty | State.ArrayAfterValue, "Invalid state to read a colon: ");
-                            state = state == State.ObjectAfterProperty ? State.ObjectAfterComma : State.ArrayAfterComma;
-                            break;
-                        case '"':
-                            string stringValue = ReadString();
-                            if ((state & (State.ObjectStart | State.ObjectAfterComma)) != 0)
-                            {
-                                state = State.ObjectBeforeColon;
-                                return JsonToken.Name(stringValue);
-                            }
-                            else
-                            {
-                                ValidateAndModifyStateForValue("Invalid state to read a double quote: ");
-                                return JsonToken.Value(stringValue);
-                            }
-                        case '{':
-                            ValidateState(ValueStates, "Invalid state to read an open brace: ");
-                            state = State.ObjectStart;
-                            containerStack.Push(ContainerType.Object);
-                            return JsonToken.StartObject;
-                        case '}':
-                            ValidateState(State.ObjectAfterProperty | State.ObjectStart, "Invalid state to read a close brace: ");
-                            PopContainer();
-                            return JsonToken.EndObject;
-                        case '[':
-                            ValidateState(ValueStates, "Invalid state to read an open square bracket: ");
-                            state = State.ArrayStart;
-                            containerStack.Push(ContainerType.Array);
-                            return JsonToken.StartArray;
-                        case ']':
-                            ValidateState(State.ArrayAfterValue | State.ArrayStart, "Invalid state to read a close square bracket: ");
-                            PopContainer();
-                            return JsonToken.EndArray;
-                        case 'n': // Start of null
-                            ConsumeLiteral("null");
-                            ValidateAndModifyStateForValue("Invalid state to read a null literal: ");
-                            return JsonToken.Null;
-                        case 't': // Start of true
-                            ConsumeLiteral("true");
-                            ValidateAndModifyStateForValue("Invalid state to read a true literal: ");
-                            return JsonToken.True;
-                        case 'f': // Start of false
-                            ConsumeLiteral("false");
-                            ValidateAndModifyStateForValue("Invalid state to read a false literal: ");
-                            return JsonToken.False;
-                        case '-': // Start of a number
-                        case '0':
-                        case '1':
-                        case '2':
-                        case '3':
-                        case '4':
-                        case '5':
-                        case '6':
-                        case '7':
-                        case '8':
-                        case '9':
-                            double number = ReadNumber(next.Value);
-                            ValidateAndModifyStateForValue("Invalid state to read a number token: ");
-                            return JsonToken.Value(number);
-                        default:
-                            throw new InvalidJsonException("Invalid first character of token: " + next.Value);
-                    }
-                }
-            }
-
-            private void ValidateState(State validStates, string errorPrefix)
-            {
-                if ((validStates & state) == 0)
-                {
-                    throw reader.CreateException(errorPrefix + state);
-                }
-            }
-
-            /// <summary>
-            /// Reads a string token. It is assumed that the opening " has already been read.
-            /// </summary>
-            private string ReadString()
-            {
-                var value = new StringBuilder();
-                bool haveHighSurrogate = false;
-                while (true)
-                {
-                    char c = reader.ReadOrFail("Unexpected end of text while reading string");
-                    if (c < ' ')
-                    {
-                        throw reader.CreateException(string.Format(CultureInfo.InvariantCulture, "Invalid character in string literal: U+{0:x4}", (int) c));
-                    }
-                    if (c == '"')
-                    {
-                        if (haveHighSurrogate)
-                        {
-                            throw reader.CreateException("Invalid use of surrogate pair code units");
-                        }
-                        return value.ToString();
-                    }
-                    if (c == '\\')
-                    {
-                        c = ReadEscapedCharacter();
-                    }
-                    // TODO: Consider only allowing surrogate pairs that are either both escaped,
-                    // or both not escaped. It would be a very odd text stream that contained a "lone" high surrogate
-                    // followed by an escaped low surrogate or vice versa... and that couldn't even be represented in UTF-8.
-                    if (haveHighSurrogate != char.IsLowSurrogate(c))
-                    {
-                        throw reader.CreateException("Invalid use of surrogate pair code units");
-                    }
-                    haveHighSurrogate = char.IsHighSurrogate(c);
-                    value.Append(c);
-                }
-            }
-
-            /// <summary>
-            /// Reads an escaped character. It is assumed that the leading backslash has already been read.
-            /// </summary>
-            private char ReadEscapedCharacter()
-            {
-                char c = reader.ReadOrFail("Unexpected end of text while reading character escape sequence");
-                switch (c)
-                {
-                    case 'n':
-                        return '\n';
-                    case '\\':
-                        return '\\';
-                    case 'b':
-                        return '\b';
-                    case 'f':
-                        return '\f';
-                    case 'r':
-                        return '\r';
-                    case 't':
-                        return '\t';
-                    case '"':
-                        return '"';
-                    case '/':
-                        return '/';
-                    case 'u':
-                        return ReadUnicodeEscape();
-                    default:
-                        throw reader.CreateException(string.Format(CultureInfo.InvariantCulture, "Invalid character in character escape sequence: U+{0:x4}", (int) c));
-                }
-            }
-
-            /// <summary>
-            /// Reads an escaped Unicode 4-nybble hex sequence. It is assumed that the leading \u has already been read.
-            /// </summary>
-            private char ReadUnicodeEscape()
-            {
-                int result = 0;
-                for (int i = 0; i < 4; i++)
-                {
-                    char c = reader.ReadOrFail("Unexpected end of text while reading Unicode escape sequence");
-                    int nybble;
-                    if (c >= '0' && c <= '9')
-                    {
-                        nybble = c - '0';
-                    }
-                    else if (c >= 'a' && c <= 'f')
-                    {
-                        nybble = c - 'a' + 10;
-                    }
-                    else if (c >= 'A' && c <= 'F')
-                    {
-                        nybble = c - 'A' + 10;
-                    }
-                    else
-                    {
-                        throw reader.CreateException(string.Format(CultureInfo.InvariantCulture, "Invalid character in character escape sequence: U+{0:x4}", (int) c));
-                    }
-                    result = (result << 4) + nybble;
-                }
-                return (char) result;
-            }
-
-            /// <summary>
-            /// Consumes a text-only literal, throwing an exception if the read text doesn't match it.
-            /// It is assumed that the first letter of the literal has already been read.
-            /// </summary>
-            private void ConsumeLiteral(string text)
-            {
-                for (int i = 1; i < text.Length; i++)
-                {
-                    char? next = reader.Read();
-                    if (next == null)
-                    {
-                        throw reader.CreateException("Unexpected end of text while reading literal token " + text);
-                    }
-                    if (next.Value != text[i])
-                    {
-                        throw reader.CreateException("Unexpected character while reading literal token " + text);
-                    }
-                }
-            }
-
-            private double ReadNumber(char initialCharacter)
-            {
-                StringBuilder builder = new StringBuilder();
-                if (initialCharacter == '-')
-                {
-                    builder.Append("-");
-                }
-                else
-                {
-                    reader.PushBack(initialCharacter);
-                }
-                // Each method returns the character it read that doesn't belong in that part,
-                // so we know what to do next, including pushing the character back at the end.
-                // null is returned for "end of text".
-                char? next = ReadInt(builder);
-                if (next == '.')
-                {
-                    next = ReadFrac(builder);
-                }
-                if (next == 'e' || next == 'E')
-                {
-                    next = ReadExp(builder);
-                }
-                // If we read a character which wasn't part of the number, push it back so we can read it again
-                // to parse the next token.
-                if (next != null)
-                {
-                    reader.PushBack(next.Value);
-                }
-
-                // TODO: What exception should we throw if the value can't be represented as a double?
-                try
-                {
-                    return double.Parse(builder.ToString(),
-                        NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent,
-                        CultureInfo.InvariantCulture);
-                }
-                catch (OverflowException)
-                {
-                    throw reader.CreateException("Numeric value out of range: " + builder);
-                }
-            }
-
-            private char? ReadInt(StringBuilder builder)
-            {
-                char first = reader.ReadOrFail("Invalid numeric literal");
-                if (first < '0' || first > '9')
-                {
-                    throw reader.CreateException("Invalid numeric literal");
-                }
-                builder.Append(first);
-                int digitCount;
-                char? next = ConsumeDigits(builder, out digitCount);
-                if (first == '0' && digitCount != 0)
-                {
-                    throw reader.CreateException("Invalid numeric literal: leading 0 for non-zero value.");
-                }
-                return next;
-            }
-
-            private char? ReadFrac(StringBuilder builder)
-            {
-                builder.Append('.'); // Already consumed this
-                int digitCount;
-                char? next = ConsumeDigits(builder, out digitCount);
-                if (digitCount == 0)
-                {
-                    throw reader.CreateException("Invalid numeric literal: fraction with no trailing digits");
-                }
-                return next;
-            }
-
-            private char? ReadExp(StringBuilder builder)
-            {
-                builder.Append('E'); // Already consumed this (or 'e')
-                char? next = reader.Read();
-                if (next == null)
-                {
-                    throw reader.CreateException("Invalid numeric literal: exponent with no trailing digits");
-                }
-                if (next == '-' || next == '+')
-                {
-                    builder.Append(next.Value);
-                }
-                else
-                {
-                    reader.PushBack(next.Value);
-                }
-                int digitCount;
-                next = ConsumeDigits(builder, out digitCount);
-                if (digitCount == 0)
-                {
-                    throw reader.CreateException("Invalid numeric literal: exponent without value");
-                }
-                return next;
-            }
-
-            private char? ConsumeDigits(StringBuilder builder, out int count)
-            {
-                count = 0;
-                while (true)
-                {
-                    char? next = reader.Read();
-                    if (next == null || next.Value < '0' || next.Value > '9')
-                    {
-                        return next;
-                    }
-                    count++;
-                    builder.Append(next.Value);
-                }
-            }
-
-            /// <summary>
-            /// Validates that we're in a valid state to read a value (using the given error prefix if necessary)
-            /// and changes the state to the appropriate one, e.g. ObjectAfterColon to ObjectAfterProperty.
-            /// </summary>
-            private void ValidateAndModifyStateForValue(string errorPrefix)
-            {
-                ValidateState(ValueStates, errorPrefix);
-                switch (state)
-                {
-                    case State.StartOfDocument:
-                        state = State.ExpectedEndOfDocument;
-                        return;
-                    case State.ObjectAfterColon:
-                        state = State.ObjectAfterProperty;
-                        return;
-                    case State.ArrayStart:
-                    case State.ArrayAfterComma:
-                        state = State.ArrayAfterValue;
-                        return;
-                    default:
-                        throw new InvalidOperationException("ValidateAndModifyStateForValue does not handle all value states (and should)");
-                }
-            }
-
-            /// <summary>
-            /// Pops the top-most container, and sets the state to the appropriate one for the end of a value
-            /// in the parent container.
-            /// </summary>
-            private void PopContainer()
-            {
-                containerStack.Pop();
-                var parent = containerStack.Peek();
-                switch (parent)
-                {
-                    case ContainerType.Object:
-                        state = State.ObjectAfterProperty;
-                        break;
-                    case ContainerType.Array:
-                        state = State.ArrayAfterValue;
-                        break;
-                    case ContainerType.Document:
-                        state = State.ExpectedEndOfDocument;
-                        break;
-                    default:
-                        throw new InvalidOperationException("Unexpected container type: " + parent);
-                }
-            }
-
-            private enum ContainerType
-            {
-                Document, Object, Array
-            }
-
-            /// <summary>
-            /// Possible states of the tokenizer.
-            /// </summary>
-            /// <remarks>
-            /// <para>This is a flags enum purely so we can simply and efficiently represent a set of valid states
-            /// for checking.</para>
-            /// <para>
-            /// Each is documented with an example,
-            /// where ^ represents the current position within the text stream. The examples all use string values,
-            /// but could be any value, including nested objects/arrays.
-            /// The complete state of the tokenizer also includes a stack to indicate the contexts (arrays/objects).
-            /// Any additional notional state of "AfterValue" indicates that a value has been completed, at which 
-            /// point there's an immediate transition to ExpectedEndOfDocument,  ObjectAfterProperty or ArrayAfterValue.
-            /// </para>
-            /// <para>
-            /// These states were derived manually by reading RFC 7159 carefully.
-            /// </para>
-            /// </remarks>
-            [Flags]
-            private enum State
-            {
-                /// <summary>
-                /// ^ { "foo": "bar" }
-                /// Before the value in a document. Next states: ObjectStart, ArrayStart, "AfterValue"
-                /// </summary>
-                StartOfDocument = 1 << 0,
-                /// <summary>
-                /// { "foo": "bar" } ^
-                /// After the value in a document. Next states: ReaderExhausted
-                /// </summary>
-                ExpectedEndOfDocument = 1 << 1,
-                /// <summary>
-                /// { "foo": "bar" } ^ (and already read to the end of the reader)
-                /// Terminal state.
-                /// </summary>
-                ReaderExhausted = 1 << 2,
-                /// <summary>
-                /// { ^ "foo": "bar" }
-                /// Before the *first* property in an object.
-                /// Next states:
-                /// "AfterValue" (empty object)
-                /// ObjectBeforeColon (read a name)
-                /// </summary>
-                ObjectStart = 1 << 3,
-                /// <summary>
-                /// { "foo" ^ : "bar", "x": "y" }
-                /// Next state: ObjectAfterColon
-                /// </summary>
-                ObjectBeforeColon = 1 << 4,
-                /// <summary>
-                /// { "foo" : ^ "bar", "x": "y" }
-                /// Before any property other than the first in an object.
-                /// (Equivalently: after any property in an object) 
-                /// Next states:
-                /// "AfterValue" (value is simple)
-                /// ObjectStart (value is object)
-                /// ArrayStart (value is array)
-                /// </summary>
-                ObjectAfterColon = 1 << 5,
-                /// <summary>
-                /// { "foo" : "bar" ^ , "x" : "y" }
-                /// At the end of a property, so expecting either a comma or end-of-object
-                /// Next states: ObjectAfterComma or "AfterValue"
-                /// </summary>
-                ObjectAfterProperty = 1 << 6,
-                /// <summary>
-                /// { "foo":"bar", ^ "x":"y" }
-                /// Read the comma after the previous property, so expecting another property.
-                /// This is like ObjectStart, but closing brace isn't valid here
-                /// Next state: ObjectBeforeColon.
-                /// </summary>
-                ObjectAfterComma = 1 << 7,
-                /// <summary>
-                /// [ ^ "foo", "bar" ]
-                /// Before the *first* value in an array.
-                /// Next states:
-                /// "AfterValue" (read a value)
-                /// "AfterValue" (end of array; will pop stack)
-                /// </summary>
-                ArrayStart = 1 << 8,
-                /// <summary>
-                /// [ "foo" ^ , "bar" ]
-                /// After any value in an array, so expecting either a comma or end-of-array
-                /// Next states: ArrayAfterComma or "AfterValue"
-                /// </summary>
-                ArrayAfterValue = 1 << 9,
-                /// <summary>
-                /// [ "foo", ^ "bar" ]
-                /// After a comma in an array, so there *must* be another value (simple or complex).
-                /// Next states: "AfterValue" (simple value), StartObject, StartArray
-                /// </summary>
-                ArrayAfterComma = 1 << 10
-            }
-
-            /// <summary>
-            /// Wrapper around a text reader allowing small amounts of buffering and location handling.
-            /// </summary>
-            private class PushBackReader
-            {
-                // TODO: Add locations for errors etc.
-
-                private readonly TextReader reader;
-
-                internal PushBackReader(TextReader reader)
-                {
-                    // TODO: Wrap the reader in a BufferedReader?
-                    this.reader = reader;
-                }
-
-                /// <summary>
-                /// The buffered next character, if we have one.
-                /// </summary>
-                private char? nextChar;
-
-                /// <summary>
-                /// Returns the next character in the stream, or null if we have reached the end.
-                /// </summary>
-                /// <returns></returns>
-                internal char? Read()
-                {
-                    if (nextChar != null)
-                    {
-                        char? tmp = nextChar;
-                        nextChar = null;
-                        return tmp;
-                    }
-                    int next = reader.Read();
-                    return next == -1 ? null : (char?) next;
-                }
-
-                internal char ReadOrFail(string messageOnFailure)
-                {
-                    char? next = Read();
-                    if (next == null)
-                    {
-                        throw CreateException(messageOnFailure);
-                    }
-                    return next.Value;
-                }
-
-                internal void PushBack(char c)
-                {
-                    if (nextChar != null)
-                    {
-                        throw new InvalidOperationException("Cannot push back when already buffering a character");
-                    }
-                    nextChar = c;
-                }
-
-                /// <summary>
-                /// Creates a new exception appropriate for the current state of the reader.
-                /// </summary>
-                internal InvalidJsonException CreateException(string message)
-                {
-                    // TODO: Keep track of and use the location.
-                    return new InvalidJsonException(message);
-                }
-            }
-        }
-    }
-}

+ 0 - 110
csharp/src/Google.Protobuf/LimitedInputStream.cs

@@ -1,110 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Stream implementation which proxies another stream, only allowing a certain amount
-    /// of data to be read. Note that this is only used to read delimited streams, so it
-    /// doesn't attempt to implement everything.
-    /// </summary>
-    internal sealed class LimitedInputStream : Stream
-    {
-        private readonly Stream proxied;
-        private int bytesLeft;
-
-        internal LimitedInputStream(Stream proxied, int size)
-        {
-            this.proxied = proxied;
-            bytesLeft = size;
-        }
-
-        public override bool CanRead
-        {
-            get { return true; }
-        }
-
-        public override bool CanSeek
-        {
-            get { return false; }
-        }
-
-        public override bool CanWrite
-        {
-            get { return false; }
-        }
-
-        public override void Flush()
-        {
-        }
-
-        public override long Length
-        {
-            get { throw new NotSupportedException(); }
-        }
-
-        public override long Position
-        {
-            get { throw new NotSupportedException(); }
-            set { throw new NotSupportedException(); }
-        }
-
-        public override int Read(byte[] buffer, int offset, int count)
-        {
-            if (bytesLeft > 0)
-            {
-                int bytesRead = proxied.Read(buffer, offset, Math.Min(bytesLeft, count));
-                bytesLeft -= bytesRead;
-                return bytesRead;
-            }
-            return 0;
-        }
-
-        public override long Seek(long offset, SeekOrigin origin)
-        {
-            throw new NotSupportedException();
-        }
-
-        public override void SetLength(long value)
-        {
-            throw new NotSupportedException();
-        }
-
-        public override void Write(byte[] buffer, int offset, int count)
-        {
-            throw new NotSupportedException();
-        }
-    }
-}

+ 0 - 157
csharp/src/Google.Protobuf/MessageExtensions.cs

@@ -1,157 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// Extension methods on <see cref="IMessage"/> and <see cref="IMessage{T}"/>.
-    /// </summary>
-    public static class MessageExtensions
-    {
-        /// <summary>
-        /// Merges data from the given byte array into an existing message.
-        /// </summary>
-        /// <param name="message">The message to merge the data into.</param>
-        /// <param name="data">The data to merge, which must be protobuf-encoded binary data.</param>
-        public static void MergeFrom(this IMessage message, byte[] data)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            ProtoPreconditions.CheckNotNull(data, "data");
-            CodedInputStream input = new CodedInputStream(data);
-            message.MergeFrom(input);
-            input.CheckReadEndOfStreamTag();
-        }
-
-        /// <summary>
-        /// Merges data from the given byte string into an existing message.
-        /// </summary>
-        /// <param name="message">The message to merge the data into.</param>
-        /// <param name="data">The data to merge, which must be protobuf-encoded binary data.</param>
-        public static void MergeFrom(this IMessage message, ByteString data)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            ProtoPreconditions.CheckNotNull(data, "data");
-            CodedInputStream input = data.CreateCodedInput();
-            message.MergeFrom(input);
-            input.CheckReadEndOfStreamTag();
-        }
-
-        /// <summary>
-        /// Merges data from the given stream into an existing message.
-        /// </summary>
-        /// <param name="message">The message to merge the data into.</param>
-        /// <param name="input">Stream containing the data to merge, which must be protobuf-encoded binary data.</param>
-        public static void MergeFrom(this IMessage message, Stream input)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            ProtoPreconditions.CheckNotNull(input, "input");
-            CodedInputStream codedInput = new CodedInputStream(input);
-            message.MergeFrom(codedInput);
-            codedInput.CheckReadEndOfStreamTag();
-        }
-
-        /// <summary>
-        /// Merges length-delimited data from the given stream into an existing message.
-        /// </summary>
-        /// <remarks>
-        /// The stream is expected to contain a length and then the data. Only the amount of data
-        /// specified by the length will be consumed.
-        /// </remarks>
-        /// <param name="message">The message to merge the data into.</param>
-        /// <param name="input">Stream containing the data to merge, which must be protobuf-encoded binary data.</param>
-        public static void MergeDelimitedFrom(this IMessage message, Stream input)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            ProtoPreconditions.CheckNotNull(input, "input");
-            int size = (int) CodedInputStream.ReadRawVarint32(input);
-            Stream limitedStream = new LimitedInputStream(input, size);
-            message.MergeFrom(limitedStream);
-        }
-
-        /// <summary>
-        /// Converts the given message into a byte array in protobuf encoding.
-        /// </summary>
-        /// <param name="message">The message to convert.</param>
-        /// <returns>The message data as a byte array.</returns>
-        public static byte[] ToByteArray(this IMessage message)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            byte[] result = new byte[message.CalculateSize()];
-            CodedOutputStream output = new CodedOutputStream(result);
-            message.WriteTo(output);
-            output.CheckNoSpaceLeft();
-            return result;
-        }
-
-        /// <summary>
-        /// Writes the given message data to the given stream in protobuf encoding.
-        /// </summary>
-        /// <param name="message">The message to write to the stream.</param>
-        /// <param name="output">The stream to write to.</param>
-        public static void WriteTo(this IMessage message, Stream output)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            ProtoPreconditions.CheckNotNull(output, "output");
-            CodedOutputStream codedOutput = new CodedOutputStream(output);
-            message.WriteTo(codedOutput);
-            codedOutput.Flush();
-        }
-
-        /// <summary>
-        /// Writes the length and then data of the given message to a stream.
-        /// </summary>
-        /// <param name="message">The message to write.</param>
-        /// <param name="output">The output stream to write to.</param>
-        public static void WriteDelimitedTo(this IMessage message, Stream output)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            ProtoPreconditions.CheckNotNull(output, "output");
-            CodedOutputStream codedOutput = new CodedOutputStream(output);
-            codedOutput.WriteRawVarint32((uint)message.CalculateSize());
-            message.WriteTo(codedOutput);
-            codedOutput.Flush();
-        }
-
-        /// <summary>
-        /// Converts the given message into a byte string in protobuf encoding.
-        /// </summary>
-        /// <param name="message">The message to convert.</param>
-        /// <returns>The message data as a byte string.</returns>
-        public static ByteString ToByteString(this IMessage message)
-        {
-            ProtoPreconditions.CheckNotNull(message, "message");
-            return ByteString.AttachBytes(message.ToByteArray());
-        }        
-    }
-}

+ 0 - 267
csharp/src/Google.Protobuf/MessageParser.cs

@@ -1,267 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.IO;
-
-namespace Google.Protobuf
-{
-    /// <summary>
-    /// A general message parser, typically used by reflection-based code as all the methods
-    /// return simple <see cref="IMessage"/>.
-    /// </summary>
-    public class MessageParser
-    {
-        private Func<IMessage> factory;
-
-        internal MessageParser(Func<IMessage> factory)
-        {
-            this.factory = factory;
-        }
-
-        /// <summary>
-        /// Creates a template instance ready for population.
-        /// </summary>
-        /// <returns>An empty message.</returns>
-        internal IMessage CreateTemplate()
-        {
-            return factory();
-        }
-
-        /// <summary>
-        /// Parses a message from a byte array.
-        /// </summary>
-        /// <param name="data">The byte array containing the message. Must not be null.</param>
-        /// <returns>The newly parsed message.</returns>
-        public IMessage ParseFrom(byte[] data)
-        {
-            ProtoPreconditions.CheckNotNull(data, "data");
-            IMessage message = factory();
-            message.MergeFrom(data);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given byte string.
-        /// </summary>
-        /// <param name="data">The data to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public IMessage ParseFrom(ByteString data)
-        {
-            ProtoPreconditions.CheckNotNull(data, "data");
-            IMessage message = factory();
-            message.MergeFrom(data);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given stream.
-        /// </summary>
-        /// <param name="input">The stream to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public IMessage ParseFrom(Stream input)
-        {
-            IMessage message = factory();
-            message.MergeFrom(input);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a length-delimited message from the given stream.
-        /// </summary>
-        /// <remarks>
-        /// The stream is expected to contain a length and then the data. Only the amount of data
-        /// specified by the length will be consumed.
-        /// </remarks>
-        /// <param name="input">The stream to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public IMessage ParseDelimitedFrom(Stream input)
-        {
-            IMessage message = factory();
-            message.MergeDelimitedFrom(input);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given coded input stream.
-        /// </summary>
-        /// <param name="input">The stream to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public IMessage ParseFrom(CodedInputStream input)
-        {
-            IMessage message = factory();
-            message.MergeFrom(input);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given JSON.
-        /// </summary>
-        /// <param name="json">The JSON to parse.</param>
-        /// <returns>The parsed message.</returns>
-        /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
-        /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
-        public IMessage ParseJson(string json)
-        {
-            IMessage message = factory();
-            JsonParser.Default.Merge(message, json);
-            return message;
-        }
-    }
-
-    /// <summary>
-    /// A parser for a specific message type.
-    /// </summary>
-    /// <remarks>
-    /// <p>
-    /// This delegates most behavior to the
-    /// <see cref="IMessage.MergeFrom"/> implementation within the original type, but
-    /// provides convenient overloads to parse from a variety of sources.
-    /// </p>
-    /// <p>
-    /// Most applications will never need to create their own instances of this type;
-    /// instead, use the static <c>Parser</c> property of a generated message type to obtain a
-    /// parser for that type.
-    /// </p>
-    /// </remarks>
-    /// <typeparam name="T">The type of message to be parsed.</typeparam>
-    public sealed class MessageParser<T> : MessageParser where T : IMessage<T>
-    {
-        // Implementation note: all the methods here *could* just delegate up to the base class and cast the result.
-        // The current implementation avoids a virtual method call and a cast, which *may* be significant in some cases.
-        // Benchmarking work is required to measure the significance - but it's only a few lines of code in any case.
-        // The API wouldn't change anyway - just the implementation - so this work can be deferred.
-        private readonly Func<T> factory; 
-
-        /// <summary>
-        /// Creates a new parser.
-        /// </summary>
-        /// <remarks>
-        /// The factory method is effectively an optimization over using a generic constraint
-        /// to require a parameterless constructor: delegates are significantly faster to execute.
-        /// </remarks>
-        /// <param name="factory">Function to invoke when a new, empty message is required.</param>
-        public MessageParser(Func<T> factory) : base(() => factory())
-        {
-            this.factory = factory;
-        }
-
-        /// <summary>
-        /// Creates a template instance ready for population.
-        /// </summary>
-        /// <returns>An empty message.</returns>
-        internal new T CreateTemplate()
-        {
-            return factory();
-        }
-
-        /// <summary>
-        /// Parses a message from a byte array.
-        /// </summary>
-        /// <param name="data">The byte array containing the message. Must not be null.</param>
-        /// <returns>The newly parsed message.</returns>
-        public new T ParseFrom(byte[] data)
-        {
-            ProtoPreconditions.CheckNotNull(data, "data");
-            T message = factory();
-            message.MergeFrom(data);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given byte string.
-        /// </summary>
-        /// <param name="data">The data to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public new T ParseFrom(ByteString data)
-        {
-            ProtoPreconditions.CheckNotNull(data, "data");
-            T message = factory();
-            message.MergeFrom(data);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given stream.
-        /// </summary>
-        /// <param name="input">The stream to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public new T ParseFrom(Stream input)
-        {
-            T message = factory();
-            message.MergeFrom(input);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a length-delimited message from the given stream.
-        /// </summary>
-        /// <remarks>
-        /// The stream is expected to contain a length and then the data. Only the amount of data
-        /// specified by the length will be consumed.
-        /// </remarks>
-        /// <param name="input">The stream to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public new T ParseDelimitedFrom(Stream input)
-        {
-            T message = factory();
-            message.MergeDelimitedFrom(input);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given coded input stream.
-        /// </summary>
-        /// <param name="input">The stream to parse.</param>
-        /// <returns>The parsed message.</returns>
-        public new T ParseFrom(CodedInputStream input)
-        {
-            T message = factory();
-            message.MergeFrom(input);
-            return message;
-        }
-
-        /// <summary>
-        /// Parses a message from the given JSON.
-        /// </summary>
-        /// <param name="json">The JSON to parse.</param>
-        /// <returns>The parsed message.</returns>
-        /// <exception cref="InvalidJsonException">The JSON does not comply with RFC 7159</exception>
-        /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception>
-        public new T ParseJson(string json)
-        {
-            T message = factory();
-            JsonParser.Default.Merge(message, json);
-            return message;
-        }
-    }
-}

+ 0 - 49
csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs

@@ -1,49 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Runtime.CompilerServices;
-using System.Security;
-
-// General Information about an assembly is controlled through the following 
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-#if !NCRUNCH
-[assembly: AllowPartiallyTrustedCallers]
-#endif
-
-[assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" +
-    "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" +
-    "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" +
-    "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" +
-    "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" +
-    "c5ae9cb6")]

+ 0 - 79
csharp/src/Google.Protobuf/ProtoPreconditions.cs

@@ -1,79 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf
-{
-    /// <summary>
-    /// Helper methods for throwing exceptions when preconditions are not met.
-    /// </summary>
-    /// <remarks>
-    /// This class is used internally and by generated code; it is not particularly
-    /// expected to be used from application code, although nothing prevents it
-    /// from being used that way.
-    /// </remarks>
-    public static class ProtoPreconditions
-    {
-        /// <summary>
-        /// Throws an ArgumentNullException if the given value is null, otherwise
-        /// return the value to the caller.
-        /// </summary>
-        public static T CheckNotNull<T>(T value, string name) where T : class
-        {
-            if (value == null)
-            {
-                throw new ArgumentNullException(name);
-            }
-            return value;
-        }
-
-        /// <summary>
-        /// Throws an ArgumentNullException if the given value is null, otherwise
-        /// return the value to the caller.
-        /// </summary>
-        /// <remarks>
-        /// This is equivalent to <see cref="CheckNotNull{T}(T, string)"/> but without the type parameter
-        /// constraint. In most cases, the constraint is useful to prevent you from calling CheckNotNull
-        /// with a value type - but it gets in the way if either you want to use it with a nullable
-        /// value type, or you want to use it with an unconstrained type parameter.
-        /// </remarks>
-        internal static T CheckNotNullUnconstrained<T>(T value, string name)
-        {
-            if (value == null)
-            {
-                throw new ArgumentNullException(name);
-            }
-            return value;
-        }
-    }
-}

+ 0 - 5991
csharp/src/Google.Protobuf/Reflection/Descriptor.cs

@@ -1,5991 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: google/protobuf/descriptor.proto
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.Reflection {
-
-  /// <summary>Holder for reflection information generated from google/protobuf/descriptor.proto</summary>
-  internal static partial class DescriptorReflection {
-
-    #region Descriptor
-    /// <summary>File descriptor for google/protobuf/descriptor.proto</summary>
-    public static pbr::FileDescriptor Descriptor {
-      get { return descriptor; }
-    }
-    private static pbr::FileDescriptor descriptor;
-
-    static DescriptorReflection() {
-      byte[] descriptorData = global::System.Convert.FromBase64String(
-          string.Concat(
-            "CiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bxIPZ29vZ2xlLnBy",
-            "b3RvYnVmIkcKEUZpbGVEZXNjcmlwdG9yU2V0EjIKBGZpbGUYASADKAsyJC5n",
-            "b29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90byLbAwoTRmlsZURl",
-            "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg8KB3BhY2thZ2UYAiABKAkS",
-            "EgoKZGVwZW5kZW5jeRgDIAMoCRIZChFwdWJsaWNfZGVwZW5kZW5jeRgKIAMo",
-            "BRIXCg93ZWFrX2RlcGVuZGVuY3kYCyADKAUSNgoMbWVzc2FnZV90eXBlGAQg",
-            "AygLMiAuZ29vZ2xlLnByb3RvYnVmLkRlc2NyaXB0b3JQcm90bxI3CgllbnVt",
-            "X3R5cGUYBSADKAsyJC5nb29nbGUucHJvdG9idWYuRW51bURlc2NyaXB0b3JQ",
-            "cm90bxI4CgdzZXJ2aWNlGAYgAygLMicuZ29vZ2xlLnByb3RvYnVmLlNlcnZp",
-            "Y2VEZXNjcmlwdG9yUHJvdG8SOAoJZXh0ZW5zaW9uGAcgAygLMiUuZ29vZ2xl",
-            "LnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvEi0KB29wdGlvbnMYCCAB",
-            "KAsyHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMSOQoQc291cmNlX2Nv",
-            "ZGVfaW5mbxgJIAEoCzIfLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5m",
-            "bxIOCgZzeW50YXgYDCABKAki8AQKD0Rlc2NyaXB0b3JQcm90bxIMCgRuYW1l",
-            "GAEgASgJEjQKBWZpZWxkGAIgAygLMiUuZ29vZ2xlLnByb3RvYnVmLkZpZWxk",
-            "RGVzY3JpcHRvclByb3RvEjgKCWV4dGVuc2lvbhgGIAMoCzIlLmdvb2dsZS5w",
-            "cm90b2J1Zi5GaWVsZERlc2NyaXB0b3JQcm90bxI1CgtuZXN0ZWRfdHlwZRgD",
-            "IAMoCzIgLmdvb2dsZS5wcm90b2J1Zi5EZXNjcmlwdG9yUHJvdG8SNwoJZW51",
-            "bV90eXBlGAQgAygLMiQuZ29vZ2xlLnByb3RvYnVmLkVudW1EZXNjcmlwdG9y",
-            "UHJvdG8SSAoPZXh0ZW5zaW9uX3JhbmdlGAUgAygLMi8uZ29vZ2xlLnByb3Rv",
-            "YnVmLkRlc2NyaXB0b3JQcm90by5FeHRlbnNpb25SYW5nZRI5CgpvbmVvZl9k",
-            "ZWNsGAggAygLMiUuZ29vZ2xlLnByb3RvYnVmLk9uZW9mRGVzY3JpcHRvclBy",
-            "b3RvEjAKB29wdGlvbnMYByABKAsyHy5nb29nbGUucHJvdG9idWYuTWVzc2Fn",
-            "ZU9wdGlvbnMSRgoOcmVzZXJ2ZWRfcmFuZ2UYCSADKAsyLi5nb29nbGUucHJv",
-            "dG9idWYuRGVzY3JpcHRvclByb3RvLlJlc2VydmVkUmFuZ2USFQoNcmVzZXJ2",
-            "ZWRfbmFtZRgKIAMoCRosCg5FeHRlbnNpb25SYW5nZRINCgVzdGFydBgBIAEo",
-            "BRILCgNlbmQYAiABKAUaKwoNUmVzZXJ2ZWRSYW5nZRINCgVzdGFydBgBIAEo",
-            "BRILCgNlbmQYAiABKAUivAUKFEZpZWxkRGVzY3JpcHRvclByb3RvEgwKBG5h",
-            "bWUYASABKAkSDgoGbnVtYmVyGAMgASgFEjoKBWxhYmVsGAQgASgOMisuZ29v",
-            "Z2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvLkxhYmVsEjgKBHR5",
-            "cGUYBSABKA4yKi5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJv",
-            "dG8uVHlwZRIRCgl0eXBlX25hbWUYBiABKAkSEAoIZXh0ZW5kZWUYAiABKAkS",
-            "FQoNZGVmYXVsdF92YWx1ZRgHIAEoCRITCgtvbmVvZl9pbmRleBgJIAEoBRIR",
-            "Cglqc29uX25hbWUYCiABKAkSLgoHb3B0aW9ucxgIIAEoCzIdLmdvb2dsZS5w",
-            "cm90b2J1Zi5GaWVsZE9wdGlvbnMitgIKBFR5cGUSDwoLVFlQRV9ET1VCTEUQ",
-            "ARIOCgpUWVBFX0ZMT0FUEAISDgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlO",
-            "VDY0EAQSDgoKVFlQRV9JTlQzMhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZ",
-            "UEVfRklYRUQzMhAHEg0KCVRZUEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkS",
-            "DgoKVFlQRV9HUk9VUBAKEhAKDFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllU",
-            "RVMQDBIPCgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVf",
-            "U0ZJWEVEMzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQ",
-            "ERIPCgtUWVBFX1NJTlQ2NBASIkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFM",
-            "EAESEgoOTEFCRUxfUkVRVUlSRUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIlQK",
-            "FE9uZW9mRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSLgoHb3B0aW9u",
-            "cxgCIAEoCzIdLmdvb2dsZS5wcm90b2J1Zi5PbmVvZk9wdGlvbnMijAEKE0Vu",
-            "dW1EZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMo",
-            "CzIpLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8S",
-            "LQoHb3B0aW9ucxgDIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9u",
-            "cyJsChhFbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIO",
-            "CgZudW1iZXIYAiABKAUSMgoHb3B0aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90",
-            "b2J1Zi5FbnVtVmFsdWVPcHRpb25zIpABChZTZXJ2aWNlRGVzY3JpcHRvclBy",
-            "b3RvEgwKBG5hbWUYASABKAkSNgoGbWV0aG9kGAIgAygLMiYuZ29vZ2xlLnBy",
-            "b3RvYnVmLk1ldGhvZERlc2NyaXB0b3JQcm90bxIwCgdvcHRpb25zGAMgASgL",
-            "Mh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zIsEBChVNZXRob2RE",
-            "ZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIg",
-            "ASgJEhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5n",
-            "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFt",
-            "aW5nGAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVm",
-            "YWxzZSKHBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK",
-            "FGphdmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVf",
-            "ZmlsZXMYCiABKAg6BWZhbHNlEiwKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2Fu",
-            "ZF9oYXNoGBQgASgIOgVmYWxzZRIlChZqYXZhX3N0cmluZ19jaGVja191dGY4",
-            "GBsgASgIOgVmYWxzZRJGCgxvcHRpbWl6ZV9mb3IYCSABKA4yKS5nb29nbGUu",
-            "cHJvdG9idWYuRmlsZU9wdGlvbnMuT3B0aW1pemVNb2RlOgVTUEVFRBISCgpn",
-            "b19wYWNrYWdlGAsgASgJEiIKE2NjX2dlbmVyaWNfc2VydmljZXMYECABKAg6",
-            "BWZhbHNlEiQKFWphdmFfZ2VuZXJpY19zZXJ2aWNlcxgRIAEoCDoFZmFsc2US",
-            "IgoTcHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USGQoKZGVwcmVj",
-            "YXRlZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoF",
-            "ZmFsc2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25h",
-            "bWVzcGFjZRglIAEoCRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsy",
-            "JC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRp",
-            "bWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JV",
-            "TlRJTUUQAyoJCOgHEICAgIACSgQIJhAnIuYBCg5NZXNzYWdlT3B0aW9ucxIm",
-            "ChdtZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9f",
-            "c3RhbmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoK",
-            "ZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMK",
-            "FHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1",
-            "Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIimAMKDEZpZWxkT3B0",
-            "aW9ucxI6CgVjdHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9w",
-            "dGlvbnMuQ1R5cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBl",
-            "GAYgASgOMiQuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6",
-            "CUpTX05PUk1BTBITCgRsYXp5GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVk",
-            "GAMgASgIOgVmYWxzZRITCgR3ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVy",
-            "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl",
-            "cnByZXRlZE9wdGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAES",
-            "EAoMU1RSSU5HX1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0K",
-            "CUpTX1NUUklORxABEg0KCUpTX05VTUJFUhACKgkI6AcQgICAgAIiXgoMT25l",
-            "b2ZPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdv",
-            "b2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIi",
-            "jQEKC0VudW1PcHRpb25zEhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJl",
-            "Y2F0ZWQYAyABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcH",
-            "IAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI",
-            "6AcQgICAgAIifQoQRW51bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEg",
-            "ASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5n",
-            "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIAC",
-            "InsKDlNlcnZpY2VPcHRpb25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNl",
-            "EkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90",
-            "b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIiegoNTWV0aG9k",
-            "T3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJDChR1bmludGVy",
-            "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl",
-            "cnByZXRlZE9wdGlvbioJCOgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0",
-            "aW9uEjsKBG5hbWUYAiADKAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnBy",
-            "ZXRlZE9wdGlvbi5OYW1lUGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJ",
-            "EhoKEnBvc2l0aXZlX2ludF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRf",
-            "dmFsdWUYBSABKAMSFAoMZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192",
-            "YWx1ZRgHIAEoDBIXCg9hZ2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBh",
-            "cnQSEQoJbmFtZV9wYXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLV",
-            "AQoOU291cmNlQ29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUu",
-            "cHJvdG9idWYuU291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9u",
-            "EhAKBHBhdGgYASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRp",
-            "bmdfY29tbWVudHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkS",
-            "IQoZbGVhZGluZ19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJh",
-            "dGVkQ29kZUluZm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90",
-            "b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRp",
-            "b24SEAoEcGF0aBgBIAMoBUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoF",
-            "YmVnaW4YAyABKAUSCwoDZW5kGAQgASgFQlsKE2NvbS5nb29nbGUucHJvdG9i",
-            "dWZCEERlc2NyaXB0b3JQcm90b3NIAVoKZGVzY3JpcHRvcqABAaICA0dQQqoC",
-            "Gkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u"));
-      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
-          new pbr::FileDescriptor[] { },
-          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), global::Google.Protobuf.Reflection.FileDescriptorProto.Parser, new[]{ "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null)})
-          }));
-    }
-    #endregion
-
-  }
-  #region Messages
-  /// <summary>
-  ///  The protocol compiler can output a FileDescriptorSet containing the .proto
-  ///  files it parses.
-  /// </summary>
-  internal sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet> {
-    private static readonly pb::MessageParser<FileDescriptorSet> _parser = new pb::MessageParser<FileDescriptorSet>(() => new FileDescriptorSet());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FileDescriptorSet> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[0]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileDescriptorSet() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileDescriptorSet(FileDescriptorSet other) : this() {
-      file_ = other.file_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileDescriptorSet Clone() {
-      return new FileDescriptorSet(this);
-    }
-
-    /// <summary>Field number for the "file" field.</summary>
-    public const int FileFieldNumber = 1;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FileDescriptorProto> _repeated_file_codec
-        = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> file_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> File {
-      get { return file_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FileDescriptorSet);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FileDescriptorSet other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!file_.Equals(other.file_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= file_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      file_.WriteTo(output, _repeated_file_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += file_.CalculateSize(_repeated_file_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FileDescriptorSet other) {
-      if (other == null) {
-        return;
-      }
-      file_.Add(other.file_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            file_.AddEntriesFrom(input, _repeated_file_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Describes a complete .proto file.
-  /// </summary>
-  internal sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto> {
-    private static readonly pb::MessageParser<FileDescriptorProto> _parser = new pb::MessageParser<FileDescriptorProto>(() => new FileDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FileDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[1]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileDescriptorProto(FileDescriptorProto other) : this() {
-      name_ = other.name_;
-      package_ = other.package_;
-      dependency_ = other.dependency_.Clone();
-      publicDependency_ = other.publicDependency_.Clone();
-      weakDependency_ = other.weakDependency_.Clone();
-      messageType_ = other.messageType_.Clone();
-      enumType_ = other.enumType_.Clone();
-      service_ = other.service_.Clone();
-      extension_ = other.extension_.Clone();
-      Options = other.options_ != null ? other.Options.Clone() : null;
-      SourceCodeInfo = other.sourceCodeInfo_ != null ? other.SourceCodeInfo.Clone() : null;
-      syntax_ = other.syntax_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileDescriptorProto Clone() {
-      return new FileDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    /// <summary>
-    ///  file name, relative to root of source tree
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "package" field.</summary>
-    public const int PackageFieldNumber = 2;
-    private string package_ = "";
-    /// <summary>
-    ///  e.g. "foo", "foo.bar", etc.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Package {
-      get { return package_; }
-      set {
-        package_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "dependency" field.</summary>
-    public const int DependencyFieldNumber = 3;
-    private static readonly pb::FieldCodec<string> _repeated_dependency_codec
-        = pb::FieldCodec.ForString(26);
-    private readonly pbc::RepeatedField<string> dependency_ = new pbc::RepeatedField<string>();
-    /// <summary>
-    ///  Names of files imported by this file.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<string> Dependency {
-      get { return dependency_; }
-    }
-
-    /// <summary>Field number for the "public_dependency" field.</summary>
-    public const int PublicDependencyFieldNumber = 10;
-    private static readonly pb::FieldCodec<int> _repeated_publicDependency_codec
-        = pb::FieldCodec.ForInt32(80);
-    private readonly pbc::RepeatedField<int> publicDependency_ = new pbc::RepeatedField<int>();
-    /// <summary>
-    ///  Indexes of the public imported files in the dependency list above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> PublicDependency {
-      get { return publicDependency_; }
-    }
-
-    /// <summary>Field number for the "weak_dependency" field.</summary>
-    public const int WeakDependencyFieldNumber = 11;
-    private static readonly pb::FieldCodec<int> _repeated_weakDependency_codec
-        = pb::FieldCodec.ForInt32(88);
-    private readonly pbc::RepeatedField<int> weakDependency_ = new pbc::RepeatedField<int>();
-    /// <summary>
-    ///  Indexes of the weak imported files in the dependency list.
-    ///  For Google-internal migration only. Do not use.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<int> WeakDependency {
-      get { return weakDependency_; }
-    }
-
-    /// <summary>Field number for the "message_type" field.</summary>
-    public const int MessageTypeFieldNumber = 4;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_messageType_codec
-        = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> messageType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>();
-    /// <summary>
-    ///  All top-level definitions in this file.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> MessageType {
-      get { return messageType_; }
-    }
-
-    /// <summary>Field number for the "enum_type" field.</summary>
-    public const int EnumTypeFieldNumber = 5;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec
-        = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType {
-      get { return enumType_; }
-    }
-
-    /// <summary>Field number for the "service" field.</summary>
-    public const int ServiceFieldNumber = 6;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.ServiceDescriptorProto> _repeated_service_codec
-        = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> service_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> Service {
-      get { return service_; }
-    }
-
-    /// <summary>Field number for the "extension" field.</summary>
-    public const int ExtensionFieldNumber = 7;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec
-        = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension {
-      get { return extension_; }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 8;
-    private global::Google.Protobuf.Reflection.FileOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FileOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "source_code_info" field.</summary>
-    public const int SourceCodeInfoFieldNumber = 9;
-    private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_;
-    /// <summary>
-    ///  This field contains optional information about the original source code.
-    ///  You may safely remove this entire field without harming runtime
-    ///  functionality of the descriptors -- the information is needed only by
-    ///  development tools.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo {
-      get { return sourceCodeInfo_; }
-      set {
-        sourceCodeInfo_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "syntax" field.</summary>
-    public const int SyntaxFieldNumber = 12;
-    private string syntax_ = "";
-    /// <summary>
-    ///  The syntax of the proto file.
-    ///  The supported values are "proto2" and "proto3".
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Syntax {
-      get { return syntax_; }
-      set {
-        syntax_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FileDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FileDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (Package != other.Package) return false;
-      if(!dependency_.Equals(other.dependency_)) return false;
-      if(!publicDependency_.Equals(other.publicDependency_)) return false;
-      if(!weakDependency_.Equals(other.weakDependency_)) return false;
-      if(!messageType_.Equals(other.messageType_)) return false;
-      if(!enumType_.Equals(other.enumType_)) return false;
-      if(!service_.Equals(other.service_)) return false;
-      if(!extension_.Equals(other.extension_)) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      if (!object.Equals(SourceCodeInfo, other.SourceCodeInfo)) return false;
-      if (Syntax != other.Syntax) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (Package.Length != 0) hash ^= Package.GetHashCode();
-      hash ^= dependency_.GetHashCode();
-      hash ^= publicDependency_.GetHashCode();
-      hash ^= weakDependency_.GetHashCode();
-      hash ^= messageType_.GetHashCode();
-      hash ^= enumType_.GetHashCode();
-      hash ^= service_.GetHashCode();
-      hash ^= extension_.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode();
-      if (Syntax.Length != 0) hash ^= Syntax.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (Package.Length != 0) {
-        output.WriteRawTag(18);
-        output.WriteString(Package);
-      }
-      dependency_.WriteTo(output, _repeated_dependency_codec);
-      messageType_.WriteTo(output, _repeated_messageType_codec);
-      enumType_.WriteTo(output, _repeated_enumType_codec);
-      service_.WriteTo(output, _repeated_service_codec);
-      extension_.WriteTo(output, _repeated_extension_codec);
-      if (options_ != null) {
-        output.WriteRawTag(66);
-        output.WriteMessage(Options);
-      }
-      if (sourceCodeInfo_ != null) {
-        output.WriteRawTag(74);
-        output.WriteMessage(SourceCodeInfo);
-      }
-      publicDependency_.WriteTo(output, _repeated_publicDependency_codec);
-      weakDependency_.WriteTo(output, _repeated_weakDependency_codec);
-      if (Syntax.Length != 0) {
-        output.WriteRawTag(98);
-        output.WriteString(Syntax);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (Package.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Package);
-      }
-      size += dependency_.CalculateSize(_repeated_dependency_codec);
-      size += publicDependency_.CalculateSize(_repeated_publicDependency_codec);
-      size += weakDependency_.CalculateSize(_repeated_weakDependency_codec);
-      size += messageType_.CalculateSize(_repeated_messageType_codec);
-      size += enumType_.CalculateSize(_repeated_enumType_codec);
-      size += service_.CalculateSize(_repeated_service_codec);
-      size += extension_.CalculateSize(_repeated_extension_codec);
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      if (sourceCodeInfo_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceCodeInfo);
-      }
-      if (Syntax.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FileDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.Package.Length != 0) {
-        Package = other.Package;
-      }
-      dependency_.Add(other.dependency_);
-      publicDependency_.Add(other.publicDependency_);
-      weakDependency_.Add(other.weakDependency_);
-      messageType_.Add(other.messageType_);
-      enumType_.Add(other.enumType_);
-      service_.Add(other.service_);
-      extension_.Add(other.extension_);
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.FileOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-      if (other.sourceCodeInfo_ != null) {
-        if (sourceCodeInfo_ == null) {
-          sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo();
-        }
-        SourceCodeInfo.MergeFrom(other.SourceCodeInfo);
-      }
-      if (other.Syntax.Length != 0) {
-        Syntax = other.Syntax;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            Package = input.ReadString();
-            break;
-          }
-          case 26: {
-            dependency_.AddEntriesFrom(input, _repeated_dependency_codec);
-            break;
-          }
-          case 34: {
-            messageType_.AddEntriesFrom(input, _repeated_messageType_codec);
-            break;
-          }
-          case 42: {
-            enumType_.AddEntriesFrom(input, _repeated_enumType_codec);
-            break;
-          }
-          case 50: {
-            service_.AddEntriesFrom(input, _repeated_service_codec);
-            break;
-          }
-          case 58: {
-            extension_.AddEntriesFrom(input, _repeated_extension_codec);
-            break;
-          }
-          case 66: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.FileOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-          case 74: {
-            if (sourceCodeInfo_ == null) {
-              sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo();
-            }
-            input.ReadMessage(sourceCodeInfo_);
-            break;
-          }
-          case 82:
-          case 80: {
-            publicDependency_.AddEntriesFrom(input, _repeated_publicDependency_codec);
-            break;
-          }
-          case 90:
-          case 88: {
-            weakDependency_.AddEntriesFrom(input, _repeated_weakDependency_codec);
-            break;
-          }
-          case 98: {
-            Syntax = input.ReadString();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Describes a message type.
-  /// </summary>
-  internal sealed partial class DescriptorProto : pb::IMessage<DescriptorProto> {
-    private static readonly pb::MessageParser<DescriptorProto> _parser = new pb::MessageParser<DescriptorProto>(() => new DescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<DescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[2]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DescriptorProto(DescriptorProto other) : this() {
-      name_ = other.name_;
-      field_ = other.field_.Clone();
-      extension_ = other.extension_.Clone();
-      nestedType_ = other.nestedType_.Clone();
-      enumType_ = other.enumType_.Clone();
-      extensionRange_ = other.extensionRange_.Clone();
-      oneofDecl_ = other.oneofDecl_.Clone();
-      Options = other.options_ != null ? other.Options.Clone() : null;
-      reservedRange_ = other.reservedRange_.Clone();
-      reservedName_ = other.reservedName_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public DescriptorProto Clone() {
-      return new DescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "field" field.</summary>
-    public const int FieldFieldNumber = 2;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_field_codec
-        = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> field_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Field {
-      get { return field_; }
-    }
-
-    /// <summary>Field number for the "extension" field.</summary>
-    public const int ExtensionFieldNumber = 6;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec
-        = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension {
-      get { return extension_; }
-    }
-
-    /// <summary>Field number for the "nested_type" field.</summary>
-    public const int NestedTypeFieldNumber = 3;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_nestedType_codec
-        = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.Reflection.DescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> nestedType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> NestedType {
-      get { return nestedType_; }
-    }
-
-    /// <summary>Field number for the "enum_type" field.</summary>
-    public const int EnumTypeFieldNumber = 4;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec
-        = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType {
-      get { return enumType_; }
-    }
-
-    /// <summary>Field number for the "extension_range" field.</summary>
-    public const int ExtensionRangeFieldNumber = 5;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> _repeated_extensionRange_codec
-        = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> extensionRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> ExtensionRange {
-      get { return extensionRange_; }
-    }
-
-    /// <summary>Field number for the "oneof_decl" field.</summary>
-    public const int OneofDeclFieldNumber = 8;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.OneofDescriptorProto> _repeated_oneofDecl_codec
-        = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> oneofDecl_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> OneofDecl {
-      get { return oneofDecl_; }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 7;
-    private global::Google.Protobuf.Reflection.MessageOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.MessageOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "reserved_range" field.</summary>
-    public const int ReservedRangeFieldNumber = 9;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> _repeated_reservedRange_codec
-        = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> reservedRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> ReservedRange {
-      get { return reservedRange_; }
-    }
-
-    /// <summary>Field number for the "reserved_name" field.</summary>
-    public const int ReservedNameFieldNumber = 10;
-    private static readonly pb::FieldCodec<string> _repeated_reservedName_codec
-        = pb::FieldCodec.ForString(82);
-    private readonly pbc::RepeatedField<string> reservedName_ = new pbc::RepeatedField<string>();
-    /// <summary>
-    ///  Reserved field names, which may not be used by fields in the same message.
-    ///  A given name may only be reserved once.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<string> ReservedName {
-      get { return reservedName_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as DescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(DescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if(!field_.Equals(other.field_)) return false;
-      if(!extension_.Equals(other.extension_)) return false;
-      if(!nestedType_.Equals(other.nestedType_)) return false;
-      if(!enumType_.Equals(other.enumType_)) return false;
-      if(!extensionRange_.Equals(other.extensionRange_)) return false;
-      if(!oneofDecl_.Equals(other.oneofDecl_)) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      if(!reservedRange_.Equals(other.reservedRange_)) return false;
-      if(!reservedName_.Equals(other.reservedName_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      hash ^= field_.GetHashCode();
-      hash ^= extension_.GetHashCode();
-      hash ^= nestedType_.GetHashCode();
-      hash ^= enumType_.GetHashCode();
-      hash ^= extensionRange_.GetHashCode();
-      hash ^= oneofDecl_.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      hash ^= reservedRange_.GetHashCode();
-      hash ^= reservedName_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      field_.WriteTo(output, _repeated_field_codec);
-      nestedType_.WriteTo(output, _repeated_nestedType_codec);
-      enumType_.WriteTo(output, _repeated_enumType_codec);
-      extensionRange_.WriteTo(output, _repeated_extensionRange_codec);
-      extension_.WriteTo(output, _repeated_extension_codec);
-      if (options_ != null) {
-        output.WriteRawTag(58);
-        output.WriteMessage(Options);
-      }
-      oneofDecl_.WriteTo(output, _repeated_oneofDecl_codec);
-      reservedRange_.WriteTo(output, _repeated_reservedRange_codec);
-      reservedName_.WriteTo(output, _repeated_reservedName_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      size += field_.CalculateSize(_repeated_field_codec);
-      size += extension_.CalculateSize(_repeated_extension_codec);
-      size += nestedType_.CalculateSize(_repeated_nestedType_codec);
-      size += enumType_.CalculateSize(_repeated_enumType_codec);
-      size += extensionRange_.CalculateSize(_repeated_extensionRange_codec);
-      size += oneofDecl_.CalculateSize(_repeated_oneofDecl_codec);
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      size += reservedRange_.CalculateSize(_repeated_reservedRange_codec);
-      size += reservedName_.CalculateSize(_repeated_reservedName_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(DescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      field_.Add(other.field_);
-      extension_.Add(other.extension_);
-      nestedType_.Add(other.nestedType_);
-      enumType_.Add(other.enumType_);
-      extensionRange_.Add(other.extensionRange_);
-      oneofDecl_.Add(other.oneofDecl_);
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.MessageOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-      reservedRange_.Add(other.reservedRange_);
-      reservedName_.Add(other.reservedName_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            field_.AddEntriesFrom(input, _repeated_field_codec);
-            break;
-          }
-          case 26: {
-            nestedType_.AddEntriesFrom(input, _repeated_nestedType_codec);
-            break;
-          }
-          case 34: {
-            enumType_.AddEntriesFrom(input, _repeated_enumType_codec);
-            break;
-          }
-          case 42: {
-            extensionRange_.AddEntriesFrom(input, _repeated_extensionRange_codec);
-            break;
-          }
-          case 50: {
-            extension_.AddEntriesFrom(input, _repeated_extension_codec);
-            break;
-          }
-          case 58: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.MessageOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-          case 66: {
-            oneofDecl_.AddEntriesFrom(input, _repeated_oneofDecl_codec);
-            break;
-          }
-          case 74: {
-            reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec);
-            break;
-          }
-          case 82: {
-            reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the DescriptorProto message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      internal sealed partial class ExtensionRange : pb::IMessage<ExtensionRange> {
-        private static readonly pb::MessageParser<ExtensionRange> _parser = new pb::MessageParser<ExtensionRange>(() => new ExtensionRange());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<ExtensionRange> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public ExtensionRange() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public ExtensionRange(ExtensionRange other) : this() {
-          start_ = other.start_;
-          end_ = other.end_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public ExtensionRange Clone() {
-          return new ExtensionRange(this);
-        }
-
-        /// <summary>Field number for the "start" field.</summary>
-        public const int StartFieldNumber = 1;
-        private int start_;
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int Start {
-          get { return start_; }
-          set {
-            start_ = value;
-          }
-        }
-
-        /// <summary>Field number for the "end" field.</summary>
-        public const int EndFieldNumber = 2;
-        private int end_;
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int End {
-          get { return end_; }
-          set {
-            end_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as ExtensionRange);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(ExtensionRange other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if (Start != other.Start) return false;
-          if (End != other.End) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          if (Start != 0) hash ^= Start.GetHashCode();
-          if (End != 0) hash ^= End.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          if (Start != 0) {
-            output.WriteRawTag(8);
-            output.WriteInt32(Start);
-          }
-          if (End != 0) {
-            output.WriteRawTag(16);
-            output.WriteInt32(End);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          if (Start != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start);
-          }
-          if (End != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(ExtensionRange other) {
-          if (other == null) {
-            return;
-          }
-          if (other.Start != 0) {
-            Start = other.Start;
-          }
-          if (other.End != 0) {
-            End = other.End;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 8: {
-                Start = input.ReadInt32();
-                break;
-              }
-              case 16: {
-                End = input.ReadInt32();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-      /// <summary>
-      ///  Range of reserved tag numbers. Reserved tag numbers may not be used by
-      ///  fields or extension ranges in the same message. Reserved ranges may
-      ///  not overlap.
-      /// </summary>
-      internal sealed partial class ReservedRange : pb::IMessage<ReservedRange> {
-        private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<ReservedRange> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[1]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public ReservedRange() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public ReservedRange(ReservedRange other) : this() {
-          start_ = other.start_;
-          end_ = other.end_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public ReservedRange Clone() {
-          return new ReservedRange(this);
-        }
-
-        /// <summary>Field number for the "start" field.</summary>
-        public const int StartFieldNumber = 1;
-        private int start_;
-        /// <summary>
-        ///  Inclusive.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int Start {
-          get { return start_; }
-          set {
-            start_ = value;
-          }
-        }
-
-        /// <summary>Field number for the "end" field.</summary>
-        public const int EndFieldNumber = 2;
-        private int end_;
-        /// <summary>
-        ///  Exclusive.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int End {
-          get { return end_; }
-          set {
-            end_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as ReservedRange);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(ReservedRange other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if (Start != other.Start) return false;
-          if (End != other.End) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          if (Start != 0) hash ^= Start.GetHashCode();
-          if (End != 0) hash ^= End.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          if (Start != 0) {
-            output.WriteRawTag(8);
-            output.WriteInt32(Start);
-          }
-          if (End != 0) {
-            output.WriteRawTag(16);
-            output.WriteInt32(End);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          if (Start != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start);
-          }
-          if (End != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(ReservedRange other) {
-          if (other == null) {
-            return;
-          }
-          if (other.Start != 0) {
-            Start = other.Start;
-          }
-          if (other.End != 0) {
-            End = other.End;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 8: {
-                Start = input.ReadInt32();
-                break;
-              }
-              case 16: {
-                End = input.ReadInt32();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  Describes a field within a message.
-  /// </summary>
-  internal sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto> {
-    private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FieldDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[3]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FieldDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FieldDescriptorProto(FieldDescriptorProto other) : this() {
-      name_ = other.name_;
-      number_ = other.number_;
-      label_ = other.label_;
-      type_ = other.type_;
-      typeName_ = other.typeName_;
-      extendee_ = other.extendee_;
-      defaultValue_ = other.defaultValue_;
-      oneofIndex_ = other.oneofIndex_;
-      jsonName_ = other.jsonName_;
-      Options = other.options_ != null ? other.Options.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FieldDescriptorProto Clone() {
-      return new FieldDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "number" field.</summary>
-    public const int NumberFieldNumber = 3;
-    private int number_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Number {
-      get { return number_; }
-      set {
-        number_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "label" field.</summary>
-    public const int LabelFieldNumber = 4;
-    private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label {
-      get { return label_; }
-      set {
-        label_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "type" field.</summary>
-    public const int TypeFieldNumber = 5;
-    private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = 0;
-    /// <summary>
-    ///  If type_name is set, this need not be set.  If both this and type_name
-    ///  are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type {
-      get { return type_; }
-      set {
-        type_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "type_name" field.</summary>
-    public const int TypeNameFieldNumber = 6;
-    private string typeName_ = "";
-    /// <summary>
-    ///  For message and enum types, this is the name of the type.  If the name
-    ///  starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
-    ///  rules are used to find the type (i.e. first the nested types within this
-    ///  message are searched, then within the parent, on up to the root
-    ///  namespace).
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string TypeName {
-      get { return typeName_; }
-      set {
-        typeName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "extendee" field.</summary>
-    public const int ExtendeeFieldNumber = 2;
-    private string extendee_ = "";
-    /// <summary>
-    ///  For extensions, this is the name of the type being extended.  It is
-    ///  resolved in the same manner as type_name.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Extendee {
-      get { return extendee_; }
-      set {
-        extendee_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "default_value" field.</summary>
-    public const int DefaultValueFieldNumber = 7;
-    private string defaultValue_ = "";
-    /// <summary>
-    ///  For numeric types, contains the original text representation of the value.
-    ///  For booleans, "true" or "false".
-    ///  For strings, contains the default text contents (not escaped in any way).
-    ///  For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
-    ///  TODO(kenton):  Base-64 encode?
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string DefaultValue {
-      get { return defaultValue_; }
-      set {
-        defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "oneof_index" field.</summary>
-    public const int OneofIndexFieldNumber = 9;
-    private int oneofIndex_;
-    /// <summary>
-    ///  If set, gives the index of a oneof in the containing type's oneof_decl
-    ///  list.  This field is a member of that oneof.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int OneofIndex {
-      get { return oneofIndex_; }
-      set {
-        oneofIndex_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "json_name" field.</summary>
-    public const int JsonNameFieldNumber = 10;
-    private string jsonName_ = "";
-    /// <summary>
-    ///  JSON name of this field. The value is set by protocol compiler. If the
-    ///  user has set a "json_name" option on this field, that option's value
-    ///  will be used. Otherwise, it's deduced from the field's name by converting
-    ///  it to camelCase.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string JsonName {
-      get { return jsonName_; }
-      set {
-        jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 8;
-    private global::Google.Protobuf.Reflection.FieldOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FieldOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FieldDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FieldDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (Number != other.Number) return false;
-      if (Label != other.Label) return false;
-      if (Type != other.Type) return false;
-      if (TypeName != other.TypeName) return false;
-      if (Extendee != other.Extendee) return false;
-      if (DefaultValue != other.DefaultValue) return false;
-      if (OneofIndex != other.OneofIndex) return false;
-      if (JsonName != other.JsonName) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (Number != 0) hash ^= Number.GetHashCode();
-      if (Label != 0) hash ^= Label.GetHashCode();
-      if (Type != 0) hash ^= Type.GetHashCode();
-      if (TypeName.Length != 0) hash ^= TypeName.GetHashCode();
-      if (Extendee.Length != 0) hash ^= Extendee.GetHashCode();
-      if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode();
-      if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode();
-      if (JsonName.Length != 0) hash ^= JsonName.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (Extendee.Length != 0) {
-        output.WriteRawTag(18);
-        output.WriteString(Extendee);
-      }
-      if (Number != 0) {
-        output.WriteRawTag(24);
-        output.WriteInt32(Number);
-      }
-      if (Label != 0) {
-        output.WriteRawTag(32);
-        output.WriteEnum((int) Label);
-      }
-      if (Type != 0) {
-        output.WriteRawTag(40);
-        output.WriteEnum((int) Type);
-      }
-      if (TypeName.Length != 0) {
-        output.WriteRawTag(50);
-        output.WriteString(TypeName);
-      }
-      if (DefaultValue.Length != 0) {
-        output.WriteRawTag(58);
-        output.WriteString(DefaultValue);
-      }
-      if (options_ != null) {
-        output.WriteRawTag(66);
-        output.WriteMessage(Options);
-      }
-      if (OneofIndex != 0) {
-        output.WriteRawTag(72);
-        output.WriteInt32(OneofIndex);
-      }
-      if (JsonName.Length != 0) {
-        output.WriteRawTag(82);
-        output.WriteString(JsonName);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (Number != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number);
-      }
-      if (Label != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Label);
-      }
-      if (Type != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
-      }
-      if (TypeName.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeName);
-      }
-      if (Extendee.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Extendee);
-      }
-      if (DefaultValue.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue);
-      }
-      if (OneofIndex != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex);
-      }
-      if (JsonName.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName);
-      }
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FieldDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.Number != 0) {
-        Number = other.Number;
-      }
-      if (other.Label != 0) {
-        Label = other.Label;
-      }
-      if (other.Type != 0) {
-        Type = other.Type;
-      }
-      if (other.TypeName.Length != 0) {
-        TypeName = other.TypeName;
-      }
-      if (other.Extendee.Length != 0) {
-        Extendee = other.Extendee;
-      }
-      if (other.DefaultValue.Length != 0) {
-        DefaultValue = other.DefaultValue;
-      }
-      if (other.OneofIndex != 0) {
-        OneofIndex = other.OneofIndex;
-      }
-      if (other.JsonName.Length != 0) {
-        JsonName = other.JsonName;
-      }
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.FieldOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            Extendee = input.ReadString();
-            break;
-          }
-          case 24: {
-            Number = input.ReadInt32();
-            break;
-          }
-          case 32: {
-            label_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum();
-            break;
-          }
-          case 40: {
-            type_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum();
-            break;
-          }
-          case 50: {
-            TypeName = input.ReadString();
-            break;
-          }
-          case 58: {
-            DefaultValue = input.ReadString();
-            break;
-          }
-          case 66: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.FieldOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-          case 72: {
-            OneofIndex = input.ReadInt32();
-            break;
-          }
-          case 82: {
-            JsonName = input.ReadString();
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the FieldDescriptorProto message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      internal enum Type {
-        /// <summary>
-        ///  0 is reserved for errors.
-        ///  Order is weird for historical reasons.
-        /// </summary>
-        [pbr::OriginalName("TYPE_DOUBLE")] Double = 1,
-        [pbr::OriginalName("TYPE_FLOAT")] Float = 2,
-        /// <summary>
-        ///  Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
-        ///  negative values are likely.
-        /// </summary>
-        [pbr::OriginalName("TYPE_INT64")] Int64 = 3,
-        [pbr::OriginalName("TYPE_UINT64")] Uint64 = 4,
-        /// <summary>
-        ///  Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
-        ///  negative values are likely.
-        /// </summary>
-        [pbr::OriginalName("TYPE_INT32")] Int32 = 5,
-        [pbr::OriginalName("TYPE_FIXED64")] Fixed64 = 6,
-        [pbr::OriginalName("TYPE_FIXED32")] Fixed32 = 7,
-        [pbr::OriginalName("TYPE_BOOL")] Bool = 8,
-        [pbr::OriginalName("TYPE_STRING")] String = 9,
-        /// <summary>
-        ///  Tag-delimited aggregate.
-        /// </summary>
-        [pbr::OriginalName("TYPE_GROUP")] Group = 10,
-        /// <summary>
-        ///  Length-delimited aggregate.
-        /// </summary>
-        [pbr::OriginalName("TYPE_MESSAGE")] Message = 11,
-        /// <summary>
-        ///  New in version 2.
-        /// </summary>
-        [pbr::OriginalName("TYPE_BYTES")] Bytes = 12,
-        [pbr::OriginalName("TYPE_UINT32")] Uint32 = 13,
-        [pbr::OriginalName("TYPE_ENUM")] Enum = 14,
-        [pbr::OriginalName("TYPE_SFIXED32")] Sfixed32 = 15,
-        [pbr::OriginalName("TYPE_SFIXED64")] Sfixed64 = 16,
-        /// <summary>
-        ///  Uses ZigZag encoding.
-        /// </summary>
-        [pbr::OriginalName("TYPE_SINT32")] Sint32 = 17,
-        /// <summary>
-        ///  Uses ZigZag encoding.
-        /// </summary>
-        [pbr::OriginalName("TYPE_SINT64")] Sint64 = 18,
-      }
-
-      internal enum Label {
-        /// <summary>
-        ///  0 is reserved for errors
-        /// </summary>
-        [pbr::OriginalName("LABEL_OPTIONAL")] Optional = 1,
-        [pbr::OriginalName("LABEL_REQUIRED")] Required = 2,
-        /// <summary>
-        ///  TODO(sanjay): Should we add LABEL_MAP?
-        /// </summary>
-        [pbr::OriginalName("LABEL_REPEATED")] Repeated = 3,
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  Describes a oneof.
-  /// </summary>
-  internal sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto> {
-    private static readonly pb::MessageParser<OneofDescriptorProto> _parser = new pb::MessageParser<OneofDescriptorProto>(() => new OneofDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<OneofDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[4]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofDescriptorProto(OneofDescriptorProto other) : this() {
-      name_ = other.name_;
-      Options = other.options_ != null ? other.Options.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofDescriptorProto Clone() {
-      return new OneofDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 2;
-    private global::Google.Protobuf.Reflection.OneofOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.OneofOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as OneofDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(OneofDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (options_ != null) {
-        output.WriteRawTag(18);
-        output.WriteMessage(Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(OneofDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.OneofOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.OneofOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Describes an enum type.
-  /// </summary>
-  internal sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto> {
-    private static readonly pb::MessageParser<EnumDescriptorProto> _parser = new pb::MessageParser<EnumDescriptorProto>(() => new EnumDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<EnumDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[5]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumDescriptorProto(EnumDescriptorProto other) : this() {
-      name_ = other.name_;
-      value_ = other.value_.Clone();
-      Options = other.options_ != null ? other.Options.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumDescriptorProto Clone() {
-      return new EnumDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "value" field.</summary>
-    public const int ValueFieldNumber = 2;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> _repeated_value_codec
-        = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> value_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> Value {
-      get { return value_; }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 3;
-    private global::Google.Protobuf.Reflection.EnumOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.EnumOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as EnumDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(EnumDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if(!value_.Equals(other.value_)) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      hash ^= value_.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      value_.WriteTo(output, _repeated_value_codec);
-      if (options_ != null) {
-        output.WriteRawTag(26);
-        output.WriteMessage(Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      size += value_.CalculateSize(_repeated_value_codec);
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(EnumDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      value_.Add(other.value_);
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.EnumOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            value_.AddEntriesFrom(input, _repeated_value_codec);
-            break;
-          }
-          case 26: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.EnumOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Describes a value within an enum.
-  /// </summary>
-  internal sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto> {
-    private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<EnumValueDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[6]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumValueDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() {
-      name_ = other.name_;
-      number_ = other.number_;
-      Options = other.options_ != null ? other.Options.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumValueDescriptorProto Clone() {
-      return new EnumValueDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "number" field.</summary>
-    public const int NumberFieldNumber = 2;
-    private int number_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int Number {
-      get { return number_; }
-      set {
-        number_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 3;
-    private global::Google.Protobuf.Reflection.EnumValueOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.EnumValueOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as EnumValueDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(EnumValueDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (Number != other.Number) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (Number != 0) hash ^= Number.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (Number != 0) {
-        output.WriteRawTag(16);
-        output.WriteInt32(Number);
-      }
-      if (options_ != null) {
-        output.WriteRawTag(26);
-        output.WriteMessage(Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (Number != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number);
-      }
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(EnumValueDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.Number != 0) {
-        Number = other.Number;
-      }
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.EnumValueOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 16: {
-            Number = input.ReadInt32();
-            break;
-          }
-          case 26: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.EnumValueOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Describes a service.
-  /// </summary>
-  internal sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto> {
-    private static readonly pb::MessageParser<ServiceDescriptorProto> _parser = new pb::MessageParser<ServiceDescriptorProto>(() => new ServiceDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<ServiceDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[7]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ServiceDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ServiceDescriptorProto(ServiceDescriptorProto other) : this() {
-      name_ = other.name_;
-      method_ = other.method_.Clone();
-      Options = other.options_ != null ? other.Options.Clone() : null;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ServiceDescriptorProto Clone() {
-      return new ServiceDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "method" field.</summary>
-    public const int MethodFieldNumber = 2;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.MethodDescriptorProto> _repeated_method_codec
-        = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> method_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> Method {
-      get { return method_; }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 3;
-    private global::Google.Protobuf.Reflection.ServiceOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.ServiceOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as ServiceDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(ServiceDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if(!method_.Equals(other.method_)) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      hash ^= method_.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      method_.WriteTo(output, _repeated_method_codec);
-      if (options_ != null) {
-        output.WriteRawTag(26);
-        output.WriteMessage(Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      size += method_.CalculateSize(_repeated_method_codec);
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(ServiceDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      method_.Add(other.method_);
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.ServiceOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            method_.AddEntriesFrom(input, _repeated_method_codec);
-            break;
-          }
-          case 26: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.ServiceOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  Describes a method of a service.
-  /// </summary>
-  internal sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto> {
-    private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MethodDescriptorProto> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[8]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MethodDescriptorProto() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MethodDescriptorProto(MethodDescriptorProto other) : this() {
-      name_ = other.name_;
-      inputType_ = other.inputType_;
-      outputType_ = other.outputType_;
-      Options = other.options_ != null ? other.Options.Clone() : null;
-      clientStreaming_ = other.clientStreaming_;
-      serverStreaming_ = other.serverStreaming_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MethodDescriptorProto Clone() {
-      return new MethodDescriptorProto(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 1;
-    private string name_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string Name {
-      get { return name_; }
-      set {
-        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "input_type" field.</summary>
-    public const int InputTypeFieldNumber = 2;
-    private string inputType_ = "";
-    /// <summary>
-    ///  Input and output type names.  These are resolved in the same way as
-    ///  FieldDescriptorProto.type_name, but must refer to a message type.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string InputType {
-      get { return inputType_; }
-      set {
-        inputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "output_type" field.</summary>
-    public const int OutputTypeFieldNumber = 3;
-    private string outputType_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string OutputType {
-      get { return outputType_; }
-      set {
-        outputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "options" field.</summary>
-    public const int OptionsFieldNumber = 4;
-    private global::Google.Protobuf.Reflection.MethodOptions options_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.MethodOptions Options {
-      get { return options_; }
-      set {
-        options_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "client_streaming" field.</summary>
-    public const int ClientStreamingFieldNumber = 5;
-    private bool clientStreaming_;
-    /// <summary>
-    ///  Identifies if client streams multiple client messages
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool ClientStreaming {
-      get { return clientStreaming_; }
-      set {
-        clientStreaming_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "server_streaming" field.</summary>
-    public const int ServerStreamingFieldNumber = 6;
-    private bool serverStreaming_;
-    /// <summary>
-    ///  Identifies if server streams multiple server messages
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool ServerStreaming {
-      get { return serverStreaming_; }
-      set {
-        serverStreaming_ = value;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MethodDescriptorProto);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MethodDescriptorProto other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Name != other.Name) return false;
-      if (InputType != other.InputType) return false;
-      if (OutputType != other.OutputType) return false;
-      if (!object.Equals(Options, other.Options)) return false;
-      if (ClientStreaming != other.ClientStreaming) return false;
-      if (ServerStreaming != other.ServerStreaming) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Name.Length != 0) hash ^= Name.GetHashCode();
-      if (InputType.Length != 0) hash ^= InputType.GetHashCode();
-      if (OutputType.Length != 0) hash ^= OutputType.GetHashCode();
-      if (options_ != null) hash ^= Options.GetHashCode();
-      if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode();
-      if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Name.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(Name);
-      }
-      if (InputType.Length != 0) {
-        output.WriteRawTag(18);
-        output.WriteString(InputType);
-      }
-      if (OutputType.Length != 0) {
-        output.WriteRawTag(26);
-        output.WriteString(OutputType);
-      }
-      if (options_ != null) {
-        output.WriteRawTag(34);
-        output.WriteMessage(Options);
-      }
-      if (ClientStreaming != false) {
-        output.WriteRawTag(40);
-        output.WriteBool(ClientStreaming);
-      }
-      if (ServerStreaming != false) {
-        output.WriteRawTag(48);
-        output.WriteBool(ServerStreaming);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Name.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
-      }
-      if (InputType.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(InputType);
-      }
-      if (OutputType.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(OutputType);
-      }
-      if (options_ != null) {
-        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
-      }
-      if (ClientStreaming != false) {
-        size += 1 + 1;
-      }
-      if (ServerStreaming != false) {
-        size += 1 + 1;
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MethodDescriptorProto other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Name.Length != 0) {
-        Name = other.Name;
-      }
-      if (other.InputType.Length != 0) {
-        InputType = other.InputType;
-      }
-      if (other.OutputType.Length != 0) {
-        OutputType = other.OutputType;
-      }
-      if (other.options_ != null) {
-        if (options_ == null) {
-          options_ = new global::Google.Protobuf.Reflection.MethodOptions();
-        }
-        Options.MergeFrom(other.Options);
-      }
-      if (other.ClientStreaming != false) {
-        ClientStreaming = other.ClientStreaming;
-      }
-      if (other.ServerStreaming != false) {
-        ServerStreaming = other.ServerStreaming;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            Name = input.ReadString();
-            break;
-          }
-          case 18: {
-            InputType = input.ReadString();
-            break;
-          }
-          case 26: {
-            OutputType = input.ReadString();
-            break;
-          }
-          case 34: {
-            if (options_ == null) {
-              options_ = new global::Google.Protobuf.Reflection.MethodOptions();
-            }
-            input.ReadMessage(options_);
-            break;
-          }
-          case 40: {
-            ClientStreaming = input.ReadBool();
-            break;
-          }
-          case 48: {
-            ServerStreaming = input.ReadBool();
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  internal sealed partial class FileOptions : pb::IMessage<FileOptions> {
-    private static readonly pb::MessageParser<FileOptions> _parser = new pb::MessageParser<FileOptions>(() => new FileOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FileOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[9]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileOptions(FileOptions other) : this() {
-      javaPackage_ = other.javaPackage_;
-      javaOuterClassname_ = other.javaOuterClassname_;
-      javaMultipleFiles_ = other.javaMultipleFiles_;
-      javaGenerateEqualsAndHash_ = other.javaGenerateEqualsAndHash_;
-      javaStringCheckUtf8_ = other.javaStringCheckUtf8_;
-      optimizeFor_ = other.optimizeFor_;
-      goPackage_ = other.goPackage_;
-      ccGenericServices_ = other.ccGenericServices_;
-      javaGenericServices_ = other.javaGenericServices_;
-      pyGenericServices_ = other.pyGenericServices_;
-      deprecated_ = other.deprecated_;
-      ccEnableArenas_ = other.ccEnableArenas_;
-      objcClassPrefix_ = other.objcClassPrefix_;
-      csharpNamespace_ = other.csharpNamespace_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FileOptions Clone() {
-      return new FileOptions(this);
-    }
-
-    /// <summary>Field number for the "java_package" field.</summary>
-    public const int JavaPackageFieldNumber = 1;
-    private string javaPackage_ = "";
-    /// <summary>
-    ///  Sets the Java package where classes generated from this .proto will be
-    ///  placed.  By default, the proto package is used, but this is often
-    ///  inappropriate because proto packages do not normally start with backwards
-    ///  domain names.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string JavaPackage {
-      get { return javaPackage_; }
-      set {
-        javaPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "java_outer_classname" field.</summary>
-    public const int JavaOuterClassnameFieldNumber = 8;
-    private string javaOuterClassname_ = "";
-    /// <summary>
-    ///  If set, all the classes from the .proto file are wrapped in a single
-    ///  outer class with the given name.  This applies to both Proto1
-    ///  (equivalent to the old "--one_java_file" option) and Proto2 (where
-    ///  a .proto always translates to a single class, but you may want to
-    ///  explicitly choose the class name).
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string JavaOuterClassname {
-      get { return javaOuterClassname_; }
-      set {
-        javaOuterClassname_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "java_multiple_files" field.</summary>
-    public const int JavaMultipleFilesFieldNumber = 10;
-    private bool javaMultipleFiles_;
-    /// <summary>
-    ///  If set true, then the Java code generator will generate a separate .java
-    ///  file for each top-level message, enum, and service defined in the .proto
-    ///  file.  Thus, these types will *not* be nested inside the outer class
-    ///  named by java_outer_classname.  However, the outer class will still be
-    ///  generated to contain the file's getDescriptor() method as well as any
-    ///  top-level extensions defined in the file.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool JavaMultipleFiles {
-      get { return javaMultipleFiles_; }
-      set {
-        javaMultipleFiles_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "java_generate_equals_and_hash" field.</summary>
-    public const int JavaGenerateEqualsAndHashFieldNumber = 20;
-    private bool javaGenerateEqualsAndHash_;
-    /// <summary>
-    ///  If set true, then the Java code generator will generate equals() and
-    ///  hashCode() methods for all messages defined in the .proto file.
-    ///  This increases generated code size, potentially substantially for large
-    ///  protos, which may harm a memory-constrained application.
-    ///  - In the full runtime this is a speed optimization, as the
-    ///  AbstractMessage base class includes reflection-based implementations of
-    ///  these methods.
-    ///  - In the lite runtime, setting this option changes the semantics of
-    ///  equals() and hashCode() to more closely match those of the full runtime;
-    ///  the generated methods compute their results based on field values rather
-    ///  than object identity. (Implementations should not assume that hashcodes
-    ///  will be consistent across runtimes or versions of the protocol compiler.)
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool JavaGenerateEqualsAndHash {
-      get { return javaGenerateEqualsAndHash_; }
-      set {
-        javaGenerateEqualsAndHash_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "java_string_check_utf8" field.</summary>
-    public const int JavaStringCheckUtf8FieldNumber = 27;
-    private bool javaStringCheckUtf8_;
-    /// <summary>
-    ///  If set true, then the Java2 code generator will generate code that
-    ///  throws an exception whenever an attempt is made to assign a non-UTF-8
-    ///  byte sequence to a string field.
-    ///  Message reflection will do the same.
-    ///  However, an extension field still accepts non-UTF-8 byte sequences.
-    ///  This option has no effect on when used with the lite runtime.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool JavaStringCheckUtf8 {
-      get { return javaStringCheckUtf8_; }
-      set {
-        javaStringCheckUtf8_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "optimize_for" field.</summary>
-    public const int OptimizeForFieldNumber = 9;
-    private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = 0;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor {
-      get { return optimizeFor_; }
-      set {
-        optimizeFor_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "go_package" field.</summary>
-    public const int GoPackageFieldNumber = 11;
-    private string goPackage_ = "";
-    /// <summary>
-    ///  Sets the Go package where structs generated from this .proto will be
-    ///  placed. If omitted, the Go package will be derived from the following:
-    ///    - The basename of the package import path, if provided.
-    ///    - Otherwise, the package statement in the .proto file, if present.
-    ///    - Otherwise, the basename of the .proto file, without extension.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string GoPackage {
-      get { return goPackage_; }
-      set {
-        goPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "cc_generic_services" field.</summary>
-    public const int CcGenericServicesFieldNumber = 16;
-    private bool ccGenericServices_;
-    /// <summary>
-    ///  Should generic services be generated in each language?  "Generic" services
-    ///  are not specific to any particular RPC system.  They are generated by the
-    ///  main code generators in each language (without additional plugins).
-    ///  Generic services were the only kind of service generation supported by
-    ///  early versions of google.protobuf.
-    ///
-    ///  Generic services are now considered deprecated in favor of using plugins
-    ///  that generate code specific to your particular RPC system.  Therefore,
-    ///  these default to false.  Old code which depends on generic services should
-    ///  explicitly set them to true.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool CcGenericServices {
-      get { return ccGenericServices_; }
-      set {
-        ccGenericServices_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "java_generic_services" field.</summary>
-    public const int JavaGenericServicesFieldNumber = 17;
-    private bool javaGenericServices_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool JavaGenericServices {
-      get { return javaGenericServices_; }
-      set {
-        javaGenericServices_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "py_generic_services" field.</summary>
-    public const int PyGenericServicesFieldNumber = 18;
-    private bool pyGenericServices_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool PyGenericServices {
-      get { return pyGenericServices_; }
-      set {
-        pyGenericServices_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 23;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this file deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for everything in the file, or it will be completely ignored; in the very
-    ///  least, this is a formalization for deprecating files.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "cc_enable_arenas" field.</summary>
-    public const int CcEnableArenasFieldNumber = 31;
-    private bool ccEnableArenas_;
-    /// <summary>
-    ///  Enables the use of arenas for the proto messages in this file. This applies
-    ///  only to generated classes for C++.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool CcEnableArenas {
-      get { return ccEnableArenas_; }
-      set {
-        ccEnableArenas_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "objc_class_prefix" field.</summary>
-    public const int ObjcClassPrefixFieldNumber = 36;
-    private string objcClassPrefix_ = "";
-    /// <summary>
-    ///  Sets the objective c class prefix which is prepended to all objective c
-    ///  generated classes from this .proto. There is no default.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string ObjcClassPrefix {
-      get { return objcClassPrefix_; }
-      set {
-        objcClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "csharp_namespace" field.</summary>
-    public const int CsharpNamespaceFieldNumber = 37;
-    private string csharpNamespace_ = "";
-    /// <summary>
-    ///  Namespace for generated classes; defaults to the package.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string CsharpNamespace {
-      get { return csharpNamespace_; }
-      set {
-        csharpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FileOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FileOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (JavaPackage != other.JavaPackage) return false;
-      if (JavaOuterClassname != other.JavaOuterClassname) return false;
-      if (JavaMultipleFiles != other.JavaMultipleFiles) return false;
-      if (JavaGenerateEqualsAndHash != other.JavaGenerateEqualsAndHash) return false;
-      if (JavaStringCheckUtf8 != other.JavaStringCheckUtf8) return false;
-      if (OptimizeFor != other.OptimizeFor) return false;
-      if (GoPackage != other.GoPackage) return false;
-      if (CcGenericServices != other.CcGenericServices) return false;
-      if (JavaGenericServices != other.JavaGenericServices) return false;
-      if (PyGenericServices != other.PyGenericServices) return false;
-      if (Deprecated != other.Deprecated) return false;
-      if (CcEnableArenas != other.CcEnableArenas) return false;
-      if (ObjcClassPrefix != other.ObjcClassPrefix) return false;
-      if (CsharpNamespace != other.CsharpNamespace) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (JavaPackage.Length != 0) hash ^= JavaPackage.GetHashCode();
-      if (JavaOuterClassname.Length != 0) hash ^= JavaOuterClassname.GetHashCode();
-      if (JavaMultipleFiles != false) hash ^= JavaMultipleFiles.GetHashCode();
-      if (JavaGenerateEqualsAndHash != false) hash ^= JavaGenerateEqualsAndHash.GetHashCode();
-      if (JavaStringCheckUtf8 != false) hash ^= JavaStringCheckUtf8.GetHashCode();
-      if (OptimizeFor != 0) hash ^= OptimizeFor.GetHashCode();
-      if (GoPackage.Length != 0) hash ^= GoPackage.GetHashCode();
-      if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode();
-      if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode();
-      if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode();
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode();
-      if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode();
-      if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (JavaPackage.Length != 0) {
-        output.WriteRawTag(10);
-        output.WriteString(JavaPackage);
-      }
-      if (JavaOuterClassname.Length != 0) {
-        output.WriteRawTag(66);
-        output.WriteString(JavaOuterClassname);
-      }
-      if (OptimizeFor != 0) {
-        output.WriteRawTag(72);
-        output.WriteEnum((int) OptimizeFor);
-      }
-      if (JavaMultipleFiles != false) {
-        output.WriteRawTag(80);
-        output.WriteBool(JavaMultipleFiles);
-      }
-      if (GoPackage.Length != 0) {
-        output.WriteRawTag(90);
-        output.WriteString(GoPackage);
-      }
-      if (CcGenericServices != false) {
-        output.WriteRawTag(128, 1);
-        output.WriteBool(CcGenericServices);
-      }
-      if (JavaGenericServices != false) {
-        output.WriteRawTag(136, 1);
-        output.WriteBool(JavaGenericServices);
-      }
-      if (PyGenericServices != false) {
-        output.WriteRawTag(144, 1);
-        output.WriteBool(PyGenericServices);
-      }
-      if (JavaGenerateEqualsAndHash != false) {
-        output.WriteRawTag(160, 1);
-        output.WriteBool(JavaGenerateEqualsAndHash);
-      }
-      if (Deprecated != false) {
-        output.WriteRawTag(184, 1);
-        output.WriteBool(Deprecated);
-      }
-      if (JavaStringCheckUtf8 != false) {
-        output.WriteRawTag(216, 1);
-        output.WriteBool(JavaStringCheckUtf8);
-      }
-      if (CcEnableArenas != false) {
-        output.WriteRawTag(248, 1);
-        output.WriteBool(CcEnableArenas);
-      }
-      if (ObjcClassPrefix.Length != 0) {
-        output.WriteRawTag(162, 2);
-        output.WriteString(ObjcClassPrefix);
-      }
-      if (CsharpNamespace.Length != 0) {
-        output.WriteRawTag(170, 2);
-        output.WriteString(CsharpNamespace);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (JavaPackage.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaPackage);
-      }
-      if (JavaOuterClassname.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaOuterClassname);
-      }
-      if (JavaMultipleFiles != false) {
-        size += 1 + 1;
-      }
-      if (JavaGenerateEqualsAndHash != false) {
-        size += 2 + 1;
-      }
-      if (JavaStringCheckUtf8 != false) {
-        size += 2 + 1;
-      }
-      if (OptimizeFor != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) OptimizeFor);
-      }
-      if (GoPackage.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(GoPackage);
-      }
-      if (CcGenericServices != false) {
-        size += 2 + 1;
-      }
-      if (JavaGenericServices != false) {
-        size += 2 + 1;
-      }
-      if (PyGenericServices != false) {
-        size += 2 + 1;
-      }
-      if (Deprecated != false) {
-        size += 2 + 1;
-      }
-      if (CcEnableArenas != false) {
-        size += 2 + 1;
-      }
-      if (ObjcClassPrefix.Length != 0) {
-        size += 2 + pb::CodedOutputStream.ComputeStringSize(ObjcClassPrefix);
-      }
-      if (CsharpNamespace.Length != 0) {
-        size += 2 + pb::CodedOutputStream.ComputeStringSize(CsharpNamespace);
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FileOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.JavaPackage.Length != 0) {
-        JavaPackage = other.JavaPackage;
-      }
-      if (other.JavaOuterClassname.Length != 0) {
-        JavaOuterClassname = other.JavaOuterClassname;
-      }
-      if (other.JavaMultipleFiles != false) {
-        JavaMultipleFiles = other.JavaMultipleFiles;
-      }
-      if (other.JavaGenerateEqualsAndHash != false) {
-        JavaGenerateEqualsAndHash = other.JavaGenerateEqualsAndHash;
-      }
-      if (other.JavaStringCheckUtf8 != false) {
-        JavaStringCheckUtf8 = other.JavaStringCheckUtf8;
-      }
-      if (other.OptimizeFor != 0) {
-        OptimizeFor = other.OptimizeFor;
-      }
-      if (other.GoPackage.Length != 0) {
-        GoPackage = other.GoPackage;
-      }
-      if (other.CcGenericServices != false) {
-        CcGenericServices = other.CcGenericServices;
-      }
-      if (other.JavaGenericServices != false) {
-        JavaGenericServices = other.JavaGenericServices;
-      }
-      if (other.PyGenericServices != false) {
-        PyGenericServices = other.PyGenericServices;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      if (other.CcEnableArenas != false) {
-        CcEnableArenas = other.CcEnableArenas;
-      }
-      if (other.ObjcClassPrefix.Length != 0) {
-        ObjcClassPrefix = other.ObjcClassPrefix;
-      }
-      if (other.CsharpNamespace.Length != 0) {
-        CsharpNamespace = other.CsharpNamespace;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            JavaPackage = input.ReadString();
-            break;
-          }
-          case 66: {
-            JavaOuterClassname = input.ReadString();
-            break;
-          }
-          case 72: {
-            optimizeFor_ = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum();
-            break;
-          }
-          case 80: {
-            JavaMultipleFiles = input.ReadBool();
-            break;
-          }
-          case 90: {
-            GoPackage = input.ReadString();
-            break;
-          }
-          case 128: {
-            CcGenericServices = input.ReadBool();
-            break;
-          }
-          case 136: {
-            JavaGenericServices = input.ReadBool();
-            break;
-          }
-          case 144: {
-            PyGenericServices = input.ReadBool();
-            break;
-          }
-          case 160: {
-            JavaGenerateEqualsAndHash = input.ReadBool();
-            break;
-          }
-          case 184: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 216: {
-            JavaStringCheckUtf8 = input.ReadBool();
-            break;
-          }
-          case 248: {
-            CcEnableArenas = input.ReadBool();
-            break;
-          }
-          case 290: {
-            ObjcClassPrefix = input.ReadString();
-            break;
-          }
-          case 298: {
-            CsharpNamespace = input.ReadString();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the FileOptions message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      /// <summary>
-      ///  Generated classes can be optimized for speed or code size.
-      /// </summary>
-      internal enum OptimizeMode {
-        /// <summary>
-        ///  Generate complete code for parsing, serialization,
-        /// </summary>
-        [pbr::OriginalName("SPEED")] Speed = 1,
-        /// <summary>
-        ///  etc.
-        /// </summary>
-        [pbr::OriginalName("CODE_SIZE")] CodeSize = 2,
-        /// <summary>
-        ///  Generate code using MessageLite and the lite runtime.
-        /// </summary>
-        [pbr::OriginalName("LITE_RUNTIME")] LiteRuntime = 3,
-      }
-
-    }
-    #endregion
-
-  }
-
-  internal sealed partial class MessageOptions : pb::IMessage<MessageOptions> {
-    private static readonly pb::MessageParser<MessageOptions> _parser = new pb::MessageParser<MessageOptions>(() => new MessageOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MessageOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[10]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageOptions(MessageOptions other) : this() {
-      messageSetWireFormat_ = other.messageSetWireFormat_;
-      noStandardDescriptorAccessor_ = other.noStandardDescriptorAccessor_;
-      deprecated_ = other.deprecated_;
-      mapEntry_ = other.mapEntry_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MessageOptions Clone() {
-      return new MessageOptions(this);
-    }
-
-    /// <summary>Field number for the "message_set_wire_format" field.</summary>
-    public const int MessageSetWireFormatFieldNumber = 1;
-    private bool messageSetWireFormat_;
-    /// <summary>
-    ///  Set true to use the old proto1 MessageSet wire format for extensions.
-    ///  This is provided for backwards-compatibility with the MessageSet wire
-    ///  format.  You should not use this for any other reason:  It's less
-    ///  efficient, has fewer features, and is more complicated.
-    ///
-    ///  The message must be defined exactly as follows:
-    ///    message Foo {
-    ///      option message_set_wire_format = true;
-    ///      extensions 4 to max;
-    ///    }
-    ///  Note that the message cannot have any defined fields; MessageSets only
-    ///  have extensions.
-    ///
-    ///  All extensions of your type must be singular messages; e.g. they cannot
-    ///  be int32s, enums, or repeated messages.
-    ///
-    ///  Because this is an option, the above two restrictions are not enforced by
-    ///  the protocol compiler.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool MessageSetWireFormat {
-      get { return messageSetWireFormat_; }
-      set {
-        messageSetWireFormat_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "no_standard_descriptor_accessor" field.</summary>
-    public const int NoStandardDescriptorAccessorFieldNumber = 2;
-    private bool noStandardDescriptorAccessor_;
-    /// <summary>
-    ///  Disables the generation of the standard "descriptor()" accessor, which can
-    ///  conflict with a field of the same name.  This is meant to make migration
-    ///  from proto1 easier; new code should avoid fields named "descriptor".
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool NoStandardDescriptorAccessor {
-      get { return noStandardDescriptorAccessor_; }
-      set {
-        noStandardDescriptorAccessor_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 3;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this message deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for the message, or it will be completely ignored; in the very least,
-    ///  this is a formalization for deprecating messages.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "map_entry" field.</summary>
-    public const int MapEntryFieldNumber = 7;
-    private bool mapEntry_;
-    /// <summary>
-    ///  Whether the message is an automatically generated map entry type for the
-    ///  maps field.
-    ///
-    ///  For maps fields:
-    ///      map&lt;KeyType, ValueType> map_field = 1;
-    ///  The parsed descriptor looks like:
-    ///      message MapFieldEntry {
-    ///          option map_entry = true;
-    ///          optional KeyType key = 1;
-    ///          optional ValueType value = 2;
-    ///      }
-    ///      repeated MapFieldEntry map_field = 1;
-    ///
-    ///  Implementations may choose not to generate the map_entry=true message, but
-    ///  use a native map in the target language to hold the keys and values.
-    ///  The reflection APIs in such implementions still need to work as
-    ///  if the field is a repeated message field.
-    ///
-    ///  NOTE: Do not set the option in .proto files. Always use the maps syntax
-    ///  instead. The option should only be implicitly set by the proto compiler
-    ///  parser.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool MapEntry {
-      get { return mapEntry_; }
-      set {
-        mapEntry_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MessageOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MessageOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (MessageSetWireFormat != other.MessageSetWireFormat) return false;
-      if (NoStandardDescriptorAccessor != other.NoStandardDescriptorAccessor) return false;
-      if (Deprecated != other.Deprecated) return false;
-      if (MapEntry != other.MapEntry) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (MessageSetWireFormat != false) hash ^= MessageSetWireFormat.GetHashCode();
-      if (NoStandardDescriptorAccessor != false) hash ^= NoStandardDescriptorAccessor.GetHashCode();
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      if (MapEntry != false) hash ^= MapEntry.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (MessageSetWireFormat != false) {
-        output.WriteRawTag(8);
-        output.WriteBool(MessageSetWireFormat);
-      }
-      if (NoStandardDescriptorAccessor != false) {
-        output.WriteRawTag(16);
-        output.WriteBool(NoStandardDescriptorAccessor);
-      }
-      if (Deprecated != false) {
-        output.WriteRawTag(24);
-        output.WriteBool(Deprecated);
-      }
-      if (MapEntry != false) {
-        output.WriteRawTag(56);
-        output.WriteBool(MapEntry);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (MessageSetWireFormat != false) {
-        size += 1 + 1;
-      }
-      if (NoStandardDescriptorAccessor != false) {
-        size += 1 + 1;
-      }
-      if (Deprecated != false) {
-        size += 1 + 1;
-      }
-      if (MapEntry != false) {
-        size += 1 + 1;
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MessageOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.MessageSetWireFormat != false) {
-        MessageSetWireFormat = other.MessageSetWireFormat;
-      }
-      if (other.NoStandardDescriptorAccessor != false) {
-        NoStandardDescriptorAccessor = other.NoStandardDescriptorAccessor;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      if (other.MapEntry != false) {
-        MapEntry = other.MapEntry;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            MessageSetWireFormat = input.ReadBool();
-            break;
-          }
-          case 16: {
-            NoStandardDescriptorAccessor = input.ReadBool();
-            break;
-          }
-          case 24: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 56: {
-            MapEntry = input.ReadBool();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  internal sealed partial class FieldOptions : pb::IMessage<FieldOptions> {
-    private static readonly pb::MessageParser<FieldOptions> _parser = new pb::MessageParser<FieldOptions>(() => new FieldOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<FieldOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[11]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FieldOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FieldOptions(FieldOptions other) : this() {
-      ctype_ = other.ctype_;
-      packed_ = other.packed_;
-      jstype_ = other.jstype_;
-      lazy_ = other.lazy_;
-      deprecated_ = other.deprecated_;
-      weak_ = other.weak_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public FieldOptions Clone() {
-      return new FieldOptions(this);
-    }
-
-    /// <summary>Field number for the "ctype" field.</summary>
-    public const int CtypeFieldNumber = 1;
-    private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = 0;
-    /// <summary>
-    ///  The ctype option instructs the C++ code generator to use a different
-    ///  representation of the field than it normally would.  See the specific
-    ///  options below.  This option is not yet implemented in the open source
-    ///  release -- sorry, we'll try to include it in a future version!
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype {
-      get { return ctype_; }
-      set {
-        ctype_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "packed" field.</summary>
-    public const int PackedFieldNumber = 2;
-    private bool packed_;
-    /// <summary>
-    ///  The packed option can be enabled for repeated primitive fields to enable
-    ///  a more efficient representation on the wire. Rather than repeatedly
-    ///  writing the tag and type for each element, the entire array is encoded as
-    ///  a single length-delimited blob. In proto3, only explicit setting it to
-    ///  false will avoid using packed encoding.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Packed {
-      get { return packed_; }
-      set {
-        packed_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "jstype" field.</summary>
-    public const int JstypeFieldNumber = 6;
-    private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = 0;
-    /// <summary>
-    ///  The jstype option determines the JavaScript type used for values of the
-    ///  field.  The option is permitted only for 64 bit integral and fixed types
-    ///  (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
-    ///  represented as JavaScript strings.  This avoids loss of precision that can
-    ///  happen when a large value is converted to a floating point JavaScript
-    ///  numbers.  Specifying JS_NUMBER for the jstype causes the generated
-    ///  JavaScript code to use the JavaScript "number" type instead of strings.
-    ///  This option is an enum to permit additional types to be added,
-    ///  e.g. goog.math.Integer.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype {
-      get { return jstype_; }
-      set {
-        jstype_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "lazy" field.</summary>
-    public const int LazyFieldNumber = 5;
-    private bool lazy_;
-    /// <summary>
-    ///  Should this field be parsed lazily?  Lazy applies only to message-type
-    ///  fields.  It means that when the outer message is initially parsed, the
-    ///  inner message's contents will not be parsed but instead stored in encoded
-    ///  form.  The inner message will actually be parsed when it is first accessed.
-    ///
-    ///  This is only a hint.  Implementations are free to choose whether to use
-    ///  eager or lazy parsing regardless of the value of this option.  However,
-    ///  setting this option true suggests that the protocol author believes that
-    ///  using lazy parsing on this field is worth the additional bookkeeping
-    ///  overhead typically needed to implement it.
-    ///
-    ///  This option does not affect the public interface of any generated code;
-    ///  all method signatures remain the same.  Furthermore, thread-safety of the
-    ///  interface is not affected by this option; const methods remain safe to
-    ///  call from multiple threads concurrently, while non-const methods continue
-    ///  to require exclusive access.
-    ///
-    ///  Note that implementations may choose not to check required fields within
-    ///  a lazy sub-message.  That is, calling IsInitialized() on the outher message
-    ///  may return true even if the inner message has missing required fields.
-    ///  This is necessary because otherwise the inner message would have to be
-    ///  parsed in order to perform the check, defeating the purpose of lazy
-    ///  parsing.  An implementation which chooses not to check required fields
-    ///  must be consistent about it.  That is, for any particular sub-message, the
-    ///  implementation must either *always* check its required fields, or *never*
-    ///  check its required fields, regardless of whether or not the message has
-    ///  been parsed.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Lazy {
-      get { return lazy_; }
-      set {
-        lazy_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 3;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this field deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for accessors, or it will be completely ignored; in the very least, this
-    ///  is a formalization for deprecating fields.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "weak" field.</summary>
-    public const int WeakFieldNumber = 10;
-    private bool weak_;
-    /// <summary>
-    ///  For Google-internal migration only. Do not use.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Weak {
-      get { return weak_; }
-      set {
-        weak_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as FieldOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(FieldOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Ctype != other.Ctype) return false;
-      if (Packed != other.Packed) return false;
-      if (Jstype != other.Jstype) return false;
-      if (Lazy != other.Lazy) return false;
-      if (Deprecated != other.Deprecated) return false;
-      if (Weak != other.Weak) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Ctype != 0) hash ^= Ctype.GetHashCode();
-      if (Packed != false) hash ^= Packed.GetHashCode();
-      if (Jstype != 0) hash ^= Jstype.GetHashCode();
-      if (Lazy != false) hash ^= Lazy.GetHashCode();
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      if (Weak != false) hash ^= Weak.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Ctype != 0) {
-        output.WriteRawTag(8);
-        output.WriteEnum((int) Ctype);
-      }
-      if (Packed != false) {
-        output.WriteRawTag(16);
-        output.WriteBool(Packed);
-      }
-      if (Deprecated != false) {
-        output.WriteRawTag(24);
-        output.WriteBool(Deprecated);
-      }
-      if (Lazy != false) {
-        output.WriteRawTag(40);
-        output.WriteBool(Lazy);
-      }
-      if (Jstype != 0) {
-        output.WriteRawTag(48);
-        output.WriteEnum((int) Jstype);
-      }
-      if (Weak != false) {
-        output.WriteRawTag(80);
-        output.WriteBool(Weak);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Ctype != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Ctype);
-      }
-      if (Packed != false) {
-        size += 1 + 1;
-      }
-      if (Jstype != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Jstype);
-      }
-      if (Lazy != false) {
-        size += 1 + 1;
-      }
-      if (Deprecated != false) {
-        size += 1 + 1;
-      }
-      if (Weak != false) {
-        size += 1 + 1;
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(FieldOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Ctype != 0) {
-        Ctype = other.Ctype;
-      }
-      if (other.Packed != false) {
-        Packed = other.Packed;
-      }
-      if (other.Jstype != 0) {
-        Jstype = other.Jstype;
-      }
-      if (other.Lazy != false) {
-        Lazy = other.Lazy;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      if (other.Weak != false) {
-        Weak = other.Weak;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            ctype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum();
-            break;
-          }
-          case 16: {
-            Packed = input.ReadBool();
-            break;
-          }
-          case 24: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 40: {
-            Lazy = input.ReadBool();
-            break;
-          }
-          case 48: {
-            jstype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum();
-            break;
-          }
-          case 80: {
-            Weak = input.ReadBool();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the FieldOptions message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      internal enum CType {
-        /// <summary>
-        ///  Default mode.
-        /// </summary>
-        [pbr::OriginalName("STRING")] String = 0,
-        [pbr::OriginalName("CORD")] Cord = 1,
-        [pbr::OriginalName("STRING_PIECE")] StringPiece = 2,
-      }
-
-      internal enum JSType {
-        /// <summary>
-        ///  Use the default type.
-        /// </summary>
-        [pbr::OriginalName("JS_NORMAL")] JsNormal = 0,
-        /// <summary>
-        ///  Use JavaScript strings.
-        /// </summary>
-        [pbr::OriginalName("JS_STRING")] JsString = 1,
-        /// <summary>
-        ///  Use JavaScript numbers.
-        /// </summary>
-        [pbr::OriginalName("JS_NUMBER")] JsNumber = 2,
-      }
-
-    }
-    #endregion
-
-  }
-
-  internal sealed partial class OneofOptions : pb::IMessage<OneofOptions> {
-    private static readonly pb::MessageParser<OneofOptions> _parser = new pb::MessageParser<OneofOptions>(() => new OneofOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<OneofOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[12]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofOptions(OneofOptions other) : this() {
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public OneofOptions Clone() {
-      return new OneofOptions(this);
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as OneofOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(OneofOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(OneofOptions other) {
-      if (other == null) {
-        return;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  internal sealed partial class EnumOptions : pb::IMessage<EnumOptions> {
-    private static readonly pb::MessageParser<EnumOptions> _parser = new pb::MessageParser<EnumOptions>(() => new EnumOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<EnumOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumOptions(EnumOptions other) : this() {
-      allowAlias_ = other.allowAlias_;
-      deprecated_ = other.deprecated_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumOptions Clone() {
-      return new EnumOptions(this);
-    }
-
-    /// <summary>Field number for the "allow_alias" field.</summary>
-    public const int AllowAliasFieldNumber = 2;
-    private bool allowAlias_;
-    /// <summary>
-    ///  Set this option to true to allow mapping different tag names to the same
-    ///  value.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool AllowAlias {
-      get { return allowAlias_; }
-      set {
-        allowAlias_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 3;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this enum deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for the enum, or it will be completely ignored; in the very least, this
-    ///  is a formalization for deprecating enums.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as EnumOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(EnumOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (AllowAlias != other.AllowAlias) return false;
-      if (Deprecated != other.Deprecated) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (AllowAlias != false) hash ^= AllowAlias.GetHashCode();
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (AllowAlias != false) {
-        output.WriteRawTag(16);
-        output.WriteBool(AllowAlias);
-      }
-      if (Deprecated != false) {
-        output.WriteRawTag(24);
-        output.WriteBool(Deprecated);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (AllowAlias != false) {
-        size += 1 + 1;
-      }
-      if (Deprecated != false) {
-        size += 1 + 1;
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(EnumOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.AllowAlias != false) {
-        AllowAlias = other.AllowAlias;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 16: {
-            AllowAlias = input.ReadBool();
-            break;
-          }
-          case 24: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  internal sealed partial class EnumValueOptions : pb::IMessage<EnumValueOptions> {
-    private static readonly pb::MessageParser<EnumValueOptions> _parser = new pb::MessageParser<EnumValueOptions>(() => new EnumValueOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<EnumValueOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumValueOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumValueOptions(EnumValueOptions other) : this() {
-      deprecated_ = other.deprecated_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public EnumValueOptions Clone() {
-      return new EnumValueOptions(this);
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 1;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this enum value deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for the enum value, or it will be completely ignored; in the very least,
-    ///  this is a formalization for deprecating enum values.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as EnumValueOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(EnumValueOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Deprecated != other.Deprecated) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Deprecated != false) {
-        output.WriteRawTag(8);
-        output.WriteBool(Deprecated);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Deprecated != false) {
-        size += 1 + 1;
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(EnumValueOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 8: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  internal sealed partial class ServiceOptions : pb::IMessage<ServiceOptions> {
-    private static readonly pb::MessageParser<ServiceOptions> _parser = new pb::MessageParser<ServiceOptions>(() => new ServiceOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<ServiceOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ServiceOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ServiceOptions(ServiceOptions other) : this() {
-      deprecated_ = other.deprecated_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ServiceOptions Clone() {
-      return new ServiceOptions(this);
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 33;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this service deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for the service, or it will be completely ignored; in the very least,
-    ///  this is a formalization for deprecating services.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as ServiceOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(ServiceOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Deprecated != other.Deprecated) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Deprecated != false) {
-        output.WriteRawTag(136, 2);
-        output.WriteBool(Deprecated);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Deprecated != false) {
-        size += 2 + 1;
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(ServiceOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 264: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  internal sealed partial class MethodOptions : pb::IMessage<MethodOptions> {
-    private static readonly pb::MessageParser<MethodOptions> _parser = new pb::MessageParser<MethodOptions>(() => new MethodOptions());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<MethodOptions> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MethodOptions() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MethodOptions(MethodOptions other) : this() {
-      deprecated_ = other.deprecated_;
-      uninterpretedOption_ = other.uninterpretedOption_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public MethodOptions Clone() {
-      return new MethodOptions(this);
-    }
-
-    /// <summary>Field number for the "deprecated" field.</summary>
-    public const int DeprecatedFieldNumber = 33;
-    private bool deprecated_;
-    /// <summary>
-    ///  Is this method deprecated?
-    ///  Depending on the target platform, this can emit Deprecated annotations
-    ///  for the method, or it will be completely ignored; in the very least,
-    ///  this is a formalization for deprecating methods.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Deprecated {
-      get { return deprecated_; }
-      set {
-        deprecated_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "uninterpreted_option" field.</summary>
-    public const int UninterpretedOptionFieldNumber = 999;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
-        = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
-    /// <summary>
-    ///  The parser stores options it doesn't recognize here. See above.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
-      get { return uninterpretedOption_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as MethodOptions);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(MethodOptions other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if (Deprecated != other.Deprecated) return false;
-      if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      if (Deprecated != false) hash ^= Deprecated.GetHashCode();
-      hash ^= uninterpretedOption_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      if (Deprecated != false) {
-        output.WriteRawTag(136, 2);
-        output.WriteBool(Deprecated);
-      }
-      uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      if (Deprecated != false) {
-        size += 2 + 1;
-      }
-      size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(MethodOptions other) {
-      if (other == null) {
-        return;
-      }
-      if (other.Deprecated != false) {
-        Deprecated = other.Deprecated;
-      }
-      uninterpretedOption_.Add(other.uninterpretedOption_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 264: {
-            Deprecated = input.ReadBool();
-            break;
-          }
-          case 7994: {
-            uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
-            break;
-          }
-        }
-      }
-    }
-
-  }
-
-  /// <summary>
-  ///  A message representing a option the parser does not recognize. This only
-  ///  appears in options protos created by the compiler::Parser class.
-  ///  DescriptorPool resolves these when building Descriptor objects. Therefore,
-  ///  options protos in descriptor objects (e.g. returned by Descriptor::options(),
-  ///  or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
-  ///  in them.
-  /// </summary>
-  internal sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption> {
-    private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<UninterpretedOption> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public UninterpretedOption() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public UninterpretedOption(UninterpretedOption other) : this() {
-      name_ = other.name_.Clone();
-      identifierValue_ = other.identifierValue_;
-      positiveIntValue_ = other.positiveIntValue_;
-      negativeIntValue_ = other.negativeIntValue_;
-      doubleValue_ = other.doubleValue_;
-      stringValue_ = other.stringValue_;
-      aggregateValue_ = other.aggregateValue_;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public UninterpretedOption Clone() {
-      return new UninterpretedOption(this);
-    }
-
-    /// <summary>Field number for the "name" field.</summary>
-    public const int NameFieldNumber = 2;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> _repeated_name_codec
-        = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> name_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart>();
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> Name {
-      get { return name_; }
-    }
-
-    /// <summary>Field number for the "identifier_value" field.</summary>
-    public const int IdentifierValueFieldNumber = 3;
-    private string identifierValue_ = "";
-    /// <summary>
-    ///  The value of the uninterpreted option, in whatever type the tokenizer
-    ///  identified it as during parsing. Exactly one of these should be set.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string IdentifierValue {
-      get { return identifierValue_; }
-      set {
-        identifierValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "positive_int_value" field.</summary>
-    public const int PositiveIntValueFieldNumber = 4;
-    private ulong positiveIntValue_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public ulong PositiveIntValue {
-      get { return positiveIntValue_; }
-      set {
-        positiveIntValue_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "negative_int_value" field.</summary>
-    public const int NegativeIntValueFieldNumber = 5;
-    private long negativeIntValue_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public long NegativeIntValue {
-      get { return negativeIntValue_; }
-      set {
-        negativeIntValue_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "double_value" field.</summary>
-    public const int DoubleValueFieldNumber = 6;
-    private double doubleValue_;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public double DoubleValue {
-      get { return doubleValue_; }
-      set {
-        doubleValue_ = value;
-      }
-    }
-
-    /// <summary>Field number for the "string_value" field.</summary>
-    public const int StringValueFieldNumber = 7;
-    private pb::ByteString stringValue_ = pb::ByteString.Empty;
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pb::ByteString StringValue {
-      get { return stringValue_; }
-      set {
-        stringValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    /// <summary>Field number for the "aggregate_value" field.</summary>
-    public const int AggregateValueFieldNumber = 8;
-    private string aggregateValue_ = "";
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public string AggregateValue {
-      get { return aggregateValue_; }
-      set {
-        aggregateValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as UninterpretedOption);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(UninterpretedOption other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!name_.Equals(other.name_)) return false;
-      if (IdentifierValue != other.IdentifierValue) return false;
-      if (PositiveIntValue != other.PositiveIntValue) return false;
-      if (NegativeIntValue != other.NegativeIntValue) return false;
-      if (DoubleValue != other.DoubleValue) return false;
-      if (StringValue != other.StringValue) return false;
-      if (AggregateValue != other.AggregateValue) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= name_.GetHashCode();
-      if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode();
-      if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode();
-      if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode();
-      if (DoubleValue != 0D) hash ^= DoubleValue.GetHashCode();
-      if (StringValue.Length != 0) hash ^= StringValue.GetHashCode();
-      if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      name_.WriteTo(output, _repeated_name_codec);
-      if (IdentifierValue.Length != 0) {
-        output.WriteRawTag(26);
-        output.WriteString(IdentifierValue);
-      }
-      if (PositiveIntValue != 0UL) {
-        output.WriteRawTag(32);
-        output.WriteUInt64(PositiveIntValue);
-      }
-      if (NegativeIntValue != 0L) {
-        output.WriteRawTag(40);
-        output.WriteInt64(NegativeIntValue);
-      }
-      if (DoubleValue != 0D) {
-        output.WriteRawTag(49);
-        output.WriteDouble(DoubleValue);
-      }
-      if (StringValue.Length != 0) {
-        output.WriteRawTag(58);
-        output.WriteBytes(StringValue);
-      }
-      if (AggregateValue.Length != 0) {
-        output.WriteRawTag(66);
-        output.WriteString(AggregateValue);
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += name_.CalculateSize(_repeated_name_codec);
-      if (IdentifierValue.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(IdentifierValue);
-      }
-      if (PositiveIntValue != 0UL) {
-        size += 1 + pb::CodedOutputStream.ComputeUInt64Size(PositiveIntValue);
-      }
-      if (NegativeIntValue != 0L) {
-        size += 1 + pb::CodedOutputStream.ComputeInt64Size(NegativeIntValue);
-      }
-      if (DoubleValue != 0D) {
-        size += 1 + 8;
-      }
-      if (StringValue.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeBytesSize(StringValue);
-      }
-      if (AggregateValue.Length != 0) {
-        size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue);
-      }
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(UninterpretedOption other) {
-      if (other == null) {
-        return;
-      }
-      name_.Add(other.name_);
-      if (other.IdentifierValue.Length != 0) {
-        IdentifierValue = other.IdentifierValue;
-      }
-      if (other.PositiveIntValue != 0UL) {
-        PositiveIntValue = other.PositiveIntValue;
-      }
-      if (other.NegativeIntValue != 0L) {
-        NegativeIntValue = other.NegativeIntValue;
-      }
-      if (other.DoubleValue != 0D) {
-        DoubleValue = other.DoubleValue;
-      }
-      if (other.StringValue.Length != 0) {
-        StringValue = other.StringValue;
-      }
-      if (other.AggregateValue.Length != 0) {
-        AggregateValue = other.AggregateValue;
-      }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 18: {
-            name_.AddEntriesFrom(input, _repeated_name_codec);
-            break;
-          }
-          case 26: {
-            IdentifierValue = input.ReadString();
-            break;
-          }
-          case 32: {
-            PositiveIntValue = input.ReadUInt64();
-            break;
-          }
-          case 40: {
-            NegativeIntValue = input.ReadInt64();
-            break;
-          }
-          case 49: {
-            DoubleValue = input.ReadDouble();
-            break;
-          }
-          case 58: {
-            StringValue = input.ReadBytes();
-            break;
-          }
-          case 66: {
-            AggregateValue = input.ReadString();
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the UninterpretedOption message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      /// <summary>
-      ///  The name of the uninterpreted option.  Each string represents a segment in
-      ///  a dot-separated name.  is_extension is true iff a segment represents an
-      ///  extension (denoted with parentheses in options specs in .proto files).
-      ///  E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
-      ///  "foo.(bar.baz).qux".
-      /// </summary>
-      internal sealed partial class NamePart : pb::IMessage<NamePart> {
-        private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<NamePart> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.Reflection.UninterpretedOption.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NamePart() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NamePart(NamePart other) : this() {
-          namePart_ = other.namePart_;
-          isExtension_ = other.isExtension_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public NamePart Clone() {
-          return new NamePart(this);
-        }
-
-        /// <summary>Field number for the "name_part" field.</summary>
-        public const int NamePart_FieldNumber = 1;
-        private string namePart_ = "";
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public string NamePart_ {
-          get { return namePart_; }
-          set {
-            namePart_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-          }
-        }
-
-        /// <summary>Field number for the "is_extension" field.</summary>
-        public const int IsExtensionFieldNumber = 2;
-        private bool isExtension_;
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool IsExtension {
-          get { return isExtension_; }
-          set {
-            isExtension_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as NamePart);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(NamePart other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if (NamePart_ != other.NamePart_) return false;
-          if (IsExtension != other.IsExtension) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode();
-          if (IsExtension != false) hash ^= IsExtension.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          if (NamePart_.Length != 0) {
-            output.WriteRawTag(10);
-            output.WriteString(NamePart_);
-          }
-          if (IsExtension != false) {
-            output.WriteRawTag(16);
-            output.WriteBool(IsExtension);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          if (NamePart_.Length != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeStringSize(NamePart_);
-          }
-          if (IsExtension != false) {
-            size += 1 + 1;
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(NamePart other) {
-          if (other == null) {
-            return;
-          }
-          if (other.NamePart_.Length != 0) {
-            NamePart_ = other.NamePart_;
-          }
-          if (other.IsExtension != false) {
-            IsExtension = other.IsExtension;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 10: {
-                NamePart_ = input.ReadString();
-                break;
-              }
-              case 16: {
-                IsExtension = input.ReadBool();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  Encapsulates information about the original source file from which a
-  ///  FileDescriptorProto was generated.
-  /// </summary>
-  internal sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo> {
-    private static readonly pb::MessageParser<SourceCodeInfo> _parser = new pb::MessageParser<SourceCodeInfo>(() => new SourceCodeInfo());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<SourceCodeInfo> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public SourceCodeInfo() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public SourceCodeInfo(SourceCodeInfo other) : this() {
-      location_ = other.location_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public SourceCodeInfo Clone() {
-      return new SourceCodeInfo(this);
-    }
-
-    /// <summary>Field number for the "location" field.</summary>
-    public const int LocationFieldNumber = 1;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> _repeated_location_codec
-        = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> location_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location>();
-    /// <summary>
-    ///  A Location identifies a piece of source code in a .proto file which
-    ///  corresponds to a particular definition.  This information is intended
-    ///  to be useful to IDEs, code indexers, documentation generators, and similar
-    ///  tools.
-    ///
-    ///  For example, say we have a file like:
-    ///    message Foo {
-    ///      optional string foo = 1;
-    ///    }
-    ///  Let's look at just the field definition:
-    ///    optional string foo = 1;
-    ///    ^       ^^     ^^  ^  ^^^
-    ///    a       bc     de  f  ghi
-    ///  We have the following locations:
-    ///    span   path               represents
-    ///    [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
-    ///    [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
-    ///    [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
-    ///    [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
-    ///    [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
-    ///
-    ///  Notes:
-    ///  - A location may refer to a repeated field itself (i.e. not to any
-    ///    particular index within it).  This is used whenever a set of elements are
-    ///    logically enclosed in a single code segment.  For example, an entire
-    ///    extend block (possibly containing multiple extension definitions) will
-    ///    have an outer location whose path refers to the "extensions" repeated
-    ///    field without an index.
-    ///  - Multiple locations may have the same path.  This happens when a single
-    ///    logical declaration is spread out across multiple places.  The most
-    ///    obvious example is the "extend" block again -- there may be multiple
-    ///    extend blocks in the same scope, each of which will have the same path.
-    ///  - A location's span is not always a subset of its parent's span.  For
-    ///    example, the "extendee" of an extension declaration appears at the
-    ///    beginning of the "extend" block and is shared by all extensions within
-    ///    the block.
-    ///  - Just because a location's span is a subset of some other location's span
-    ///    does not mean that it is a descendent.  For example, a "group" defines
-    ///    both a type and a field in a single declaration.  Thus, the locations
-    ///    corresponding to the type and field and their components will overlap.
-    ///  - Code which tries to interpret locations should probably be designed to
-    ///    ignore those that it doesn't understand, as more types of locations could
-    ///    be recorded in the future.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> Location {
-      get { return location_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as SourceCodeInfo);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(SourceCodeInfo other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!location_.Equals(other.location_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= location_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      location_.WriteTo(output, _repeated_location_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += location_.CalculateSize(_repeated_location_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(SourceCodeInfo other) {
-      if (other == null) {
-        return;
-      }
-      location_.Add(other.location_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            location_.AddEntriesFrom(input, _repeated_location_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the SourceCodeInfo message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      internal sealed partial class Location : pb::IMessage<Location> {
-        private static readonly pb::MessageParser<Location> _parser = new pb::MessageParser<Location>(() => new Location());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<Location> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.Reflection.SourceCodeInfo.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public Location() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public Location(Location other) : this() {
-          path_ = other.path_.Clone();
-          span_ = other.span_.Clone();
-          leadingComments_ = other.leadingComments_;
-          trailingComments_ = other.trailingComments_;
-          leadingDetachedComments_ = other.leadingDetachedComments_.Clone();
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public Location Clone() {
-          return new Location(this);
-        }
-
-        /// <summary>Field number for the "path" field.</summary>
-        public const int PathFieldNumber = 1;
-        private static readonly pb::FieldCodec<int> _repeated_path_codec
-            = pb::FieldCodec.ForInt32(10);
-        private readonly pbc::RepeatedField<int> path_ = new pbc::RepeatedField<int>();
-        /// <summary>
-        ///  Identifies which part of the FileDescriptorProto was defined at this
-        ///  location.
-        ///
-        ///  Each element is a field number or an index.  They form a path from
-        ///  the root FileDescriptorProto to the place where the definition.  For
-        ///  example, this path:
-        ///    [ 4, 3, 2, 7, 1 ]
-        ///  refers to:
-        ///    file.message_type(3)  // 4, 3
-        ///        .field(7)         // 2, 7
-        ///        .name()           // 1
-        ///  This is because FileDescriptorProto.message_type has field number 4:
-        ///    repeated DescriptorProto message_type = 4;
-        ///  and DescriptorProto.field has field number 2:
-        ///    repeated FieldDescriptorProto field = 2;
-        ///  and FieldDescriptorProto.name has field number 1:
-        ///    optional string name = 1;
-        ///
-        ///  Thus, the above path gives the location of a field name.  If we removed
-        ///  the last element:
-        ///    [ 4, 3, 2, 7 ]
-        ///  this path refers to the whole field declaration (from the beginning
-        ///  of the label to the terminating semicolon).
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public pbc::RepeatedField<int> Path {
-          get { return path_; }
-        }
-
-        /// <summary>Field number for the "span" field.</summary>
-        public const int SpanFieldNumber = 2;
-        private static readonly pb::FieldCodec<int> _repeated_span_codec
-            = pb::FieldCodec.ForInt32(18);
-        private readonly pbc::RepeatedField<int> span_ = new pbc::RepeatedField<int>();
-        /// <summary>
-        ///  Always has exactly three or four elements: start line, start column,
-        ///  end line (optional, otherwise assumed same as start line), end column.
-        ///  These are packed into a single field for efficiency.  Note that line
-        ///  and column numbers are zero-based -- typically you will want to add
-        ///  1 to each before displaying to a user.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public pbc::RepeatedField<int> Span {
-          get { return span_; }
-        }
-
-        /// <summary>Field number for the "leading_comments" field.</summary>
-        public const int LeadingCommentsFieldNumber = 3;
-        private string leadingComments_ = "";
-        /// <summary>
-        ///  If this SourceCodeInfo represents a complete declaration, these are any
-        ///  comments appearing before and after the declaration which appear to be
-        ///  attached to the declaration.
-        ///
-        ///  A series of line comments appearing on consecutive lines, with no other
-        ///  tokens appearing on those lines, will be treated as a single comment.
-        ///
-        ///  leading_detached_comments will keep paragraphs of comments that appear
-        ///  before (but not connected to) the current element. Each paragraph,
-        ///  separated by empty lines, will be one comment element in the repeated
-        ///  field.
-        ///
-        ///  Only the comment content is provided; comment markers (e.g. //) are
-        ///  stripped out.  For block comments, leading whitespace and an asterisk
-        ///  will be stripped from the beginning of each line other than the first.
-        ///  Newlines are included in the output.
-        ///
-        ///  Examples:
-        ///
-        ///    optional int32 foo = 1;  // Comment attached to foo.
-        ///    // Comment attached to bar.
-        ///    optional int32 bar = 2;
-        ///
-        ///    optional string baz = 3;
-        ///    // Comment attached to baz.
-        ///    // Another line attached to baz.
-        ///
-        ///    // Comment attached to qux.
-        ///    //
-        ///    // Another line attached to qux.
-        ///    optional double qux = 4;
-        ///
-        ///    // Detached comment for corge. This is not leading or trailing comments
-        ///    // to qux or corge because there are blank lines separating it from
-        ///    // both.
-        ///
-        ///    // Detached comment for corge paragraph 2.
-        ///
-        ///    optional string corge = 5;
-        ///    /* Block comment attached
-        ///     * to corge.  Leading asterisks
-        ///     * will be removed. */
-        ///    /* Block comment attached to
-        ///     * grault. */
-        ///    optional int32 grault = 6;
-        ///
-        ///    // ignored detached comments.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public string LeadingComments {
-          get { return leadingComments_; }
-          set {
-            leadingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-          }
-        }
-
-        /// <summary>Field number for the "trailing_comments" field.</summary>
-        public const int TrailingCommentsFieldNumber = 4;
-        private string trailingComments_ = "";
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public string TrailingComments {
-          get { return trailingComments_; }
-          set {
-            trailingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-          }
-        }
-
-        /// <summary>Field number for the "leading_detached_comments" field.</summary>
-        public const int LeadingDetachedCommentsFieldNumber = 6;
-        private static readonly pb::FieldCodec<string> _repeated_leadingDetachedComments_codec
-            = pb::FieldCodec.ForString(50);
-        private readonly pbc::RepeatedField<string> leadingDetachedComments_ = new pbc::RepeatedField<string>();
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public pbc::RepeatedField<string> LeadingDetachedComments {
-          get { return leadingDetachedComments_; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as Location);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(Location other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if(!path_.Equals(other.path_)) return false;
-          if(!span_.Equals(other.span_)) return false;
-          if (LeadingComments != other.LeadingComments) return false;
-          if (TrailingComments != other.TrailingComments) return false;
-          if(!leadingDetachedComments_.Equals(other.leadingDetachedComments_)) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          hash ^= path_.GetHashCode();
-          hash ^= span_.GetHashCode();
-          if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode();
-          if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode();
-          hash ^= leadingDetachedComments_.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          path_.WriteTo(output, _repeated_path_codec);
-          span_.WriteTo(output, _repeated_span_codec);
-          if (LeadingComments.Length != 0) {
-            output.WriteRawTag(26);
-            output.WriteString(LeadingComments);
-          }
-          if (TrailingComments.Length != 0) {
-            output.WriteRawTag(34);
-            output.WriteString(TrailingComments);
-          }
-          leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          size += path_.CalculateSize(_repeated_path_codec);
-          size += span_.CalculateSize(_repeated_span_codec);
-          if (LeadingComments.Length != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeStringSize(LeadingComments);
-          }
-          if (TrailingComments.Length != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments);
-          }
-          size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec);
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(Location other) {
-          if (other == null) {
-            return;
-          }
-          path_.Add(other.path_);
-          span_.Add(other.span_);
-          if (other.LeadingComments.Length != 0) {
-            LeadingComments = other.LeadingComments;
-          }
-          if (other.TrailingComments.Length != 0) {
-            TrailingComments = other.TrailingComments;
-          }
-          leadingDetachedComments_.Add(other.leadingDetachedComments_);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 10:
-              case 8: {
-                path_.AddEntriesFrom(input, _repeated_path_codec);
-                break;
-              }
-              case 18:
-              case 16: {
-                span_.AddEntriesFrom(input, _repeated_span_codec);
-                break;
-              }
-              case 26: {
-                LeadingComments = input.ReadString();
-                break;
-              }
-              case 34: {
-                TrailingComments = input.ReadString();
-                break;
-              }
-              case 50: {
-                leadingDetachedComments_.AddEntriesFrom(input, _repeated_leadingDetachedComments_codec);
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  /// <summary>
-  ///  Describes the relationship between generated code and its original source
-  ///  file. A GeneratedCodeInfo message is associated with only one generated
-  ///  source file, but may contain references to different source .proto files.
-  /// </summary>
-  internal sealed partial class GeneratedCodeInfo : pb::IMessage<GeneratedCodeInfo> {
-    private static readonly pb::MessageParser<GeneratedCodeInfo> _parser = new pb::MessageParser<GeneratedCodeInfo>(() => new GeneratedCodeInfo());
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pb::MessageParser<GeneratedCodeInfo> Parser { get { return _parser; } }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static pbr::MessageDescriptor Descriptor {
-      get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[19]; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    pbr::MessageDescriptor pb::IMessage.Descriptor {
-      get { return Descriptor; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public GeneratedCodeInfo() {
-      OnConstruction();
-    }
-
-    partial void OnConstruction();
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public GeneratedCodeInfo(GeneratedCodeInfo other) : this() {
-      annotation_ = other.annotation_.Clone();
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public GeneratedCodeInfo Clone() {
-      return new GeneratedCodeInfo(this);
-    }
-
-    /// <summary>Field number for the "annotation" field.</summary>
-    public const int AnnotationFieldNumber = 1;
-    private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> _repeated_annotation_codec
-        = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser);
-    private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> annotation_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation>();
-    /// <summary>
-    ///  An Annotation connects some span of text in generated code to an element
-    ///  of its generating .proto file.
-    /// </summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> Annotation {
-      get { return annotation_; }
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override bool Equals(object other) {
-      return Equals(other as GeneratedCodeInfo);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public bool Equals(GeneratedCodeInfo other) {
-      if (ReferenceEquals(other, null)) {
-        return false;
-      }
-      if (ReferenceEquals(other, this)) {
-        return true;
-      }
-      if(!annotation_.Equals(other.annotation_)) return false;
-      return true;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override int GetHashCode() {
-      int hash = 1;
-      hash ^= annotation_.GetHashCode();
-      return hash;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public override string ToString() {
-      return pb::JsonFormatter.ToDiagnosticString(this);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void WriteTo(pb::CodedOutputStream output) {
-      annotation_.WriteTo(output, _repeated_annotation_codec);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public int CalculateSize() {
-      int size = 0;
-      size += annotation_.CalculateSize(_repeated_annotation_codec);
-      return size;
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(GeneratedCodeInfo other) {
-      if (other == null) {
-        return;
-      }
-      annotation_.Add(other.annotation_);
-    }
-
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public void MergeFrom(pb::CodedInputStream input) {
-      uint tag;
-      while ((tag = input.ReadTag()) != 0) {
-        switch(tag) {
-          default:
-            input.SkipLastField();
-            break;
-          case 10: {
-            annotation_.AddEntriesFrom(input, _repeated_annotation_codec);
-            break;
-          }
-        }
-      }
-    }
-
-    #region Nested types
-    /// <summary>Container for nested types declared in the GeneratedCodeInfo message type.</summary>
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-    public static partial class Types {
-      internal sealed partial class Annotation : pb::IMessage<Annotation> {
-        private static readonly pb::MessageParser<Annotation> _parser = new pb::MessageParser<Annotation>(() => new Annotation());
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pb::MessageParser<Annotation> Parser { get { return _parser; } }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public static pbr::MessageDescriptor Descriptor {
-          get { return global::Google.Protobuf.Reflection.GeneratedCodeInfo.Descriptor.NestedTypes[0]; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        pbr::MessageDescriptor pb::IMessage.Descriptor {
-          get { return Descriptor; }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public Annotation() {
-          OnConstruction();
-        }
-
-        partial void OnConstruction();
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public Annotation(Annotation other) : this() {
-          path_ = other.path_.Clone();
-          sourceFile_ = other.sourceFile_;
-          begin_ = other.begin_;
-          end_ = other.end_;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public Annotation Clone() {
-          return new Annotation(this);
-        }
-
-        /// <summary>Field number for the "path" field.</summary>
-        public const int PathFieldNumber = 1;
-        private static readonly pb::FieldCodec<int> _repeated_path_codec
-            = pb::FieldCodec.ForInt32(10);
-        private readonly pbc::RepeatedField<int> path_ = new pbc::RepeatedField<int>();
-        /// <summary>
-        ///  Identifies the element in the original source .proto file. This field
-        ///  is formatted the same as SourceCodeInfo.Location.path.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public pbc::RepeatedField<int> Path {
-          get { return path_; }
-        }
-
-        /// <summary>Field number for the "source_file" field.</summary>
-        public const int SourceFileFieldNumber = 2;
-        private string sourceFile_ = "";
-        /// <summary>
-        ///  Identifies the filesystem path to the original source .proto.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public string SourceFile {
-          get { return sourceFile_; }
-          set {
-            sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
-          }
-        }
-
-        /// <summary>Field number for the "begin" field.</summary>
-        public const int BeginFieldNumber = 3;
-        private int begin_;
-        /// <summary>
-        ///  Identifies the starting offset in bytes in the generated code
-        ///  that relates to the identified object.
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int Begin {
-          get { return begin_; }
-          set {
-            begin_ = value;
-          }
-        }
-
-        /// <summary>Field number for the "end" field.</summary>
-        public const int EndFieldNumber = 4;
-        private int end_;
-        /// <summary>
-        ///  Identifies the ending offset in bytes in the generated code that
-        ///  relates to the identified offset. The end offset should be one past
-        ///  the last relevant byte (so the length of the text = end - begin).
-        /// </summary>
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int End {
-          get { return end_; }
-          set {
-            end_ = value;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override bool Equals(object other) {
-          return Equals(other as Annotation);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public bool Equals(Annotation other) {
-          if (ReferenceEquals(other, null)) {
-            return false;
-          }
-          if (ReferenceEquals(other, this)) {
-            return true;
-          }
-          if(!path_.Equals(other.path_)) return false;
-          if (SourceFile != other.SourceFile) return false;
-          if (Begin != other.Begin) return false;
-          if (End != other.End) return false;
-          return true;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override int GetHashCode() {
-          int hash = 1;
-          hash ^= path_.GetHashCode();
-          if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode();
-          if (Begin != 0) hash ^= Begin.GetHashCode();
-          if (End != 0) hash ^= End.GetHashCode();
-          return hash;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public override string ToString() {
-          return pb::JsonFormatter.ToDiagnosticString(this);
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void WriteTo(pb::CodedOutputStream output) {
-          path_.WriteTo(output, _repeated_path_codec);
-          if (SourceFile.Length != 0) {
-            output.WriteRawTag(18);
-            output.WriteString(SourceFile);
-          }
-          if (Begin != 0) {
-            output.WriteRawTag(24);
-            output.WriteInt32(Begin);
-          }
-          if (End != 0) {
-            output.WriteRawTag(32);
-            output.WriteInt32(End);
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public int CalculateSize() {
-          int size = 0;
-          size += path_.CalculateSize(_repeated_path_codec);
-          if (SourceFile.Length != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile);
-          }
-          if (Begin != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(Begin);
-          }
-          if (End != 0) {
-            size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
-          }
-          return size;
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(Annotation other) {
-          if (other == null) {
-            return;
-          }
-          path_.Add(other.path_);
-          if (other.SourceFile.Length != 0) {
-            SourceFile = other.SourceFile;
-          }
-          if (other.Begin != 0) {
-            Begin = other.Begin;
-          }
-          if (other.End != 0) {
-            End = other.End;
-          }
-        }
-
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
-        public void MergeFrom(pb::CodedInputStream input) {
-          uint tag;
-          while ((tag = input.ReadTag()) != 0) {
-            switch(tag) {
-              default:
-                input.SkipLastField();
-                break;
-              case 10:
-              case 8: {
-                path_.AddEntriesFrom(input, _repeated_path_codec);
-                break;
-              }
-              case 18: {
-                SourceFile = input.ReadString();
-                break;
-              }
-              case 24: {
-                Begin = input.ReadInt32();
-                break;
-              }
-              case 32: {
-                End = input.ReadInt32();
-                break;
-              }
-            }
-          }
-        }
-
-      }
-
-    }
-    #endregion
-
-  }
-
-  #endregion
-
-}
-
-#endregion Designer generated code

+ 0 - 85
csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs

@@ -1,85 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Base class for nearly all descriptors, providing common functionality.
-    /// </summary>
-    public abstract class DescriptorBase : IDescriptor
-    {
-        private readonly FileDescriptor file;
-        private readonly string fullName;
-        private readonly int index;
-
-        internal DescriptorBase(FileDescriptor file, string fullName, int index)
-        {
-            this.file = file;
-            this.fullName = fullName;
-            this.index = index;
-        }
-
-        /// <value>
-        /// The index of this descriptor within its parent descriptor. 
-        /// </value>
-        /// <remarks>
-        /// This returns the index of this descriptor within its parent, for
-        /// this descriptor's type. (There can be duplicate values for different
-        /// types, e.g. one enum type with index 0 and one message type with index 0.)
-        /// </remarks>
-        public int Index
-        {
-            get { return index; }
-        }
-
-        /// <summary>
-        /// Returns the name of the entity (field, message etc) being described.
-        /// </summary>
-        public abstract string Name { get; }
-
-        /// <summary>
-        /// The fully qualified name of the descriptor's target.
-        /// </summary>
-        public string FullName
-        {
-            get { return fullName; }
-        }
-
-        /// <value>
-        /// The file this descriptor was declared in.
-        /// </value>
-        public FileDescriptor File
-        {
-            get { return file; }
-        }
-    }
-}

+ 0 - 368
csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs

@@ -1,368 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 System.Text;
-using System.Text.RegularExpressions;
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Contains lookup tables containing all the descriptors defined in a particular file.
-    /// </summary>
-    internal sealed class DescriptorPool
-    {
-        private readonly IDictionary<string, IDescriptor> descriptorsByName =
-            new Dictionary<string, IDescriptor>();
-
-        private readonly IDictionary<DescriptorIntPair, FieldDescriptor> fieldsByNumber =
-            new Dictionary<DescriptorIntPair, FieldDescriptor>();
-
-        private readonly IDictionary<DescriptorIntPair, EnumValueDescriptor> enumValuesByNumber =
-            new Dictionary<DescriptorIntPair, EnumValueDescriptor>();
-
-        private readonly HashSet<FileDescriptor> dependencies;
-
-        internal DescriptorPool(FileDescriptor[] dependencyFiles)
-        {
-            dependencies = new HashSet<FileDescriptor>();
-            for (int i = 0; i < dependencyFiles.Length; i++)
-            {
-                dependencies.Add(dependencyFiles[i]);
-                ImportPublicDependencies(dependencyFiles[i]);
-            }
-
-            foreach (FileDescriptor dependency in dependencyFiles)
-            {
-                AddPackage(dependency.Package, dependency);
-            }
-        }
-
-        private void ImportPublicDependencies(FileDescriptor file)
-        {
-            foreach (FileDescriptor dependency in file.PublicDependencies)
-            {
-                if (dependencies.Add(dependency))
-                {
-                    ImportPublicDependencies(dependency);
-                }
-            }
-        }
-
-        /// <summary>
-        /// Finds a symbol of the given name within the pool.
-        /// </summary>
-        /// <typeparam name="T">The type of symbol to look for</typeparam>
-        /// <param name="fullName">Fully-qualified name to look up</param>
-        /// <returns>The symbol with the given name and type,
-        /// or null if the symbol doesn't exist or has the wrong type</returns>
-        internal T FindSymbol<T>(string fullName) where T : class
-        {
-            IDescriptor result;
-            descriptorsByName.TryGetValue(fullName, out result);
-            T descriptor = result as T;
-            if (descriptor != null)
-            {
-                return descriptor;
-            }
-
-            // dependencies contains direct dependencies and any *public* dependencies
-            // of those dependencies (transitively)... so we don't need to recurse here.
-            foreach (FileDescriptor dependency in dependencies)
-            {
-                dependency.DescriptorPool.descriptorsByName.TryGetValue(fullName, out result);
-                descriptor = result as T;
-                if (descriptor != null)
-                {
-                    return descriptor;
-                }
-            }
-
-            return null;
-        }
-
-        /// <summary>
-        /// Adds a package to the symbol tables. If a package by the same name
-        /// already exists, that is fine, but if some other kind of symbol
-        /// exists under the same name, an exception is thrown. If the package
-        /// has multiple components, this also adds the parent package(s).
-        /// </summary>
-        internal void AddPackage(string fullName, FileDescriptor file)
-        {
-            int dotpos = fullName.LastIndexOf('.');
-            String name;
-            if (dotpos != -1)
-            {
-                AddPackage(fullName.Substring(0, dotpos), file);
-                name = fullName.Substring(dotpos + 1);
-            }
-            else
-            {
-                name = fullName;
-            }
-
-            IDescriptor old;
-            if (descriptorsByName.TryGetValue(fullName, out old))
-            {
-                if (!(old is PackageDescriptor))
-                {
-                    throw new DescriptorValidationException(file,
-                                                            "\"" + name +
-                                                            "\" is already defined (as something other than a " +
-                                                            "package) in file \"" + old.File.Name + "\".");
-                }
-            }
-            descriptorsByName[fullName] = new PackageDescriptor(name, fullName, file);
-        }
-
-        /// <summary>
-        /// Adds a symbol to the symbol table.
-        /// </summary>
-        /// <exception cref="DescriptorValidationException">The symbol already existed
-        /// in the symbol table.</exception>
-        internal void AddSymbol(IDescriptor descriptor)
-        {
-            ValidateSymbolName(descriptor);
-            String fullName = descriptor.FullName;
-
-            IDescriptor old;
-            if (descriptorsByName.TryGetValue(fullName, out old))
-            {
-                int dotPos = fullName.LastIndexOf('.');
-                string message;
-                if (descriptor.File == old.File)
-                {
-                    if (dotPos == -1)
-                    {
-                        message = "\"" + fullName + "\" is already defined.";
-                    }
-                    else
-                    {
-                        message = "\"" + fullName.Substring(dotPos + 1) + "\" is already defined in \"" +
-                                  fullName.Substring(0, dotPos) + "\".";
-                    }
-                }
-                else
-                {
-                    message = "\"" + fullName + "\" is already defined in file \"" + old.File.Name + "\".";
-                }
-                throw new DescriptorValidationException(descriptor, message);
-            }
-            descriptorsByName[fullName] = descriptor;
-        }
-
-        private static readonly Regex ValidationRegex = new Regex("^[_A-Za-z][_A-Za-z0-9]*$",
-                                                                  FrameworkPortability.CompiledRegexWhereAvailable);
-
-        /// <summary>
-        /// Verifies that the descriptor's name is valid (i.e. it contains
-        /// only letters, digits and underscores, and does not start with a digit).
-        /// </summary>
-        /// <param name="descriptor"></param>
-        private static void ValidateSymbolName(IDescriptor descriptor)
-        {
-            if (descriptor.Name == "")
-            {
-                throw new DescriptorValidationException(descriptor, "Missing name.");
-            }
-            if (!ValidationRegex.IsMatch(descriptor.Name))
-            {
-                throw new DescriptorValidationException(descriptor,
-                                                        "\"" + descriptor.Name + "\" is not a valid identifier.");
-            }
-        }
-
-        /// <summary>
-        /// Returns the field with the given number in the given descriptor,
-        /// or null if it can't be found.
-        /// </summary>
-        internal FieldDescriptor FindFieldByNumber(MessageDescriptor messageDescriptor, int number)
-        {
-            FieldDescriptor ret;
-            fieldsByNumber.TryGetValue(new DescriptorIntPair(messageDescriptor, number), out ret);
-            return ret;
-        }
-
-        internal EnumValueDescriptor FindEnumValueByNumber(EnumDescriptor enumDescriptor, int number)
-        {
-            EnumValueDescriptor ret;
-            enumValuesByNumber.TryGetValue(new DescriptorIntPair(enumDescriptor, number), out ret);
-            return ret;
-        }
-
-        /// <summary>
-        /// Adds a field to the fieldsByNumber table.
-        /// </summary>
-        /// <exception cref="DescriptorValidationException">A field with the same
-        /// containing type and number already exists.</exception>
-        internal void AddFieldByNumber(FieldDescriptor field)
-        {
-            DescriptorIntPair key = new DescriptorIntPair(field.ContainingType, field.FieldNumber);
-            FieldDescriptor old;
-            if (fieldsByNumber.TryGetValue(key, out old))
-            {
-                throw new DescriptorValidationException(field, "Field number " + field.FieldNumber +
-                                                               "has already been used in \"" +
-                                                               field.ContainingType.FullName +
-                                                               "\" by field \"" + old.Name + "\".");
-            }
-            fieldsByNumber[key] = field;
-        }
-
-        /// <summary>
-        /// Adds an enum value to the enumValuesByNumber table. If an enum value
-        /// with the same type and number already exists, this method does nothing.
-        /// (This is allowed; the first value defined with the number takes precedence.)
-        /// </summary>
-        internal void AddEnumValueByNumber(EnumValueDescriptor enumValue)
-        {
-            DescriptorIntPair key = new DescriptorIntPair(enumValue.EnumDescriptor, enumValue.Number);
-            if (!enumValuesByNumber.ContainsKey(key))
-            {
-                enumValuesByNumber[key] = enumValue;
-            }
-        }
-
-        /// <summary>
-        /// Looks up a descriptor by name, relative to some other descriptor.
-        /// The name may be fully-qualified (with a leading '.'), partially-qualified,
-        /// or unqualified. C++-like name lookup semantics are used to search for the
-        /// matching descriptor.
-        /// </summary>
-        /// <remarks>
-        /// This isn't heavily optimized, but it's only used during cross linking anyway.
-        /// If it starts being used more widely, we should look at performance more carefully.
-        /// </remarks>
-        internal IDescriptor LookupSymbol(string name, IDescriptor relativeTo)
-        {
-            IDescriptor result;
-            if (name.StartsWith("."))
-            {
-                // Fully-qualified name.
-                result = FindSymbol<IDescriptor>(name.Substring(1));
-            }
-            else
-            {
-                // If "name" is a compound identifier, we want to search for the
-                // first component of it, then search within it for the rest.
-                int firstPartLength = name.IndexOf('.');
-                string firstPart = firstPartLength == -1 ? name : name.Substring(0, firstPartLength);
-
-                // We will search each parent scope of "relativeTo" looking for the
-                // symbol.
-                StringBuilder scopeToTry = new StringBuilder(relativeTo.FullName);
-
-                while (true)
-                {
-                    // Chop off the last component of the scope.
-
-                    int dotpos = scopeToTry.ToString().LastIndexOf(".");
-                    if (dotpos == -1)
-                    {
-                        result = FindSymbol<IDescriptor>(name);
-                        break;
-                    }
-                    else
-                    {
-                        scopeToTry.Length = dotpos + 1;
-
-                        // Append firstPart and try to find.
-                        scopeToTry.Append(firstPart);
-                        result = FindSymbol<IDescriptor>(scopeToTry.ToString());
-
-                        if (result != null)
-                        {
-                            if (firstPartLength != -1)
-                            {
-                                // We only found the first part of the symbol.  Now look for
-                                // the whole thing.  If this fails, we *don't* want to keep
-                                // searching parent scopes.
-                                scopeToTry.Length = dotpos + 1;
-                                scopeToTry.Append(name);
-                                result = FindSymbol<IDescriptor>(scopeToTry.ToString());
-                            }
-                            break;
-                        }
-
-                        // Not found.  Remove the name so we can try again.
-                        scopeToTry.Length = dotpos;
-                    }
-                }
-            }
-
-            if (result == null)
-            {
-                throw new DescriptorValidationException(relativeTo, "\"" + name + "\" is not defined.");
-            }
-            else
-            {
-                return result;
-            }
-        }
-
-        /// <summary>
-        /// Struct used to hold the keys for the fieldByNumber table.
-        /// </summary>
-        private struct DescriptorIntPair : IEquatable<DescriptorIntPair>
-        {
-            private readonly int number;
-            private readonly IDescriptor descriptor;
-
-            internal DescriptorIntPair(IDescriptor descriptor, int number)
-            {
-                this.number = number;
-                this.descriptor = descriptor;
-            }
-
-            public bool Equals(DescriptorIntPair other)
-            {
-                return descriptor == other.descriptor
-                       && number == other.number;
-            }
-
-            public override bool Equals(object obj)
-            {
-                if (obj is DescriptorIntPair)
-                {
-                    return Equals((DescriptorIntPair) obj);
-                }
-                return false;
-            }
-
-            public override int GetHashCode()
-            {
-                return descriptor.GetHashCode()*((1 << 16) - 1) + number;
-            }
-        }
-    }
-}

+ 0 - 64
csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs

@@ -1,64 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Internal class containing utility methods when working with descriptors.
-    /// </summary>
-    internal static class DescriptorUtil
-    {
-        /// <summary>
-        /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
-        /// arrays.
-        /// </summary>
-        internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index);
-
-        /// <summary>
-        /// Converts the given array into a read-only list, applying the specified conversion to
-        /// each input element.
-        /// </summary>
-        internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput>
-            (IList<TInput> input, IndexedConverter<TInput, TOutput> converter)
-        {
-            TOutput[] array = new TOutput[input.Count];
-            for (int i = 0; i < array.Length; i++)
-            {
-                array[i] = converter(input[i], i);
-            }
-            return new ReadOnlyCollection<TOutput>(array);
-        }
-    }
-}

+ 0 - 80
csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs

@@ -1,80 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Protobuf.Reflection
-{
-    /// <summary>
-    /// Thrown when building descriptors fails because the source DescriptorProtos
-    /// are not valid.
-    /// </summary>
-    public sealed class DescriptorValidationException : Exception
-    {
-        private readonly String name;
-        private readonly string description;
-
-        /// <value>
-        /// The full name of the descriptor where the error occurred.
-        /// </value>
-        public String ProblemSymbolName
-        {
-            get { return name; }
-        }
-
-        /// <value>
-        /// A human-readable description of the error. (The Message property
-        /// is made up of the descriptor's name and this description.)
-        /// </value>
-        public string Description
-        {
-            get { return description; }
-        }
-
-        internal DescriptorValidationException(IDescriptor problemDescriptor, string description) :
-            base(problemDescriptor.FullName + ": " + description)
-        {
-            // Note that problemDescriptor may be partially uninitialized, so we
-            // don't want to expose it directly to the user.  So, we only provide
-            // the name and the original proto.
-            name = problemDescriptor.FullName;
-            this.description = description;
-        }
-
-        internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) :
-            base(problemDescriptor.FullName + ": " + description, cause)
-        {
-            name = problemDescriptor.FullName;
-            this.description = description;
-        }
-    }
-}

+ 0 - 116
csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs

@@ -1,116 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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;
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Descriptor for an enum type in a .proto file.
-    /// </summary>
-    public sealed class EnumDescriptor : DescriptorBase
-    {
-        private readonly EnumDescriptorProto proto;
-        private readonly MessageDescriptor containingType;
-        private readonly IList<EnumValueDescriptor> values;
-        private readonly Type clrType;
-
-        internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, Type clrType)
-            : base(file, file.ComputeFullName(parent, proto.Name), index)
-        {
-            this.proto = proto;
-            this.clrType = clrType;
-            containingType = parent;
-
-            if (proto.Value.Count == 0)
-            {
-                // We cannot allow enums with no values because this would mean there
-                // would be no valid default value for fields of this type.
-                throw new DescriptorValidationException(this, "Enums must contain at least one value.");
-            }
-
-            values = DescriptorUtil.ConvertAndMakeReadOnly(proto.Value,
-                                                           (value, i) => new EnumValueDescriptor(value, file, this, i));
-
-            File.DescriptorPool.AddSymbol(this);
-        }
-
-        internal EnumDescriptorProto Proto { get { return proto; } }
-
-        /// <summary>
-        /// The brief name of the descriptor's target.
-        /// </summary>
-        public override string Name { get { return proto.Name; } }
-
-        /// <summary>
-        /// The CLR type for this enum. For generated code, this will be a CLR enum type.
-        /// </summary>
-        public Type ClrType { get { return clrType; } }
-
-        /// <value>
-        /// If this is a nested type, get the outer descriptor, otherwise null.
-        /// </value>
-        public MessageDescriptor ContainingType
-        {
-            get { return containingType; }
-        }
-
-        /// <value>
-        /// An unmodifiable list of defined value descriptors for this enum.
-        /// </value>
-        public IList<EnumValueDescriptor> Values
-        {
-            get { return values; }
-        }
-
-        /// <summary>
-        /// Finds an enum value by number. If multiple enum values have the
-        /// same number, this returns the first defined value with that number.
-        /// If there is no value for the given number, this returns <c>null</c>.
-        /// </summary>
-        public EnumValueDescriptor FindValueByNumber(int number)
-        {
-            return File.DescriptorPool.FindEnumValueByNumber(this, number);
-        }
-
-        /// <summary>
-        /// Finds an enum value by name.
-        /// </summary>
-        /// <param name="name">The unqualified name of the value (e.g. "FOO").</param>
-        /// <returns>The value's descriptor, or null if not found.</returns>
-        public EnumValueDescriptor FindValueByName(string name)
-        {
-            return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name);
-        }
-    }
-}

+ 0 - 70
csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs

@@ -1,70 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Descriptor for a single enum value within an enum in a .proto file.
-    /// </summary>
-    public sealed class EnumValueDescriptor : DescriptorBase                                            
-    {
-        private readonly EnumDescriptor enumDescriptor;
-        private readonly EnumValueDescriptorProto proto;
-
-        internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
-                                     EnumDescriptor parent, int index)
-            : base(file, parent.FullName + "." + proto.Name, index)
-        {
-            this.proto = proto;
-            enumDescriptor = parent;
-            file.DescriptorPool.AddSymbol(this);
-            file.DescriptorPool.AddEnumValueByNumber(this);
-        }
-
-        internal EnumValueDescriptorProto Proto { get { return proto; } }
-
-        /// <summary>
-        /// Returns the name of the enum value described by this object.
-        /// </summary>
-        public override string Name { get { return proto.Name; } }
-
-        /// <summary>
-        /// Returns the number associated with this enum value.
-        /// </summary>
-        public int Number { get { return Proto.Number; } }
-
-        /// <summary>
-        /// Returns the enum descriptor that this value is part of.
-        /// </summary>
-        public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } }
-    }
-}

+ 0 - 63
csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs

@@ -1,63 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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.Reflection;
-using Google.Protobuf.Compatibility;
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Base class for field accessors.
-    /// </summary>
-    internal abstract class FieldAccessorBase : IFieldAccessor
-    {
-        private readonly Func<IMessage, object> getValueDelegate;
-        private readonly FieldDescriptor descriptor;
-
-        internal FieldAccessorBase(PropertyInfo property, FieldDescriptor descriptor)
-        {
-            this.descriptor = descriptor;
-            getValueDelegate = ReflectionUtil.CreateFuncIMessageObject(property.GetGetMethod());
-        }
-
-        public FieldDescriptor Descriptor { get { return descriptor; } }
-
-        public object GetValue(IMessage message)
-        {
-            return getValueDelegate(message);
-        }
-
-        public abstract void Clear(IMessage message);
-        public abstract void SetValue(IMessage message, object value);
-    }
-}

+ 0 - 343
csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs

@@ -1,343 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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 Google.Protobuf.Compatibility;
-using System;
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Descriptor for a field or extension within a message in a .proto file.
-    /// </summary>
-    public sealed class FieldDescriptor : DescriptorBase, IComparable<FieldDescriptor>
-    {
-        private EnumDescriptor enumType;
-        private MessageDescriptor messageType;
-        private FieldType fieldType;
-        private readonly string propertyName; // Annoyingly, needed in Crosslink.
-        private IFieldAccessor accessor;
-
-        /// <summary>
-        /// Get the field's containing message type.
-        /// </summary>
-        public MessageDescriptor ContainingType { get; }
-
-        /// <summary>
-        /// Returns the oneof containing this field, or <c>null</c> if it is not part of a oneof.
-        /// </summary>
-        public OneofDescriptor ContainingOneof { get; }
-
-        /// <summary>
-        /// The effective JSON name for this field. This is usually the lower-camel-cased form of the field name,
-        /// but can be overridden using the <c>json_name</c> option in the .proto file.
-        /// </summary>
-        public string JsonName { get; }
-
-        internal FieldDescriptorProto Proto { get; }
-
-        internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file,
-                                 MessageDescriptor parent, int index, string propertyName)
-            : base(file, file.ComputeFullName(parent, proto.Name), index)
-        {
-            Proto = proto;
-            if (proto.Type != 0)
-            {
-                fieldType = GetFieldTypeFromProtoType(proto.Type);
-            }
-
-            if (FieldNumber <= 0)
-            {
-                throw new DescriptorValidationException(this, "Field numbers must be positive integers.");
-            }
-            ContainingType = parent;
-            // OneofIndex "defaults" to -1 due to a hack in FieldDescriptor.OnConstruction.
-            if (proto.OneofIndex != -1)
-            {
-                if (proto.OneofIndex < 0 || proto.OneofIndex >= parent.Proto.OneofDecl.Count)
-                {
-                    throw new DescriptorValidationException(this,
-                        $"FieldDescriptorProto.oneof_index is out of range for type {parent.Name}");
-                }
-                ContainingOneof = parent.Oneofs[proto.OneofIndex];
-            }
-
-            file.DescriptorPool.AddSymbol(this);
-            // We can't create the accessor until we've cross-linked, unfortunately, as we
-            // may not know whether the type of the field is a map or not. Remember the property name
-            // for later.
-            // We could trust the generated code and check whether the type of the property is
-            // a MapField, but that feels a tad nasty.
-            this.propertyName = propertyName;
-            JsonName =  Proto.JsonName == "" ? JsonFormatter.ToCamelCase(Proto.Name) : Proto.JsonName;
-        }
-    
-
-        /// <summary>
-        /// The brief name of the descriptor's target.
-        /// </summary>
-        public override string Name => Proto.Name;
-
-        /// <summary>
-        /// Returns the accessor for this field.
-        /// </summary>
-        /// <remarks>
-        /// <para>
-        /// While a <see cref="FieldDescriptor"/> describes the field, it does not provide
-        /// any way of obtaining or changing the value of the field within a specific message;
-        /// that is the responsibility of the accessor.
-        /// </para>
-        /// <para>
-        /// The value returned by this property will be non-null for all regular fields. However,
-        /// if a message containing a map field is introspected, the list of nested messages will include
-        /// an auto-generated nested key/value pair message for the field. This is not represented in any
-        /// generated type, and the value of the map field itself is represented by a dictionary in the
-        /// reflection API. There are never instances of those "hidden" messages, so no accessor is provided
-        /// and this property will return null.
-        /// </para>
-        /// </remarks>
-        public IFieldAccessor Accessor => accessor;
-        
-        /// <summary>
-        /// Maps a field type as included in the .proto file to a FieldType.
-        /// </summary>
-        private static FieldType GetFieldTypeFromProtoType(FieldDescriptorProto.Types.Type type)
-        {
-            switch (type)
-            {
-                case FieldDescriptorProto.Types.Type.Double:
-                    return FieldType.Double;
-                case FieldDescriptorProto.Types.Type.Float:
-                    return FieldType.Float;
-                case FieldDescriptorProto.Types.Type.Int64:
-                    return FieldType.Int64;
-                case FieldDescriptorProto.Types.Type.Uint64:
-                    return FieldType.UInt64;
-                case FieldDescriptorProto.Types.Type.Int32:
-                    return FieldType.Int32;
-                case FieldDescriptorProto.Types.Type.Fixed64:
-                    return FieldType.Fixed64;
-                case FieldDescriptorProto.Types.Type.Fixed32:
-                    return FieldType.Fixed32;
-                case FieldDescriptorProto.Types.Type.Bool:
-                    return FieldType.Bool;
-                case FieldDescriptorProto.Types.Type.String:
-                    return FieldType.String;
-                case FieldDescriptorProto.Types.Type.Group:
-                    return FieldType.Group;
-                case FieldDescriptorProto.Types.Type.Message:
-                    return FieldType.Message;
-                case FieldDescriptorProto.Types.Type.Bytes:
-                    return FieldType.Bytes;
-                case FieldDescriptorProto.Types.Type.Uint32:
-                    return FieldType.UInt32;
-                case FieldDescriptorProto.Types.Type.Enum:
-                    return FieldType.Enum;
-                case FieldDescriptorProto.Types.Type.Sfixed32:
-                    return FieldType.SFixed32;
-                case FieldDescriptorProto.Types.Type.Sfixed64:
-                    return FieldType.SFixed64;
-                case FieldDescriptorProto.Types.Type.Sint32:
-                    return FieldType.SInt32;
-                case FieldDescriptorProto.Types.Type.Sint64:
-                    return FieldType.SInt64;
-                default:
-                    throw new ArgumentException("Invalid type specified");
-            }
-        }
-
-        /// <summary>
-        /// Returns <c>true</c> if this field is a repeated field; <c>false</c> otherwise.
-        /// </summary>
-        public bool IsRepeated => Proto.Label == FieldDescriptorProto.Types.Label.Repeated;
-
-        /// <summary>
-        /// Returns <c>true</c> if this field is a map field; <c>false</c> otherwise.
-        /// </summary>
-        public bool IsMap => fieldType == FieldType.Message && messageType.Proto.Options != null && messageType.Proto.Options.MapEntry;
-
-        /// <summary>
-        /// Returns <c>true</c> if this field is a packed, repeated field; <c>false</c> otherwise.
-        /// </summary>
-        public bool IsPacked => 
-            // Note the || rather than && here - we're effectively defaulting to packed, because that *is*
-            // the default in proto3, which is all we support. We may give the wrong result for the protos
-            // within descriptor.proto, but that's okay, as they're never exposed and we don't use IsPacked
-            // within the runtime.
-            Proto.Options == null || Proto.Options.Packed;
-        
-        /// <summary>
-        /// Returns the type of the field.
-        /// </summary>
-        public FieldType FieldType => fieldType;
-
-        /// <summary>
-        /// Returns the field number declared in the proto file.
-        /// </summary>
-        public int FieldNumber => Proto.Number;
-
-        /// <summary>
-        /// Compares this descriptor with another one, ordering in "canonical" order
-        /// which simply means ascending order by field number. <paramref name="other"/>
-        /// must be a field of the same type, i.e. the <see cref="ContainingType"/> of
-        /// both fields must be the same.
-        /// </summary>
-        public int CompareTo(FieldDescriptor other)
-        {
-            if (other.ContainingType != ContainingType)
-            {
-                throw new ArgumentException("FieldDescriptors can only be compared to other FieldDescriptors " +
-                                            "for fields of the same message type.");
-            }
-            return FieldNumber - other.FieldNumber;
-        }
-
-        /// <summary>
-        /// For enum fields, returns the field's type.
-        /// </summary>
-        public EnumDescriptor EnumType
-        {
-            get
-            {
-                if (fieldType != FieldType.Enum)
-                {
-                    throw new InvalidOperationException("EnumType is only valid for enum fields.");
-                }
-                return enumType;
-            }
-        }
-
-        /// <summary>
-        /// For embedded message and group fields, returns the field's type.
-        /// </summary>
-        public MessageDescriptor MessageType
-        {
-            get
-            {
-                if (fieldType != FieldType.Message)
-                {
-                    throw new InvalidOperationException("MessageType is only valid for message fields.");
-                }
-                return messageType;
-            }
-        }
-
-        /// <summary>
-        /// Look up and cross-link all field types etc.
-        /// </summary>
-        internal void CrossLink()
-        {
-            if (Proto.TypeName != "")
-            {
-                IDescriptor typeDescriptor =
-                    File.DescriptorPool.LookupSymbol(Proto.TypeName, this);
-
-                if (Proto.Type != 0)
-                {
-                    // Choose field type based on symbol.
-                    if (typeDescriptor is MessageDescriptor)
-                    {
-                        fieldType = FieldType.Message;
-                    }
-                    else if (typeDescriptor is EnumDescriptor)
-                    {
-                        fieldType = FieldType.Enum;
-                    }
-                    else
-                    {
-                        throw new DescriptorValidationException(this, $"\"{Proto.TypeName}\" is not a type.");
-                    }
-                }
-
-                if (fieldType == FieldType.Message)
-                {
-                    if (!(typeDescriptor is MessageDescriptor))
-                    {
-                        throw new DescriptorValidationException(this, $"\"{Proto.TypeName}\" is not a message type.");
-                    }
-                    messageType = (MessageDescriptor) typeDescriptor;
-
-                    if (Proto.DefaultValue != "")
-                    {
-                        throw new DescriptorValidationException(this, "Messages can't have default values.");
-                    }
-                }
-                else if (fieldType == FieldType.Enum)
-                {
-                    if (!(typeDescriptor is EnumDescriptor))
-                    {
-                        throw new DescriptorValidationException(this, $"\"{Proto.TypeName}\" is not an enum type.");
-                    }
-                    enumType = (EnumDescriptor) typeDescriptor;
-                }
-                else
-                {
-                    throw new DescriptorValidationException(this, "Field with primitive type has type_name.");
-                }
-            }
-            else
-            {
-                if (fieldType == FieldType.Message || fieldType == FieldType.Enum)
-                {
-                    throw new DescriptorValidationException(this, "Field with message or enum type missing type_name.");
-                }
-            }
-
-            // Note: no attempt to perform any default value parsing
-
-            File.DescriptorPool.AddFieldByNumber(this);
-
-            if (ContainingType != null && ContainingType.Proto.Options != null && ContainingType.Proto.Options.MessageSetWireFormat)
-            {
-                throw new DescriptorValidationException(this, "MessageSet format is not supported.");
-            }
-            accessor = CreateAccessor();
-        }
-
-        private IFieldAccessor CreateAccessor()
-        {
-            // If we're given no property name, that's because we really don't want an accessor.
-            // (At the moment, that means it's a map entry message...)
-            if (propertyName == null)
-            {
-                return null;
-            }
-            var property = ContainingType.ClrType.GetProperty(propertyName);
-            if (property == null)
-            {
-                throw new DescriptorValidationException(this, $"Property {propertyName} not found in {ContainingType.ClrType}");
-            }
-            return IsMap ? new MapFieldAccessor(property, this)
-                : IsRepeated ? new RepeatedFieldAccessor(property, this)
-                : (IFieldAccessor) new SingleFieldAccessor(property, this);
-        }
-    }
-}

+ 0 - 113
csharp/src/Google.Protobuf/Reflection/FieldType.cs

@@ -1,113 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc.  All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// 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
-
-namespace Google.Protobuf.Reflection
-{
-    /// <summary>
-    /// Enumeration of all the possible field types.
-    /// </summary>
-    public enum FieldType
-    {
-        /// <summary>
-        /// The <c>double</c> field type.
-        /// </summary>
-        Double,
-        /// <summary>
-        /// The <c>float</c> field type.
-        /// </summary>
-        Float,
-        /// <summary>
-        /// The <c>int64</c> field type.
-        /// </summary>
-        Int64,
-        /// <summary>
-        /// The <c>uint64</c> field type.
-        /// </summary>
-        UInt64,
-        /// <summary>
-        /// The <c>int32</c> field type.
-        /// </summary>
-        Int32,
-        /// <summary>
-        /// The <c>fixed64</c> field type.
-        /// </summary>
-        Fixed64,
-        /// <summary>
-        /// The <c>fixed32</c> field type.
-        /// </summary>
-        Fixed32,
-        /// <summary>
-        /// The <c>bool</c> field type.
-        /// </summary>
-        Bool,
-        /// <summary>
-        /// The <c>string</c> field type.
-        /// </summary>
-        String,
-        /// <summary>
-        /// The field type used for groups (not supported in this implementation).
-        /// </summary>
-        Group,
-        /// <summary>
-        /// The field type used for message fields.
-        /// </summary>
-        Message,
-        /// <summary>
-        /// The <c>bytes</c> field type.
-        /// </summary>
-        Bytes,
-        /// <summary>
-        /// The <c>uint32</c> field type.
-        /// </summary>
-        UInt32,
-        /// <summary>
-        /// The <c>sfixed32</c> field type.
-        /// </summary>
-        SFixed32,
-        /// <summary>
-        /// The <c>sfixed64</c> field type.
-        /// </summary>
-        SFixed64,
-        /// <summary>
-        /// The <c>sint32</c> field type.
-        /// </summary>
-        SInt32,
-        /// <summary>
-        /// The <c>sint64</c> field type.
-        /// </summary>
-        SInt64,
-        /// <summary>
-        /// The field type used for enum fields.
-        /// </summary>
-        Enum
-    }
-}

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini