3

我已经成功地在 protobuf-csharp-port-2.4.1.473-source 中构建了示例 AddressBook 项目,甚至让它与来自 protobuf-2.4.1-win32 的 C++ 示例一起工作。但是,当我尝试重新生成 AddressBookProtos.cs 文件并执行它时,我遇到了以下运行时问题。

Options:
L: List contents
A: Add new person
Q: Quit
Action? a
Exception executing action: System.TypeInitializationException: The type initializer
for 'Google.ProtocolBuffers.Examples.AddressBook.AddressBook' threw an exception. ---> 
System.TypeInitializationException: The type initializer
for 'Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos' threw an exception. --->
System.ArgumentException: Invalid embedded descriptor for "tutorial/addressbook.proto". --->
Google.ProtocolBuffers.Descriptors.DescriptorValidationException: tutorial/addressbook.proto:
Dependencies passed to FileDescriptor.BuildFrom() don't match those listed in the
FileDescriptorProto.
at Google.ProtocolBuffers.Descriptors.FileDescriptor.BuildFrom(FileDescriptorProto proto,
FileDescriptor[] dependencies)
at Google.ProtocolBuffers.Descriptors.FileDescriptor.InternalBuildGeneratedFileFrom(Byte[]
descriptorData, FileDescriptor[] dependencies, InternalDescriptorAssigner descriptorAssigner)

我尝试使用 protos\tutorial\addressbook.proto 从 protobuf-csharp-port-2.4.1.473-release-binaries 生成 AddressBookProtos.cs,但它似乎缺少命名空间和雨伞类名选项。此外,protobuf-csharp-port-2.4.1.473-source 中的 src\AddressBook\AddressBookProtos.cs 中列出的版本号表示它是“2.3.0.277”。

4

0 回答 0