Closed
Description
Version: 3.9.1
Language: C#
Linux & Windows
Protoc: Grpc.Tools.1.22.0
What did you do?
Steps to reproduce the behavior:
- Create a simple custom option proto in TestAnnotations.proto:
extend google.protobuf.FieldOptions {
string test_field_opt1 = 5640936;
}
-
Generate the c# code and compile via Grpc.Tools.1.22.0
-
Try and access the custom options:
var options = TestAnnotationsReflection.Descriptor.CustomOptions;
- See error "System.IndexOutOfRangeException : Index was outside the bounds of the array"
at Google.Protobuf.Reflection.ExtensionCollection.<>c__DisplayClass2_0.<.ctor>b__0(FieldDescriptorProto extension, Int32 i) in C:\develop\protobuf-master\csharp\src\Google.Protobuf\Reflection\ExtensionCollection.cs:line 51
at Google.Protobuf.Reflection.DescriptorUtil.ConvertAndMakeReadOnly[TInput,TOutput](IList`1 input, IndexedConverter`2 converter) in C:\develop\protobuf-master\csharp\src\Google.Protobuf\Reflection\DescriptorUtil.cs:line 59
at Google.Protobuf.Reflection.ExtensionCollection..ctor(FileDescriptor file, Extension[] extensions) in C:\develop\protobuf-master\csharp\src\Google.Protobuf\Reflection\ExtensionCollection.cs:line 49
at Google.Protobuf.Reflection.FileDescriptor..ctor(ByteString descriptorData, FileDescriptorProto proto, IEnumerable`1 dependencies, DescriptorPool pool, Boolean allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) in C:\develop\protobuf-master\csharp\src\Google.Protobuf\Reflection\FileDescriptor.cs:line 87
at Google.Protobuf.Reflection.FileDescriptor.BuildFrom(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, Boolean allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) in C:\develop\protobuf-master\csharp\src\Google.Protobuf\Reflection\FileDescriptor.cs:line 340
at Google.Protobuf.Reflection.FileDescriptor.FromGeneratedCode(Byte[] descriptorData, FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedCodeInfo) in C:\develop\protobuf-master\csharp\src\Google.Protobuf\Reflection\FileDescriptor.cs:line 400
at TestAnnotationsReflection..cctor()
Anything else we should know about your project / environment
Changing to use the Porotc Compiler to Google.Protobuf.Tools v 3.9.1 resolves this particular, unfortunately I can't use that as a work around as that introduces another error 'FieldOptions' is inaccessible due to its protection level for which I will log a separate bug.
Metadata
Assignees
Labels
No labels
Activity