aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf.Test
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf.Test')
-rw-r--r--[-rwxr-xr-x]csharp/src/Google.Protobuf.Test/ByteStringTest.cs0
-rw-r--r--csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs83
-rw-r--r--[-rwxr-xr-x]csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs0
-rw-r--r--[-rwxr-xr-x]csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs0
-rw-r--r--[-rwxr-xr-x]csharp/src/Google.Protobuf.Test/FieldCodecTest.cs0
-rw-r--r--csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj8
-rw-r--r--csharp/src/Google.Protobuf.Test/JsonParserTest.cs16
-rwxr-xr-xcsharp/src/Google.Protobuf.Test/Program.cs48
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs2
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs20
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs6
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs2
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs24
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs20
14 files changed, 140 insertions, 89 deletions
diff --git a/csharp/src/Google.Protobuf.Test/ByteStringTest.cs b/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
index afdd491f..afdd491f 100755..100644
--- a/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
+++ b/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
diff --git a/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
index e7c6b805..8795fa65 100644
--- a/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
+++ b/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs
@@ -615,5 +615,88 @@ namespace Google.Protobuf
var stream = new CodedInputStream(new byte[10]);
stream.Dispose();
}
+
+ [Test]
+ public void TestParseMessagesCloseTo2G()
+ {
+ byte[] serializedMessage = GenerateBigSerializedMessage();
+ // How many of these big messages do we need to take us near our 2GB limit?
+ int count = Int32.MaxValue / serializedMessage.Length;
+ // Now make a MemoryStream that will fake a near-2GB stream of messages by returning
+ // our big serialized message 'count' times.
+ using (RepeatingMemoryStream stream = new RepeatingMemoryStream(serializedMessage, count))
+ {
+ Assert.DoesNotThrow(()=>TestAllTypes.Parser.ParseFrom(stream));
+ }
+ }
+
+ [Test]
+ public void TestParseMessagesOver2G()
+ {
+ byte[] serializedMessage = GenerateBigSerializedMessage();
+ // How many of these big messages do we need to take us near our 2GB limit?
+ int count = Int32.MaxValue / serializedMessage.Length;
+ // Now add one to take us over the 2GB limit
+ count++;
+ // Now make a MemoryStream that will fake a near-2GB stream of messages by returning
+ // our big serialized message 'count' times.
+ using (RepeatingMemoryStream stream = new RepeatingMemoryStream(serializedMessage, count))
+ {
+ Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(stream),
+ "Protocol message was too large. May be malicious. " +
+ "Use CodedInputStream.SetSizeLimit() to increase the size limit.");
+ }
+ }
+
+ /// <returns>A serialized big message</returns>
+ private static byte[] GenerateBigSerializedMessage()
+ {
+ byte[] value = new byte[16 * 1024 * 1024];
+ TestAllTypes message = SampleMessages.CreateFullTestAllTypes();
+ message.SingleBytes = ByteString.CopyFrom(value);
+ return message.ToByteArray();
+ }
+
+ /// <summary>
+ /// A MemoryStream that repeats a byte arrays' content a number of times.
+ /// Simulates really large input without consuming loads of memory. Used above
+ /// to test the parsing behavior when the input size exceeds 2GB or close to it.
+ /// </summary>
+ private class RepeatingMemoryStream: MemoryStream
+ {
+ private readonly byte[] bytes;
+ private readonly int maxIterations;
+ private int index = 0;
+
+ public RepeatingMemoryStream(byte[] bytes, int maxIterations)
+ {
+ this.bytes = bytes;
+ this.maxIterations = maxIterations;
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ if (bytes.Length == 0)
+ {
+ return 0;
+ }
+ int numBytesCopiedTotal = 0;
+ while (numBytesCopiedTotal < count && index < maxIterations)
+ {
+ int numBytesToCopy = Math.Min(bytes.Length - (int)Position, count);
+ Array.Copy(bytes, (int)Position, buffer, offset, numBytesToCopy);
+ numBytesCopiedTotal += numBytesToCopy;
+ offset += numBytesToCopy;
+ count -= numBytesCopiedTotal;
+ Position += numBytesToCopy;
+ if (Position >= bytes.Length)
+ {
+ Position = 0;
+ index++;
+ }
+ }
+ return numBytesCopiedTotal;
+ }
+ }
}
} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs b/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs
index 48c0725f..48c0725f 100755..100644
--- a/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs
diff --git a/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs b/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
index abbe3c95..abbe3c95 100755..100644
--- a/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
diff --git a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
index 77641163..77641163 100755..100644
--- a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
+++ b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index 06d07b9f..6a430116 100644
--- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <OutputType>Exe</OutputType>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
@@ -14,8 +13,9 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="NUnit" Version="3.6.1" />
- <PackageReference Include="NUnitLite" Version="3.6.1" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
+ <PackageReference Include="NUnit" Version="3.9.0" />
+ <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
</ItemGroup>
<!--
@@ -26,5 +26,5 @@
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<TargetFrameworks>netcoreapp1.0</TargetFrameworks>
</PropertyGroup>
-
+
</Project>
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index 329ae9be..a6cf04ab 100644
--- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -696,6 +696,22 @@ namespace Google.Protobuf
}
[Test]
+ public void Value_List_WithNullElement()
+ {
+ var expected = Value.ForList(Value.ForString("x"), Value.ForNull(), Value.ForString("y"));
+ var actual = Value.Parser.ParseJson("[\"x\", null, \"y\"]");
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test]
+ public void StructValue_NullElement()
+ {
+ var expected = Value.ForStruct(new Struct { Fields = { { "x", Value.ForNull() } } });
+ var actual = Value.Parser.ParseJson("{ \"x\": null }");
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test]
public void ParseListValue()
{
Assert.AreEqual(new ListValue { Values = { Value.ForNumber(1), Value.ForString("x") } }, ListValue.Parser.ParseJson("[1, \"x\"]"));
diff --git a/csharp/src/Google.Protobuf.Test/Program.cs b/csharp/src/Google.Protobuf.Test/Program.cs
deleted file mode 100755
index 954c02b5..00000000
--- a/csharp/src/Google.Protobuf.Test/Program.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#region Copyright notice and license
-// Protocol Buffers - Google's data interchange format
-// Copyright 2017 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 NUnitLite;
-using System.Reflection;
-
-namespace Google.Protobuf.Test
-{
- class Program
- {
- public static int Main(string[] args)
- {
- #if NET35
- return new AutoRun(typeof(Program).Assembly).Execute(args);
- #else
- return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args);
- #endif
- }
- }
-} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
index cb1bc920..51715a0c 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
@@ -642,7 +642,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMapSubmessage(TestMapSubmessage other) : this() {
- TestMap = other.testMap_ != null ? other.TestMap.Clone() : null;
+ testMap_ = other.testMap_ != null ? other.testMap_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
index a2a236d9..7353be7b 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
@@ -273,13 +273,13 @@ namespace ProtobufTestMessages.Proto3 {
optionalBool_ = other.optionalBool_;
optionalString_ = other.optionalString_;
optionalBytes_ = other.optionalBytes_;
- OptionalNestedMessage = other.optionalNestedMessage_ != null ? other.OptionalNestedMessage.Clone() : null;
- OptionalForeignMessage = other.optionalForeignMessage_ != null ? other.OptionalForeignMessage.Clone() : null;
+ optionalNestedMessage_ = other.optionalNestedMessage_ != null ? other.optionalNestedMessage_.Clone() : null;
+ optionalForeignMessage_ = other.optionalForeignMessage_ != null ? other.optionalForeignMessage_.Clone() : null;
optionalNestedEnum_ = other.optionalNestedEnum_;
optionalForeignEnum_ = other.optionalForeignEnum_;
optionalStringPiece_ = other.optionalStringPiece_;
optionalCord_ = other.optionalCord_;
- RecursiveMessage = other.recursiveMessage_ != null ? other.RecursiveMessage.Clone() : null;
+ recursiveMessage_ = other.recursiveMessage_ != null ? other.recursiveMessage_.Clone() : null;
repeatedInt32_ = other.repeatedInt32_.Clone();
repeatedInt64_ = other.repeatedInt64_.Clone();
repeatedUint32_ = other.repeatedUint32_.Clone();
@@ -338,12 +338,12 @@ namespace ProtobufTestMessages.Proto3 {
repeatedDoubleWrapper_ = other.repeatedDoubleWrapper_.Clone();
repeatedStringWrapper_ = other.repeatedStringWrapper_.Clone();
repeatedBytesWrapper_ = other.repeatedBytesWrapper_.Clone();
- OptionalDuration = other.optionalDuration_ != null ? other.OptionalDuration.Clone() : null;
- OptionalTimestamp = other.optionalTimestamp_ != null ? other.OptionalTimestamp.Clone() : null;
- OptionalFieldMask = other.optionalFieldMask_ != null ? other.OptionalFieldMask.Clone() : null;
- OptionalStruct = other.optionalStruct_ != null ? other.OptionalStruct.Clone() : null;
- OptionalAny = other.optionalAny_ != null ? other.OptionalAny.Clone() : null;
- OptionalValue = other.optionalValue_ != null ? other.OptionalValue.Clone() : null;
+ optionalDuration_ = other.optionalDuration_ != null ? other.optionalDuration_.Clone() : null;
+ optionalTimestamp_ = other.optionalTimestamp_ != null ? other.optionalTimestamp_.Clone() : null;
+ optionalFieldMask_ = other.optionalFieldMask_ != null ? other.optionalFieldMask_.Clone() : null;
+ optionalStruct_ = other.optionalStruct_ != null ? other.optionalStruct_.Clone() : null;
+ optionalAny_ = other.optionalAny_ != null ? other.optionalAny_.Clone() : null;
+ optionalValue_ = other.optionalValue_ != null ? other.optionalValue_.Clone() : null;
repeatedDuration_ = other.repeatedDuration_.Clone();
repeatedTimestamp_ = other.repeatedTimestamp_.Clone();
repeatedFieldmask_ = other.repeatedFieldmask_.Clone();
@@ -3455,7 +3455,7 @@ namespace ProtobufTestMessages.Proto3 {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public NestedMessage(NestedMessage other) : this() {
a_ = other.a_;
- Corecursive = other.corecursive_ != null ? other.Corecursive.Clone() : null;
+ corecursive_ = other.corecursive_ != null ? other.corecursive_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
index 6d02bda6..3ab5a48b 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
@@ -1740,9 +1740,9 @@ namespace UnitTest.Issues.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public ComplexOptionType2(ComplexOptionType2 other) : this() {
- Bar = other.bar_ != null ? other.Bar.Clone() : null;
+ bar_ = other.bar_ != null ? other.bar_.Clone() : null;
baz_ = other.baz_;
- Fred = other.fred_ != null ? other.Fred.Clone() : null;
+ fred_ = other.fred_ != null ? other.fred_.Clone() : null;
barney_ = other.barney_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -2331,7 +2331,7 @@ namespace UnitTest.Issues.TestProtos {
public Aggregate(Aggregate other) : this() {
i_ = other.i_;
s_ = other.s_;
- Sub = other.sub_ != null ? other.Sub.Clone() : null;
+ sub_ = other.sub_ != null ? other.sub_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
index 01a86f8f..819fc201 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
@@ -704,7 +704,7 @@ namespace UnitTest.Issues.TestProtos {
public DeprecatedFieldsMessage(DeprecatedFieldsMessage other) : this() {
primitiveValue_ = other.primitiveValue_;
primitiveArray_ = other.primitiveArray_.Clone();
- MessageValue = other.messageValue_ != null ? other.MessageValue.Clone() : null;
+ messageValue_ = other.messageValue_ != null ? other.messageValue_.Clone() : null;
messageArray_ = other.messageArray_.Clone();
enumValue_ = other.enumValue_;
enumArray_ = other.enumArray_.Clone();
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
index 4242c192..d5dbe866 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
@@ -280,13 +280,13 @@ namespace Google.Protobuf.TestProtos {
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;
+ 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;
+ singlePublicImportMessage_ = other.singlePublicImportMessage_ != null ? other.singlePublicImportMessage_.Clone() : null;
repeatedInt32_ = other.repeatedInt32_.Clone();
repeatedInt64_ = other.repeatedInt64_.Clone();
repeatedUint32_ = other.repeatedUint32_.Clone();
@@ -1786,8 +1786,8 @@ namespace Google.Protobuf.TestProtos {
[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;
+ child_ = other.child_ != null ? other.child_.Clone() : null;
+ payload_ = other.payload_ != null ? other.payload_.Clone() : null;
repeatedChild_ = other.repeatedChild_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -2342,7 +2342,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestForeignNested(TestForeignNested other) : this() {
- ForeignNested = other.foreignNested_ != null ? other.ForeignNested.Clone() : null;
+ foreignNested_ = other.foreignNested_ != null ? other.foreignNested_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -2641,7 +2641,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestRecursiveMessage(TestRecursiveMessage other) : this() {
- A = other.a_ != null ? other.A.Clone() : null;
+ a_ = other.a_ != null ? other.a_.Clone() : null;
i_ = other.i_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -2807,7 +2807,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMutualRecursionA(TestMutualRecursionA other) : this() {
- Bb = other.bb_ != null ? other.Bb.Clone() : null;
+ bb_ = other.bb_ != null ? other.bb_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -2942,7 +2942,7 @@ namespace Google.Protobuf.TestProtos {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public TestMutualRecursionB(TestMutualRecursionB other) : this() {
- A = other.a_ != null ? other.A.Clone() : null;
+ a_ = other.a_ != null ? other.a_.Clone() : null;
optionalInt32_ = other.optionalInt32_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -3241,7 +3241,7 @@ namespace Google.Protobuf.TestProtos {
primitiveField_ = other.primitiveField_;
stringField_ = other.stringField_;
enumField_ = other.enumField_;
- MessageField = other.messageField_ != null ? other.MessageField.Clone() : null;
+ messageField_ = other.messageField_ != null ? other.messageField_.Clone() : null;
repeatedPrimitiveField_ = other.repeatedPrimitiveField_.Clone();
repeatedStringField_ = other.repeatedStringField_.Clone();
repeatedEnumField_ = other.repeatedEnumField_.Clone();
@@ -3546,7 +3546,7 @@ namespace Google.Protobuf.TestProtos {
myString_ = other.myString_;
myInt_ = other.myInt_;
myFloat_ = other.myFloat_;
- SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null;
+ singleNestedMessage_ = other.singleNestedMessage_ != null ? other.singleNestedMessage_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
index 2e1d2bd6..fe913802 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
@@ -204,15 +204,15 @@ namespace Google.Protobuf.TestProtos {
[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;
+ 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;
@@ -222,7 +222,7 @@ namespace Google.Protobuf.TestProtos {
BoolField = other.BoolField;
StringField = other.StringField;
BytesField = other.BytesField;
- ValueField = other.valueField_ != null ? other.ValueField.Clone() : null;
+ valueField_ = other.valueField_ != null ? other.valueField_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}