Regenerate all C# code and make it compile

JSON tests fail, as we're not using OriginalNameAttribute yet.
diff --git a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
index 38ba227..c616470 100644
--- a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
+++ b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
@@ -58,7 +58,7 @@
             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.FOREIGN_BAZ, "Enum"),
+                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"),
         };
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
index 5c2a052..8b153d6 100644
--- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
+++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
@@ -66,13 +66,13 @@
             Assert.AreEqual(0, message.SingleFixed32);

             Assert.AreEqual(0L, message.SingleFixed64);

             Assert.AreEqual(0.0f, message.SingleFloat);

-            Assert.AreEqual(ForeignEnum.FOREIGN_UNSPECIFIED, message.SingleForeignEnum);

+            Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum);

             Assert.IsNull(message.SingleForeignMessage);

-            Assert.AreEqual(ImportEnum.IMPORT_ENUM_UNSPECIFIED, message.SingleImportEnum);

+            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.NESTED_ENUM_UNSPECIFIED, message.SingleNestedEnum);

+            Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum);

             Assert.IsNull(message.SingleNestedMessage);

             Assert.IsNull(message.SinglePublicImportMessage);

             Assert.AreEqual(0, message.SingleSfixed32);

@@ -145,13 +145,13 @@
                 SingleFixed32 = 23,

                 SingleFixed64 = 1234567890123,

                 SingleFloat = 12.25f,

-                SingleForeignEnum = ForeignEnum.FOREIGN_BAR,

+                SingleForeignEnum = ForeignEnum.ForeignBar,

                 SingleForeignMessage = new ForeignMessage { C = 10 },

-                SingleImportEnum = ImportEnum.IMPORT_BAZ,

+                SingleImportEnum = ImportEnum.ImportBaz,

                 SingleImportMessage = new ImportMessage { D = 20 },

                 SingleInt32 = 100,

                 SingleInt64 = 3210987654321,

-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.FOO,

+                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,

                 SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 },

                 SinglePublicImportMessage = new PublicImportMessage { E = 54 },

                 SingleSfixed32 = -123,

@@ -179,13 +179,13 @@
                 RepeatedFixed32 = { uint.MaxValue, 23 },

                 RepeatedFixed64 = { ulong.MaxValue, 1234567890123 },

                 RepeatedFloat = { 100f, 12.25f },

-                RepeatedForeignEnum = { ForeignEnum.FOREIGN_FOO, ForeignEnum.FOREIGN_BAR },

+                RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar },

                 RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } },

-                RepeatedImportEnum = { ImportEnum.IMPORT_BAZ, ImportEnum.IMPORT_ENUM_UNSPECIFIED },

+                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 },

+                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 },

@@ -224,8 +224,8 @@
                     { 5, new ForeignMessage() },

                 },

                 MapInt32Enum = {

-                    { 1, MapEnum.MAP_ENUM_BAR },

-                    { 2000, MapEnum.MAP_ENUM_FOO }

+                    { 1, MapEnum.Bar },

+                    { 2000, MapEnum.Foo }

                 }

             };

 

@@ -249,7 +249,7 @@
             Assert.AreEqual(1, parsed.MapInt32Bytes.Count);

             Assert.AreEqual(ByteString.Empty, parsed.MapInt32Bytes[0]);

         }

-        

+

         [Test]

         public void MapWithOnlyValue()

         {

@@ -449,7 +449,7 @@
                 SingleFloat = 12.25f,

                 SingleInt32 = 100,

                 SingleInt64 = 3210987654321,

-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.FOO,

+                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,

                 SingleSfixed32 = -123,

                 SingleSfixed64 = -12345678901234,

                 SingleSint32 = -456,

@@ -479,7 +479,7 @@
                 RepeatedFloat = { 100f, 12.25f },

                 RepeatedInt32 = { 100, 200 },

                 RepeatedInt64 = { 3210987654321, long.MaxValue },

-                RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.FOO, TestAllTypes.Types.NestedEnum.NEG },

+                RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg },

                 RepeatedSfixed32 = { -123, 123 },

                 RepeatedSfixed64 = { -12345678901234, 12345678901234 },

                 RepeatedSint32 = { -456, 100 },

@@ -670,7 +670,7 @@
         {

             // 130, 3 is the message tag

             // 1 is the data length - but there's no data.

-            var data = new byte[] { 130, 3, 1 };            

+            var data = new byte[] { 130, 3, 1 };

             Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(data));

         }

 

@@ -720,4 +720,4 @@
             Assert.AreEqual("{ \"c\": 31 }", writer.ToString());

         }

     }

-}

+}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
index 344d727..0b6cd7e 100644
--- a/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
@@ -75,13 +75,13 @@
                 SingleFixed32 = 23,
                 SingleFixed64 = 1234567890123,
                 SingleFloat = 12.25f,
-                SingleForeignEnum = ForeignEnum.FOREIGN_BAR,
+                SingleForeignEnum = ForeignEnum.ForeignBar,
                 SingleForeignMessage = new ForeignMessage { C = 10 },
-                SingleImportEnum = ImportEnum.IMPORT_BAZ,
+                SingleImportEnum = ImportEnum.ImportBaz,
                 SingleImportMessage = new ImportMessage { D = 20 },
                 SingleInt32 = 100,
                 SingleInt64 = 3210987654321,
-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.FOO,
+                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,
                 SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 },
                 SinglePublicImportMessage = new PublicImportMessage { E = 54 },
                 SingleSfixed32 = -123,
@@ -174,14 +174,14 @@
         [Test]
         public void UnknownEnumValueNumeric_RepeatedField()
         {
-            var message = new TestAllTypes { RepeatedForeignEnum = { ForeignEnum.FOREIGN_BAZ, (ForeignEnum) 100, ForeignEnum.FOREIGN_FOO } };
+            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.MAP_ENUM_FOO }, { 2, (MapEnum) 100 }, { 3, MapEnum.MAP_ENUM_BAR } } };
+            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));
         }
 
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index d21da58..684f52b 100644
--- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -142,8 +142,8 @@
         [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);
+            IMessage parsed = (IMessage)Activator.CreateInstance(wrapperType);
+            IMessage expected = (IMessage)Activator.CreateInstance(wrapperType);
             JsonParser.Default.Merge(parsed, "null");
             Assert.AreEqual(expected, parsed);
 
@@ -640,7 +640,7 @@
             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")]
@@ -886,9 +886,9 @@
         }
 
         [Test]
-        [TestCase("\"FOREIGN_BAR\"", ForeignEnum.FOREIGN_BAR)]
-        [TestCase("5", ForeignEnum.FOREIGN_BAR)]
-        [TestCase("100", (ForeignEnum) 100)]
+        [TestCase("\"FOREIGN_BAR\"", ForeignEnum.ForeignBar)]
+        [TestCase("5", ForeignEnum.ForeignBar)]
+        [TestCase("100", (ForeignEnum)100)]
         public void EnumValid(string value, ForeignEnum expectedValue)
         {
             string json = "{ \"singleForeignEnum\": " + value + " }";
@@ -922,4 +922,4 @@
             return '"' + text + '"';
         }
     }
-}
+}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
index 086a4e9..52d5a67 100644
--- a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
@@ -195,7 +195,7 @@
             Assert.AreEqual(value, enumType.Values[1]);
             Assert.AreEqual("FOREIGN_FOO", value.Name);
             Assert.AreEqual(4, value.Number);
-            Assert.AreEqual((int) ForeignEnum.FOREIGN_FOO, 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++)
diff --git a/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
index 936e41c..a488af3 100644
--- a/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
@@ -128,7 +128,7 @@
             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.FOREIGN_FOO);
+            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);
 
@@ -138,7 +138,7 @@
                 SingleInt32 = 500,
                 SingleString = "It's a string",
                 SingleBytes = ByteString.CopyFrom(99, 98, 97),
-                SingleForeignEnum = ForeignEnum.FOREIGN_FOO,
+                SingleForeignEnum = ForeignEnum.ForeignFoo,
                 SingleForeignMessage = new ForeignMessage { C = 12345 },
                 SingleDouble = 20150701.5
             };
diff --git a/csharp/src/Google.Protobuf.Test/SampleMessages.cs b/csharp/src/Google.Protobuf.Test/SampleMessages.cs
index 8a9c7f8..ffa4e2a 100644
--- a/csharp/src/Google.Protobuf.Test/SampleMessages.cs
+++ b/csharp/src/Google.Protobuf.Test/SampleMessages.cs
@@ -54,13 +54,13 @@
                 SingleFixed32 = 23,
                 SingleFixed64 = 1234567890123,
                 SingleFloat = 12.25f,
-                SingleForeignEnum = ForeignEnum.FOREIGN_BAR,
+                SingleForeignEnum = ForeignEnum.ForeignBar,
                 SingleForeignMessage = new ForeignMessage { C = 10 },
-                SingleImportEnum = ImportEnum.IMPORT_BAZ,
+                SingleImportEnum = ImportEnum.ImportBaz,
                 SingleImportMessage = new ImportMessage { D = 20 },
                 SingleInt32 = 100,
                 SingleInt64 = 3210987654321,
-                SingleNestedEnum = TestAllTypes.Types.NestedEnum.FOO,
+                SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo,
                 SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 },
                 SinglePublicImportMessage = new PublicImportMessage { E = 54 },
                 SingleSfixed32 = -123,
@@ -76,13 +76,13 @@
                 RepeatedFixed32 = { UInt32.MaxValue, 23 },
                 RepeatedFixed64 = { UInt64.MaxValue, 1234567890123 },
                 RepeatedFloat = { 100f, 12.25f },
-                RepeatedForeignEnum = { ForeignEnum.FOREIGN_FOO, ForeignEnum.FOREIGN_BAR },
+                RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar },
                 RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } },
-                RepeatedImportEnum = { ImportEnum.IMPORT_BAZ, ImportEnum.IMPORT_ENUM_UNSPECIFIED },
+                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 },
+                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 },
@@ -92,8 +92,8 @@
                 RepeatedString = { "foo", "bar" },
                 RepeatedUint32 = { UInt32.MaxValue, UInt32.MinValue },
                 RepeatedUint64 = { UInt64.MaxValue, UInt32.MinValue },
-                OneofString = "Oneof string"                
+                OneofString = "Oneof string"
             };
         }
     }
-}
+}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/TestCornerCases.cs b/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
index 03fa185..248f5fa 100644
--- a/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
+++ b/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
@@ -43,8 +43,8 @@
             NegativeEnumMessage msg = new NegativeEnumMessage

             {

                 Value = NegativeEnum.MinusOne,

-                Values = { NegativeEnum.NEGATIVE_ENUM_ZERO, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },

-                PackedValues = { NegativeEnum.NEGATIVE_ENUM_ZERO, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }

+                Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },

+                PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }

             };

 

             Assert.AreEqual(58, msg.CalculateSize());

diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
index 27c0478..3ba4a2b 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
@@ -164,9 +164,9 @@
   }
   #region Enums
   public enum MapEnum {
-    MAP_ENUM_FOO = 0,
-    MAP_ENUM_BAR = 1,
-    MAP_ENUM_BAZ = 2,
+    [pbr::OriginalName("MAP_ENUM_FOO")] Foo = 0,
+    [pbr::OriginalName("MAP_ENUM_BAR")] Bar = 1,
+    [pbr::OriginalName("MAP_ENUM_BAZ")] Baz = 2,
   }
 
   #endregion
@@ -1358,7 +1358,7 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     public static partial class Types {
       public enum Type {
-        TYPE_FOO = 0,
+        [pbr::OriginalName("TYPE_FOO")] Foo = 0,
       }
 
     }
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
index 7b824dc..263e17c 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
@@ -42,10 +42,10 @@
   }
   #region Enums
   public enum ImportEnum {
-    IMPORT_ENUM_UNSPECIFIED = 0,
-    IMPORT_FOO = 7,
-    IMPORT_BAR = 8,
-    IMPORT_BAZ = 9,
+    [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
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
index 586f01c..7d4451b 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
@@ -66,14 +66,14 @@
   }
   #region Enums
   public enum NegativeEnum {
-    NEGATIVE_ENUM_ZERO = 0,
-    FiveBelow = -5,
-    MinusOne = -1,
+    [pbr::OriginalName("NEGATIVE_ENUM_ZERO")] Zero = 0,
+    [pbr::OriginalName("FiveBelow")] FiveBelow = -5,
+    [pbr::OriginalName("MinusOne")] MinusOne = -1,
   }
 
   public enum DeprecatedEnum {
-    DEPRECATED_ZERO = 0,
-    one = 1,
+    [pbr::OriginalName("DEPRECATED_ZERO")] DeprecatedZero = 0,
+    [pbr::OriginalName("one")] One = 1,
   }
 
   #endregion
@@ -356,7 +356,7 @@
 
     /// <summary>Field number for the "value" field.</summary>
     public const int ValueFieldNumber = 1;
-    private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO;
+    private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = 0;
     public global::UnitTest.Issues.TestProtos.NegativeEnum Value {
       get { return value_; }
       set {
@@ -401,7 +401,7 @@
 
     public override int GetHashCode() {
       int hash = 1;
-      if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) hash ^= Value.GetHashCode();
+      if (Value != 0) hash ^= Value.GetHashCode();
       hash ^= values_.GetHashCode();
       hash ^= packedValues_.GetHashCode();
       return hash;
@@ -412,7 +412,7 @@
     }
 
     public void WriteTo(pb::CodedOutputStream output) {
-      if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) {
+      if (Value != 0) {
         output.WriteRawTag(8);
         output.WriteEnum((int) Value);
       }
@@ -422,7 +422,7 @@
 
     public int CalculateSize() {
       int size = 0;
-      if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) {
+      if (Value != 0) {
         size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Value);
       }
       size += values_.CalculateSize(_repeated_values_codec);
@@ -434,7 +434,7 @@
       if (other == null) {
         return;
       }
-      if (other.Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) {
+      if (other.Value != 0) {
         Value = other.Value;
       }
       values_.Add(other.values_);
@@ -620,7 +620,7 @@
 
     /// <summary>Field number for the "EnumValue" field.</summary>
     public const int EnumValueFieldNumber = 5;
-    private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO;
+    private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = 0;
     [global::System.ObsoleteAttribute()]
     public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue {
       get { return enumValue_; }
@@ -665,7 +665,7 @@
       hash ^= primitiveArray_.GetHashCode();
       if (messageValue_ != null) hash ^= MessageValue.GetHashCode();
       hash ^= messageArray_.GetHashCode();
-      if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) hash ^= EnumValue.GetHashCode();
+      if (EnumValue != 0) hash ^= EnumValue.GetHashCode();
       hash ^= enumArray_.GetHashCode();
       return hash;
     }
@@ -685,7 +685,7 @@
         output.WriteMessage(MessageValue);
       }
       messageArray_.WriteTo(output, _repeated_messageArray_codec);
-      if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) {
+      if (EnumValue != 0) {
         output.WriteRawTag(40);
         output.WriteEnum((int) EnumValue);
       }
@@ -702,7 +702,7 @@
         size += 1 + pb::CodedOutputStream.ComputeMessageSize(MessageValue);
       }
       size += messageArray_.CalculateSize(_repeated_messageArray_codec);
-      if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) {
+      if (EnumValue != 0) {
         size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnumValue);
       }
       size += enumArray_.CalculateSize(_repeated_enumArray_codec);
@@ -724,7 +724,7 @@
         MessageValue.MergeFrom(other.MessageValue);
       }
       messageArray_.Add(other.messageArray_);
-      if (other.EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) {
+      if (other.EnumValue != 0) {
         EnumValue = other.EnumValue;
       }
       enumArray_.Add(other.enumArray_);
@@ -1435,7 +1435,7 @@
     public const int NameFieldNumber = 1;
     private string name_ = "";
     /// <summary>
-    ///  json_name field options are not properly handled during deserialization
+    ///  Message for testing the effects for of the json_name option
     /// </summary>
     public string Name {
       get { return name_; }
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
index d846544..b8d159b 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
@@ -193,39 +193,39 @@
   }
   #region Enums
   public enum ForeignEnum {
-    FOREIGN_UNSPECIFIED = 0,
-    FOREIGN_FOO = 4,
-    FOREIGN_BAR = 5,
-    FOREIGN_BAZ = 6,
+    [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 {
-    TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0,
-    FOO1 = 1,
-    BAR1 = 2,
-    BAZ = 3,
-    FOO2 = 1,
-    BAR2 = 2,
+    [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 {
-    TEST_SPARSE_ENUM_UNSPECIFIED = 0,
-    SPARSE_A = 123,
-    SPARSE_B = 62374,
-    SPARSE_C = 12589234,
-    SPARSE_D = -15,
-    SPARSE_E = -53452,
+    [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>
-    SPARSE_G = 2,
+    [pbr::OriginalName("SPARSE_G")] SparseG = 2,
   }
 
   #endregion
@@ -505,7 +505,7 @@
 
     /// <summary>Field number for the "single_nested_enum" field.</summary>
     public const int SingleNestedEnumFieldNumber = 21;
-    private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum singleNestedEnum_ = global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.NESTED_ENUM_UNSPECIFIED;
+    private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum singleNestedEnum_ = 0;
     public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum SingleNestedEnum {
       get { return singleNestedEnum_; }
       set {
@@ -515,7 +515,7 @@
 
     /// <summary>Field number for the "single_foreign_enum" field.</summary>
     public const int SingleForeignEnumFieldNumber = 22;
-    private global::Google.Protobuf.TestProtos.ForeignEnum singleForeignEnum_ = global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED;
+    private global::Google.Protobuf.TestProtos.ForeignEnum singleForeignEnum_ = 0;
     public global::Google.Protobuf.TestProtos.ForeignEnum SingleForeignEnum {
       get { return singleForeignEnum_; }
       set {
@@ -525,7 +525,7 @@
 
     /// <summary>Field number for the "single_import_enum" field.</summary>
     public const int SingleImportEnumFieldNumber = 23;
-    private global::Google.Protobuf.TestProtos.ImportEnum singleImportEnum_ = global::Google.Protobuf.TestProtos.ImportEnum.IMPORT_ENUM_UNSPECIFIED;
+    private global::Google.Protobuf.TestProtos.ImportEnum singleImportEnum_ = 0;
     public global::Google.Protobuf.TestProtos.ImportEnum SingleImportEnum {
       get { return singleImportEnum_; }
       set {
@@ -892,9 +892,9 @@
       if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode();
       if (singleForeignMessage_ != null) hash ^= SingleForeignMessage.GetHashCode();
       if (singleImportMessage_ != null) hash ^= SingleImportMessage.GetHashCode();
-      if (SingleNestedEnum != global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.NESTED_ENUM_UNSPECIFIED) hash ^= SingleNestedEnum.GetHashCode();
-      if (SingleForeignEnum != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) hash ^= SingleForeignEnum.GetHashCode();
-      if (SingleImportEnum != global::Google.Protobuf.TestProtos.ImportEnum.IMPORT_ENUM_UNSPECIFIED) hash ^= SingleImportEnum.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();
@@ -1003,15 +1003,15 @@
         output.WriteRawTag(162, 1);
         output.WriteMessage(SingleImportMessage);
       }
-      if (SingleNestedEnum != global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.NESTED_ENUM_UNSPECIFIED) {
+      if (SingleNestedEnum != 0) {
         output.WriteRawTag(168, 1);
         output.WriteEnum((int) SingleNestedEnum);
       }
-      if (SingleForeignEnum != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) {
+      if (SingleForeignEnum != 0) {
         output.WriteRawTag(176, 1);
         output.WriteEnum((int) SingleForeignEnum);
       }
-      if (SingleImportEnum != global::Google.Protobuf.TestProtos.ImportEnum.IMPORT_ENUM_UNSPECIFIED) {
+      if (SingleImportEnum != 0) {
         output.WriteRawTag(184, 1);
         output.WriteEnum((int) SingleImportEnum);
       }
@@ -1115,13 +1115,13 @@
       if (singleImportMessage_ != null) {
         size += 2 + pb::CodedOutputStream.ComputeMessageSize(SingleImportMessage);
       }
-      if (SingleNestedEnum != global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.NESTED_ENUM_UNSPECIFIED) {
+      if (SingleNestedEnum != 0) {
         size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) SingleNestedEnum);
       }
-      if (SingleForeignEnum != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) {
+      if (SingleForeignEnum != 0) {
         size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) SingleForeignEnum);
       }
-      if (SingleImportEnum != global::Google.Protobuf.TestProtos.ImportEnum.IMPORT_ENUM_UNSPECIFIED) {
+      if (SingleImportEnum != 0) {
         size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) SingleImportEnum);
       }
       if (singlePublicImportMessage_ != null) {
@@ -1231,13 +1231,13 @@
         }
         SingleImportMessage.MergeFrom(other.SingleImportMessage);
       }
-      if (other.SingleNestedEnum != global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.NESTED_ENUM_UNSPECIFIED) {
+      if (other.SingleNestedEnum != 0) {
         SingleNestedEnum = other.SingleNestedEnum;
       }
-      if (other.SingleForeignEnum != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) {
+      if (other.SingleForeignEnum != 0) {
         SingleForeignEnum = other.SingleForeignEnum;
       }
-      if (other.SingleImportEnum != global::Google.Protobuf.TestProtos.ImportEnum.IMPORT_ENUM_UNSPECIFIED) {
+      if (other.SingleImportEnum != 0) {
         SingleImportEnum = other.SingleImportEnum;
       }
       if (other.singlePublicImportMessage_ != null) {
@@ -1526,14 +1526,14 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     public static partial class Types {
       public enum NestedEnum {
-        NESTED_ENUM_UNSPECIFIED = 0,
-        FOO = 1,
-        BAR = 2,
-        BAZ = 3,
+        [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>
-        NEG = -1,
+        [pbr::OriginalName("NEG")] Neg = -1,
       }
 
       [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2793,7 +2793,7 @@
 
     /// <summary>Field number for the "EnumField" field.</summary>
     public const int EnumFieldFieldNumber = 3;
-    private global::Google.Protobuf.TestProtos.ForeignEnum enumField_ = global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED;
+    private global::Google.Protobuf.TestProtos.ForeignEnum enumField_ = 0;
     public global::Google.Protobuf.TestProtos.ForeignEnum EnumField {
       get { return enumField_; }
       set {
@@ -2873,7 +2873,7 @@
       int hash = 1;
       if (PrimitiveField != 0) hash ^= PrimitiveField.GetHashCode();
       if (StringField.Length != 0) hash ^= StringField.GetHashCode();
-      if (EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) hash ^= EnumField.GetHashCode();
+      if (EnumField != 0) hash ^= EnumField.GetHashCode();
       if (messageField_ != null) hash ^= MessageField.GetHashCode();
       hash ^= repeatedPrimitiveField_.GetHashCode();
       hash ^= repeatedStringField_.GetHashCode();
@@ -2895,7 +2895,7 @@
         output.WriteRawTag(18);
         output.WriteString(StringField);
       }
-      if (EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) {
+      if (EnumField != 0) {
         output.WriteRawTag(24);
         output.WriteEnum((int) EnumField);
       }
@@ -2917,7 +2917,7 @@
       if (StringField.Length != 0) {
         size += 1 + pb::CodedOutputStream.ComputeStringSize(StringField);
       }
-      if (EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) {
+      if (EnumField != 0) {
         size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnumField);
       }
       if (messageField_ != null) {
@@ -2940,7 +2940,7 @@
       if (other.StringField.Length != 0) {
         StringField = other.StringField;
       }
-      if (other.EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) {
+      if (other.EnumField != 0) {
         EnumField = other.EnumField;
       }
       if (other.messageField_ != null) {
@@ -3370,7 +3370,7 @@
 
     /// <summary>Field number for the "sparse_enum" field.</summary>
     public const int SparseEnumFieldNumber = 1;
-    private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED;
+    private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = 0;
     public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum {
       get { return sparseEnum_; }
       set {
@@ -3395,7 +3395,7 @@
 
     public override int GetHashCode() {
       int hash = 1;
-      if (SparseEnum != global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED) hash ^= SparseEnum.GetHashCode();
+      if (SparseEnum != 0) hash ^= SparseEnum.GetHashCode();
       return hash;
     }
 
@@ -3404,7 +3404,7 @@
     }
 
     public void WriteTo(pb::CodedOutputStream output) {
-      if (SparseEnum != global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED) {
+      if (SparseEnum != 0) {
         output.WriteRawTag(8);
         output.WriteEnum((int) SparseEnum);
       }
@@ -3412,7 +3412,7 @@
 
     public int CalculateSize() {
       int size = 0;
-      if (SparseEnum != global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED) {
+      if (SparseEnum != 0) {
         size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) SparseEnum);
       }
       return size;
@@ -3422,7 +3422,7 @@
       if (other == null) {
         return;
       }
-      if (other.SparseEnum != global::Google.Protobuf.TestProtos.TestSparseEnum.TEST_SPARSE_ENUM_UNSPECIFIED) {
+      if (other.SparseEnum != 0) {
         SparseEnum = other.SparseEnum;
       }
     }