From 3c2a32a75f15ba6a527ae267351de4160e1a1de7 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Sun, 24 Nov 2019 14:22:26 -0600 Subject: [PATCH 1/6] Use Distinct on depended extensions to filter duplicate extensions --- csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index 388a40b4bb..37afdcc657 100644 --- a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -422,7 +422,8 @@ namespace Google.Protobuf.Reflection GeneratedClrTypeInfo generatedCodeInfo) { ExtensionRegistry registry = new ExtensionRegistry(); - AddAllExtensions(dependencies, generatedCodeInfo, registry); + registry.AddRange(GetAllExtensions(dependencies, generatedCodeInfo)); + FileDescriptorProto proto; try { @@ -445,9 +446,9 @@ namespace Google.Protobuf.Reflection } } - private static void AddAllExtensions(FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedInfo, ExtensionRegistry registry) + private static IEnumerable GetAllExtensions(FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedInfo) { - registry.AddRange(dependencies.SelectMany(GetAllDependedExtensions).Concat(GetAllGeneratedExtensions(generatedInfo)).ToArray()); + return dependencies.SelectMany(GetAllDependedExtensions).Distinct().Concat(GetAllGeneratedExtensions(generatedInfo)); } private static IEnumerable GetAllGeneratedExtensions(GeneratedClrTypeInfo generated) From 2b0b8385284d6ac9242b645b686b7036f7d90ec3 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Sun, 24 Nov 2019 14:22:50 -0600 Subject: [PATCH 2/6] Add tests --- Makefile.am | 6 + csharp/generate_protos.sh | 29 +-- csharp/protos/extensions/extensions_a.proto | 12 ++ csharp/protos/extensions/extensions_b.proto | 12 ++ csharp/protos/extensions/extensions_c.proto | 14 ++ .../ExtensionsA.cs | 46 +++++ .../ExtensionsB.cs | 145 ++++++++++++++ .../ExtensionsC.cs | 180 ++++++++++++++++++ .../Reflection/CustomOptionsTest.cs | 7 + csharp/src/Google.Protobuf.Test/testprotos.pb | Bin 329562 -> 330746 bytes 10 files changed, 438 insertions(+), 13 deletions(-) create mode 100644 csharp/protos/extensions/extensions_a.proto create mode 100644 csharp/protos/extensions/extensions_b.proto create mode 100644 csharp/protos/extensions/extensions_c.proto create mode 100644 csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs create mode 100644 csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs create mode 100644 csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs diff --git a/Makefile.am b/Makefile.am index 8fd66c79ee..de08c29ddf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,6 +65,9 @@ csharp_EXTRA_DIST= \ csharp/keys/Google.Protobuf.snk \ csharp/keys/README.md \ csharp/protos/README.md \ + csharp/protos/extensions/extensions_a.proto \ + csharp/protos/extensions/extensions_b.proto \ + csharp/protos/extensions/extensions_c.proto \ csharp/protos/map_unittest_proto3.proto \ csharp/protos/old_extensions1.proto \ csharp/protos/old_extensions2.proto \ @@ -128,6 +131,9 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/SampleNaNs.cs \ csharp/src/Google.Protobuf.Test/TestCornerCases.cs \ csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj \ + csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs \ csharp/src/Google.Protobuf.Test.TestProtos/ForeignMessagePartial.cs \ csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs \ csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs \ diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index 66d87c02f7..35ce28c94c 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -44,23 +44,26 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ # Note that this deliberately does *not* include old_extensions1.proto # and old_extensions2.proto, which are generated with an older version # of protoc. -$PROTOC -Isrc -Icsharp/protos \ +$PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \ --csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \ --descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \ --include_source_info \ --include_imports \ - csharp/protos/map_unittest_proto3.proto \ - csharp/protos/unittest_issues.proto \ - csharp/protos/unittest_custom_options_proto3.proto \ - csharp/protos/unittest_proto3.proto \ - csharp/protos/unittest_import_proto3.proto \ - csharp/protos/unittest_import_public_proto3.proto \ - csharp/protos/unittest.proto \ - csharp/protos/unittest_import.proto \ - csharp/protos/unittest_import_public.proto \ - src/google/protobuf/unittest_well_known_types.proto \ - src/google/protobuf/test_messages_proto3.proto \ - src/google/protobuf/test_messages_proto2.proto + map_unittest_proto3.proto \ + unittest_issues.proto \ + unittest_custom_options_proto3.proto \ + unittest_proto3.proto \ + unittest_import_proto3.proto \ + unittest_import_public_proto3.proto \ + unittest.proto \ + unittest_import.proto \ + unittest_import_public.proto \ + extensions_a.proto \ + extensions_b.proto \ + extensions_c.proto \ + google/protobuf/unittest_well_known_types.proto \ + google/protobuf/test_messages_proto3.proto \ + google/protobuf/test_messages_proto2.proto # AddressBook sample protos $PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ diff --git a/csharp/protos/extensions/extensions_a.proto b/csharp/protos/extensions/extensions_a.proto new file mode 100644 index 0000000000..e967dede05 --- /dev/null +++ b/csharp/protos/extensions/extensions_a.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; + +// This file is used as part of a unit test for issue 6936 +// We don't need to use it, we just have to import it in both b and c + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + string opt = 50000; +} \ No newline at end of file diff --git a/csharp/protos/extensions/extensions_b.proto b/csharp/protos/extensions/extensions_b.proto new file mode 100644 index 0000000000..c19e9885af --- /dev/null +++ b/csharp/protos/extensions/extensions_b.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "extensions_a.proto"; + +option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; + +// This file is used as part of a unit test for issue 6936 +// We don't need to use it, we just have to import it in c + +message Foo { + option (opt) = "bar"; +} \ No newline at end of file diff --git a/csharp/protos/extensions/extensions_c.proto b/csharp/protos/extensions/extensions_c.proto new file mode 100644 index 0000000000..3a32da9b79 --- /dev/null +++ b/csharp/protos/extensions/extensions_c.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +import "extensions_a.proto"; +import "extensions_b.proto"; + +option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; + +// This file is used as part of a unit test for issue 6936 +// We don't need to use it, we just have to load it at runtime + +message Bar { + option (opt) = "foo"; + Foo foo = 1; +} \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs new file mode 100644 index 0000000000..f2f66ffad2 --- /dev/null +++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs @@ -0,0 +1,46 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: extensions_a.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.Extensions { + + /// Holder for reflection information generated from extensions_a.proto + public static partial class ExtensionsAReflection { + + #region Descriptor + /// File descriptor for extensions_a.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExtensionsAReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChJleHRlbnNpb25zX2EucHJvdG8aIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw", + "dG9yLnByb3RvOi4KA29wdBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0", + "aW9ucxjQhgMgASgJQiiqAiVHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvcy5F", + "eHRlbnNpb25zYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsAExtensions.Opt }, null)); + } + #endregion + + } + /// Holder for extension identifiers generated from the top level of extensions_a.proto + public static partial class ExtensionsAExtensions { + public static readonly pb::Extension Opt = + new pb::Extension(50000, pb::FieldCodec.ForString(400002, "")); + } + +} + +#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs new file mode 100644 index 0000000000..a67688f755 --- /dev/null +++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs @@ -0,0 +1,145 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: extensions_b.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.Extensions { + + /// Holder for reflection information generated from extensions_b.proto + public static partial class ExtensionsBReflection { + + #region Descriptor + /// File descriptor for extensions_b.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExtensionsBReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChJleHRlbnNpb25zX2IucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90byIOCgNG", + "b286B4K1GANiYXJCKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4", + "dGVuc2lvbnNiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Foo), global::Google.Protobuf.TestProtos.Extensions.Foo.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class Foo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Foo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Foo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Foo(Foo other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Foo Clone() { + return new Foo(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Foo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Foo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.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 (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Foo other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs new file mode 100644 index 0000000000..d8387c1d13 --- /dev/null +++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs @@ -0,0 +1,180 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: extensions_c.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.Extensions { + + /// Holder for reflection information generated from extensions_c.proto + public static partial class ExtensionsCReflection { + + #region Descriptor + /// File descriptor for extensions_c.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExtensionsCReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChJleHRlbnNpb25zX2MucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90bxoSZXh0", + "ZW5zaW9uc19iLnByb3RvIiEKA0JhchIRCgNmb28YASABKAsyBC5Gb286B4K1", + "GANmb29CKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4dGVuc2lv", + "bnNiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Bar), global::Google.Protobuf.TestProtos.Extensions.Bar.Parser, new[]{ "Foo" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class Bar : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Bar()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsCReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bar() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bar(Bar other) : this() { + foo_ = other.foo_ != null ? other.foo_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Bar Clone() { + return new Bar(this); + } + + /// Field number for the "foo" field. + public const int FooFieldNumber = 1; + private global::Google.Protobuf.TestProtos.Extensions.Foo foo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.TestProtos.Extensions.Foo Foo { + get { return foo_; } + set { + foo_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Bar); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Bar other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Foo, other.Foo)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (foo_ != null) hash ^= Foo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.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 (foo_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Foo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (foo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Foo); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Bar other) { + if (other == null) { + return; + } + if (other.foo_ != null) { + if (foo_ == null) { + Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo(); + } + Foo.MergeFrom(other.Foo); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (foo_ == null) { + Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo(); + } + input.ReadMessage(Foo); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs index d65a6f2023..99f7e28c1b 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs @@ -42,6 +42,7 @@ using static UnitTest.Issues.TestProtos.ComplexOptionType2.Types; using static UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Extensions; using static UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types; using Google.Protobuf.TestProtos; +using Google.Protobuf.TestProtos.Extensions; #pragma warning disable CS0618 @@ -193,6 +194,12 @@ namespace Google.Protobuf.Test.Reflection Assert.NotNull(TestAllTypes.Descriptor.Oneofs[0].CustomOptions); } + [Test] + public void MultipleImportOfSameFileWithExtension() + { + var descriptor = ExtensionsCReflection.Descriptor; + } + private void AssertOption(T expected, OptionFetcher fetcher, Extension extension, Func, T> descriptorOptionFetcher) where D : IExtendableMessage { T customOptionsValue; diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb index 818b227b37a8c1e3622a99542859ec46aa5d1b84..b1c6650385748cc97a7c85238f183f1e17660481 100644 GIT binary patch delta 1094 zcmbV~&ubGw6vt=P(ej?lG zC)o32jjDq__M=dvmWjrWis_f6FLCo$a})4^9AH~TS2RYFy0kLg80u^ISmL8Tb#(m$ zY5Z`%r)VAx3L^}Z?qYy`)W%()wJgUId9yWb=+IUmE&u>6XL~&FR8yTXK1t(Sq}`Iy z_Z-HlSY8dXy;y10gfI3S%bO^g0P!JR>DB;AEiXlJIhjXa__ z8{EK(R^#AYxCaXYeNNna%5R%A`x@hZq{DqVMGiB_-Ff7ubU_Ga-=y>uL>UT@p^9Zq e<(yS?*8&Y0pV3nlN=s)?^>S3>pGGxtIQj$NYW?T{ delta 25 hcmex0UF24uNJ9%_3)2?ndz$Tadd%DF^jK={0sxL&3Sj^M From cd11d5414f0704cfbbdb187e53d5f5ed44bda4a1 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Sun, 24 Nov 2019 14:56:35 -0600 Subject: [PATCH 3/6] Improve test to make sure the extensions are actually loaded for CustomOptions --- .../src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs index 99f7e28c1b..efbc48afb0 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs @@ -198,6 +198,10 @@ namespace Google.Protobuf.Test.Reflection public void MultipleImportOfSameFileWithExtension() { var descriptor = ExtensionsCReflection.Descriptor; + var foo = Foo.Descriptor; + var bar = Bar.Descriptor; + AssertOption("bar", foo.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, foo.GetOption); + AssertOption("foo", bar.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, bar.GetOption); } private void AssertOption(T expected, OptionFetcher fetcher, Extension extension, Func, T> descriptorOptionFetcher) where D : IExtendableMessage From 145033c05611fb51f560fc9b7326e3720ea6ed7e Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Tue, 26 Nov 2019 18:45:22 -0600 Subject: [PATCH 4/6] Adjust based on review feedback --- csharp/generate_protos.sh | 8 ++-- csharp/protos/extensions/extensions_a.proto | 12 ------ csharp/protos/extensions/extensions_b.proto | 12 ------ csharp/protos/extensions/extensions_c.proto | 14 ------- csharp/protos/extensions_issue6936_a.proto | 15 ++++++++ csharp/protos/extensions_issue6936_b.proto | 14 +++++++ csharp/protos/extensions_issue6936_c.proto | 16 ++++++++ ...ExtensionsA.cs => ExtensionsIssue6936A.cs} | 26 ++++++------- ...ExtensionsB.cs => ExtensionsIssue6936B.cs} | 24 ++++++------ ...ExtensionsC.cs => ExtensionsIssue6936C.cs} | 35 +++++++++--------- .../Reflection/CustomOptionsTest.cs | 7 ++-- csharp/src/Google.Protobuf.Test/testprotos.pb | Bin 330746 -> 330962 bytes 12 files changed, 95 insertions(+), 88 deletions(-) delete mode 100644 csharp/protos/extensions/extensions_a.proto delete mode 100644 csharp/protos/extensions/extensions_b.proto delete mode 100644 csharp/protos/extensions/extensions_c.proto create mode 100644 csharp/protos/extensions_issue6936_a.proto create mode 100644 csharp/protos/extensions_issue6936_b.proto create mode 100644 csharp/protos/extensions_issue6936_c.proto rename csharp/src/Google.Protobuf.Test.TestProtos/{ExtensionsA.cs => ExtensionsIssue6936A.cs} (62%) rename csharp/src/Google.Protobuf.Test.TestProtos/{ExtensionsB.cs => ExtensionsIssue6936B.cs} (80%) rename csharp/src/Google.Protobuf.Test.TestProtos/{ExtensionsC.cs => ExtensionsIssue6936C.cs} (77%) diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index 35ce28c94c..86b901410e 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -44,7 +44,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \ # Note that this deliberately does *not* include old_extensions1.proto # and old_extensions2.proto, which are generated with an older version # of protoc. -$PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \ +$PROTOC -Isrc -Icsharp/protos \ --csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \ --descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \ --include_source_info \ @@ -58,9 +58,9 @@ $PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \ unittest.proto \ unittest_import.proto \ unittest_import_public.proto \ - extensions_a.proto \ - extensions_b.proto \ - extensions_c.proto \ + extensions_issue6936_a.proto \ + extensions_issue6936_b.proto \ + extensions_issue6936_c.proto \ google/protobuf/unittest_well_known_types.proto \ google/protobuf/test_messages_proto3.proto \ google/protobuf/test_messages_proto2.proto diff --git a/csharp/protos/extensions/extensions_a.proto b/csharp/protos/extensions/extensions_a.proto deleted file mode 100644 index e967dede05..0000000000 --- a/csharp/protos/extensions/extensions_a.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; - -// This file is used as part of a unit test for issue 6936 -// We don't need to use it, we just have to import it in both b and c - -import "google/protobuf/descriptor.proto"; - -extend google.protobuf.MessageOptions { - string opt = 50000; -} \ No newline at end of file diff --git a/csharp/protos/extensions/extensions_b.proto b/csharp/protos/extensions/extensions_b.proto deleted file mode 100644 index c19e9885af..0000000000 --- a/csharp/protos/extensions/extensions_b.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -import "extensions_a.proto"; - -option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; - -// This file is used as part of a unit test for issue 6936 -// We don't need to use it, we just have to import it in c - -message Foo { - option (opt) = "bar"; -} \ No newline at end of file diff --git a/csharp/protos/extensions/extensions_c.proto b/csharp/protos/extensions/extensions_c.proto deleted file mode 100644 index 3a32da9b79..0000000000 --- a/csharp/protos/extensions/extensions_c.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; - -import "extensions_a.proto"; -import "extensions_b.proto"; - -option csharp_namespace = "Google.Protobuf.TestProtos.Extensions"; - -// This file is used as part of a unit test for issue 6936 -// We don't need to use it, we just have to load it at runtime - -message Bar { - option (opt) = "foo"; - Foo foo = 1; -} \ No newline at end of file diff --git a/csharp/protos/extensions_issue6936_a.proto b/csharp/protos/extensions_issue6936_a.proto new file mode 100644 index 0000000000..097d083a98 --- /dev/null +++ b/csharp/protos/extensions_issue6936_a.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package unittest_issues; + +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +// This file is used as part of a unit test for issue 6936 +// We don't need to use it, we just have to import it in both +// "extensions_issue6936_b.proto" and "extensions_issue6936_c.proto" + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + string opt = 50000; +} \ No newline at end of file diff --git a/csharp/protos/extensions_issue6936_b.proto b/csharp/protos/extensions_issue6936_b.proto new file mode 100644 index 0000000000..2027b7b4d7 --- /dev/null +++ b/csharp/protos/extensions_issue6936_b.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +import "extensions_issue6936_a.proto"; + +package unittest_issues; + +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +// This file is used as part of a unit test for issue 6936 +// We don't need to use it, we just have to import it in "extensions_issue6936_c.proto" + +message Foo { + option (opt) = "foo"; +} \ No newline at end of file diff --git a/csharp/protos/extensions_issue6936_c.proto b/csharp/protos/extensions_issue6936_c.proto new file mode 100644 index 0000000000..d33794dc11 --- /dev/null +++ b/csharp/protos/extensions_issue6936_c.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +import "extensions_issue6936_a.proto"; +import "extensions_issue6936_b.proto"; + +package unittest_issues; + +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +// This file is used as part of a unit test for issue 6936 +// We don't need to use it, we just have to load it at runtime + +message Bar { + option (opt) = "bar"; + Foo foo = 1; +} \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs similarity index 62% rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs index f2f66ffad2..95a746b239 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: extensions_a.proto +// source: extensions_issue6936_a.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,34 +9,34 @@ 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.Extensions { +namespace UnitTest.Issues.TestProtos { - /// Holder for reflection information generated from extensions_a.proto - public static partial class ExtensionsAReflection { + /// Holder for reflection information generated from extensions_issue6936_a.proto + public static partial class ExtensionsIssue6936AReflection { #region Descriptor - /// File descriptor for extensions_a.proto + /// File descriptor for extensions_issue6936_a.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ExtensionsAReflection() { + static ExtensionsIssue6936AReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChJleHRlbnNpb25zX2EucHJvdG8aIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw", - "dG9yLnByb3RvOi4KA29wdBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0", - "aW9ucxjQhgMgASgJQiiqAiVHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvcy5F", - "eHRlbnNpb25zYgZwcm90bzM=")); + "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9hLnByb3RvEg91bml0dGVzdF9pc3N1", + "ZXMaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlwdG9yLnByb3RvOi4KA29wdBIf", + "Lmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjQhgMgASgJQh2qAhpV", + "bml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsAExtensions.Opt }, null)); + new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsIssue6936AExtensions.Opt }, null)); } #endregion } - /// Holder for extension identifiers generated from the top level of extensions_a.proto - public static partial class ExtensionsAExtensions { + /// Holder for extension identifiers generated from the top level of extensions_issue6936_a.proto + public static partial class ExtensionsIssue6936AExtensions { public static readonly pb::Extension Opt = new pb::Extension(50000, pb::FieldCodec.ForString(400002, "")); } diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs similarity index 80% rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs index a67688f755..2404906de4 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: extensions_b.proto +// source: extensions_issue6936_b.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,28 +9,28 @@ 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.Extensions { +namespace UnitTest.Issues.TestProtos { - /// Holder for reflection information generated from extensions_b.proto - public static partial class ExtensionsBReflection { + /// Holder for reflection information generated from extensions_issue6936_b.proto + public static partial class ExtensionsIssue6936BReflection { #region Descriptor - /// File descriptor for extensions_b.proto + /// File descriptor for extensions_issue6936_b.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ExtensionsBReflection() { + static ExtensionsIssue6936BReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChJleHRlbnNpb25zX2IucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90byIOCgNG", - "b286B4K1GANiYXJCKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4", - "dGVuc2lvbnNiBnByb3RvMw==")); + "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9iLnByb3RvEg91bml0dGVzdF9pc3N1", + "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8iDgoDRm9vOgeCtRgD", + "Zm9vQh2qAhpVbml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Foo), global::Google.Protobuf.TestProtos.Extensions.Foo.Parser, null, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Foo), global::UnitTest.Issues.TestProtos.Foo.Parser, null, null, null, null, null) })); } #endregion @@ -45,7 +45,7 @@ namespace Google.Protobuf.TestProtos.Extensions { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor.MessageTypes[0]; } + get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs similarity index 77% rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs index d8387c1d13..aeffcc1e9e 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: extensions_c.proto +// source: extensions_issue6936_c.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -9,29 +9,30 @@ 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.Extensions { +namespace UnitTest.Issues.TestProtos { - /// Holder for reflection information generated from extensions_c.proto - public static partial class ExtensionsCReflection { + /// Holder for reflection information generated from extensions_issue6936_c.proto + public static partial class ExtensionsIssue6936CReflection { #region Descriptor - /// File descriptor for extensions_c.proto + /// File descriptor for extensions_issue6936_c.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ExtensionsCReflection() { + static ExtensionsIssue6936CReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChJleHRlbnNpb25zX2MucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90bxoSZXh0", - "ZW5zaW9uc19iLnByb3RvIiEKA0JhchIRCgNmb28YASABKAsyBC5Gb286B4K1", - "GANmb29CKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4dGVuc2lv", - "bnNiBnByb3RvMw==")); + "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9jLnByb3RvEg91bml0dGVzdF9pc3N1", + "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8aHGV4dGVuc2lvbnNf", + "aXNzdWU2OTM2X2IucHJvdG8iMQoDQmFyEiEKA2ZvbxgBIAEoCzIULnVuaXR0", + "ZXN0X2lzc3Vlcy5Gb286B4K1GANiYXJCHaoCGlVuaXRUZXN0Lklzc3Vlcy5U", + "ZXN0UHJvdG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Bar), global::Google.Protobuf.TestProtos.Extensions.Bar.Parser, new[]{ "Foo" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Bar), global::UnitTest.Issues.TestProtos.Bar.Parser, new[]{ "Foo" }, null, null, null, null) })); } #endregion @@ -46,7 +47,7 @@ namespace Google.Protobuf.TestProtos.Extensions { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsCReflection.Descriptor.MessageTypes[0]; } + get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936CReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -74,9 +75,9 @@ namespace Google.Protobuf.TestProtos.Extensions { /// Field number for the "foo" field. public const int FooFieldNumber = 1; - private global::Google.Protobuf.TestProtos.Extensions.Foo foo_; + private global::UnitTest.Issues.TestProtos.Foo foo_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.TestProtos.Extensions.Foo Foo { + public global::UnitTest.Issues.TestProtos.Foo Foo { get { return foo_; } set { foo_ = value; @@ -145,7 +146,7 @@ namespace Google.Protobuf.TestProtos.Extensions { } if (other.foo_ != null) { if (foo_ == null) { - Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo(); + Foo = new global::UnitTest.Issues.TestProtos.Foo(); } Foo.MergeFrom(other.Foo); } @@ -162,7 +163,7 @@ namespace Google.Protobuf.TestProtos.Extensions { break; case 10: { if (foo_ == null) { - Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo(); + Foo = new global::UnitTest.Issues.TestProtos.Foo(); } input.ReadMessage(Foo); break; diff --git a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs index efbc48afb0..bf5f5ad9c3 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs @@ -42,7 +42,6 @@ using static UnitTest.Issues.TestProtos.ComplexOptionType2.Types; using static UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Extensions; using static UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types; using Google.Protobuf.TestProtos; -using Google.Protobuf.TestProtos.Extensions; #pragma warning disable CS0618 @@ -197,11 +196,11 @@ namespace Google.Protobuf.Test.Reflection [Test] public void MultipleImportOfSameFileWithExtension() { - var descriptor = ExtensionsCReflection.Descriptor; + var descriptor = ExtensionsIssue6936CReflection.Descriptor; var foo = Foo.Descriptor; var bar = Bar.Descriptor; - AssertOption("bar", foo.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, foo.GetOption); - AssertOption("foo", bar.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, bar.GetOption); + AssertOption("foo", foo.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, foo.GetOption); + AssertOption("bar", bar.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, bar.GetOption); } private void AssertOption(T expected, OptionFetcher fetcher, Extension extension, Func, T> descriptorOptionFetcher) where D : IExtendableMessage diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb index b1c6650385748cc97a7c85238f183f1e17660481..7f2e310798336800c4d2d5b7eee968dd2147937b 100644 GIT binary patch delta 884 zcmaKqzi-n(6vyxGUF`7uqwOiQX;jousTD1%hg1rJF#}@VS*p=9dqN-IV z1`iejp|EyDAjHJP1OsAVgMWb$iK*{3Zc?P0?fboZ^7nl|=f7Fy`-{r6LwTs)!LRk& zZ@{JSX%hD1Ueu5GdU3oTHt%jV_uA?9%LQ3Wm*3vZ<~N|3ejP2hJ}I<}7Q&ZUM(G+5 z!mv^Xl&G>Q8_?noUPD!09m~%W6$k?;HX0vg_GS~h+3amF2UuUZGPx5x8AM66Qg8Pk z6^wNA5u_k#8}0H&lxb6rrxy?rY(Y!8_Uc%d_?#r4OVW;y!MOo4bMqbRJaP+9ig0uo zM^GzZm9OI?+>fGr_V9fb9!F97WmMlD=E%Iu$Y@nYqQqKGPfzGsQ+h045j`!8c7!Jz z&!_mj-qrA?WT>9zu1?wE-dfniLocF-7U^$C)ST?3`JbZZU2cBx|K|@y(9_aWc<^`0ik=q17m)j_Mmm+RMmEAY9~y8jIQsV<|t32 z3=^uQ2~~SamE|y}>WZ1{^(G7-x|bk%|3YHxpw>dsi}`vMT`aM&*x473a(((nen)Km N<2Zm1aiEWXo&lS8wo3p2 delta 705 zcmZwEJ4*vW5C`zxolWjCck!`=_#jFUA}SIkc9sz>6hySKlU!7^$%Q0{jSobOy~SxE zSX(RN7qAvPLH!(J<&1a61nmB^x4SpLotLZBSCBeBm8a?sKE~6RfM#pIu~n(>`jz@d zDPOJm4L|6ffOS1~t8y0`_TXH8zO`fVQ)1j`AsmS|O4oo8hLdeTi6SOY*|{*DOH?2X zSYo1Z5L{0}^~m!ZJ6SJVs%&PygHNhM;)RmIc3mdojdUR_`2MVQa^DYLsaE`zF1Jfx|C3UqY*HcBptknJTi( Date: Mon, 2 Dec 2019 13:56:21 -0600 Subject: [PATCH 5/6] Use explicit comparer for extension identifiers --- csharp/src/Google.Protobuf/ExtensionRegistry.cs | 13 +++++++++++++ .../Google.Protobuf/Reflection/FileDescriptor.cs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/csharp/src/Google.Protobuf/ExtensionRegistry.cs b/csharp/src/Google.Protobuf/ExtensionRegistry.cs index 2318e449e6..e631ba353d 100644 --- a/csharp/src/Google.Protobuf/ExtensionRegistry.cs +++ b/csharp/src/Google.Protobuf/ExtensionRegistry.cs @@ -42,6 +42,19 @@ namespace Google.Protobuf /// public sealed class ExtensionRegistry : ICollection, IDeepCloneable { + internal sealed class ExtensionComparer : IEqualityComparer + { + public bool Equals(Extension a, Extension b) + { + return new ObjectIntPair(a.TargetType, a.FieldNumber).Equals(new ObjectIntPair(b.TargetType, b.FieldNumber)); + } + public int GetHashCode(Extension a) + { + return new ObjectIntPair(a.TargetType, a.FieldNumber).GetHashCode(); + } + + internal static ExtensionComparer Instance = new ExtensionComparer(); + } private IDictionary, Extension> extensions; /// diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index 37afdcc657..56c0caacfd 100644 --- a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -448,7 +448,7 @@ namespace Google.Protobuf.Reflection private static IEnumerable GetAllExtensions(FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedInfo) { - return dependencies.SelectMany(GetAllDependedExtensions).Distinct().Concat(GetAllGeneratedExtensions(generatedInfo)); + return dependencies.SelectMany(GetAllDependedExtensions).Distinct(ExtensionRegistry.ExtensionComparer.Instance).Concat(GetAllGeneratedExtensions(generatedInfo)); } private static IEnumerable GetAllGeneratedExtensions(GeneratedClrTypeInfo generated) From 367fd2773282a3007eecda3374056db2539b8076 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Tue, 3 Dec 2019 10:52:24 -0600 Subject: [PATCH 6/6] Rename files and revert changes to generate protos script --- Makefile.am | 12 +++---- csharp/generate_protos.sh | 30 +++++++++--------- ...936_a.proto => unittest_issue6936_a.proto} | 0 ...936_b.proto => unittest_issue6936_b.proto} | 4 +-- ...936_c.proto => unittest_issue6936_c.proto} | 4 +-- ...onsIssue6936A.cs => UnittestIssue6936A.cs} | 24 +++++++------- ...onsIssue6936B.cs => UnittestIssue6936B.cs} | 20 ++++++------ ...onsIssue6936C.cs => UnittestIssue6936C.cs} | 24 +++++++------- .../Reflection/CustomOptionsTest.cs | 6 ++-- csharp/src/Google.Protobuf.Test/testprotos.pb | Bin 330962 -> 330948 bytes 10 files changed, 62 insertions(+), 62 deletions(-) rename csharp/protos/{extensions_issue6936_a.proto => unittest_issue6936_a.proto} (100%) rename csharp/protos/{extensions_issue6936_b.proto => unittest_issue6936_b.proto} (61%) rename csharp/protos/{extensions_issue6936_c.proto => unittest_issue6936_c.proto} (78%) rename csharp/src/Google.Protobuf.Test.TestProtos/{ExtensionsIssue6936A.cs => UnittestIssue6936A.cs} (64%) rename csharp/src/Google.Protobuf.Test.TestProtos/{ExtensionsIssue6936B.cs => UnittestIssue6936B.cs} (86%) rename csharp/src/Google.Protobuf.Test.TestProtos/{ExtensionsIssue6936C.cs => UnittestIssue6936C.cs} (86%) diff --git a/Makefile.am b/Makefile.am index de08c29ddf..7ee57da299 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,12 +65,12 @@ csharp_EXTRA_DIST= \ csharp/keys/Google.Protobuf.snk \ csharp/keys/README.md \ csharp/protos/README.md \ - csharp/protos/extensions/extensions_a.proto \ - csharp/protos/extensions/extensions_b.proto \ - csharp/protos/extensions/extensions_c.proto \ csharp/protos/map_unittest_proto3.proto \ csharp/protos/old_extensions1.proto \ csharp/protos/old_extensions2.proto \ + csharp/protos/unittest_issue6936_a.proto \ + csharp/protos/unittest_issue6936_b.proto \ + csharp/protos/unittest_issue6936_c.proto \ csharp/protos/unittest_custom_options_proto3.proto \ csharp/protos/unittest_import_public_proto3.proto \ csharp/protos/unittest_import_public.proto \ @@ -131,9 +131,9 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/SampleNaNs.cs \ csharp/src/Google.Protobuf.Test/TestCornerCases.cs \ csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj \ - csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs \ + csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs \ csharp/src/Google.Protobuf.Test.TestProtos/ForeignMessagePartial.cs \ csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs \ csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs \ diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index 86b901410e..e6687c308e 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -49,21 +49,21 @@ $PROTOC -Isrc -Icsharp/protos \ --descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \ --include_source_info \ --include_imports \ - map_unittest_proto3.proto \ - unittest_issues.proto \ - unittest_custom_options_proto3.proto \ - unittest_proto3.proto \ - unittest_import_proto3.proto \ - unittest_import_public_proto3.proto \ - unittest.proto \ - unittest_import.proto \ - unittest_import_public.proto \ - extensions_issue6936_a.proto \ - extensions_issue6936_b.proto \ - extensions_issue6936_c.proto \ - google/protobuf/unittest_well_known_types.proto \ - google/protobuf/test_messages_proto3.proto \ - google/protobuf/test_messages_proto2.proto + csharp/protos/map_unittest_proto3.proto \ + csharp/protos/unittest_issues.proto \ + csharp/protos/unittest_custom_options_proto3.proto \ + csharp/protos/unittest_proto3.proto \ + csharp/protos/unittest_import_proto3.proto \ + csharp/protos/unittest_import_public_proto3.proto \ + csharp/protos/unittest.proto \ + csharp/protos/unittest_import.proto \ + csharp/protos/unittest_import_public.proto \ + csharp/protos/unittest_issue6936_a.proto \ + csharp/protos/unittest_issue6936_b.proto \ + csharp/protos/unittest_issue6936_c.proto \ + src/google/protobuf/unittest_well_known_types.proto \ + src/google/protobuf/test_messages_proto3.proto \ + src/google/protobuf/test_messages_proto2.proto # AddressBook sample protos $PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \ diff --git a/csharp/protos/extensions_issue6936_a.proto b/csharp/protos/unittest_issue6936_a.proto similarity index 100% rename from csharp/protos/extensions_issue6936_a.proto rename to csharp/protos/unittest_issue6936_a.proto diff --git a/csharp/protos/extensions_issue6936_b.proto b/csharp/protos/unittest_issue6936_b.proto similarity index 61% rename from csharp/protos/extensions_issue6936_b.proto rename to csharp/protos/unittest_issue6936_b.proto index 2027b7b4d7..8f71683ba6 100644 --- a/csharp/protos/extensions_issue6936_b.proto +++ b/csharp/protos/unittest_issue6936_b.proto @@ -1,13 +1,13 @@ syntax = "proto3"; -import "extensions_issue6936_a.proto"; +import "unittest_issue6936_a.proto"; package unittest_issues; option csharp_namespace = "UnitTest.Issues.TestProtos"; // This file is used as part of a unit test for issue 6936 -// We don't need to use it, we just have to import it in "extensions_issue6936_c.proto" +// We don't need to use it, we just have to import it in "unittest_issue6936_c.proto" message Foo { option (opt) = "foo"; diff --git a/csharp/protos/extensions_issue6936_c.proto b/csharp/protos/unittest_issue6936_c.proto similarity index 78% rename from csharp/protos/extensions_issue6936_c.proto rename to csharp/protos/unittest_issue6936_c.proto index d33794dc11..40004ecaae 100644 --- a/csharp/protos/extensions_issue6936_c.proto +++ b/csharp/protos/unittest_issue6936_c.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -import "extensions_issue6936_a.proto"; -import "extensions_issue6936_b.proto"; +import "unittest_issue6936_a.proto"; +import "unittest_issue6936_b.proto"; package unittest_issues; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs similarity index 64% rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs index 95a746b239..56fde4f00a 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: extensions_issue6936_a.proto +// source: unittest_issue6936_a.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -11,32 +11,32 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace UnitTest.Issues.TestProtos { - /// Holder for reflection information generated from extensions_issue6936_a.proto - public static partial class ExtensionsIssue6936AReflection { + /// Holder for reflection information generated from unittest_issue6936_a.proto + public static partial class UnittestIssue6936AReflection { #region Descriptor - /// File descriptor for extensions_issue6936_a.proto + /// File descriptor for unittest_issue6936_a.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ExtensionsIssue6936AReflection() { + static UnittestIssue6936AReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9hLnByb3RvEg91bml0dGVzdF9pc3N1", - "ZXMaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlwdG9yLnByb3RvOi4KA29wdBIf", - "Lmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjQhgMgASgJQh2qAhpV", - "bml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z")); + "Chp1bml0dGVzdF9pc3N1ZTY5MzZfYS5wcm90bxIPdW5pdHRlc3RfaXNzdWVz", + "GiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bzouCgNvcHQSHy5n", + "b29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMY0IYDIAEoCUIdqgIaVW5p", + "dFRlc3QuSXNzdWVzLlRlc3RQcm90b3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsIssue6936AExtensions.Opt }, null)); + new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { UnittestIssue6936AExtensions.Opt }, null)); } #endregion } - /// Holder for extension identifiers generated from the top level of extensions_issue6936_a.proto - public static partial class ExtensionsIssue6936AExtensions { + /// Holder for extension identifiers generated from the top level of unittest_issue6936_a.proto + public static partial class UnittestIssue6936AExtensions { public static readonly pb::Extension Opt = new pb::Extension(50000, pb::FieldCodec.ForString(400002, "")); } diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs similarity index 86% rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs index 2404906de4..6b816f739b 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: extensions_issue6936_b.proto +// source: unittest_issue6936_b.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -11,24 +11,24 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace UnitTest.Issues.TestProtos { - /// Holder for reflection information generated from extensions_issue6936_b.proto - public static partial class ExtensionsIssue6936BReflection { + /// Holder for reflection information generated from unittest_issue6936_b.proto + public static partial class UnittestIssue6936BReflection { #region Descriptor - /// File descriptor for extensions_issue6936_b.proto + /// File descriptor for unittest_issue6936_b.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ExtensionsIssue6936BReflection() { + static UnittestIssue6936BReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9iLnByb3RvEg91bml0dGVzdF9pc3N1", - "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8iDgoDRm9vOgeCtRgD", - "Zm9vQh2qAhpVbml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z")); + "Chp1bml0dGVzdF9pc3N1ZTY5MzZfYi5wcm90bxIPdW5pdHRlc3RfaXNzdWVz", + "Ghp1bml0dGVzdF9pc3N1ZTY5MzZfYS5wcm90byIOCgNGb286B4K1GANmb29C", + "HaoCGlVuaXRUZXN0Lklzc3Vlcy5UZXN0UHJvdG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.UnittestIssue6936AReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Foo), global::UnitTest.Issues.TestProtos.Foo.Parser, null, null, null, null, null) })); @@ -45,7 +45,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor.MessageTypes[0]; } + get { return global::UnitTest.Issues.TestProtos.UnittestIssue6936BReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs similarity index 86% rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs rename to csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs index aeffcc1e9e..a8a73f6cb6 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs @@ -1,6 +1,6 @@ // // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: extensions_issue6936_c.proto +// source: unittest_issue6936_c.proto // #pragma warning disable 1591, 0612, 3021 #region Designer generated code @@ -11,26 +11,26 @@ using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace UnitTest.Issues.TestProtos { - /// Holder for reflection information generated from extensions_issue6936_c.proto - public static partial class ExtensionsIssue6936CReflection { + /// Holder for reflection information generated from unittest_issue6936_c.proto + public static partial class UnittestIssue6936CReflection { #region Descriptor - /// File descriptor for extensions_issue6936_c.proto + /// File descriptor for unittest_issue6936_c.proto public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; - static ExtensionsIssue6936CReflection() { + static UnittestIssue6936CReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9jLnByb3RvEg91bml0dGVzdF9pc3N1", - "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8aHGV4dGVuc2lvbnNf", - "aXNzdWU2OTM2X2IucHJvdG8iMQoDQmFyEiEKA2ZvbxgBIAEoCzIULnVuaXR0", - "ZXN0X2lzc3Vlcy5Gb286B4K1GANiYXJCHaoCGlVuaXRUZXN0Lklzc3Vlcy5U", - "ZXN0UHJvdG9zYgZwcm90bzM=")); + "Chp1bml0dGVzdF9pc3N1ZTY5MzZfYy5wcm90bxIPdW5pdHRlc3RfaXNzdWVz", + "Ghp1bml0dGVzdF9pc3N1ZTY5MzZfYS5wcm90bxoadW5pdHRlc3RfaXNzdWU2", + "OTM2X2IucHJvdG8iMQoDQmFyEiEKA2ZvbxgBIAEoCzIULnVuaXR0ZXN0X2lz", + "c3Vlcy5Gb286B4K1GANiYXJCHaoCGlVuaXRUZXN0Lklzc3Vlcy5UZXN0UHJv", + "dG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.UnittestIssue6936AReflection.Descriptor, global::UnitTest.Issues.TestProtos.UnittestIssue6936BReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Bar), global::UnitTest.Issues.TestProtos.Bar.Parser, new[]{ "Foo" }, null, null, null, null) })); @@ -47,7 +47,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936CReflection.Descriptor.MessageTypes[0]; } + get { return global::UnitTest.Issues.TestProtos.UnittestIssue6936CReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs index bf5f5ad9c3..bfee5f5d43 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs @@ -196,11 +196,11 @@ namespace Google.Protobuf.Test.Reflection [Test] public void MultipleImportOfSameFileWithExtension() { - var descriptor = ExtensionsIssue6936CReflection.Descriptor; + var descriptor = UnittestIssue6936CReflection.Descriptor; var foo = Foo.Descriptor; var bar = Bar.Descriptor; - AssertOption("foo", foo.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, foo.GetOption); - AssertOption("bar", bar.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, bar.GetOption); + AssertOption("foo", foo.CustomOptions.TryGetString, UnittestIssue6936AExtensions.Opt, foo.GetOption); + AssertOption("bar", bar.CustomOptions.TryGetString, UnittestIssue6936AExtensions.Opt, bar.GetOption); } private void AssertOption(T expected, OptionFetcher fetcher, Extension extension, Func, T> descriptorOptionFetcher) where D : IExtendableMessage diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb index 7f2e310798336800c4d2d5b7eee968dd2147937b..d00db7fdeb7639fc7be4590acb156234abafd3f3 100644 GIT binary patch delta 199 zcmcaKQ{>1@k%kt=7N#xC_cVFlGIL3l=4F6g3C?cuFKrPqr%0>#l*}g#LUc~((bLtyxm)m HrTrcNK9@bU delta 173 zcmX>yQ{>W2k%kt=7N#xC_cU4FGjqvIPt;}>-TqaR`6eSvCyYP+sW!7DBSdbxkPfps zW7Bjm9cEcZwdol;%nJN-7`d2O7=&238F(3u`WdHZ>oF%!|E0ss2Qp25x~eX-KFfEg zVKS3LW(zV&K@8(e)GH{;FUf~;r*F|^uH{kV;^bmtW)xy(W>9Ol)nndntH;uQ4*=nt BE2sbf